From: Karl O. Pinc Date: Sat, 3 Aug 2024 20:43:25 +0000 (-0500) Subject: Add label id targets back to input labels X-Git-Url: https://papio.biology.duke.edu/gitweb/?a=commitdiff_plain;h=b5ed7151350fbbf31ce4dec52b8de20817d7c0bf;p=pgwui_common Add label id targets back to input labels As it turns out, you can't use "for" as an argument/tag element attribute with mako. At least not when inheriting the namespace into templates at arbitrary depth. --- diff --git a/src/pgwui_common/templates/auth_base.mak b/src/pgwui_common/templates/auth_base.mak index c017d31..eb92dbc 100644 --- a/src/pgwui_common/templates/auth_base.mak +++ b/src/pgwui_common/templates/auth_base.mak @@ -97,7 +97,7 @@ <%def name="user_row(tab_index, havecreds, user)"> - <%self.lib:td_label>Username + <%self.lib:td_label for_id="user_id">Username % if havecreds: ${user} % else: @@ -117,7 +117,7 @@ <%def name="password_row(tab_index, havecreds)"> % if not havecreds: - <%self.lib:td_label>Password + <%self.lib:td_label for_id="password_id">Password <%self.lib:td_input tab_index="${tab_index}"> - <%self.lib:td_label>Database + <%self.lib:td_label for_id="db_id">Database <%self.lib:td_input tab_index="${tab_index}"> +<%def name="td_label(for_id=None)"> - + <% + for_attr = '' + if for_id is not None: + for_attr = f'for="{for_id}"' + %> +