Skip to content

Commit

Permalink
ZMS.permalinks: added js-function remove_row()
Browse files Browse the repository at this point in the history
  • Loading branch information
drfho committed Sep 28, 2024
1 parent 6c0ee25 commit 7d6ef1d
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<tr class="form-group"
tal:define="id python:key[len(prefix):]">
<td class="meta-sort">
<span class="btn btn-add mr-1 btn-secondary w-100"
tal:attributes="onclick python:'if (confirm(getZMILangStr(\'MSG_CONFIRM_DELOBJ\'))){$(this).parents(\'tr\').remove()}'; title python:here.getZMILangStr('BTN_DELETE')">
<span class="btn btn-add mr-1 btn-secondary w-100" onclick="javascript:remove_row(this)"
tal:attributes="title python:here.getZMILangStr('BTN_DELETE')">
<i class="fas fa-times"></i>
</span>
</td>
Expand Down Expand Up @@ -48,8 +48,20 @@
*/
var table_id = 'permalinks';

function remove_row(context) {
// Remove row
$(context).closest('tr').hide('slow',function(){$(this).closest('tr').remove()});
// Enable refreshing all input fields by onChangeObjEvt.py
$('tr.row_insert input').attr('disabled',false);
// Set form as modified
const $body = $('body.zmi');
const $btn_save = $('.controls.save button[value="BTN_SAVE"]',$(context).closest('form'));
$body.addClass('form-modified');
$btn_save.removeClass('btn-secondary').addClass('btn-primary');
}

/**
* Init: Execute on DOM-Ready
* Init (DOM-Ready)
*/
$(function(){
// New field set: initially disable inputs
Expand Down

0 comments on commit 7d6ef1d

Please sign in to comment.