diff -r 5595823c66f1 -r 94e76f8e9828 src/pyams_security/resources/js/security.js --- a/src/pyams_security/resources/js/security.js Sun Feb 22 14:52:32 2015 +0100 +++ b/src/pyams_security/resources/js/security.js Mon Feb 23 17:55:05 2015 +0100 @@ -27,17 +27,73 @@ }, /** - * Ordered plug-ins callback + * Plug-ins callback */ plugins: { /** + * Plug-in delete callback + */ + deletePlugin: function(link) { + return function() { + var link = $(this); + MyAMS.skin.bigBox({ + title: MyAMS.i18n.WARNING, + content: '  ' + MyAMS.i18n.DELETE_WARNING, + buttons: MyAMS.i18n.BTN_OK_CANCEL + }, function(button) { + if (button == MyAMS.i18n.BTN_OK) { + var location = link.parents('table').data('ams-location'); + var tr = link.parents('tr'); + var plugin_name = tr.data('ams-element-name'); + MyAMS.ajax.post(location + '/delete-plugin.json', {'plugin_name': plugin_name}, function(result, status) { + if (result.status == 'success') { + link.parents('tr').remove(); + } + }); + } + }); + } + }, + + /** * Change plug-ins names order */ changeOrder: function(table, names) { var input = $('input[name="' + $(this).data('ams-input-name') + '"]', $(this)); input.val(names.join(';')); } + }, + + /** + * Social providers callbacks + */ + social: { + + /** + * Social login provider delete callback + */ + deleteProvider: function(link) { + return function() { + var link = $(this); + MyAMS.skin.bigBox({ + title: MyAMS.i18n.WARNING, + content: '  ' + MyAMS.i18n.DELETE_WARNING, + buttons: MyAMS.i18n.BTN_OK_CANCEL + }, function(button) { + if (button == MyAMS.i18n.BTN_OK) { + var location = link.parents('table').data('ams-location'); + var tr = link.parents('tr'); + var provider_name = tr.data('ams-element-name'); + MyAMS.ajax.post(location + '/delete-provider.json', {'provider_name': provider_name}, function(result, status) { + if (result.status == 'success') { + link.parents('tr').remove(); + } + }); + } + }); + } + } } };