--- a/src/pyams_skin/resources/js/myams-container.js Fri Jul 26 12:36:57 2019 +0200
+++ b/src/pyams_skin/resources/js/myams-container.js Fri Jul 26 12:38:49 2019 +0200
@@ -51,10 +51,10 @@
tr.remove();
}
if (result.handle_json) {
- ams.ajax && ams.ajax.handleJSON(result);
+ ams.ajax.handleJSON(result);
}
} else {
- ams.ajax && ams.ajax.handleJSON(result);
+ ams.ajax.handleJSON(result);
}
});
}
@@ -76,10 +76,14 @@
(cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
{object_name: row.data('ams-element-name')},
function(result, status) {
- if (result.visible) {
- $('i', source).attr('class', 'fa fa-fw fa-eye');
+ if (result.status === 'success') {
+ 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');
+ }
} else {
- $('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
+ ams.ajax.handleJSON(result);
}
});
}
@@ -100,10 +104,14 @@
(cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
{object_name: row.data('ams-element-name')},
function(result, status) {
- if (result[attribute] || result['on']) {
- $('i', source).attr('class', table.data('ams-' + attribute + '-icon-on') || 'fa fa-fw fa-check-square-o');
+ if (result.status === 'success') {
+ if (result[attribute] || result['on']) {
+ $('i', source).attr('class', table.data('ams-' + attribute + '-icon-on') || 'fa fa-fw fa-check-square-o');
+ } else {
+ $('i', source).attr('class', table.data('ams-' + attribute + '-icon-off') || 'fa fa-fw fa-check-square txt-color-silver opacity-75');
+ }
} else {
- $('i', source).attr('class', table.data('ams-' + attribute + '-icon-off') || 'fa fa-fw fa-check-square txt-color-silver opacity-75');
+ ams.ajax.handleJSON(result);
}
});
}