Class: BlueberryCMS::Admin::PagesController
- Inherits:
-
Object
- Object
- BlueberryCMS::Admin::PagesController
- Includes:
- Wisper::Publisher
- Defined in:
- app/controllers/blueberry_cms/admin/pages_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/blueberry_cms/admin/pages_controller.rb', line 18 def create @page = Page.new(page_params) if @page.save redirect_to(params[:continue] ? [:edit, :admin, @page] : [:admin, :pages]) else render :new end end |
#destroy ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'app/controllers/blueberry_cms/admin/pages_controller.rb', line 48 def destroy @page = Page.find(params[:id]) if @page.destroy redirect_to [:admin, :pages] else redirect_to [:admin, :pages] end end |
#edit ⇒ Object
27 28 29 |
# File 'app/controllers/blueberry_cms/admin/pages_controller.rb', line 27 def edit @page = Page.find(params[:id]) end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/blueberry_cms/admin/pages_controller.rb', line 9 def index @pages = Page.roots end |
#new ⇒ Object
13 14 15 16 |
# File 'app/controllers/blueberry_cms/admin/pages_controller.rb', line 13 def new @page = Page.new @page.parent = Page.find(params[:parent_id]) if params[:parent_id] end |
#update ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/blueberry_cms/admin/pages_controller.rb', line 31 def update @page = Page.find(params[:id]) if @page.update_attributes(page_params) respond_to do |format| format.html { redirect_to(params[:continue] ? [:edit, :admin, @page] : [:admin, :pages]) } format.js { head :ok } end else respond_to do |format| format.html { render :edit } format.js { head :unprocessable_entity } end end end |