Configure button is enabled only if module is enabled.
This commit is contained in:
@@ -38,12 +38,9 @@
|
||||
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
|
||||
|
||||
|
||||
{if $CONFIGURABLE == 1}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module=$CODE access="VIEW"}
|
||||
<a class="btn btn-primary btn-xs" title="{intl l='Configure this module'}" href="{url path="/admin/module/$CODE"}">{intl l="Configure"}</a>
|
||||
<a class="{if ! $ACTIVE}disabled {/if} btn btn-primary btn-xs" id="config-btn-{$ID}" title="{intl l='Configure this module'}" href="{url path="/admin/module/$CODE"}">{intl l="Configure"}</a>
|
||||
{/loop}
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -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('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
|
||||
$.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");
|
||||
|
||||
Reference in New Issue
Block a user