Merge remote-tracking branch 'origin/v2' into v2_material

This commit is contained in:
Alexandr Danilov 2015-08-12 23:02:19 +03:00
commit a737d2a0ee
7 changed files with 14 additions and 48 deletions

View file

@ -266,6 +266,7 @@ class Entry
{
$this->content = $content;
$this->readingTime = Tools::getReadingTime($content);
$this->domainName = parse_url($this->url, PHP_URL_HOST);
return $this;
}

View file

@ -1,9 +1,4 @@
services:
wallabag_core.twig.extension:
class: Wallabag\CoreBundle\Twig\Extension\WallabagExtension
tags:
- { name: twig.extension }
wallabag_core.helper.detect_active_theme:
class: Wallabag\CoreBundle\Helper\DetectActiveTheme
arguments:

View file

@ -35,7 +35,7 @@
<li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
<li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | domainName }}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.domainName }}</span></a></li>
</ul>
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
</div>

View file

@ -1,12 +1,12 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %}
{% block content %}
<div id="article_toolbar">
<ul class="links">
<li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | domainName }}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.domainName }}</span></a></li>
<li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
<li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
<li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>

View file

@ -46,7 +46,7 @@
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
</div>
<div class="card-action">
<span class="bold"><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %}: {{ entry.title|e }}" class="tool original grey-text"><span>{{ entry.url | e | domainName }}</span></a></bold>
<span class="bold"><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %}: {{ entry.title|e }}" class="tool original grey-text"><span>{{ entry.domainName }}</span></a></bold>
<ul class="tools links right">
<li>

View file

@ -1,6 +1,6 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %}
{% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %}
{% block menu %}
<nav class="hide-on-large-only">
@ -70,9 +70,9 @@
</a>
<div class="collapsible-body">
<ul>
{% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</span></a></li>{% endif %}
{% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}twitter{% endtrans %}"><span>{% trans %}twitter{% endtrans %}</span></a></li>{% endif %}
{% if share_shaarli %}<li><a href="{{ shaarli_url }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</span></a></li>{% endif %}
{% if share_diaspora %}<li><a href="{{ diaspora_url }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora{% endtrans %}"><span>{% trans %}diaspora{% endtrans %}</span></a></li>{% endif %}
{% if share_diaspora %}<li><a href="{{ diaspora_url }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora*{% endtrans %}"><span>{% trans %}diaspora*{% endtrans %}</span></a></li>{% endif %}
{# {% if flattr %}{% if flattr.status == flattrable %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}"><span>{% trans %}flattr{% endtrans %}</span></a></li>{% elseif flattr.status == flattred %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}><span>{% trans %}flattr{% endtrans %}</span> ({{ flattr.numFlattrs }})</a></li>{% endif %}{% endif %} #}
{% if carrot %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans %}carrot{% endtrans %}"><span>Carrot</span></a></li>{% endif %}
{% if share_mail %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %}
@ -83,13 +83,13 @@
<li class="bold">
<a class="waves-effect collapsible-header">
<i class="mdi-file-file-download small"></i>
<span>{% trans %}Download{% endtrans %}</span>
<span><del>{% trans %}Download{% endtrans %}</del></span>
</a>
<div class="collapsible-body">
<ul>
{% if export_epub %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></li>{% endif %}
{% if export_mobi %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
{% if export_pdf %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></li>{% endif %}
{% if export_epub %}<li><del><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></del></li>{% endif %}
{% if export_mobi %}<li><del><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></del></li>{% endif %}
{% if export_pdf %}<li><del><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></del> </li>{% endif %}
</ul>
</div>
</li>
@ -123,7 +123,7 @@ main {
<div id="article">
<header class="mbm">
<h1>{{ entry.title|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{% trans %}Edit title{% endtrans %}">✎</a></h1>
<a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.url | e | domainName }}</span></a>
<a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.domainName }}</span></a>
</header>
<aside class="tags">
tags: {% for tag in entry.tags %}<a href="./?view=tag&amp;id={{ tag.id }}">{{ tag.label }}</a> {% endfor %}<a href="./?view=edit-tags&amp;id={{ entry.id }}" title="{% trans %}Edit tags{% endtrans %}">✎</a>
@ -135,4 +135,4 @@ main {
{% endblock %}
{% block footer %}
{% endblock %}
{% endblock %}

View file

@ -1,30 +0,0 @@
<?php
namespace Wallabag\CoreBundle\Twig\Extension;
class WallabagExtension extends \Twig_Extension
{
public function getFilters()
{
return array(
new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')),
);
}
/**
* Returns the domain name for a URL.
*
* @param $url
*
* @return string
*/
public static function getDomainName($url)
{
return parse_url($url, PHP_URL_HOST);
}
public function getName()
{
return 'wallabag_extension';
}
}