fixes checkboxes for settingsv2 (deja vu)

v1.18.x
psychobunny 10 years ago
parent a3c41e7fdb
commit fdc66eb607

@ -14,7 +14,7 @@
activateMobile();
}
$(window).on('action:ajaxify.end', function(ev, data) {
$(window).on('action:ajaxify.contentLoaded', function(ev, data) {
var url = data.url;
selectMenuItem(data.url);
@ -23,6 +23,8 @@
setupCheckboxes();
});
$(window).on('action:admin.settingsLoaded', setupCheckboxes);
$('[component="logout"]').on('click', app.logout);
$(window).resize(setupHeaderMenu);
@ -175,31 +177,32 @@
return $('[type=checkbox]').show();
}
$('[type=checkbox]').change(function() {
var checked = $(this).is(':checked');
$(this).siblings('[class*=fa-]').toggleClass('fa-toggle-off', !checked)
.toggleClass('fa-toggle-on', checked);
});
$('[type=checkbox]').each(function() {
var checkbox = $(this),
checked = checkbox.is(':checked');
if (checkbox.attr('data-toggle-added')) {
return;
}
checkbox.hide();
if (checked) {
checkbox.after('<i class="fa fa-toggle-on"></i>');
}
else {
checkbox.after('<i class="fa fa-toggle-off"></i>');
}
});
$('[type=checkbox]').change(function() {
var checked = $(this).is(':checked');
$(this).siblings('[class*=fa-]').toggleClass('fa-toggle-off', !checked)
.toggleClass('fa-toggle-on', checked);
checkbox.attr('data-toggle-added', true);
});
$.propHooks.checked = {
set: function(elem, value, name) {
$(elem).trigger("change");
}
};
}
}());

@ -104,6 +104,8 @@ define('admin/settings', ['uploader', 'sounds'], function(uploader, sounds) {
if (typeof callback === 'function') {
callback();
}
$(window).trigger('action:admin.settingsLoaded');
};
function handleUploads() {

@ -471,6 +471,7 @@ define('settings', function () {
}
$(formEl).deserialize(values);
$(window).trigger('action:admin.settingsLoaded');
callback(null, values);
});

Loading…
Cancel
Save