changeset d2581a79398b in bugs.tryton.org:default
details: https://hg.tryton.org/bugs.tryton.org?cmd=changeset;node=d2581a79398b
description:
        Improve keyword edition

        see https://issues.roundup-tracker.org/issue2551109
diffstat:

 html/keyword.item.html |  32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diffs (50 lines):

diff -r 164106c97c82 -r d2581a79398b html/keyword.item.html
--- a/html/keyword.item.html    Sat Jan 09 11:42:50 2021 +0100
+++ b/html/keyword.item.html    Wed Jan 13 19:25:11 2021 +0100
@@ -11,28 +11,32 @@
 {% block content %}
 
   <h4>Existing Keywords</h4>
+  <ul class='nav nav-pills nav-stacked'>
+    {% for keyword in db.keyword.list() %}
+      <li class='nav-item'>
+        <a class='nav-link {{ 'active' if context.id == keyword.id else '' }}' 
href='keyword{{ keyword.id }}'>{{ keyword.name.plain()|u }}</a>
+      </li>
+    {% else %}
+      <p class='text-mute'>{% trans %}There are no keywords yet.  Be the first 
-{% endtrans %}</p>
+    {% endfor %}
+    {% if context.id %}
+    <li class='nav-item'>
+      <a class='nav-link close' href='keyword?@template=item' 
aria-label="Close">
+        <span aria-hidden="true">&times;</span>
+      </a>
+    </li>
+    {% endif %}
+  </ul>
   <p class='text-warning'>
    {% trans %}To edit an existing keyword (for spelling or typing errors),
    click on its entry above.{% endtrans %}
   </p>
 
-  <ul class='nav nav-pills nav-stacked'>
-    {% for keyword in db.keyword.list() %}
-      <li>
-        <a href='keyword{{ keyword.id }}'>{{ keyword.name.plain()|u }}</a>
-      </li>
-    {% else %}
-      <p class='text-mute'>{% trans %}There are no keywords yet.  Be the first 
-{% endtrans %}</p>
-    {% endfor %}
-  </ul>
 
   <form class='form-inline' method="POST" action='{{ context.designator() }}'>
-    <input type='text' class='input-xlarge' name='name'>
+    <input type='text' class='input-xlarge' name='name' value='{{ context.name 
if context.id else '' }}'>
     <input type="hidden" name="@required" value="name">
     <input type="hidden" name="@template" value="item">
-    <input name="@csrf" type="hidden"
-           value="{{ utils.anti_csrf_nonce() }}">
-    <input type="hidden" name="@action" value="new">
-    <input type='submit' class='btn btn-primary' value="{% trans %}Create 
keyword{% endtrans %}">
+    {{ context.submit(html_kwargs={ 'class': 'btn btn-primary' })|u|safe }}
   </form>
 {% endblock %}

Reply via email to