Parent

Included Modules

Event

Constants

REPEATS

Attributes

commit_button[RW]
frequency[RW]
period[RW]

Public Class Methods

new_from_icalendar_event(ievent) click to toggle source
# File app/models/event.rb, line 33
def self.new_from_icalendar_event(ievent)
  event = self.new
  event.starttime = ievent.dtstart
  event.endtime = ievent.dtend
  event.uid = ievent.uid
  event.created_at = ievent.created
  event.updated_at = ievent.last_modified
  event.description = ievent.description
  event.title = ievent.summary
  event.location = ievent.location    
  # ("<tt>"+ievent.inspect + "<p>" + event.inspect).gsub(/#</,'#&lt;')
  event
end

Public Instance Methods

background_color() click to toggle source
# File app/models/event.rb, line 47
def background_color
  'yellow'
end
border_color() click to toggle source
# File app/models/event.rb, line 55
def border_color
  'gray'
end
text_color() click to toggle source
# File app/models/event.rb, line 51
def text_color
  'black'
end
update_events(events, event) click to toggle source
# File app/models/event.rb, line 65
def update_events(events, event)
  events.each do |e|
    begin 
      st, et = e.starttime, e.endtime
      e.attributes = event
      if event_series.period.downcase == 'monthly' or event_series.period.downcase == 'yearly'
        nst = DateTime.parse("#{e.starttime.hour}:#{e.starttime.min}:#{e.starttime.sec}, #{e.starttime.day}-#{st.month}-#{st.year}")  
        net = DateTime.parse("#{e.endtime.hour}:#{e.endtime.min}:#{e.endtime.sec}, #{e.endtime.day}-#{et.month}-#{et.year}")
      else
        nst = DateTime.parse("#{e.starttime.hour}:#{e.starttime.min}:#{e.starttime.sec}, #{st.day}-#{st.month}-#{st.year}")  
        net = DateTime.parse("#{e.endtime.hour}:#{e.endtime.min}:#{e.endtime.sec}, #{et.day}-#{et.month}-#{et.year}")
      end
      #puts "#{nst}           :::::::::          #{net}"
    rescue
      nst = net = nil
    end
    if nst and net
      #          e.attributes = event
      e.starttime, e.endtime = nst, net
      e.save
    end
  end
  
  event_series.attributes = event
  event_series.save
end
validate() click to toggle source
# File app/models/event.rb, line 59
def validate
  if (starttime >= endtime) and !all_day
    errors.add_to_base("Start Time must be less than End Time")
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.