comparison 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
comparison
equal deleted inserted replaced
7739:e2816259ccce 7740:67438e439da8
1862 1862
1863 To edit the status of all items in the item index view, edit the 1863 To edit the status of all items in the item index view, edit the
1864 ``issue.index.html``: 1864 ``issue.index.html``:
1865 1865
1866 1. add a form around the listing table (separate from the existing 1866 1. add a form around the listing table (separate from the existing
1867 index-page form), so at the top it reads:: 1867 index-page form), so at the top it reads:
1868 1868
1869 <form method="POST" tal:attributes="action request/classname"> 1869 .. tabs::
1870 <table class="list"> 1870
1871 1871 .. code-tab:: html TAL
1872 and at the bottom of that table:: 1872
1873 <form method="POST" tal:attributes="action request/classname">
1874 <table class="list">
1875
1876 .. code-tab:: html Jinja2
1877
1878 <form method="POST" action='issue{{ context.id }}' class='form-inline'>
1879 <table class="list">
1880
1881
1882 and at the bottom of that table add::
1873 1883
1874 </table> 1884 </table>
1875 </form 1885 </form
1876 1886
1877 making sure you match the ``</table>`` from the list table, not the 1887 making sure you match the ``</table>`` from the list table, not the
1878 navigation table or the subsequent form table. 1888 navigation table or the subsequent form table.
1879 1889
1880 2. in the display for the issue property, change:: 1890 2. in the display for the issue property, change:
1881 1891
1882 <td tal:condition="request/show/status" 1892 .. tabs::
1883 tal:content="python:i.status.plain() or default">&nbsp;</td> 1893
1884 1894 .. code-tab:: html TAL
1885 to:: 1895
1886 1896 <td tal:condition="request/show/status"
1887 <td tal:condition="request/show/status" 1897 tal:content="python:i.status.plain() or default">&nbsp;</td>
1888 tal:content="structure i/status/field">&nbsp;</td> 1898
1889 1899 .. code-tab:: html Jinja2
1900
1901 {% if request.show.status %}
1902 <td>{{ issue.status.plain()|u }}</td>
1903 {% endif %}
1904
1905 to:
1906
1907 .. tabs::
1908
1909 .. code-tab:: html TAL
1910
1911 <td tal:condition="request/show/status"
1912 tal:content="structure i/status/field">&nbsp;</td>
1913
1914 .. code-tab:: html Jinja2
1915
1916 {% if request.show.status %}
1917 <td>{{ issue.status.menu()|u|safe }}</td>
1918 {% endif %}
1919 <!-- untested -->
1920
1890 this will result in an edit field for the status property. 1921 this will result in an edit field for the status property.
1891 1922
1892 3. after the ``tal:block`` which lists the index items (marked by 1923 3. after the ``tal:block`` which lists the index items (marked by
1893 ``tal:repeat="i batch"``) add a new table row:: 1924 ``tal:repeat="i batch"``) add a new table row:
1894 1925
1895 <tr> 1926 .. tabs::
1896 <td tal:attributes="colspan python:len(request.columns)"> 1927
1897 <input name="@csrf" type="hidden" 1928 .. code-tab:: html TAL
1898 tal:attributes="value python:utils.anti_csrf_nonce()"> 1929
1899 <input type="submit" value=" Save Changes "> 1930 <tr>
1900 <input type="hidden" name="@action" value="edit"> 1931 <td tal:attributes="colspan python:len(request.columns)">
1901 <tal:block replace="structure request/indexargs_form" /> 1932 <input name="@csrf" type="hidden"
1902 </td> 1933 tal:attributes="value python:utils.anti_csrf_nonce()">
1903 </tr> 1934 <input type="submit" value=" Save Changes ">
1935 <input type="hidden" name="@action" value="edit">
1936 <tal:block replace="structure request/indexargs_form" />
1937 </td>
1938 </tr>
1939
1940 .. code-tab:: html Jinja2
1941
1942 To Be Written
1904 1943
1905 which gives us a submit button, indicates that we are performing an 1944 which gives us a submit button, indicates that we are performing an
1906 edit on any changed statuses, and provides a defense against cross 1945 edit on any changed statuses, and provides a defense against cross
1907 site request forgery attacks. 1946 site request forgery attacks.
1908 1947

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