Skip to content

Commit

Permalink
doc: replace URL action example with form
Browse files Browse the repository at this point in the history
The example to provide a link to take or resolve an item was broken.
Roundup has required a POST not GET for changes to the database for
a while. This example was never fixed.

Replaced a link using GET with a POSTed form. This changes the
activating element from a link to a button. The button could be
restyled as a link using CSS I think.

The original example was also not canonical. It used :action rather
than the canonical @action.
  • Loading branch information
rouilj committed Feb 14, 2024
1 parent be0d9f8 commit 5d95bb9
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions doc/customizing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1812,17 +1812,26 @@ Changes to the Web User Interface
Adding action links to the index page
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add a column to the ``item.index.html`` template.
Add a column to the ``item.index.html`` template. In that column add
a form to trigger the action. Note: the form must use the POST method
for security.

Resolving the issue::

<a tal:attributes="href
string:issue${i/id}?:status=resolved&:action=edit">resolve</a>
<form method="POST" tal:attributes="action string:issue${i/id}">
<button tal:replace="structure
python:context.submit(label='resolve', action='edit')" />
<input type="hidden" name="status" value="resolved">
</form>

"Take" the issue::

<a tal:attributes="href
string:issue${i/id}?:assignedto=${request/user/id}&:action=edit">take</a>
<form method="POST" tal:attributes="action string:issue${i/id}">
<button tal:replace="structure
python:context.submit(label='take', action='edit')" />
<input type="hidden" name="assignedto"
tal:attributes="value request/user/id">
</form>

... and so on.

Expand Down

0 comments on commit 5d95bb9

Please sign in to comment.