Skip to content

Commit 86d96dc

Browse files
committed
Don't display submit button with readoly use of _generic.item.html
_generic.item.html in all templates except jinja2 displays the submit button even when the user has no edit rights. Check for is_edit_ok before emitting the submit button. The jinja2 template doesn't have an _generic.item.html template.
1 parent 7425c81 commit 86d96dc

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Fixed:
110110
- make setup.py install the Zope and wsgi.py frontends under
111111
share/frontends. This matches the install fo the cgi-bin/roundup.cgi
112112
frontend. (John Rouillard)
113+
- prevent submit button from showing up when using _generic.item.html
114+
if the user doesn't have edit permissions
113115

114116
Features:
115117

doc/upgrading.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,26 @@ If you use this and it works for you please followup with an email to
228228
the roundup-users at lists.sourceforge.net mailing list so we can
229229
enable it by default in a future release.
230230

231+
232+
Hide submit button during readonly use of _generic.item.html (optional)
233+
-----------------------------------------------------------------------
234+
235+
The submit button in _generic.item.html always shows up even when the
236+
user doesn't have edit perms. Change the ``context/submit`` html to
237+
read::
238+
239+
<td colspan=3 tal:content="structure context/submit"
240+
tal:condition="context/is_edit_ok">
241+
242+
in your TAL based templates. The ``jinja2`` based templates are
243+
missing this file, but if you implemented one you want to surround the
244+
jinja2 code with::
245+
246+
{% if context.is_view_ok() %}
247+
<submit button code here>
248+
{% endif %}
249+
250+
231251
Migrating from 2.0.0 to 2.1.0
232252
=============================
233253

share/roundup/templates/classic/html/_generic.item.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
</tr>
3737
<tr>
3838
<td>&nbsp;</td>
39-
<td colspan=3 tal:content="structure context/submit">
39+
<td colspan=3 tal:content="structure context/submit"
40+
tal:condition="context/is_edit_ok">
4041
submit button will go here
4142
</td>
4243
</tr>

share/roundup/templates/devel/html/_generic.item.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
</tr>
3737
<tr>
3838
<td>&nbsp;</td>
39-
<td colspan=3 tal:content="structure context/submit">
39+
<td colspan=3 tal:content="structure context/submit"
40+
tal:condition="context/is_edit_ok">
4041
submit button will go here
4142
</td>
4243
</tr>

share/roundup/templates/minimal/html/_generic.item.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
</tr>
3737
<tr>
3838
<td>&nbsp;</td>
39-
<td colspan=3 tal:content="structure context/submit">
39+
<td colspan=3 tal:content="structure context/submit"
40+
tal:condition="context/is_edit_ok">
4041
submit button will go here
4142
</td>
4243
</tr>

share/roundup/templates/responsive/html/_generic.item.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
</tr>
3737
<tr>
3838
<td>&nbsp;</td>
39-
<td colspan=3 tal:content="structure context/submit">
39+
<td colspan=3 tal:content="structure context/submit"
40+
tal:condition="context/is_edit_ok">
4041
submit button will go here
4142
</td>
4243
</tr>

0 commit comments

Comments
 (0)