mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
add bootstrap-switch for is_highlight
This commit is contained in:
parent
2dd326c8b9
commit
a845dd5d7d
9 changed files with 45 additions and 12 deletions
3
Gemfile
3
Gemfile
|
|
@ -121,6 +121,9 @@ gem 'money-rails'
|
|||
# for lists
|
||||
gem 'acts_as_list'
|
||||
|
||||
# for switch checkboxes
|
||||
gem 'bootstrap-switch-rails', '~> 3.0.0'
|
||||
|
||||
# Use guard and spring for testing in development
|
||||
group :development do
|
||||
# rspec Guard rules
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ GEM
|
|||
bcrypt (3.1.7)
|
||||
bootstrap-sass (3.3.1.0)
|
||||
sass (~> 3.2)
|
||||
bootstrap-switch-rails (3.0.2)
|
||||
bootstrap3-datetimepicker-rails (3.0.3)
|
||||
momentjs-rails (>= 2.8.1)
|
||||
browser (0.6.0)
|
||||
|
|
@ -438,6 +439,7 @@ DEPENDENCIES
|
|||
awesome_nested_set (~> 3.0.0.rc.5)
|
||||
axlsx_rails
|
||||
bootstrap-sass
|
||||
bootstrap-switch-rails (~> 3.0.0)
|
||||
bootstrap3-datetimepicker-rails (~> 3.0.2)
|
||||
byebug
|
||||
cancancan
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
//= require osem-datepickers
|
||||
//= require osem-datatables
|
||||
//= require osem-tickets
|
||||
//= require bootstrap-switch
|
||||
|
||||
$(document).ready(function() {
|
||||
$('a[disabled=disabled]').click(function(event){
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@
|
|||
*= require bootstrap-markdown.min
|
||||
*= require bootstrap-datetimepicker
|
||||
*= require leaflet
|
||||
*= require bootstrap3-switch
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -106,9 +106,14 @@ module Admin
|
|||
|
||||
def update
|
||||
if @event.submitter.update_attributes(params[:user]) &&
|
||||
@event.update_attributes(params[:event])
|
||||
@event.update_attributes(params[:event])
|
||||
|
||||
if request.xhr?
|
||||
render js: 'index'
|
||||
else
|
||||
flash[:notice] = "Successfully updated event with ID #{@event.id}."
|
||||
redirect_back_or_to(admin_conference_event_path(@conference.short_title, @event))
|
||||
end
|
||||
else
|
||||
@url = admin_conference_event_path(@conference.short_title, @event)
|
||||
flash[:notice] = 'Update not successful. ' + @event.errors.full_messages.to_sentence
|
||||
|
|
|
|||
|
|
@ -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