Class: Comfy::Admin::Cms::SitesController
- Inherits:
-
BaseController
- Object
- BaseController
- Comfy::Admin::Cms::SitesController
- Defined in:
- app/controllers/comfy/admin/cms/sites_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/controllers/comfy/admin/cms/sites_controller.rb', line 23 def create @site.save! flash[:success] = I18n.t('comfy.admin.cms.sites.created') redirect_to comfy_admin_cms_site_layouts_path(@site) rescue ActiveRecord::RecordInvalid flash.now[:danger] = I18n.t('comfy.admin.cms.sites.creation_failure') render :action => :new end |
#destroy ⇒ Object
41 42 43 44 45 |
# File 'app/controllers/comfy/admin/cms/sites_controller.rb', line 41 def destroy @site.destroy flash[:success] = I18n.t('comfy.admin.cms.sites.deleted') redirect_to :action => :index end |
#edit ⇒ Object
19 20 21 |
# File 'app/controllers/comfy/admin/cms/sites_controller.rb', line 19 def edit render end |
#index ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/comfy/admin/cms/sites_controller.rb', line 9 def index return redirect_to :action => :new if ::Comfy::Cms::Site.count == 0 @site = ::Comfy::Cms::Site.find_by_id(session[:site_id]) @sites ||= ::Comfy::Cms::Site.all end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/comfy/admin/cms/sites_controller.rb', line 15 def new render end |
#update ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'app/controllers/comfy/admin/cms/sites_controller.rb', line 32 def update @site.update_attributes!(site_params) flash[:success] = I18n.t('comfy.admin.cms.sites.updated') redirect_to :action => :edit, :id => @site rescue ActiveRecord::RecordInvalid flash.now[:danger] = I18n.t('comfy.admin.cms.sites.update_failure') render :action => :edit end |