diff --git a/common/js/plugins/filebox/filebox.js b/common/js/plugins/filebox/filebox.js index cb719fba9..a8999253e 100644 --- a/common/js/plugins/filebox/filebox.js +++ b/common/js/plugins/filebox/filebox.js @@ -85,7 +85,7 @@ function addRow(ulId){ var $ = jQuery; var count = $('#'+ulId).children().length; var clone = $('#'+ulId).find('li:last-child').prev().clone(); - $('#'+ulId).find('li:last-child').prev().find('.__addBtn').remove(); + $('#'+ulId).find('li:last-child').prev().find('.__addBtn').hide(); clone.find('input[name^="attribute_name"]').attr("name", "attribute_name"+count).attr('value', '') .attr("id", "attribute_name"+count) @@ -93,15 +93,19 @@ function addRow(ulId){ clone.find('input[name^="attribute_value"]').attr("name", "attribute_value"+count).attr('value', '') .attr("id", "attribute_value"+count) .prev('label').attr('for', 'attribute_value'+count); - clone.find('.__deleteBtn').attr("href", "javascript:clearRow('fileUp', "+count+")"); $('#'+ulId).find('li:last-child').before(clone); } -function clearRow(ulId,rowNumber){ +function clearRow(target){ var $ = jQuery; - var count = $('#'+ulId).children().length - 1; - if (count <= 1) return; + var ulTag = $(target).closest('ul'); + var count = ulTag.children().length - 1; + if (count <= 1){ + ulTag.find('li:last-child').prev().find('.__addBtn').show(); + return; + } - $('#'+ulId).find('input[name="attribute_name'+rowNumber+'"]').parent().remove(); + $(target).closest('li').remove(); + ulTag.find('li:last-child').prev().find('.__addBtn').show(); } diff --git a/modules/module/tpl/adminFileBox.html b/modules/module/tpl/adminFileBox.html index 3d9028b0f..4b0730666 100644 --- a/modules/module/tpl/adminFileBox.html +++ b/modules/module/tpl/adminFileBox.html @@ -13,8 +13,8 @@