--- a/src/pyams_skin/resources/js/myams.js Tue Jul 17 15:50:46 2018 +0200
+++ b/src/pyams_skin/resources/js/myams.js Thu Jul 19 02:07:58 2018 +0200
@@ -2,7 +2,7 @@
* MyAMS
* « My Application Management Skin »
*
- * $Tag$ (rev. 1)
+ * $Tag: 0.1.17 $ (rev. 1)
* A bootstrap based application/administration skin
*
* Custom administration and application skin tools
@@ -4992,6 +4992,29 @@
}
});
}
+ },
+
+ /**
+ * Switch element attribute
+ */
+ switchElementAttribute: function() {
+ return function() {
+ var source = $(this);
+ var cell = source.parents('td').first();
+ var attribute = cell.data('ams-switcher-attribute-name');
+ var row = source.parents('tr').first();
+ var table = row.parents('table');
+ ams.ajax.post(table.data('ams-location') + '/' +
+ (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
+ {object_name: row.data('ams-element-name')},
+ function(result, status) {
+ if (result.on) {
+ $('i', source).attr('class', table.data('ams-' + attribute + '-icon-on') || 'fa fa-fw fa-eye');
+ } else {
+ $('i', source).attr('class', table.data('ams-' + attribute + '-icon-off') || 'fa fa-fw fa-eye-slash text-danger');
+ }
+ });
+ }
}
};