Module: BootstrapFormExtensions::Scheduler

Includes:
Helpers
Defined in:
lib/bootstrap_form_extensions/scheduler.rb

Defined Under Namespace

Classes: Serializer

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#merge_css_classes, #true?

Class Method Details

.serializer(to: :yaml, default_selection: true) ⇒ Object



7
8
9
# File 'lib/bootstrap_form_extensions/scheduler.rb', line 7

def self.serializer to: :yaml, default_selection: true
  BootstrapFormExtensions::Scheduler::Serializer.new to, default_selection
end

Instance Method Details

#scheduler(method, **options) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/bootstrap_form_extensions/scheduler.rb', line 11

def scheduler method, **options
  schedule = object.send method
  hidden   = hidden_field method, value: JSON.dump(schedule), class: 'scheduler-hidden-field'
  options[:wrapper] ||= {}
  options[:wrapper][:data] ||= {}
  options[:wrapper][:data][:scheduler] = true
  form_group_builder(method, options) { hidden + schedule_to_table(schedule) }
end