diff options
author | Stéphane HULARD <s.hulard@chstudio.fr> | 2018-01-24 17:29:26 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-09-25 10:18:08 +0200 |
commit | 9b0aef9171389aa9cdc39e8434df0f912ee5bdae (patch) | |
tree | c05579d2af4f4120831691032e10005888bc8cd5 /app/Resources | |
parent | b846c1e4d03ec51ae6b740040d79d47d9bdec12c (diff) | |
download | wallabag-9b0aef9171389aa9cdc39e8434df0f912ee5bdae.tar.gz wallabag-9b0aef9171389aa9cdc39e8434df0f912ee5bdae.tar.zst wallabag-9b0aef9171389aa9cdc39e8434df0f912ee5bdae.zip |
Update tag list template to allow renaming.
* Add a form on each tag to handle rename action.
* Add JavaScript to handle action on the corresponding page inside the global index.js file.
* Add support for the 2 active themes : material / baggy
The form solution is cleaner than an Ajax one because it let the browser validate input data and make the POST easier without the need to handle JSON response.
Diffstat (limited to 'app/Resources')
-rw-r--r-- | app/Resources/static/themes/_global/index.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index ae598e56..bb3e95b6 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js | |||
@@ -70,4 +70,23 @@ $(document).ready(() => { | |||
70 | retrievePercent(x.entryId, true); | 70 | retrievePercent(x.entryId, true); |
71 | }); | 71 | }); |
72 | } | 72 | } |
73 | |||
74 | document.querySelectorAll('[data-handler=tag-rename]').forEach((item) => { | ||
75 | const current = item; | ||
76 | current.wallabag_edit_mode = false; | ||
77 | current.onclick = (event) => { | ||
78 | const target = event.currentTarget; | ||
79 | |||
80 | if (target.wallabag_edit_mode === false) { | ||
81 | $(target.parentNode.querySelector('[data-handle=tag-link]')).addClass('hidden'); | ||
82 | $(target.parentNode.querySelector('[data-handle=tag-rename-form]')).removeClass('hidden'); | ||
83 | target.parentNode.querySelector('[data-handle=tag-rename-form] input').focus(); | ||
84 | target.querySelector('.material-icons').innerHTML = 'done'; | ||
85 | |||
86 | target.wallabag_edit_mode = true; | ||
87 | } else { | ||
88 | target.parentNode.querySelector('[data-handle=tag-rename-form]').submit(); | ||
89 | } | ||
90 | }; | ||
91 | }); | ||
73 | }); | 92 | }); |