aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
blob: 9323e7873aa03a6d399363d64cd1f99125830dce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
{% extends "WallabagCoreBundle::layout.html.twig" %}

{% block title %}{{ entry.title|raw }} ({{ entry.domainName|removeWww }}){% 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>
        </header>

        <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.domainName|removeWww }}</span></a></li>
            <li><a title="{% trans %}Re-fetch content{% endtrans %}" class="tool icon icon-reload" href="{{ path('reload_entry', { 'id': entry.id }) }}"><span>{% trans %}Re-fetch content{% endtrans %}</span></a></li>
            <li><a title="{% if entry.isArchived == 0 %}{% trans %}Mark as read{% endtrans %}{% else %}{% trans %}Mark as unread{% endtrans %}{% 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 %}{% trans %}Mark as read{% endtrans %}{% else %}{% trans %}Mark as unread{% endtrans %}{% endif %}</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 id="nav-btn-add-tag" title="{% trans %}Add a tag{% endtrans %}"><span>{% trans %}Tag{% 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>
            {% 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="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</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" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</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" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</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" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora{% endtrans %}"><span>{% trans %}diaspora{% endtrans %}</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 }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans %}carrot{% endtrans %}"><span>Carrot</span></a></li>{% endif %}
            {% if craue_setting('show_printlink') %}<li><a title="{% trans %}Print{% endtrans %}" class="tool icon icon-print" href="javascript: window.print();"><span>{% trans %}Print{% endtrans %}</span></a></li>{% endif %}
            {% if craue_setting('export_epub') %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></li>{% endif %}
            {% if craue_setting('export_mobi') %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
            {% if craue_setting('export_pdf') %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></li>{% endif %}
            <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans %}Does this article appear wrong?{% endtrans %}" class="tool bad-display icon icon-delete"><span>{% trans %}Does this article appear wrong?{% endtrans %}</span></a></li>
        </ul>
    </div>
        {% set nbAnnotations = entry.annotations | length %}
        <span class="tool link mdi-communication-comment"> {% transchoice nbAnnotations %}{0} No annotations|{1} One annotation|]1,Inf[ %nbAnnotations% annotations{% endtranschoice %}</span>
        <aside class="tags">
            {% for tag in entry.tags %}
                <span class="mdi-action-label-outline">{{ tag.label }}</span> <a href="{{ path('remove_tag', { 'entry': entry.id, 'tag': tag.id }) }}"><i></i></a>
            {% endfor %}
            <div class="input-field nav-panel-add-tag" style="display: none">
                {{ render(controller( "WallabagCoreBundle:Tag:addTagForm", { 'id': entry.id } )) }}
            </div>
        </aside>
        {% if entry.previewPicture is not null %}
            <div><img class="preview" src="{{ entry.previewPicture }}" alt="{{ entry.title|raw }}" /></div>
        {% endif %}
        <article>
            {{ entry.content | raw }}
        </article>
    </div>
    <script src="{{ asset('bundles/wallabagcore/themes/_global/js/restoreScroll.js')}}"></script>
    <script type="text/javascript">
        $(document).ready(function() {

            // toggle read property of current article
          /*  $('#markAsRead').click(function(){
                $("body").css("cursor", "wait");
                $.ajax( { url: '{{ path('archive_entry', { 'id': entry.id }) }}' }).done(
                        function( data ) {
                            if ( data == '1' ) {
                                if ( $('#markAsRead').hasClass("archive-off") ) {
                                    $('#markAsRead').removeClass("archive-off");
                                    $('#markAsRead').addClass("archive");
                                }
                                else {
                                    $('#markAsRead').removeClass("archive");
                                    $('#markAsRead').addClass("archive-off");
                                }
                            }
                            else {
                                alert('Error! Pls check if you are logged in.');
                            }
                        });
                $("body").css("cursor", "auto");
            });*/

            // toggle favorite property of current article
          /*  $('#setFav').click(function(){
                $("body").css("cursor", "wait");
                $.ajax( { url: '{{ path('star_entry', { 'id': entry.id }) }}' }).done(
                        function( data ) {
                            if ( data == '1' ) {
                                if ( $('#setFav').hasClass("fav-off") ) {
                                    $('#setFav').removeClass("fav-off");
                                    $('#setFav').addClass("fav");
                                }
                                else {
                                    $('#setFav').removeClass("fav");
                                    $('#setFav').addClass("fav-off");
                                }
                            }
                            else {
                                alert('Error! Pls check if you are logged in.');
                            }
                        });
                $("body").css("cursor", "auto");
            });*/

            $(window).scroll(function(e){
                var scrollTop = $(window).scrollTop();
                var docHeight = $(document).height();
                var scrollPercent = (scrollTop) / (docHeight);
                var scrollPercentRounded = Math.round(scrollPercent*100)/100;
                savePercent({{ entry.id }}, scrollPercentRounded);
            });

            retrievePercent({{ entry.id }});

            $(window).resize(function(){
                retrievePercent({{ entry.id }});
            });
        });

        var app = new annotator.App();
        app.include(annotator.ui.main, {
            element: document.querySelector('article')
        });
        app.include(annotator.storage.http, {
            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 }) }}'
            }
        });
        app
            .start()
            .then(function () {
                app.annotations.load({entry: {{ entry.id }}});
            });
    </script>

{% endblock %}