Class: SitesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SitesController
- Defined in:
- app/controllers/sites_controller.rb
Overview
TODO: Cleanup sites_controller now that we only support visitors for a single site !!
Instance Method Summary collapse
- #action ⇒ Object
- #clear_cache ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #jobs ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from Zena::App
Instance Method Details
#action ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'app/controllers/sites_controller.rb', line 63 def action if Site::ACTIONS.include?(params[:do]) @site.send(params[:do]) flash.now[:notice] = _("#{params[:do]} done.") else flash.now[:error] = _("Invalid action '%{action}'.") % {:action => params[:do]} end end |
#clear_cache ⇒ Object
56 57 58 59 60 61 |
# File 'app/controllers/sites_controller.rb', line 56 def clear_cache secure!(Site) { Site.all }.each do |site| site.clear_cache end redirect_to '/' end |
#edit ⇒ Object
34 35 36 37 38 39 |
# File 'app/controllers/sites_controller.rb', line 34 def edit respond_to do |format| format.html format.js { render :partial => 'sites/form', :layout => false } end end |
#index ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/sites_controller.rb', line 9 def index secure!(Site) do @sites = Site.paginate(:all, :order => 'host', :per_page => 20, :page => params[:page]) end respond_to do |format| format.html # index.erb format.xml { render :xml => @sites } end end |
#jobs ⇒ Object
27 28 29 30 31 32 |
# File 'app/controllers/sites_controller.rb', line 27 def jobs @jobs = @site.respond_to?(:jobs) ? @site.jobs : [] respond_to do |format| format.html end end |
#show ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/controllers/sites_controller.rb', line 19 def show respond_to do |format| format.html format.xml { render :xml => @site } format.js end end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/sites_controller.rb', line 41 def update respond_to do |format| if @site.update_attributes(params[:site]) flash.now[:notice] = _('Site was successfully updated.') format.html { redirect_to site_path(@site) } format.js format.xml { head :ok } else format.html { render :action => "edit" } format.js format.xml { render :xml => @site.errors } end end end |