From 35b3f98cd88f51410e4ec9fbbcff834f90f7d91d Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Mon, 2 Dec 2013 19:03:37 +0100 Subject: [PATCH] Configure button is enabled only if module is enabled. --- .../backOffice/default/includes/module-block.html | 5 +---- templates/backOffice/default/modules.html | 13 ++++++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/templates/backOffice/default/includes/module-block.html b/templates/backOffice/default/includes/module-block.html index 386b28e6f..a7191b7c6 100644 --- a/templates/backOffice/default/includes/module-block.html +++ b/templates/backOffice/default/includes/module-block.html @@ -38,12 +38,9 @@
- - - {if $CONFIGURABLE == 1} {loop type="auth" name="can_change" role="ADMIN" module=$CODE access="VIEW"} - {intl l="Configure"} + {intl l="Configure"} {/loop} {/if} diff --git a/templates/backOffice/default/modules.html b/templates/backOffice/default/modules.html index 12d918efc..c730fa4a4 100644 --- a/templates/backOffice/default/modules.html +++ b/templates/backOffice/default/modules.html @@ -84,13 +84,24 @@ $(document).ready(function() { var url_management = "{url path="/admin/module/toggle-activation/"}"; $(".module-activation").on("switch-change", function(e, data){ + + var module_id = $(this).data('id'); + var is_checked = data.value; + $('body').append(''); $.ajax({ url: url_management+$(this).data('id') }).done(function(){ $("#loading-event").remove(); }) - .fail(function(jqXHR, textStatus, errorThrown){ + .success(function() { + if (is_checked) + $('#config-btn-' + module_id).removeClass('disabled'); + else + $('#config-btn-' + module_id).addClass('disabled'); + + }) + .fail(function(jqXHR, textStatus, errorThrown){ $("#loading-event").remove(); $('#module-failed-body').html(jqXHR.responseJSON.error); $("#module-failed").modal("show");