]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
Add annotator in baggy theme
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Resources / views / themes / baggy / Entry / entry.html.twig
index 94f4ba7d3145031171813894ce7e1d8f16bda680..988cbd29cfff2ea5398aee0e935bea41b5458ad2 100644 (file)
                 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', { 'comment': 'idComment' }) }}',
+                destroy: '{{ path('annotations_delete_annotation', { 'comment': 'idComment' }) }}',
+                search: '{{ path('annotations_get_annotations', { 'entry': entry.id }) }}'
+            }
+        });
+        app
+            .start()
+            .then(function () {
+                app.annotations.load({entry: {{ entry.id }}});
+            });
     </script>
+
 {% endblock %}