diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 2ec6c867..8111385d 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -35,6 +35,7 @@ //= require osem-datatables //= require osem-tickets //= require bootstrap-switch +//= require osem-switch $(document).ready(function() { $('a[disabled=disabled]').click(function(event){ diff --git a/app/assets/javascripts/osem-switch.js b/app/assets/javascripts/osem-switch.js new file mode 100644 index 00000000..314f9e3f --- /dev/null +++ b/app/assets/javascripts/osem-switch.js @@ -0,0 +1,16 @@ +$(function () { + $(document).ready(function() { + $("[class='switch-checkbox']").bootstrapSwitch(); + + $('input[class="switch-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) { + url = "/admin/conference/" + this.name + "/events/" + this.value + + $.ajax({ + url: url, + type: 'PATCH', + data: { event: { is_highlight: state } }, + dataType: 'script' + }); + }); + }); +}); diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index d912b1d8..6ec74ec4 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -33,7 +33,10 @@ %b Highlight %td = check_box_tag @conference.short_title, @event.id, @event.is_highlight, class: 'switch-checkbox', - data: { size: "small" } + data: { size: "small", + off_color: 'warning', + on_text: 'Yes', + off_text: 'No' } %tr %td diff --git a/app/views/admin/events/index.html.haml b/app/views/admin/events/index.html.haml index 7e8180b7..f0925497 100644 --- a/app/views/admin/events/index.html.haml +++ b/app/views/admin/events/index.html.haml @@ -74,7 +74,10 @@ Unknown speaker %td{'data-order' => "#{event.is_highlight}"} = check_box_tag @conference.short_title, event.id, event.is_highlight, class: 'switch-checkbox', - data: { size: "small" } + data: { size: "small", + off_color: 'warning', + on_text: 'Yes', + off_text: 'No' } %td .btn-group diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 6f9e2a1a..133eec2f 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -7,6 +7,7 @@ %meta{:content => "", :name => "author"} = stylesheet_link_tag "application", :media => "all" = javascript_include_tag "application" + = csrf_meta_tags :javascript window.liveSettings = { @@ -15,23 +16,6 @@ detectlang: true, autocollect: true }; - - $(document).ready(function() { - $("[class='switch-checkbox']").bootstrapSwitch(); - }); - - $(document).ready(function() { - $('input[class="switch-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) { - url = "/admin/conference/" + this.name + "/events/" + this.value - - $.ajax({ - url: url, - type: 'PATCH', - data: { event: { is_highlight: state } }, - dataType: "script" - }); - }); - }); = content_for(:script_head) =# javascript_include_tag "//cdn.transifex.com/live.js"