Merge pull request #679 from differentreality/switch

Rework bootstrapSwitch
This commit is contained in:
Stella Rouzi 2015-07-02 13:08:16 +03:00
commit 8567a997cb
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'
});
});
});