Class: Kuhsaft::Cms::PagesController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- ApplicationController
- AdminController
- Kuhsaft::Cms::PagesController
- Defined in:
- app/controllers/kuhsaft/cms/pages_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from AdminController
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/kuhsaft/cms/pages_controller.rb', line 20 def create @page = Kuhsaft::Page.create params[:page] if @page.valid? flash[:success] = t('layouts.kuhsaft.cms.flash.success', :subject => Kuhsaft::Page.model_name.human) respond_with @page, :location => kuhsaft.edit_cms_page_path(@page) else render 'new' end end |
#destroy ⇒ Object
47 48 49 50 51 |
# File 'app/controllers/kuhsaft/cms/pages_controller.rb', line 47 def destroy @page = Kuhsaft::Page.find(params[:id]) @page.destroy redirect_to kuhsaft.cms_pages_path end |
#edit ⇒ Object
31 32 33 34 35 |
# File 'app/controllers/kuhsaft/cms/pages_controller.rb', line 31 def edit @page = Kuhsaft::Page.find(params[:id]) @page.published ||= Kuhsaft::PublishState::UNPUBLISHED respond_with @page end |
#index ⇒ Object
4 5 6 7 |
# File 'app/controllers/kuhsaft/cms/pages_controller.rb', line 4 def index @pages = Kuhsaft::Page.roots respond_with @pages end |
#new ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/kuhsaft/cms/pages_controller.rb', line 14 def new @page = Kuhsaft::Page.new @page.published ||= Kuhsaft::PublishState::UNPUBLISHED respond_with @page end |
#show ⇒ Object
9 10 11 12 |
# File 'app/controllers/kuhsaft/cms/pages_controller.rb', line 9 def show @page = Kuhsaft::Page.find(params[:id]) respond_with @page end |
#update ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/kuhsaft/cms/pages_controller.rb', line 37 def update @page = Kuhsaft::Page.find(params[:id]) if @page.update_attributes(params[:page]) flash[:success] = t('layouts.kuhsaft.cms.flash.success', :subject => Kuhsaft::Page.model_name.human) respond_with @page, :location => kuhsaft.edit_cms_page_path(@page) else render 'edit' end end |