Class: CmsAdmin::SitesController
- Inherits:
-
BaseController
- Object
- BaseController
- CmsAdmin::SitesController
- Defined in:
- app/controllers/cms_admin/sites_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 24 def create @site.save! upload_logo flash[:success] = I18n.t('cms.sites.created') redirect_to cms_admin_site_layouts_path(@site) rescue ActiveRecord::RecordInvalid logger.detailed_error($!) flash.now[:error] = I18n.t('cms.sites.creation_failure') render :action => :new end |
#destroy ⇒ Object
46 47 48 49 50 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 46 def destroy @site.destroy flash[:success] = I18n.t('cms.sites.deleted') redirect_to :action => :index end |
#edit ⇒ Object
20 21 22 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 20 def edit render end |
#index ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 10 def index return redirect_to :action => :new if Cms::Site.count == 0 @site = Cms::Site.find_by_id(session[:site_id]) @sites ||= Cms::Site.all end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 16 def new render end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/cms_admin/sites_controller.rb', line 35 def update upload_logo @site.update_attributes!(params[:site]) flash[:success] = I18n.t('cms.sites.updated') redirect_to :action => :edit, :id => @site rescue ActiveRecord::RecordInvalid logger.detailed_error($!) flash.now[:error] = I18n.t('cms.sites.update_failure') render :action => :edit end |