diff options
Diffstat (limited to 'src')
7 files changed, 8 insertions, 42 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 9aebc55b..7d2d2027 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -266,6 +266,7 @@ class Entry | |||
266 | { | 266 | { |
267 | $this->content = $content; | 267 | $this->content = $content; |
268 | $this->readingTime = Tools::getReadingTime($content); | 268 | $this->readingTime = Tools::getReadingTime($content); |
269 | $this->domainName = parse_url($this->url, PHP_URL_HOST); | ||
269 | 270 | ||
270 | return $this; | 271 | return $this; |
271 | } | 272 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index d8bd8d52..08eae327 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -1,9 +1,4 @@ | |||
1 | services: | 1 | services: |
2 | wallabag_core.twig.extension: | ||
3 | class: Wallabag\CoreBundle\Twig\Extension\WallabagExtension | ||
4 | tags: | ||
5 | - { name: twig.extension } | ||
6 | |||
7 | wallabag_core.helper.detect_active_theme: | 2 | wallabag_core.helper.detect_active_theme: |
8 | class: Wallabag\CoreBundle\Helper\DetectActiveTheme | 3 | class: Wallabag\CoreBundle\Helper\DetectActiveTheme |
9 | arguments: | 4 | arguments: |
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig index ea4a9976..539c035f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig | |||
@@ -35,7 +35,7 @@ | |||
35 | <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> | 35 | <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> |
36 | <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> | 36 | <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> |
37 | <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> | 37 | <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> |
38 | <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> | 38 | <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> |
39 | </ul> | 39 | </ul> |
40 | <p>{{ entry.content|striptags|slice(0, 300) }}...</p> | 40 | <p>{{ entry.content|striptags|slice(0, 300) }}...</p> |
41 | </div> | 41 | </div> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig index f5c19ea3..00480d1a 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig | |||
@@ -1,12 +1,12 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %} | 3 | {% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %} |
4 | 4 | ||
5 | {% block content %} | 5 | {% block content %} |
6 | <div id="article_toolbar"> | 6 | <div id="article_toolbar"> |
7 | <ul class="links"> | 7 | <ul class="links"> |
8 | <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> | 8 | <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> |
9 | <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> | 9 | <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> |
10 | <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> | 10 | <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> |
11 | <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> | 11 | <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> |
12 | <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> | 12 | <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> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index 55e3540d..7777dc7f 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig | |||
@@ -47,7 +47,7 @@ | |||
47 | <p>{{ entry.content|striptags|slice(0, 300) }}...</p> | 47 | <p>{{ entry.content|striptags|slice(0, 300) }}...</p> |
48 | </div> | 48 | </div> |
49 | <div class="card-action"> | 49 | <div class="card-action"> |
50 | <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> | 50 | <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> |
51 | 51 | ||
52 | <ul class="tools links right"> | 52 | <ul class="tools links right"> |
53 | <li> | 53 | <li> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index 5d098232..6b91be97 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig | |||
@@ -1,6 +1,6 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block title %}{{ entry.title|raw }} ({{ entry.url | e | domainName }}){% endblock %} | 3 | {% block title %}{{ entry.title|raw }} ({{ entry.domainName }}){% endblock %} |
4 | 4 | ||
5 | {% block menu %} | 5 | {% block menu %} |
6 | <nav class="hide-on-large-only"> | 6 | <nav class="hide-on-large-only"> |
@@ -123,7 +123,7 @@ main { | |||
123 | <div id="article"> | 123 | <div id="article"> |
124 | <header class="mbm"> | 124 | <header class="mbm"> |
125 | <h1>{{ entry.title|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{% trans %}Edit title{% endtrans %}">✎</a></h1> | 125 | <h1>{{ entry.title|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{% trans %}Edit title{% endtrans %}">✎</a></h1> |
126 | <a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.url | e | domainName }}</span></a> | 126 | <a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.domainName }}</span></a> |
127 | </header> | 127 | </header> |
128 | <aside class="tags"> | 128 | <aside class="tags"> |
129 | tags: {% for tag in entry.tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.label }}</a> {% endfor %}<a href="./?view=edit-tags&id={{ entry.id }}" title="{% trans %}Edit tags{% endtrans %}">✎</a> | 129 | tags: {% for tag in entry.tags %}<a href="./?view=tag&id={{ tag.id }}">{{ tag.label }}</a> {% endfor %}<a href="./?view=edit-tags&id={{ entry.id }}" title="{% trans %}Edit tags{% endtrans %}">✎</a> |
@@ -135,4 +135,4 @@ main { | |||
135 | {% endblock %} | 135 | {% endblock %} |
136 | 136 | ||
137 | {% block footer %} | 137 | {% block footer %} |
138 | {% endblock %} \ No newline at end of file | 138 | {% endblock %} |
diff --git a/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php deleted file mode 100644 index 5f0a9643..00000000 --- a/src/Wallabag/CoreBundle/Twig/Extension/WallabagExtension.php +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Twig\Extension; | ||
4 | |||
5 | class WallabagExtension extends \Twig_Extension | ||
6 | { | ||
7 | public function getFilters() | ||
8 | { | ||
9 | return array( | ||
10 | new \Twig_SimpleFilter('domainName', array($this, 'getDomainName')), | ||
11 | ); | ||
12 | } | ||
13 | |||
14 | /** | ||
15 | * Returns the domain name for a URL. | ||
16 | * | ||
17 | * @param $url | ||
18 | * | ||
19 | * @return string | ||
20 | */ | ||
21 | public static function getDomainName($url) | ||
22 | { | ||
23 | return parse_url($url, PHP_URL_HOST); | ||
24 | } | ||
25 | |||
26 | public function getName() | ||
27 | { | ||
28 | return 'wallabag_extension'; | ||
29 | } | ||
30 | } | ||