diff options
author | Thomas Citharel <tcit@tcit.fr> | 2015-09-29 23:23:58 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2015-09-29 23:23:58 +0200 |
commit | d2755b1c30318f370e7e903ebbd9d34bca11d939 (patch) | |
tree | 6ec37fb78b74fcf6eb6e4c5b61d2c58bc80dabd7 /src/Wallabag | |
parent | 917040d4a0b7694ca4f695c02243ffb4283d6901 (diff) | |
parent | 2afdea1ccc69e390758559133479eba1e49ec561 (diff) | |
download | wallabag-d2755b1c30318f370e7e903ebbd9d34bca11d939.tar.gz wallabag-d2755b1c30318f370e7e903ebbd9d34bca11d939.tar.zst wallabag-d2755b1c30318f370e7e903ebbd9d34bca11d939.zip |
Merge pull request #1440 from wallabag/v2-fix-1433
fix #1433: remove www. on entries view
Diffstat (limited to 'src/Wallabag')
3 files changed, 25 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index 08f3fe60..abbcb389 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | |||
@@ -36,7 +36,7 @@ | |||
36 | <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 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> |
37 | <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 %}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> |
38 | <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 title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}delete{% endtrans %}</span></a></li> |
39 | <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 | <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.domainName|removeWww }}</span></a></li> |
40 | </ul> | 40 | </ul> |
41 | {% if entry.previewPicture is null %} | 41 | {% if entry.previewPicture is null %} |
42 | <p>{{ entry.content|striptags|slice(0, 300) }}…</p> | 42 | <p>{{ entry.content|striptags|slice(0, 300) }}…</p> |
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 dcdf7c09..ff69e821 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 | |||
@@ -76,7 +76,7 @@ | |||
76 | {% endif %} | 76 | {% endif %} |
77 | 77 | ||
78 | <div class="card-action"> | 78 | <div class="card-action"> |
79 | <span class="bold"><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %}: {{ entry.title|e }} - {{ entry.domainName }}" class="tool original grey-text"><span>{{ entry.domainName | truncate(18) }}</span></a></bold> | 79 | <span class="bold"><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %}: {{ entry.title|e }} - {{ entry.domainName|removeWww }}" class="tool original grey-text"><span>{{ entry.domainName|removeWww|truncate(18) }}</span></a></bold> |
80 | 80 | ||
81 | <ul class="tools links right"> | 81 | <ul class="tools links right"> |
82 | <li> | 82 | <li> |
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php new file mode 100644 index 00000000..f8328860 --- /dev/null +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php | |||
@@ -0,0 +1,23 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Twig; | ||
4 | |||
5 | class WallabagExtension extends \Twig_Extension | ||
6 | { | ||
7 | public function getFilters() | ||
8 | { | ||
9 | return array( | ||
10 | new \Twig_SimpleFilter('removeWww', array($this, 'removeWww')), | ||
11 | ); | ||
12 | } | ||
13 | |||
14 | public function removeWww($url) | ||
15 | { | ||
16 | return preg_replace('/^www\./i', '',$url); | ||
17 | } | ||
18 | |||
19 | public function getName() | ||
20 | { | ||
21 | return 'wallabag_extension'; | ||
22 | } | ||
23 | } | ||