Configure button is enabled only if module is enabled.
This commit is contained in:
@@ -38,12 +38,9 @@
|
|||||||
|
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{if $CONFIGURABLE == 1}
|
{if $CONFIGURABLE == 1}
|
||||||
{loop type="auth" name="can_change" role="ADMIN" module=$CODE access="VIEW"}
|
{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}
|
{/loop}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@@ -84,13 +84,24 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var url_management = "{url path="/admin/module/toggle-activation/"}";
|
var url_management = "{url path="/admin/module/toggle-activation/"}";
|
||||||
$(".module-activation").on("switch-change", function(e, data){
|
$(".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>');
|
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url_management+$(this).data('id')
|
url: url_management+$(this).data('id')
|
||||||
}).done(function(){
|
}).done(function(){
|
||||||
$("#loading-event").remove();
|
$("#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();
|
$("#loading-event").remove();
|
||||||
$('#module-failed-body').html(jqXHR.responseJSON.error);
|
$('#module-failed-body').html(jqXHR.responseJSON.error);
|
||||||
$("#module-failed").modal("show");
|
$("#module-failed").modal("show");
|
||||||
|
|||||||
Reference in New Issue
Block a user