changeset 6753:2bca9fcef70d

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.
author John Rouillard <rouilj@ieee.org>
date Mon, 04 Jul 2022 23:43:49 -0400
parents d640e9a5d6d7
children bb04638dc78d
files CHANGES.txt doc/upgrading.txt share/roundup/templates/classic/html/_generic.item.html share/roundup/templates/devel/html/_generic.item.html share/roundup/templates/minimal/html/_generic.item.html share/roundup/templates/responsive/html/_generic.item.html
diffstat 6 files changed, 30 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Mon Jul 04 22:21:05 2022 -0400
+++ b/CHANGES.txt	Mon Jul 04 23:43:49 2022 -0400
@@ -110,6 +110,8 @@
 - make setup.py install the Zope and wsgi.py frontends under
   share/frontends. This matches the install fo the cgi-bin/roundup.cgi
   frontend. (John Rouillard)
+- prevent submit button from showing up when using _generic.item.html
+  if the user doesn't have edit permissions
 
 Features:
 
--- a/doc/upgrading.txt	Mon Jul 04 22:21:05 2022 -0400
+++ b/doc/upgrading.txt	Mon Jul 04 23:43:49 2022 -0400
@@ -228,6 +228,26 @@
 the roundup-users at lists.sourceforge.net mailing list so we can
 enable it by default in a future release.
 
+
+Hide submit button during readonly use of _generic.item.html (optional)
+-----------------------------------------------------------------------
+
+The submit button in _generic.item.html always shows up even when the
+user doesn't have edit perms. Change the ``context/submit`` html to
+read::
+
+   <td colspan=3 tal:content="structure context/submit"
+       tal:condition="context/is_edit_ok">
+
+in your TAL based templates. The ``jinja2`` based templates are
+missing this file, but if you implemented one you want to surround the
+jinja2 code with::
+
+  {% if context.is_view_ok() %}
+    <submit button code here>
+  {% endif %}
+
+
 Migrating from 2.0.0 to 2.1.0
 =============================
 
--- a/share/roundup/templates/classic/html/_generic.item.html	Mon Jul 04 22:21:05 2022 -0400
+++ b/share/roundup/templates/classic/html/_generic.item.html	Mon Jul 04 23:43:49 2022 -0400
@@ -36,7 +36,8 @@
 </tr>
 <tr>
  <td>&nbsp;</td>
- <td colspan=3 tal:content="structure context/submit">
+ <td colspan=3 tal:content="structure context/submit"
+     tal:condition="context/is_edit_ok">
   submit button will go here
  </td>
 </tr>
--- a/share/roundup/templates/devel/html/_generic.item.html	Mon Jul 04 22:21:05 2022 -0400
+++ b/share/roundup/templates/devel/html/_generic.item.html	Mon Jul 04 23:43:49 2022 -0400
@@ -36,7 +36,8 @@
 </tr>
 <tr>
  <td>&nbsp;</td>
- <td colspan=3 tal:content="structure context/submit">
+ <td colspan=3 tal:content="structure context/submit"
+     tal:condition="context/is_edit_ok">
   submit button will go here
  </td>
 </tr>
--- a/share/roundup/templates/minimal/html/_generic.item.html	Mon Jul 04 22:21:05 2022 -0400
+++ b/share/roundup/templates/minimal/html/_generic.item.html	Mon Jul 04 23:43:49 2022 -0400
@@ -36,7 +36,8 @@
 </tr>
 <tr>
  <td>&nbsp;</td>
- <td colspan=3 tal:content="structure context/submit">
+ <td colspan=3 tal:content="structure context/submit"
+     tal:condition="context/is_edit_ok">
   submit button will go here
  </td>
 </tr>
--- a/share/roundup/templates/responsive/html/_generic.item.html	Mon Jul 04 22:21:05 2022 -0400
+++ b/share/roundup/templates/responsive/html/_generic.item.html	Mon Jul 04 23:43:49 2022 -0400
@@ -36,7 +36,8 @@
 </tr>
 <tr>
  <td>&nbsp;</td>
- <td colspan=3 tal:content="structure context/submit">
+ <td colspan=3 tal:content="structure context/submit"
+     tal:condition="context/is_edit_ok">
   submit button will go here
  </td>
 </tr>

Roundup Issue Tracker: http://roundup-tracker.org/