add bootstrap-switch for is_highlight
This commit is contained in:
parent
2dd326c8b9
commit
a845dd5d7d
9 changed files with 45 additions and 12 deletions
|
|
@ -32,15 +32,9 @@
|
|||
%td
|
||||
%b Highlight
|
||||
%td
|
||||
= link_to "#{@event.is_highlight}".capitalize,
|
||||
admin_conference_event_path(@conference.short_title,
|
||||
@event,
|
||||
event: { is_highlight: !@event.is_highlight }),
|
||||
method: :patch
|
||||
- if @event.is_highlight
|
||||
(the event is as a highlight and will appear in the splashpage)
|
||||
- else
|
||||
(mark as true to make the event a highlight that appears in the splashpage)
|
||||
= check_box_tag @conference.short_title, @event.id, @event.is_highlight, class: 'switch-checkbox',
|
||||
data: { size: "small" }
|
||||
|
||||
%tr
|
||||
%td
|
||||
%b State
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
%b Submitter
|
||||
%th
|
||||
%b Speaker
|
||||
%th
|
||||
%b Highlight
|
||||
%th
|
||||
%b Type
|
||||
%th
|
||||
|
|
@ -70,6 +72,10 @@
|
|||
= link_to speaker.name, admin_user_path(speaker)
|
||||
- else
|
||||
Unknown speaker
|
||||
%td
|
||||
= check_box_tag @conference.short_title, event.id, event.is_highlight, class: 'switch-checkbox',
|
||||
data: { size: "small" }
|
||||
|
||||
%td
|
||||
.btn-group
|
||||
%button{:type=>"button", :class=>"btn btn-link dropdown-toggle", "data-toggle"=>"dropdown"}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,23 @@
|
|||
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"
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,12 @@
|
|||
include_blank: false, label: 'Session Type'
|
||||
- else
|
||||
Event type: #{@event.event_type.title}
|
||||
%br
|
||||
%br
|
||||
|
||||
%br
|
||||
= f.label :is_highlight
|
||||
= f.check_box :is_highlight, class: 'switch-checkbox', data: { size: "small" }
|
||||
|
||||
%br
|
||||
= f.input :difficulty_level, :as => :select, :collection => @conference.difficulty_levels, :include_blank => "(Please select)" if @conference.difficulty_levels.any?
|
||||
= f.input :require_registration
|
||||
= f.input :abstract, :input_html => {:rows => 5, :class => "span11"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue