diff options
Diffstat (limited to 'app')
-rwxr-xr-x | app/Resources/static/themes/material/index.js | 26 | ||||
-rw-r--r-- | app/config/config.yml | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js index d8f5628c..185ac1e0 100755 --- a/app/Resources/static/themes/material/index.js +++ b/app/Resources/static/themes/material/index.js | |||
@@ -120,4 +120,30 @@ $(document).ready(() => { | |||
120 | }); | 120 | }); |
121 | }); | 121 | }); |
122 | } | 122 | } |
123 | |||
124 | $('.markasread').on('click', () => { | ||
125 | const article = document.getElementById('article'); | ||
126 | const link = document.getElementById('link-archive'); | ||
127 | const articleId = article.dataset.id; | ||
128 | const xhr = new XMLHttpRequest(); | ||
129 | |||
130 | xhr.onload = function toggleArchive() { | ||
131 | if (xhr.status === 200) { | ||
132 | const previousStatus = document.getElementById('archive-icon').innerHTML; | ||
133 | let status = link.dataset.iconUnread; | ||
134 | let label = link.dataset.labelUnread; | ||
135 | if (previousStatus === 'unarchive') { | ||
136 | status = link.dataset.iconRead; | ||
137 | label = link.dataset.labelRead; | ||
138 | } | ||
139 | document.getElementById('archive-icon').innerHTML = status; | ||
140 | document.getElementById('archive-label').innerHTML = label; | ||
141 | window.Materialize.toast(xhr.responseText, 4000); | ||
142 | } | ||
143 | }; | ||
144 | |||
145 | const url = `${Routing.generate('archive_entry', { id: articleId })}?some_var_name=true`; | ||
146 | xhr.open('GET', url, false); | ||
147 | xhr.send(null); | ||
148 | }); | ||
123 | }); | 149 | }); |
diff --git a/app/config/config.yml b/app/config/config.yml index 4eea0531..f87835cf 100644 --- a/app/config/config.yml +++ b/app/config/config.yml | |||
@@ -373,6 +373,7 @@ fos_js_routing: | |||
373 | - howto | 373 | - howto |
374 | - fos_user_security_logout | 374 | - fos_user_security_logout |
375 | - new | 375 | - new |
376 | - archive_entry | ||
376 | 377 | ||
377 | jms_serializer: | 378 | jms_serializer: |
378 | handlers: | 379 | handlers: |