diff -r b2b043bf066a -r a3d2ef66e7ea src/pyams_skin/resources/js/myams.js --- a/src/pyams_skin/resources/js/myams.js Tue Apr 03 15:47:05 2018 +0200 +++ b/src/pyams_skin/resources/js/myams.js Thu Apr 05 22:35:31 2018 +0200 @@ -2,7 +2,7 @@ * MyAMS * « My Application Management Skin » * - * $Tag$ (rev. 1) + * $Tag: 0.1.14 $ (rev. 1) * A bootstrap based application/administration skin * * Custom administration and application skin tools @@ -4826,10 +4826,9 @@ /** * Delete an element from a container table * - * @param element * @returns {Function} */ - deleteElement: function(element) { + deleteElement: function() { return function() { var link = $(this); MyAMS.skin.bigBox({ @@ -4861,6 +4860,27 @@ } }); }; + }, + + /** + * Switch element visibility + */ + switchElementVisibility: function() { + return function() { + var source = $(this); + var element = source.parents('tr').first(); + var container = element.parents('table'); + ams.ajax.post(container.data('ams-location') + '/' + + container.data('ams-visibility-target'), + {object_name: element.data('ams-element-name')}, + function(result, status) { + if (result.visible) { + $('i', source).attr('class', 'fa fa-fw fa-eye'); + } else { + $('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger'); + } + }); + } } }; @@ -5197,6 +5217,21 @@ MyAMS.initContent(widget); return widget; }, + + /** + * Replace given table with new content + * If table is located inside a switched fieldset, fieldset is opened + * + * @param changes + */ + refreshSwitchedTable: function(changes) { + var widget = ams.skin.refreshTable(changes); + var legend = widget.siblings('legend'); + if (legend.parents('fieldset:first').hasClass('switched')) { + legend.click(); + } + }, + /** * Replace given row with new content */