mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Add helper for event switch checkboxes
This commit is contained in:
parent
ad19a6d753
commit
0848df6948
3 changed files with 25 additions and 27 deletions
|
|
@ -156,6 +156,27 @@ module EventsHelper
|
|||
active_dropdown(selection, options)
|
||||
end
|
||||
|
||||
def event_switch_checkbox(event, attribute, conference_id)
|
||||
check_box_tag(
|
||||
conference_id,
|
||||
event.id,
|
||||
event.send(attribute),
|
||||
url: admin_conference_program_event_path(
|
||||
conference_id,
|
||||
event,
|
||||
event: { attribute => nil }
|
||||
),
|
||||
method: :patch,
|
||||
class: 'switch-checkbox',
|
||||
data: {
|
||||
size: 'small',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No'
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def active_dropdown(selection, options)
|
||||
|
|
|
|||
|
|
@ -21,13 +21,7 @@
|
|||
%td
|
||||
%b Highlight
|
||||
%td
|
||||
= check_box_tag @conference.short_title, @event.id, @event.is_highlight,
|
||||
method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}?event[is_highlight]=",
|
||||
class: 'switch-checkbox', data: { size: 'small',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
|
||||
= event_switch_checkbox(@event, :is_highlight, @conference.short_title)
|
||||
%tr
|
||||
%td
|
||||
%b State
|
||||
|
|
@ -47,12 +41,7 @@
|
|||
%td
|
||||
%b Requires Registration
|
||||
%td
|
||||
= check_box_tag @conference.short_title, @event.id, @event.require_registration,
|
||||
method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}?event[require_registration]=",
|
||||
class: 'switch-checkbox', data: { size: 'small',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
= event_switch_checkbox(@event, :require_registration, @conference.short_title)
|
||||
- if @event.require_registration
|
||||
= registered_text(@event)
|
||||
|
||||
|
|
|
|||
|
|
@ -133,24 +133,12 @@
|
|||
= event.language
|
||||
|
||||
%td.text-center{ 'data-order' => "#{event.require_registration}" }
|
||||
= check_box_tag @conference.short_title, event.id, event.require_registration,
|
||||
method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=",
|
||||
class: 'switch-checkbox', data: { size: 'small',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
= event_switch_checkbox(event, :require_registration, @conference.short_title)
|
||||
- if event.require_registration
|
||||
%br
|
||||
= link_to registered_text(event), registrations_admin_conference_program_event_path(@conference.short_title, event), class: 'btn btn-xs btn-default'
|
||||
|
||||
%td.text-center{ 'data-order' => "#{event.is_highlight}" }
|
||||
= check_box_tag @conference.short_title, event.id, event.is_highlight,
|
||||
method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=",
|
||||
class: 'switch-checkbox', data: { size: 'small',
|
||||
off_color: 'warning',
|
||||
on_text: 'Yes',
|
||||
off_text: 'No' }
|
||||
|
||||
= event_switch_checkbox(event, :is_highlight, @conference.short_title)
|
||||
%td
|
||||
= event_type_dropdown(event, @event_types, @conference.short_title)
|
||||
%td
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue