Mercurial > kallithea
changeset 7280:dd9cb0a5aba3
admin: hooks: restore delete functionality as intended
Commit 9d34bea3059d9abd0d912f37a2475ee67c8e2918 ("style: various minor-ish
markup changes, preparing for Bootstrap") partially broke the delete
functionality of hooks. When clicking the delete button, the hook is deleted
via AJAX and then the corresponding form group is intended to be removed
visually. This relies on an 'id' attribute on the form-group div.
The mentioned commit moved the div with the 'id' attribute outside the loop
iterating over the different hooks, so that there no longer is a div with
the id expected by the delete button. The hook would still be deleted, but
the page visually still looks the same until refresh/Save.
Move the diff back into the loop. This causes a little more visual
separation between the different hooks, but still looks OK.
The layout of the built-in hooks (that can't be removed) is left untouched.
Making the same change there would be possible but there the extra vertical
whitespace seems somewhat unnecessary, although this is personal.
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sun, 20 May 2018 22:07:36 +0200 |
parents | 61f8ce5fff25 |
children | cefc3010baaf |
files | kallithea/templates/admin/settings/settings_hooks.html |
diffstat | 1 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/admin/settings/settings_hooks.html Sun May 20 21:50:11 2018 +0200 +++ b/kallithea/templates/admin/settings/settings_hooks.html Sun May 20 22:07:36 2018 +0200 @@ -15,23 +15,23 @@ % if c.visual.allow_custom_hooks_settings: ${h.form(url('admin_settings_hooks'), method='post')} <div class="form"> - <div class="form-group form-inline" id="${'id%s' % hook.ui_id }"> <h4>${_('Custom Hooks')}</h4> %for hook in c.custom_hooks: - <% input_id = hook.ui_key.replace('.', '_') %> - <label class="control-label" for="${input_id}">${hook.ui_key}</label> - <div> - ${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')} - <button type="button" class="btn btn-default btn-xs" - onclick="delete_hook(${hook.ui_id},'${'id%s' % hook.ui_id }')"> - <i class="icon-trashcan"></i> - ${_('Delete')} - </button> - </div> + <div class="form-group form-inline" id="${'id%s' % hook.ui_id }"> + <% input_id = hook.ui_key.replace('.', '_') %> + <label class="control-label" for="${input_id}">${hook.ui_key}</label> + <div> + ${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')} + <button type="button" class="btn btn-default btn-xs" + onclick="delete_hook(${hook.ui_id},'${'id%s' % hook.ui_id }')"> + <i class="icon-trashcan"></i> + ${_('Delete')} + </button> + </div> + </div> %endfor - </div> <div class="form-group form-inline"> <label>