Class: TimeTable::TimetableCalendarHelper::Timetable
- Inherits:
-
Object
- Object
- TimeTable::TimetableCalendarHelper::Timetable
- Defined in:
- app/helpers/time_table/timetable_calendar_helper.rb
Instance Attribute Summary collapse
-
#clip ⇒ Object
Returns the value of attribute clip.
-
#dates ⇒ Object
Returns the value of attribute dates.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#events ⇒ Object
Returns the value of attribute events.
-
#frozen ⇒ Object
Returns the value of attribute frozen.
-
#scale ⇒ Object
Returns the value of attribute scale.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#template_event ⇒ Object
Returns the value of attribute template_event.
-
#view ⇒ Object
Returns the value of attribute view.
Instance Method Summary collapse
-
#initialize(start_date:, end_date:, view:, start_time: nil, end_time: nil, scale: 60, clip: 15, frozen: false) ⇒ Timetable
constructor
A new instance of Timetable.
- #register_events_for_column(day, events) ⇒ Object
- #register_events_template(model) ⇒ Object
- #render_timetable_with_events(&block) ⇒ Object
Constructor Details
#initialize(start_date:, end_date:, view:, start_time: nil, end_time: nil, scale: 60, clip: 15, frozen: false) ⇒ Timetable
Returns a new instance of Timetable.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 16 def initialize(start_date:, end_date:, view:, start_time: nil, end_time: nil, scale: 60, clip: 15, frozen: false) @start_date = start_date @end_date = end_date @dates = start_date..end_date @scale = scale @clip = clip @frozen = frozen @view = view @events = {} @start_time = start_time || start_date.beginning_of_day @end_time = end_time || start_date.end_of_day end |
Instance Attribute Details
#clip ⇒ Object
Returns the value of attribute clip.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def clip @clip end |
#dates ⇒ Object
Returns the value of attribute dates.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def dates @dates end |
#end_date ⇒ Object
Returns the value of attribute end_date.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def end_date @end_date end |
#end_time ⇒ Object
Returns the value of attribute end_time.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def end_time @end_time end |
#events ⇒ Object
Returns the value of attribute events.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def events @events end |
#frozen ⇒ Object
Returns the value of attribute frozen.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def frozen @frozen end |
#scale ⇒ Object
Returns the value of attribute scale.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def scale @scale end |
#start_date ⇒ Object
Returns the value of attribute start_date.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def start_date @start_date end |
#start_time ⇒ Object
Returns the value of attribute start_time.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def start_time @start_time end |
#template_event ⇒ Object
Returns the value of attribute template_event.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def template_event @template_event end |
#view ⇒ Object
Returns the value of attribute view.
14 15 16 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14 def view @view end |
Instance Method Details
#register_events_for_column(day, events) ⇒ Object
33 34 35 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 33 def register_events_for_column(day, events) @events[day] = events end |
#register_events_template(model) ⇒ Object
29 30 31 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 29 def register_events_template(model) @template_event = model end |
#render_timetable_with_events(&block) ⇒ Object
37 38 39 |
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 37 def (&block) @view.render(layout: "time_table/timetable", locals: { timetable: self }, &block) end |