Mercurial > kallithea
changeset 6408:4fdf7ccd42dc
templates: use valid ids for input fields in hook settings so labels can reference them correctly
h.text will generate safe ids based on the name ... but these ids are not
available in the template for referencing from <label for=...>.
Instead, generate safe ids for the input fields.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 06 Jan 2017 01:43:51 +0100 |
parents | 65b6797b102d |
children | c617f60486c2 |
files | kallithea/templates/admin/settings/settings_hooks.html |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/admin/settings/settings_hooks.html Fri Jan 06 01:43:51 2017 +0100 +++ b/kallithea/templates/admin/settings/settings_hooks.html Fri Jan 06 01:43:51 2017 +0100 @@ -2,10 +2,11 @@ <div class="form"> <div class="form-horizontal"> % for hook in c.hooks: + <% input_id = hook.ui_key.replace('.', '_') %> <div class="form-group"> - <label class="control-label" for="${hook.ui_key}">${hook.ui_key}</label> + <label class="control-label" for="${input_id}">${hook.ui_key}</label> <div style="margin-left:280px"> - ${h.text(hook.ui_key,hook.ui_value,size=60,readonly="readonly",class_='form-control')} + ${h.text(hook.ui_key,hook.ui_value,id=input_id,size=60,readonly="readonly",class_='form-control')} </div> </div> % endfor @@ -20,12 +21,13 @@ <div class="form-horizontal"> %for hook in c.custom_hooks: + <% input_id = hook.ui_key.replace('.', '_') %> <div class="form-group form-inline" id="${'id%s' % hook.ui_id }"> - <label class="control-label" for="${hook.ui_key}">${hook.ui_key}</label> + <label class="control-label" for="${input_id}">${hook.ui_key}</label> <div style="margin-left:280px"> - ${h.hidden('hook_ui_key',hook.ui_key)} - ${h.hidden('hook_ui_value',hook.ui_value)} - ${h.text('hook_ui_value_new',hook.ui_value,size=60,class_='form-control')} + ${h.hidden('hook_ui_key',hook.ui_key,id='hook_ui_key_'+input_id)} + ${h.hidden('hook_ui_value',hook.ui_value,id='hook_ui_value_'+input_id)} + ${h.text('hook_ui_value_new',hook.ui_value,id=input_id,size=60,class_='form-control')} <span class="btn btn-default btn-xs" onclick="delete_hook(${hook.ui_id},'${'id%s' % hook.ui_id }')"> <i class="icon-minus-circled" style="color:#FF4444"></i>