Skip to content

Commit d217654

Browse files
committed
issue2551109 - improve keyword editing in jinja2 template.
1 parent 6ed8d7a commit d217654

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Features:
9090
available. (John Rouillard)
9191
- Added explanation for modifying Fileclass content files to
9292
customizing.txt. Result of mailing list question. (John Rouillard)
93-
93+
- issue2551109 - Improve keyword editing in jinja2 template. (Cedric Krier)
9494

9595
2020-07-13 2.0.0
9696

share/roundup/templates/jinja2/html/keyword.item.html

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,32 @@
1111
{% block content %}
1212

1313
<h4>Existing Keywords</h4>
14-
<p class='text-warning'>
15-
{% trans %}To edit an existing keyword (for spelling or typing errors),
16-
click on its entry above.{% endtrans %}
17-
</p>
18-
1914
<ul class='nav nav-pills nav-stacked'>
2015
{% for keyword in db.keyword.list() %}
21-
<li>
22-
<a href='keyword{{ keyword.id }}'>{{ keyword.name.plain()|u }}</a>
16+
<li class='nav-item'>
17+
<a class='nav-link {{ 'active' if context.id == keyword.id else '' }}' href='keyword{{ keyword.id }}'>{{ keyword.name.plain()|u }}</a>
2318
</li>
2419
{% else %}
2520
<p class='text-mute'>{% trans %}There are no keywords yet. Be the first -{% endtrans %}</p>
2621
{% endfor %}
22+
{% if context.id %}
23+
<li class='nav-item'>
24+
<a class='nav-link close' href='keyword?@template=item' aria-label="Close">
25+
<span aria-hidden="true">&times;</span>
26+
</a>
27+
</li>
28+
{% endif %}
2729
</ul>
30+
<p class='text-warning'>
31+
{% trans %}To edit an existing keyword (for spelling or typing errors),
32+
click on its entry above.{% endtrans %}
33+
</p>
34+
2835

2936
<form class='form-inline' method="POST" action='{{ context.designator() }}'>
30-
<input type='text' class='input-xlarge' name='name'>
37+
<input type='text' class='input-xlarge' name='name' value='{{ context.name if context.id else '' }}'>
3138
<input type="hidden" name="@required" value="name">
3239
<input type="hidden" name="@template" value="item">
33-
<input name="@csrf" type="hidden"
34-
value="{{ utils.anti_csrf_nonce() }}">
35-
<input type="hidden" name="@action" value="new">
36-
<input type='submit' class='btn btn-primary' value="{% trans %}Create keyword{% endtrans %}">
40+
{{ context.submit(html_kwargs={ 'class': 'btn btn-primary' })|u|safe }}
3741
</form>
3842
{% endblock %}

0 commit comments

Comments
 (0)