app/controllers/application_controller.rb
def generate_ical(talks)
    coder = HTMLEntities.new
    cal = RiCal.Calendar do |cal|
      talks.each do |t|
        cal.event do |event|
          event.summary = "#{t.speaker} - #{t.title}"
          event.dtstart = t.start_time.in_time_zone("US/Eastern")
          event.dtend = t.end_time.in_time_zone("US/Eastern")
          if t.room && t.building
            event.location = "#{t.room} #{t.building.abbrv}"
          elsif t.room
            event.location = t.room
          end
	        event.url = talk_url(t)
          # notes = ""
          # unless t.abstract.empty?
	        #    notes = coder.decode(ActionController::Base.helpers.strip_tags(t.abstract))
          # else
	        #    notes = "(No abstract yet)"
	        # end
	        # unless t.bio.empty?
	        #    notes << "Bio: " << coder.decode(ActionController::Base.helpers.strip_tags(t.bio))
	        # end
	        # event.description = notes
        end
      end
    end
  end
# turn a list of talks into a calendar
turn a list of talks into a calendar
turn a list of talks into a calendar
def generate_ical(talks)
    coder = HTMLEntities.new
    cal = RiCal.Calendar do |cal|
      talks.each do |t|
        cal.event do |event|
          event.summary = "#{t.speaker} - #{t.title}"
          event.dtstart = t.start_time.in_time_zone("US/Eastern")
          event.dtend = t.end_time.in_time_zone("US/Eastern")
          if t.room && t.building
            event.location = "#{t.room} #{t.building.abbrv}"
          elsif t.room
            event.location = t.room
          end
	        event.url = talk_url(t)
        end
      end
    end
  end
def generate_ical ( talks ) coder = HTMLEntities . new cal = RiCal . Calendar do | cal | talks . each do | t | cal . event do | event | event . summary = "#{t.speaker} - #{t.title}" event . dtstart = t . start_time . in_time_zone ( "US/Eastern" ) event . dtend = t . end_time . in_time_zone ( "US/Eastern" ) if t . room && t . building event . location = "#{t.room} #{t.building.abbrv}" elsif t . room event . location = t . room end event . url = talk_url ( t ) end end end end
turn a list of talks into a calendar
turn a list of talks into a calendar
# notes = "" # unless t.abstract.empty? #    notes = coder.decode(ActionController::Base.helpers.strip_tags(t.abstract)) # else #    notes = "(No abstract yet)" # end # unless t.bio.empty? #    notes << "Bio: " << coder.decode(ActionController::Base.helpers.strip_tags(t.bio)) # end # event.description = notes
talks