]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
Fixed possible JS injection via the title edition
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Resources / views / themes / material / Entry / entry.html.twig
index fd84d984edb970d82b206c7f83d94ac633be1397..b445f7d5fabeb9497103987ddd763f7503d29177 100644 (file)
@@ -1,6 +1,8 @@
 {% extends "WallabagCoreBundle::layout.html.twig" %}
 
-{% block title %}{{ entry.title|raw }} ({{ entry.domainName|removeWww }}){% endblock %}
+{% block title %}{{ entry.title|e|raw }} ({{ entry.domainName|removeWww }}){% endblock %}
+
+{% block body_class %}entry{% endblock %}
 
 {% block menu %}
     <div class="progress">
             <ul>
                 <li>
                     <a class="waves-effect" href="{{ path('homepage') }}">
-                        <i class="mdi-action-exit-to-app"></i>
+                        <i class="material-icons">exit_to_app</i>
                     </a>
                 </li>
             </ul>
             <ul class="right">
                 <li>
-                    <a class="waves-effect" title="{% trans %}Mark as read{% endtrans %}" href="{{ path('archive_entry', { 'id': entry.id }) }}" id="markAsRead">
-                        <i class="{% if entry.isArchived == 0 %}mdi-action-done{% else %}mdi-content-redo{% endif %} small"></i>
+                    <a class="waves-effect" title="{{ 'entry.view.left_menu.set_as_read'|trans }}" href="{{ path('archive_entry', { 'id': entry.id }) }}" id="markAsRead">
+                        <i class="material-icons small">{% if entry.isArchived == 0 %}done{% else %}redo{% endif %}</i>
                     </a>
                 </li>
                 <li>
-                    <a class="waves-effect" title="{% trans %}Favorite{% endtrans %}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav">
-                        <i class="{% if entry.isStarred == 0 %}mdi-action-favorite-outline{% else %}mdi-action-favorite{% endif %} small"></i>
+                    <a class="waves-effect" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav">
+                        <i class="material-icons small">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i>
                     </a>
                 </li>
                 <li>
                     <a href="#" data-activates="slide-out" class="button-collapse right">
-                        <i class="mdi-navigation-menu"></i>
+                        <i class="material-icons">menu</i>
                     </a>
                 </li>
             </ul>
     <ul id="slide-out" class="collapsible side-nav fixed reader-mode" data-collapsible="accordion">
         <li class="bold border-bottom hide-on-med-and-down">
             <a class="waves-effect collapsible-header" href="{{ path('homepage') }}">
-                <i class="mdi-action-exit-to-app small"></i>
-                <span>{% trans %}back{% endtrans %}</span>
+                <i class="material-icons small">exit_to_app</i>
+                <span>{{ 'entry.view.left_menu.back_to_homepage'|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
 
         <li class="bold border-bottom hide-on-med-and-down">
             <a class="waves-effect collapsible-header" href="{{ entry.url|e }}">
-                <i class="mdi-content-link small"></i>
-                <span>{% trans %}original article{% endtrans %}</span>
+                <i class="material-icons small">link</i>
+                <span>{{ 'entry.view.left_menu.view_original_article'|trans }}</span>
+            </a>
+            <div class="collapsible-body"></div>
+        </li>
+
+        <li class="bold hide-on-med-and-down">
+            <a class="waves-effect collapsible-header" title="{{ 'entry.view.left_menu.re_fetch_content'|trans }}" href="{{ path('reload_entry', { 'id': entry.id }) }}" id="reload">
+                <i class="material-icons small">autorenew</i>
+                <span>{{ 'entry.view.left_menu.re_fetch_content'|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
 
+        {% set markAsReadLabel = 'entry.view.left_menu.set_as_unread' %}
+        {% if entry.isArchived == 0 %}
+            {% set markAsReadLabel = 'entry.view.left_menu.set_as_read' %}
+        {% endif %}
+
         <li class="bold hide-on-med-and-down">
-            <a class="waves-effect collapsible-header" title="{% trans %}Mark as read{% endtrans %}" href="{{ path('archive_entry', { 'id': entry.id }) }}" id="markAsRead">
-                <i class="{% if entry.isArchived == 0 %}mdi-action-done{% else %}mdi-content-redo{% endif %} small"></i>
-                <span>{% trans %}Mark as read{% endtrans %}</span>
+            <a class="waves-effect collapsible-header" title="{{ markAsReadLabel|trans }}" href="{{ path('archive_entry', { 'id': entry.id }) }}" id="markAsRead">
+                <i class="material-icons small">{% if entry.isArchived == 0 %}done{% else %}redo{% endif %}</i>
+                <span>{{ markAsReadLabel|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
 
         <li class="bold hide-on-med-and-down">
-            <a class="waves-effect collapsible-header" title="{% trans %}Favorite{% endtrans %}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav">
-                <i class="{% if entry.isStarred == 0 %}mdi-action-favorite-outline{% else %}mdi-action-favorite{% endif %} small"></i>
-                <span>{% trans %}Favorite{% endtrans %}</span>
+            <a class="waves-effect collapsible-header" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" href="{{ path('star_entry', { 'id': entry.id }) }}" id="setFav">
+                <i class="material-icons spall">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i>
+                <span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
         <li class="bold border-bottom hide-on-med-and-down">
-            <a class="waves-effect collapsible-header" title="{% trans %}Delete{% endtrans %}" href="{{ path('delete_entry', { 'id': entry.id }) }}">
-                <i class="mdi-action-delete small"></i>
-                <span>{% trans %}Delete{% endtrans %}</span>
+            <a class="waves-effect collapsible-header" title="{{ 'entry.view.left_menu.delete'|trans }}" href="{{ path('delete_entry', { 'id': entry.id }) }}">
+                <i class="material-icons small">delete</i>
+                <span>{{ 'entry.view.left_menu.delete'|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
 
         <li class="bold border-bottom hide-on-med-and-down">
             <a class="waves-effect collapsible-header" id="nav-btn-add-tag">
-                <i class="mdi-action-label-outline small"></i>
-                <span>{% trans %}Add a tag{% endtrans %}</span>
+                <i class="material-icons small">label_outline</i>
+                <span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
 
         <li class="bold">
             <a class="waves-effect collapsible-header">
-                <i class="mdi-social-share small"></i>
-                <span>{% trans %}Share{% endtrans %}</span>
+                <i class="material-icons small">share</i>
+                <span>{{ 'entry.view.left_menu.share_content'|trans }}</span>
             </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 %}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 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 %}
+                    {% if craue_setting('share_public') %}
+                        <li>
+                            <a href="{{ path('share', {'id': entry.id }) }}" target="_blank" title="{{ 'entry.view.left_menu.public_link'|trans }}" class="tool icon-eye">
+                                <span>{{ 'entry.view.left_menu.public_link'|trans }}</span>
+                            </a>
+                        </li>
+                        <li>
+                            <a href="{{ path('delete_share', {'id': entry.id }) }}" title="{{ 'entry.view.left_menu.delete_public_link'|trans }}" class="tool icon-no-eye">
+                                <span>{{ 'entry.view.left_menu.delete_public_link'|trans }}</span>
+                            </a>
+                        </li>
+                    {% endif %}
+                    {% 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 icon-twitter" title="twitter">
+                                <span>twitter</span>
+                            </a>
+                        </li>
+                    {% endif %}
+                    {% if craue_setting('share_shaarli') %}
+                        <li>
+                            <a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank">
+                                <i class="tool icon-image icon-image--shaarli" title="shaarli"></i>
+                                <span>shaarli</span>
+                            </a>
+                        </li>
+                    {% endif %}
+                    {% if craue_setting('share_diaspora') %}
+                        <li>
+                            <a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank">
+                                <i class="tool icon-image icon-image--diaspora" title="diaspora"></i>
+                                <span>diaspora*</span>
+                            </a>
+                        </li>
+                    {% endif %}
+                    {% if craue_setting('carrot') %}
+                        <li>
+                            <a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" target="_blank" title="carrot">
+                                <i class="tool icon-image icon-image--carrot"></i>
+                                <span>Carrot</span>
+                            </a>
+                        </li>
+                    {% endif %}
+                    {% if craue_setting('share_mail') %}
+                        <li>
+                            <a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" title="{{ 'entry.view.left_menu.share_email_label'|trans }}" class="tool email icon icon-mail">
+                                <span>{{ 'entry.view.left_menu.share_email_label'|trans }}</span>
+                            </a>
+                        </li>
+                    {% endif %}
                 </ul>
             </div>
         </li>
 
+        {% if craue_setting('show_printlink') %}
+        <li class="bold border-bottom hide-on-med-and-down">
+            <a class="waves-effect collapsible-header" title="{{ 'entry.view.left_menu.print'|trans }}" href="javascript: window.print();">
+                <i class="material-icons small">print</i>
+                <span>{{ 'entry.view.left_menu.print'|trans }}</span>
+            </a>
+            <div class="collapsible-body"></div>
+        </li>
+        {% endif %}
+
         <li class="bold">
             <a class="waves-effect collapsible-header">
-                <i class="mdi-file-file-download small"></i>
-                <span>{% trans %}Download{% endtrans %}</span>
+                <i class="material-icons small">file_download</i>
+                <span>{{ 'entry.view.left_menu.download'|trans }}</span>
             </a>
             <div class="collapsible-body">
                 <ul>
-                    {% if export_epub %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %}
-                    {% if export_mobi %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
-                    {% if export_pdf %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
-                    <li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>
-                    <li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>
-                    <li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>
+                    {% if craue_setting('export_epub') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %}
+                    {% if craue_setting('export_mobi') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
+                    {% if craue_setting('export_pdf') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
+                    {% if craue_setting('export_csv') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %}
+                    {% if craue_setting('export_json') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %}
+                    {% if craue_setting('export_txt') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'txt' }) }}" title="Generate TXT file">TXT</a></li>{% endif %}
+                    {% if craue_setting('export_xml') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %}
                 </ul>
             </div>
         </li>
 
         <li class="bold hide-on-large-only">
-            <a class="waves-effect collapsible-header" title="{% trans %}Delete{% endtrans %}" href="{{ path('delete_entry', { 'id': entry.id }) }}">
-                <i class="mdi-action-delete small"></i>
-                <span>{% trans %}Delete{% endtrans %}</span>
+            <a class="waves-effect collapsible-header" title="{{ 'entry.view.left_menu.delete'|trans }}" href="{{ path('delete_entry', { 'id': entry.id }) }}">
+                <i class="material-icons small">delete</i>
+                <span>{{ 'entry.view.left_menu.delete'|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
 
         <li class="bold">
-            <a class="waves-effect collapsible-header" href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans %}Does this article appear wrong?{% endtrans %}">
-                <i class="mdi-alert-error small"></i>
-                <span>{% trans %}Problems?{% endtrans %}</span>
+            <a class="waves-effect collapsible-header" href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{{ 'entry.view.left_menu.problem.description'|trans }}">
+                <i class="material-icons small">error</i>
+                <span>{{ 'entry.view.left_menu.problem.label'|trans }}</span>
             </a>
             <div class="collapsible-body"></div>
         </li>
 
     </ul>
 
-<style>
-main {
-    padding: 0;
-}
-</style>
 {% endblock %}
 
 {% block content %}
     <div id="article">
         <header class="mbm">
-            <h1>{{ entry.title|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{% trans %}Edit title{% endtrans %}">✎</a></h1>
+            <h1>{{ entry.title|e|raw }} <a href="{{ path('edit', { 'id': entry.id }) }}" title="{{ 'entry.view.edit_title'|trans }}">✎</a></h1>
         </header>
         <aside>
-            <a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link mdi-content-link"> <span>{{ entry.domainName|removeWww }}</span></a>
-            <div id="list">
-                {% for tag in entry.tags %}
-                    <div class="chip">
-                    {{ tag.label }}
-                    </div>
-                {% endfor %}
+            <ul class="tools">
+                <li>
+                    {% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
+                    <i class="material-icons">timer</i>
+                    {% if readingTime > 0 %}
+                        {{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': readingTime|round}) }}
+                    {% else %}
+                        {{ 'entry.list.reading_time_less_one_minute_short'|trans|raw }}
+                    {% endif %}
+                </li>
+                <li>
+                    <i class="material-icons" title="{{ 'entry.view.created_at'|trans }}">today</i>
+                    {{ entry.createdAt|date('Y-m-d') }}
+                </li>
+                <li>
+                    <i class="material-icons link">link</i>
+                    <a href="{{ entry.url|e }}" target="_blank" title="{{ 'entry.view.original_article'|trans }} : {{ entry.title|e }}" class="tool">
+                        {{ entry.domainName|removeWww }}
+                    </a>
+                </li>
+                <li>
+                    <i class="material-icons link">comment</i>
+                    {{ 'entry.view.annotations_on_the_entry'|transchoice(entry.annotations | length) }}
+                </li>
+                <li id="list">
+                    {% for tag in entry.tags %}
+                        <div class="chip">
+                        <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a> <a href="{{ path('remove_tag', { 'entry': entry.id, 'tag': tag.id }) }}"><i class="material-icons">delete</i></a>
+                        </div>
+                    {% endfor %}
+                </li>
+            </ul>
+
+            <div class="input-field nav-panel-add-tag" style="display: none">
+                {{ render(controller( "WallabagCoreBundle:Tag:addTagForm", { 'id': entry.id } )) }}
             </div>
 
             {% if entry.previewPicture is not null %}
                 <div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|raw }}" /></div>
             {% endif %}
 
-            <div class="input-field nav-panel-add-tag" style="display: none">
-                {{ render(controller( "WallabagCoreBundle:Tag:addTagForm", { 'id': entry.id } )) }}
-            </div>
-
         </aside>
         <article>
             {{ entry.content | raw }}
         </article>
     </div>
+
+<script id="annotationroutes" type="application/json">
+{
+    "prefix": "",
+    "urls": {
+        "create": "{{ path('annotations_post_annotation', { 'entry': entry.id }) }}",
+        "update": "{{ path('annotations_put_annotation', { 'annotation': 'idAnnotation' }) }}",
+        "destroy": "{{ path('annotations_delete_annotation', { 'annotation': 'idAnnotation' }) }}",
+        "search": "{{ path('annotations_get_annotations', { 'entry': entry.id }) }}"
+    },
+    "entryId": "{{ entry.id }}"
+}</script>
+
 {% endblock %}
 
 {% block footer %}