diff options
21 files changed, 176 insertions, 54 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 4eb314f7..ccdf9406 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -357,7 +357,7 @@ class EntryController extends Controller | |||
357 | } | 357 | } |
358 | 358 | ||
359 | /** | 359 | /** |
360 | * Changes favorite status for an entry. | 360 | * Changes starred status for an entry. |
361 | * | 361 | * |
362 | * @param Request $request | 362 | * @param Request $request |
363 | * @param Entry $entry | 363 | * @param Entry $entry |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 0dcf7caa..c066aaf7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Tilbage' | 178 | back_to_homepage: 'Tilbage' |
179 | set_as_read: 'Marker som læst' | 179 | set_as_read: 'Marker som læst' |
180 | # set_as_unread: 'Mark as unread' | 180 | # set_as_unread: 'Mark as unread' |
181 | set_as_favorite: 'Marker som favorit' | 181 | set_as_starred: 'Marker som favorit' |
182 | view_original_article: 'Originalartikel' | 182 | view_original_article: 'Originalartikel' |
183 | # re_fetch_content: 'Re-fetch content' | 183 | # re_fetch_content: 'Re-fetch content' |
184 | delete: 'Slet' | 184 | delete: 'Slet' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 533078db..28d826b6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Zurück' | 178 | back_to_homepage: 'Zurück' |
179 | set_as_read: 'Als gelesen markieren' | 179 | set_as_read: 'Als gelesen markieren' |
180 | set_as_unread: 'Als ungelesen markieren' | 180 | set_as_unread: 'Als ungelesen markieren' |
181 | set_as_favorite: 'Favorisieren' | 181 | set_as_starred: 'Favorisieren' |
182 | view_original_article: 'Original-Artikel' | 182 | view_original_article: 'Original-Artikel' |
183 | re_fetch_content: 'Inhalt neu laden' | 183 | re_fetch_content: 'Inhalt neu laden' |
184 | delete: 'Löschen' | 184 | delete: 'Löschen' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 19b592e0..c6633f5b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -148,7 +148,7 @@ entry: | |||
148 | reading_time_less_one_minute_short: '<small class="inferieur"><</small> 1 min' | 148 | reading_time_less_one_minute_short: '<small class="inferieur"><</small> 1 min' |
149 | original_article: 'original' | 149 | original_article: 'original' |
150 | toogle_as_read: 'Toggle mark as read' | 150 | toogle_as_read: 'Toggle mark as read' |
151 | toogle_as_star: 'Toggle favorite' | 151 | toogle_as_star: 'Toggle starred' |
152 | delete: 'Delete' | 152 | delete: 'Delete' |
153 | export_title: 'Export' | 153 | export_title: 'Export' |
154 | filters: | 154 | filters: |
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Back' | 178 | back_to_homepage: 'Back' |
179 | set_as_read: 'Mark as read' | 179 | set_as_read: 'Mark as read' |
180 | set_as_unread: 'Mark as unread' | 180 | set_as_unread: 'Mark as unread' |
181 | set_as_favorite: 'Favorite' | 181 | set_as_starred: 'Toggle starred' |
182 | view_original_article: 'Original article' | 182 | view_original_article: 'Original article' |
183 | re_fetch_content: 'Re-fetch content' | 183 | re_fetch_content: 'Re-fetch content' |
184 | delete: 'Delete' | 184 | delete: 'Delete' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 21f26d9e..266b4af5 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Regrese a la página principal' | 178 | back_to_homepage: 'Regrese a la página principal' |
179 | set_as_read: 'Marcar como leído' | 179 | set_as_read: 'Marcar como leído' |
180 | set_as_unread: 'Marcar como no leído' | 180 | set_as_unread: 'Marcar como no leído' |
181 | set_as_favorite: 'Marcar como favorito' | 181 | set_as_starred: 'Marcar como favorito' |
182 | view_original_article: 'Artículo original' | 182 | view_original_article: 'Artículo original' |
183 | re_fetch_content: 'Redescargar el contenido' | 183 | re_fetch_content: 'Redescargar el contenido' |
184 | delete: 'Suprimir' | 184 | delete: 'Suprimir' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 6dedd984..c2350019 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'بازگشت' | 178 | back_to_homepage: 'بازگشت' |
179 | set_as_read: 'خواندهشده' | 179 | set_as_read: 'خواندهشده' |
180 | set_as_unread: 'به عنوان خواندهنشده علامت بزن' | 180 | set_as_unread: 'به عنوان خواندهنشده علامت بزن' |
181 | set_as_favorite: 'برگزیده' | 181 | set_as_starred: 'برگزیده' |
182 | view_original_article: 'مقالهٔ اصلی' | 182 | view_original_article: 'مقالهٔ اصلی' |
183 | re_fetch_content: 'مقالهها را دوباره دریافت کن' | 183 | re_fetch_content: 'مقالهها را دوباره دریافت کن' |
184 | delete: 'پاک کردن' | 184 | delete: 'پاک کردن' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 829df809..25d9ec59 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Retour' | 178 | back_to_homepage: 'Retour' |
179 | set_as_read: 'Marquer comme lu' | 179 | set_as_read: 'Marquer comme lu' |
180 | set_as_unread: 'Marquer comme non lu' | 180 | set_as_unread: 'Marquer comme non lu' |
181 | set_as_favorite: 'Mettre en favori' | 181 | set_as_starred: 'Mettre en favori' |
182 | view_original_article: 'Article original' | 182 | view_original_article: 'Article original' |
183 | re_fetch_content: 'Recharger le contenu' | 183 | re_fetch_content: 'Recharger le contenu' |
184 | delete: 'Supprimer' | 184 | delete: 'Supprimer' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index a7291a1b..231ba759 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -177,7 +177,7 @@ entry: | |||
177 | back_to_homepage: 'Indietro' | 177 | back_to_homepage: 'Indietro' |
178 | set_as_read: 'Segna come già letto' | 178 | set_as_read: 'Segna come già letto' |
179 | set_as_unread: 'Segna come da leggere' | 179 | set_as_unread: 'Segna come da leggere' |
180 | set_as_favorite: 'Segna come preferito' | 180 | set_as_starred: 'Segna come preferito' |
181 | view_original_article: 'Contenuto originale' | 181 | view_original_article: 'Contenuto originale' |
182 | re_fetch_content: 'Ri-ottieni pagina' | 182 | re_fetch_content: 'Ri-ottieni pagina' |
183 | delete: 'Elimina' | 183 | delete: 'Elimina' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 8531f7ee..6e71b850 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Tornar' | 178 | back_to_homepage: 'Tornar' |
179 | set_as_read: 'Marcar coma legit' | 179 | set_as_read: 'Marcar coma legit' |
180 | set_as_unread: 'Marcar coma pas legit' | 180 | set_as_unread: 'Marcar coma pas legit' |
181 | set_as_favorite: 'Metre en favori' | 181 | set_as_starred: 'Metre en favori' |
182 | view_original_article: 'Article original' | 182 | view_original_article: 'Article original' |
183 | re_fetch_content: 'Tornar cargar lo contengut' | 183 | re_fetch_content: 'Tornar cargar lo contengut' |
184 | delete: 'Suprimir' | 184 | delete: 'Suprimir' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index bd45767d..2db26cf1 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Cofnij' | 178 | back_to_homepage: 'Cofnij' |
179 | set_as_read: 'Oznacz jako przeczytane' | 179 | set_as_read: 'Oznacz jako przeczytane' |
180 | set_as_unread: 'Oznacz jako nieprzeczytane' | 180 | set_as_unread: 'Oznacz jako nieprzeczytane' |
181 | set_as_favorite: 'Ulubione' | 181 | set_as_starred: 'Ulubione' |
182 | view_original_article: 'Oryginalny artykuł' | 182 | view_original_article: 'Oryginalny artykuł' |
183 | re_fetch_content: 'Pobierz ponownie treść' | 183 | re_fetch_content: 'Pobierz ponownie treść' |
184 | delete: 'Usuń' | 184 | delete: 'Usuń' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 8455a6bd..d8f09bc9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Înapoi' | 178 | back_to_homepage: 'Înapoi' |
179 | set_as_read: 'Marchează ca citit' | 179 | set_as_read: 'Marchează ca citit' |
180 | # set_as_unread: 'Mark as unread' | 180 | # set_as_unread: 'Mark as unread' |
181 | set_as_favorite: 'Favorit' | 181 | set_as_starred: 'Favorit' |
182 | view_original_article: 'Articol original' | 182 | view_original_article: 'Articol original' |
183 | # re_fetch_content: 'Re-fetch content' | 183 | # re_fetch_content: 'Re-fetch content' |
184 | delete: 'Șterge' | 184 | delete: 'Șterge' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 8d3d4524..074d13e2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -178,7 +178,7 @@ entry: | |||
178 | back_to_homepage: 'Back' | 178 | back_to_homepage: 'Back' |
179 | set_as_read: 'Okundu olarak işaretle' | 179 | set_as_read: 'Okundu olarak işaretle' |
180 | set_as_unread: 'Okunmadı olarak işaretle' | 180 | set_as_unread: 'Okunmadı olarak işaretle' |
181 | set_as_favorite: 'Favorilere ekle/çıkar' | 181 | set_as_starred: 'Favorilere ekle/çıkar' |
182 | view_original_article: 'Orijinal makale' | 182 | view_original_article: 'Orijinal makale' |
183 | re_fetch_content: 'İçeriği yenile' | 183 | re_fetch_content: 'İçeriği yenile' |
184 | delete: 'Sil' | 184 | delete: 'Sil' |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index 6bf85725..d7374dc7 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig | |||
@@ -14,7 +14,7 @@ | |||
14 | <li><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.domainName|removeWww }}</span></a></li> | 14 | <li><a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.domainName|removeWww }}</span></a></li> |
15 | <li><a title="{{ 'entry.view.left_menu.re_fetch_content'|trans }}" class="tool icon icon-reload" href="{{ path('reload_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.re_fetch_content'|trans }}</span></a></li> | 15 | <li><a title="{{ 'entry.view.left_menu.re_fetch_content'|trans }}" class="tool icon icon-reload" href="{{ path('reload_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.re_fetch_content'|trans }}</span></a></li> |
16 | <li><a title="{% if entry.isArchived == 0 %}{{ 'entry.view.left_menu.set_as_read'|trans }}{% else %}{{ 'entry.view.left_menu.set_as_unread'|trans }}{% endif %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% if entry.isArchived == 0 %}{{ 'entry.view.left_menu.set_as_read'|trans }}{% else %}{{ 'entry.view.left_menu.set_as_unread'|trans }}{% endif %}</span></a></li> | 16 | <li><a title="{% if entry.isArchived == 0 %}{{ 'entry.view.left_menu.set_as_read'|trans }}{% else %}{{ 'entry.view.left_menu.set_as_unread'|trans }}{% endif %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% if entry.isArchived == 0 %}{{ 'entry.view.left_menu.set_as_read'|trans }}{% else %}{{ 'entry.view.left_menu.set_as_unread'|trans }}{% endif %}</span></a></li> |
17 | <li><a title="{{ 'entry.view.left_menu.set_as_favorite'|trans }}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.set_as_favorite'|trans }}</span></a></li> | 17 | <li><a title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span></a></li> |
18 | <li><a id="nav-btn-add-tag" title="{{ 'entry.view.left_menu.add_a_tag'|trans }}"><span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span></a></li> | 18 | <li><a id="nav-btn-add-tag" title="{{ 'entry.view.left_menu.add_a_tag'|trans }}"><span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span></a></li> |
19 | <li><a title="{{ 'entry.view.left_menu.delete'|trans }}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.delete'|trans }}</span></a></li> | 19 | <li><a title="{{ 'entry.view.left_menu.delete'|trans }}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.delete'|trans }}</span></a></li> |
20 | {% if craue_setting('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="Tweet"><span>Tweet</span></a></li>{% endif %} | 20 | {% if craue_setting('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="Tweet"><span>Tweet</span></a></li>{% endif %} |
@@ -85,7 +85,7 @@ | |||
85 | $("body").css("cursor", "auto"); | 85 | $("body").css("cursor", "auto"); |
86 | });*/ | 86 | });*/ |
87 | 87 | ||
88 | // toggle favorite property of current article | 88 | // toggle starred property of current article |
89 | /* $('#setFav').click(function(){ | 89 | /* $('#setFav').click(function(){ |
90 | $("body").css("cursor", "wait"); | 90 | $("body").css("cursor", "wait"); |
91 | $.ajax( { url: '{{ path('star_entry', { 'id': entry.id }) }}' }).done( | 91 | $.ajax( { url: '{{ path('star_entry', { 'id': entry.id }) }}' }).done( |
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 920fa933..c8e4a533 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 | |||
@@ -77,7 +77,7 @@ | |||
77 | <ul class="tools links right"> | 77 | <ul class="tools links right"> |
78 | <li> | 78 | <li> |
79 | <a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text {% if entry.isArchived == 0 %}mdi-action-done{% else %}mdi-content-redo{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"></a> | 79 | <a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text {% if entry.isArchived == 0 %}mdi-action-done{% else %}mdi-content-redo{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"></a> |
80 | <a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text {% if entry.isStarred == 0 %}mdi-action-favorite-outline{% else %}mdi-action-favorite{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"></a> | 80 | <a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text {% if entry.isStarred == 0 %}mdi-toggle-star-outline{% else %}mdi-toggle-star{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"></a> |
81 | <a title="{{ 'entry.list.delete'|trans }}" class="tool grey-text delete mdi-action-delete " href="{{ path('delete_entry', { 'id': entry.id }) }}"></a> | 81 | <a title="{{ 'entry.list.delete'|trans }}" class="tool grey-text delete mdi-action-delete " href="{{ path('delete_entry', { 'id': entry.id }) }}"></a> |
82 | </li> | 82 | </li> |
83 | </ul> | 83 | </ul> |
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 4f58b692..2ee615aa 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 | |||
@@ -24,8 +24,8 @@ | |||
24 | </a> | 24 | </a> |
25 | </li> | 25 | </li> |
26 | <li> | 26 | <li> |
27 | <a class="waves-effect" title="{{ 'entry.view.left_menu.set_as_favorite'|trans }}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav"> | 27 | <a class="waves-effect" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav"> |
28 | <i class="{% if entry.isStarred == 0 %}mdi-action-favorite-outline{% else %}mdi-action-favorite{% endif %} small"></i> | 28 | <i class="{% if entry.isStarred == 0 %}mdi-toggle-star-outline{% else %}mdi-toggle-star{% endif %} small"></i> |
29 | </a> | 29 | </a> |
30 | </li> | 30 | </li> |
31 | <li> | 31 | <li> |
@@ -70,9 +70,9 @@ | |||
70 | </li> | 70 | </li> |
71 | 71 | ||
72 | <li class="bold hide-on-med-and-down"> | 72 | <li class="bold hide-on-med-and-down"> |
73 | <a class="waves-effect collapsible-header" title="{{ 'entry.view.left_menu.set_as_favorite'|trans }}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav"> | 73 | <a class="waves-effect collapsible-header" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav"> |
74 | <i class="{% if entry.isStarred == 0 %}mdi-action-favorite-outline{% else %}mdi-action-favorite{% endif %} small"></i> | 74 | <i class="{% if entry.isStarred == 0 %}mdi-toggle-star-outline{% else %}mdi-toggle-star{% endif %} small"></i> |
75 | <span>{{ 'entry.view.left_menu.set_as_favorite'|trans }}</span> | 75 | <span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span> |
76 | </a> | 76 | </a> |
77 | <div class="collapsible-body"></div> | 77 | <div class="collapsible-body"></div> |
78 | </li> | 78 | </li> |
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php new file mode 100644 index 00000000..14377a35 --- /dev/null +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php | |||
@@ -0,0 +1,47 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\Import; | ||
4 | |||
5 | use Psr\Log\LoggerInterface; | ||
6 | use Psr\Log\NullLogger; | ||
7 | use Doctrine\ORM\EntityManager; | ||
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
9 | use Wallabag\CoreBundle\Entity\Entry; | ||
10 | |||
11 | abstract class AbstractImport implements ImportInterface | ||
12 | { | ||
13 | protected $em; | ||
14 | protected $logger; | ||
15 | protected $contentProxy; | ||
16 | |||
17 | public function __construct(EntityManager $em, ContentProxy $contentProxy) | ||
18 | { | ||
19 | $this->em = $em; | ||
20 | $this->logger = new NullLogger(); | ||
21 | $this->contentProxy = $contentProxy; | ||
22 | } | ||
23 | |||
24 | public function setLogger(LoggerInterface $logger) | ||
25 | { | ||
26 | $this->logger = $logger; | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * Fetch content from the ContentProxy (using graby). | ||
31 | * If it fails return false instead of the updated entry. | ||
32 | * | ||
33 | * @param Entry $entry Entry to update | ||
34 | * @param string $url Url to grab content for | ||
35 | * @param array $content An array with AT LEAST keys title, html, url, language & content_type to skip the fetchContent from the url | ||
36 | * | ||
37 | * @return Entry|false | ||
38 | */ | ||
39 | protected function fetchContent(Entry $entry, $url, array $content = []) | ||
40 | { | ||
41 | try { | ||
42 | return $this->contentProxy->updateEntry($entry, $url, $content); | ||
43 | } catch (\Exception $e) { | ||
44 | return false; | ||
45 | } | ||
46 | } | ||
47 | } | ||
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 29361a32..798cfdae 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\ImportBundle\Import; | 3 | namespace Wallabag\ImportBundle\Import; |
4 | 4 | ||
5 | use Psr\Log\LoggerInterface; | ||
6 | use Psr\Log\NullLogger; | 5 | use Psr\Log\NullLogger; |
7 | use Doctrine\ORM\EntityManager; | 6 | use Doctrine\ORM\EntityManager; |
8 | use GuzzleHttp\Client; | 7 | use GuzzleHttp\Client; |
@@ -12,12 +11,9 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
12 | use Wallabag\CoreBundle\Helper\ContentProxy; | 11 | use Wallabag\CoreBundle\Helper\ContentProxy; |
13 | use Craue\ConfigBundle\Util\Config; | 12 | use Craue\ConfigBundle\Util\Config; |
14 | 13 | ||
15 | class PocketImport implements ImportInterface | 14 | class PocketImport extends AbstractImport |
16 | { | 15 | { |
17 | private $user; | 16 | private $user; |
18 | private $em; | ||
19 | private $contentProxy; | ||
20 | private $logger; | ||
21 | private $client; | 17 | private $client; |
22 | private $consumerKey; | 18 | private $consumerKey; |
23 | private $skippedEntries = 0; | 19 | private $skippedEntries = 0; |
@@ -34,11 +30,6 @@ class PocketImport implements ImportInterface | |||
34 | $this->logger = new NullLogger(); | 30 | $this->logger = new NullLogger(); |
35 | } | 31 | } |
36 | 32 | ||
37 | public function setLogger(LoggerInterface $logger) | ||
38 | { | ||
39 | $this->logger = $logger; | ||
40 | } | ||
41 | |||
42 | /** | 33 | /** |
43 | * {@inheritdoc} | 34 | * {@inheritdoc} |
44 | */ | 35 | */ |
@@ -219,14 +210,20 @@ class PocketImport implements ImportInterface | |||
219 | } | 210 | } |
220 | 211 | ||
221 | $entry = new Entry($this->user); | 212 | $entry = new Entry($this->user); |
222 | $entry = $this->contentProxy->updateEntry($entry, $url); | 213 | $entry = $this->fetchContent($entry, $url); |
214 | |||
215 | // jump to next entry in case of problem while getting content | ||
216 | if (false === $entry) { | ||
217 | ++$this->skippedEntries; | ||
218 | continue; | ||
219 | } | ||
223 | 220 | ||
224 | // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted | 221 | // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted |
225 | if ($pocketEntry['status'] == 1 || $this->markAsRead) { | 222 | if ($pocketEntry['status'] == 1 || $this->markAsRead) { |
226 | $entry->setArchived(true); | 223 | $entry->setArchived(true); |
227 | } | 224 | } |
228 | 225 | ||
229 | // 0 or 1 - 1 If the item is favorited | 226 | // 0 or 1 - 1 If the item is starred |
230 | if ($pocketEntry['favorite'] == 1) { | 227 | if ($pocketEntry['favorite'] == 1) { |
231 | $entry->setStarred(true); | 228 | $entry->setStarred(true); |
232 | } | 229 | } |
diff --git a/src/Wallabag/ImportBundle/Import/WallabagImport.php b/src/Wallabag/ImportBundle/Import/WallabagImport.php index 65803823..a1cc085b 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagImport.php +++ b/src/Wallabag/ImportBundle/Import/WallabagImport.php | |||
@@ -2,19 +2,12 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\ImportBundle\Import; | 3 | namespace Wallabag\ImportBundle\Import; |
4 | 4 | ||
5 | use Psr\Log\LoggerInterface; | ||
6 | use Psr\Log\NullLogger; | ||
7 | use Doctrine\ORM\EntityManager; | ||
8 | use Wallabag\CoreBundle\Entity\Entry; | 5 | use Wallabag\CoreBundle\Entity\Entry; |
9 | use Wallabag\UserBundle\Entity\User; | 6 | use Wallabag\UserBundle\Entity\User; |
10 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
11 | 7 | ||
12 | abstract class WallabagImport implements ImportInterface | 8 | abstract class WallabagImport extends AbstractImport |
13 | { | 9 | { |
14 | protected $user; | 10 | protected $user; |
15 | protected $em; | ||
16 | protected $logger; | ||
17 | protected $contentProxy; | ||
18 | protected $skippedEntries = 0; | 11 | protected $skippedEntries = 0; |
19 | protected $importedEntries = 0; | 12 | protected $importedEntries = 0; |
20 | protected $filepath; | 13 | protected $filepath; |
@@ -35,18 +28,6 @@ abstract class WallabagImport implements ImportInterface | |||
35 | '', | 28 | '', |
36 | ]; | 29 | ]; |
37 | 30 | ||
38 | public function __construct(EntityManager $em, ContentProxy $contentProxy) | ||
39 | { | ||
40 | $this->em = $em; | ||
41 | $this->logger = new NullLogger(); | ||
42 | $this->contentProxy = $contentProxy; | ||
43 | } | ||
44 | |||
45 | public function setLogger(LoggerInterface $logger) | ||
46 | { | ||
47 | $this->logger = $logger; | ||
48 | } | ||
49 | |||
50 | /** | 31 | /** |
51 | * We define the user in a custom call because on the import command there is no logged in user. | 32 | * We define the user in a custom call because on the import command there is no logged in user. |
52 | * So we can't retrieve user from the `security.token_storage` service. | 33 | * So we can't retrieve user from the `security.token_storage` service. |
@@ -159,12 +140,18 @@ abstract class WallabagImport implements ImportInterface | |||
159 | 140 | ||
160 | $data = $this->prepareEntry($importedEntry, $this->markAsRead); | 141 | $data = $this->prepareEntry($importedEntry, $this->markAsRead); |
161 | 142 | ||
162 | $entry = $this->contentProxy->updateEntry( | 143 | $entry = $this->fetchContent( |
163 | new Entry($this->user), | 144 | new Entry($this->user), |
164 | $importedEntry['url'], | 145 | $importedEntry['url'], |
165 | $data | 146 | $data |
166 | ); | 147 | ); |
167 | 148 | ||
149 | // jump to next entry in case of problem while getting content | ||
150 | if (false === $entry) { | ||
151 | ++$this->skippedEntries; | ||
152 | continue; | ||
153 | } | ||
154 | |||
168 | if (array_key_exists('tags', $data)) { | 155 | if (array_key_exists('tags', $data)) { |
169 | $this->contentProxy->assignTagsToEntry( | 156 | $this->contentProxy->assignTagsToEntry( |
170 | $entry, | 157 | $entry, |
diff --git a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php index 41f9b51f..8534e1c8 100644 --- a/tests/Wallabag/ImportBundle/Import/PocketImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/PocketImportTest.php | |||
@@ -390,4 +390,55 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
390 | $this->assertContains('PocketImport: Failed to import', $records[0]['message']); | 390 | $this->assertContains('PocketImport: Failed to import', $records[0]['message']); |
391 | $this->assertEquals('ERROR', $records[0]['level_name']); | 391 | $this->assertEquals('ERROR', $records[0]['level_name']); |
392 | } | 392 | } |
393 | |||
394 | public function testImportWithExceptionFromGraby() | ||
395 | { | ||
396 | $client = new Client(); | ||
397 | |||
398 | $mock = new Mock([ | ||
399 | new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), | ||
400 | new Response(200, ['Content-Type' => 'application/json'], Stream::factory(' | ||
401 | { | ||
402 | "status": 1, | ||
403 | "list": { | ||
404 | "229279689": { | ||
405 | "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview" | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | ')), | ||
410 | ]); | ||
411 | |||
412 | $client->getEmitter()->attach($mock); | ||
413 | |||
414 | $pocketImport = $this->getPocketImport(); | ||
415 | |||
416 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
417 | ->disableOriginalConstructor() | ||
418 | ->getMock(); | ||
419 | |||
420 | $entryRepo->expects($this->once()) | ||
421 | ->method('findByUrlAndUserId') | ||
422 | ->will($this->onConsecutiveCalls(false, true)); | ||
423 | |||
424 | $this->em | ||
425 | ->expects($this->once()) | ||
426 | ->method('getRepository') | ||
427 | ->willReturn($entryRepo); | ||
428 | |||
429 | $entry = new Entry($this->user); | ||
430 | |||
431 | $this->contentProxy | ||
432 | ->expects($this->once()) | ||
433 | ->method('updateEntry') | ||
434 | ->will($this->throwException(new \Exception())); | ||
435 | |||
436 | $pocketImport->setClient($client); | ||
437 | $pocketImport->authorize('wunderbar_code'); | ||
438 | |||
439 | $res = $pocketImport->import(); | ||
440 | |||
441 | $this->assertTrue($res); | ||
442 | $this->assertEquals(['skipped' => 1, 'imported' => 0], $pocketImport->getSummary()); | ||
443 | } | ||
393 | } | 444 | } |
diff --git a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php index 8ec66b12..4a45e0f0 100644 --- a/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php +++ b/tests/Wallabag/ImportBundle/Import/WallabagV2ImportTest.php | |||
@@ -143,4 +143,44 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
143 | $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); | 143 | $this->assertContains('WallabagImport: user is not defined', $records[0]['message']); |
144 | $this->assertEquals('ERROR', $records[0]['level_name']); | 144 | $this->assertEquals('ERROR', $records[0]['level_name']); |
145 | } | 145 | } |
146 | |||
147 | public function testImportEmptyFile() | ||
148 | { | ||
149 | $wallabagV2Import = $this->getWallabagV2Import(); | ||
150 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-empty.json'); | ||
151 | |||
152 | $res = $wallabagV2Import->import(); | ||
153 | |||
154 | $this->assertFalse($res); | ||
155 | $this->assertEquals(['skipped' => 0, 'imported' => 0], $wallabagV2Import->getSummary()); | ||
156 | } | ||
157 | |||
158 | public function testImportWithExceptionFromGraby() | ||
159 | { | ||
160 | $wallabagV2Import = $this->getWallabagV2Import(); | ||
161 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2.json'); | ||
162 | |||
163 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
164 | ->disableOriginalConstructor() | ||
165 | ->getMock(); | ||
166 | |||
167 | $entryRepo->expects($this->exactly(24)) | ||
168 | ->method('findByUrlAndUserId') | ||
169 | ->will($this->onConsecutiveCalls(false, true, false)); | ||
170 | |||
171 | $this->em | ||
172 | ->expects($this->any()) | ||
173 | ->method('getRepository') | ||
174 | ->willReturn($entryRepo); | ||
175 | |||
176 | $this->contentProxy | ||
177 | ->expects($this->exactly(2)) | ||
178 | ->method('updateEntry') | ||
179 | ->will($this->throwException(new \Exception())); | ||
180 | |||
181 | $res = $wallabagV2Import->import(); | ||
182 | |||
183 | $this->assertTrue($res); | ||
184 | $this->assertEquals(['skipped' => 24, 'imported' => 0], $wallabagV2Import->getSummary()); | ||
185 | } | ||
146 | } | 186 | } |
diff --git a/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-empty.json b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-empty.json new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-empty.json | |||