Class: FullcalendarEngine::Event
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- FullcalendarEngine::Event
- Defined in:
- app/models/fullcalendar_engine/event.rb
Constant Summary collapse
- REPEATS =
{ :no_repeat => "Does not repeat", :days => "Daily", :weeks => "Weekly", :months => "Monthly", :years => "Yearly" }
Instance Attribute Summary collapse
-
#commit_button ⇒ Object
Returns the value of attribute commit_button.
-
#frequency ⇒ Object
Returns the value of attribute frequency.
-
#period ⇒ Object
Returns the value of attribute period.
Instance Method Summary collapse
Instance Attribute Details
#commit_button ⇒ Object
Returns the value of attribute commit_button.
4 5 6 |
# File 'app/models/fullcalendar_engine/event.rb', line 4 def @commit_button end |
#frequency ⇒ Object
Returns the value of attribute frequency.
4 5 6 |
# File 'app/models/fullcalendar_engine/event.rb', line 4 def frequency @frequency end |
#period ⇒ Object
Returns the value of attribute period.
4 5 6 |
# File 'app/models/fullcalendar_engine/event.rb', line 4 def period @period end |
Instance Method Details
#update_events(events, event) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/models/fullcalendar_engine/event.rb', line 25 def update_events(events, event) events.each do |e| begin old_start_time, old_end_time = e.starttime, e.endtime e.attributes = event if event_series.period.downcase == 'monthly' or event_series.period.downcase == 'yearly' new_start_time = make_date_time(e.starttime, old_start_time) new_end_time = make_date_time(e.starttime, old_end_time, e.endtime) else new_start_time = make_date_time(e.starttime, old_end_time) new_end_time = make_date_time(e.endtime, old_end_time) end rescue new_start_time = new_end_time = nil end if new_start_time and new_end_time e.starttime, e.endtime = new_start_time, new_end_time e.save end end event_series.attributes = event event_series.save end |
#validate_timings ⇒ Object
19 20 21 22 23 |
# File 'app/models/fullcalendar_engine/event.rb', line 19 def validate_timings if (starttime >= endtime) and !all_day errors[:base] << "Start Time must be less than End Time" end end |