Class: Admin::IcalsController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/admin/icals_controller.rb

Instance Method Summary collapse

Instance Method Details

#refreshObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/admin/icals_controller.rb', line 16

def refresh
  ical = Ical.find(params[:id])
  if response = ical.refresh
    flash[:notice] = ical.calendar.name + " calendar refreshed. #{response}"
  else
    flash[:notice] = "Error parsing " + ical.calendar.name + " calendar from iCal subscription."
  end
  redirect_to :back
end

#refresh_allObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/admin/icals_controller.rb', line 3

def refresh_all
  # This is the correct line for the agent to run.  
  # Calendar::refresh_all
  
  # We'll keep using this so we can keep an eye on the downlaod status until an agent and proper error checking is implemented.
  @icals = Ical.find(:all)
  @icals.each do |ical|
    ical.refresh
  end
  flash[:notice] = "iCal subscription refresh complete."
  redirect_to admin_calendars_path
end