Move table rows into their own %def
authorKarl O. Pinc <kop@karlpinc.com>
Thu, 1 Aug 2024 22:24:35 +0000 (17:24 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Thu, 1 Aug 2024 22:24:35 +0000 (17:24 -0500)
src/pgwui_common/templates/auth_base.mak
src/pgwui_common/templates/db_base.mak

index 098b54a11666bf754377724610be6f5428e5c001..927c4b2b92a4a33ca0679cf42c95537be7ecdda4 100644 (file)
       % endif
 </%def>
 
+<%def name="table_rows(tab_index)">
+  <%
+    self.user_row(tab_index, havecreds, user)
+    self.password_row(tab_index, havecreds)
+    caller.body(tab_index)
+  %>
+</%def>
+
 <%def name="main_form(tab_index)">
   <form action="" enctype="multipart/form-data" method="post">
     <div>
     </div>
 
     <table>
-      <%
-      if hasattr(caller, 'database_row'):
-        caller.database_row(tab_index)
-      self.user_row(tab_index, havecreds, user)
-      self.password_row(tab_index, havecreds)
-
-      caller.body(tab_index)
-
-      %>
+      <%self:table_rows tab_index="${tab_index}" args="tab_index"/>
     </table>
 
     <p>
index 80b2775e109737fa5e3006ead081b9a6be4667bf..694b6ef822de15bdd00526443a9742236d4022be 100644 (file)
        table.
 </%doc>
 
-<%def name="main_form(tab_index)">
-  <%parent:main_form tab_index="${tab_index}" args="tab_index">
-    <%def name="database_row(tab_index)">
-      <tr>
-        <td class="label">
-          <label for="db_id">Database:</label>
-        </td>
-        <td>
-          <input name="db"
-                 tabindex="${tab_index.val}"
-                 id="db_id"
-                 type="text"
-                 size="30"
-                 value="${db}"
-                 />
-        </td>
-      </tr>
-      <% tab_index.inc() %>
-    </%def>
+<%def name="database_row(tab_index)">
+  <tr>
+    <td class="label">
+      <label for="db_id">Database:</label>
+    </td>
+    <td>
+      <input name="db"
+             tabindex="${tab_index.val}"
+             id="db_id"
+             type="text"
+             size="30"
+             value="${db}"
+             />
+    </td>
+  </tr>
+  <% tab_index.inc() %>
+</%def>
 
+<%def name="table_rows(tab_index)">
+  ${self.database_row(tab_index)}
+  <%parent:table_rows tab_index="${tab_index}" args="tab_index">
     <% caller.body(tab_index) %>
-  </%parent:main_form>
+  </%parent:table_rows>
 </%def>