Mercurial > p > roundup > code
diff doc/customizing.txt @ 7740:67438e439da8
docs: issue2551317 add support for jinja2 customization examples
Added sphinx-tabs to doc build. This allows adding code-tabs one for
"TAL" examples and one for "Jinja2" examples in the doc.
Converted partly the "Editing multiple items in an index view"
example. Sombody who knows jinja2 better than I, and can test the
example will need to finish it.
Documented requirement and method for building docs in developers.txt.
Added requirements.pip files for pip install -r ... modules needed for
processing docs.
Fixed missing block in layout.txt that stopped tabs.css from being
loaded.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 17 Feb 2024 18:56:04 -0500 |
| parents | ce0c40b6cdc3 |
| children | 697062addac4 |
line wrap: on
line diff
--- a/doc/customizing.txt Tue Feb 13 20:31:42 2024 -0500 +++ b/doc/customizing.txt Sat Feb 17 18:56:04 2024 -0500 @@ -1864,12 +1864,22 @@ ``issue.index.html``: 1. add a form around the listing table (separate from the existing - index-page form), so at the top it reads:: - - <form method="POST" tal:attributes="action request/classname"> - <table class="list"> - - and at the bottom of that table:: + index-page form), so at the top it reads: + + .. tabs:: + + .. code-tab:: html TAL + + <form method="POST" tal:attributes="action request/classname"> + <table class="list"> + + .. code-tab:: html Jinja2 + + <form method="POST" action='issue{{ context.id }}' class='form-inline'> + <table class="list"> + + + and at the bottom of that table add:: </table> </form @@ -1877,30 +1887,59 @@ making sure you match the ``</table>`` from the list table, not the navigation table or the subsequent form table. -2. in the display for the issue property, change:: - - <td tal:condition="request/show/status" - tal:content="python:i.status.plain() or default"> </td> - - to:: - - <td tal:condition="request/show/status" - tal:content="structure i/status/field"> </td> - +2. in the display for the issue property, change: + + .. tabs:: + + .. code-tab:: html TAL + + <td tal:condition="request/show/status" + tal:content="python:i.status.plain() or default"> </td> + + .. code-tab:: html Jinja2 + + {% if request.show.status %} + <td>{{ issue.status.plain()|u }}</td> + {% endif %} + + to: + + .. tabs:: + + .. code-tab:: html TAL + + <td tal:condition="request/show/status" + tal:content="structure i/status/field"> </td> + + .. code-tab:: html Jinja2 + + {% if request.show.status %} + <td>{{ issue.status.menu()|u|safe }}</td> + {% endif %} + <!-- untested --> + this will result in an edit field for the status property. 3. after the ``tal:block`` which lists the index items (marked by - ``tal:repeat="i batch"``) add a new table row:: - - <tr> - <td tal:attributes="colspan python:len(request.columns)"> - <input name="@csrf" type="hidden" - tal:attributes="value python:utils.anti_csrf_nonce()"> - <input type="submit" value=" Save Changes "> - <input type="hidden" name="@action" value="edit"> - <tal:block replace="structure request/indexargs_form" /> - </td> - </tr> + ``tal:repeat="i batch"``) add a new table row: + + .. tabs:: + + .. code-tab:: html TAL + + <tr> + <td tal:attributes="colspan python:len(request.columns)"> + <input name="@csrf" type="hidden" + tal:attributes="value python:utils.anti_csrf_nonce()"> + <input type="submit" value=" Save Changes "> + <input type="hidden" name="@action" value="edit"> + <tal:block replace="structure request/indexargs_form" /> + </td> + </tr> + + .. code-tab:: html Jinja2 + + To Be Written which gives us a submit button, indicates that we are performing an edit on any changed statuses, and provides a defense against cross
