Rework bootstrapSwitch

This commit is contained in:
Stella Rouzi 2015-06-14 22:28:33 +03:00
parent a35f98b1a3
commit 53f0606ac1
4 changed files with 89 additions and 32 deletions

View file

@ -1,16 +1,14 @@
$(function () {
$(document).ready(function() {
$("[class='switch-checkbox']").bootstrapSwitch();
$("[class='switch-checkbox']").bootstrapSwitch();
$('input[class="switch-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) {
url = "/admin/conference/" + this.name + "/events/" + this.value
$('input[class="switch-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) {
var url = $(this).attr('url') + state;
var method = $(this).attr('method');
$.ajax({
url: url,
type: 'PATCH',
data: { event: { is_highlight: state } },
dataType: 'script'
});
$.ajax({
url: url,
type: method,
dataType: 'script'
});
});
});