diff options
3 files changed, 46 insertions, 4 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 | }); |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig index 070d5629..35351ab1 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Tag/tags.html.twig | |||
@@ -10,10 +10,22 @@ | |||
10 | <ul> | 10 | <ul> |
11 | {% for tag in tags %} | 11 | {% for tag in tags %} |
12 | <li id="tag-{{ tag.id|e }}"> | 12 | <li id="tag-{{ tag.id|e }}"> |
13 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.nbEntries }})</a> | 13 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}" data-handle="tag-link">{{ tag.label }} ({{ tag.nbEntries }})</a> |
14 | <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="right"> | 14 | |
15 | <i class="material-icons md-24">rss_feed</i> | 15 | {% if renameForms is defined and renameForms[tag.id] is defined %} |
16 | <form class="card-tag-form hidden" data-handle="tag-rename-form" action="{{ path('tag_rename', {'slug': tag.slug})}}" method="POST"> | ||
17 | {{ form_widget(renameForms[tag.id].label, {'attr': {'value': tag.label}}) }} | ||
18 | {{ form_rest(renameForms[tag.id]) }} | ||
19 | </form> | ||
20 | <a class="card-tag-rename" data-handler="tag-rename" href="javascript:void(0);"> | ||
21 | <i class="material-icons">mode_edit</i> | ||
16 | </a> | 22 | </a> |
23 | {% endif %} | ||
24 | {% if app.user.config.rssToken %} | ||
25 | <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="right"> | ||
26 | <i class="material-icons md-24">rss_feed</i> | ||
27 | </a> | ||
28 | {% endif %} | ||
17 | </li> | 29 | </li> |
18 | {% endfor %} | 30 | {% endfor %} |
19 | </ul> | 31 | </ul> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig index c15b5146..21e88a9a 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig | |||
@@ -13,7 +13,18 @@ | |||
13 | <ul class="card-tag-labels"> | 13 | <ul class="card-tag-labels"> |
14 | {% for tag in tags %} | 14 | {% for tag in tags %} |
15 | <li title="{{tag.label}} ({{ tag.nbEntries }})" id="tag-{{ tag.id }}"> | 15 | <li title="{{tag.label}} ({{ tag.nbEntries }})" id="tag-{{ tag.id }}"> |
16 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}" class="card-tag-link">{{tag.label}} ({{ tag.nbEntries }})</a> | 16 | <a href="{{ path('tag_entries', {'slug': tag.slug}) }}" class="card-tag-link" data-handle="tag-link"> |
17 | {{ tag.label }} ({{ tag.nbEntries }}) | ||
18 | </a> | ||
19 | {% if renameForms is defined and renameForms[tag.id] is defined %} | ||
20 | <form class="card-tag-form hidden" data-handle="tag-rename-form" action="{{ path('tag_rename', {'slug': tag.slug})}}" method="POST"> | ||
21 | {{ form_widget(renameForms[tag.id].label, {'attr': {'value': tag.label}}) }} | ||
22 | {{ form_rest(renameForms[tag.id]) }} | ||
23 | </form> | ||
24 | <a class="card-tag-rename" data-handler="tag-rename" href="javascript:void(0);"> | ||
25 | <i class="material-icons">mode_edit</i> | ||
26 | </a> | ||
27 | {% endif %} | ||
17 | {% if app.user.config.rssToken %} | 28 | {% if app.user.config.rssToken %} |
18 | <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="card-tag-rss"><i class="material-icons">rss_feed</i></a> | 29 | <a rel="alternate" type="application/rss+xml" href="{{ path('tag_rss', {'username': app.user.username, 'token': app.user.config.rssToken, 'slug': tag.slug}) }}" class="card-tag-rss"><i class="material-icons">rss_feed</i></a> |
19 | {% endif %} | 30 | {% endif %} |