Class: TimeTable::TimetableCalendarHelper::Timetable

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/time_table/timetable_calendar_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clipObject

Returns the value of attribute clip.



14
15
16
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14

def clip
  @clip
end

#datesObject

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_dateObject

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_timeObject

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

#eventsObject

Returns the value of attribute events.



14
15
16
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14

def events
  @events
end

#frozenObject

Returns the value of attribute frozen.



14
15
16
# File 'app/helpers/time_table/timetable_calendar_helper.rb', line 14

def frozen
  @frozen
end

#scaleObject

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_dateObject

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_timeObject

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_eventObject

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

#viewObject

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 render_timetable_with_events(&block)
  @view.render(layout: "time_table/timetable", locals: { timetable: self }, &block)
end