Class: Admin::PagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PagesController
- Defined in:
- app/controllers/admin/pages_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/admin/pages_controller.rb', line 21 def create @page = Effective::Page.new(page_params) @page_title = 'New Page' EffectivePages.(self, :create, @page) if @page.save if params[:commit] == 'Save and Edit Content' && defined?(EffectiveRegions) redirect_to effective_regions.edit_path(effective_pages.page_path(@page), :exit => effective_pages.edit_admin_page_path(@page)) elsif params[:commit] == 'Save and Add New' redirect_to effective_pages.new_admin_page_path else flash[:success] = 'Successfully created page' redirect_to effective_pages.edit_admin_page_path(@page) end else flash.now[:danger] = 'Unable to create page' render :action => :new end end |
#destroy ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/controllers/admin/pages_controller.rb', line 70 def destroy @page = Effective::Page.find(params[:id]) EffectivePages.(self, :destroy, @page) if @page.destroy flash[:success] = 'Successfully deleted page' else flash[:danger] = 'Unable to delete page' end redirect_to effective_pages.admin_pages_path end |
#edit ⇒ Object
42 43 44 45 46 47 |
# File 'app/controllers/admin/pages_controller.rb', line 42 def edit @page = Effective::Page.find(params[:id]) @page_title = 'Edit Page' EffectivePages.(self, :edit, @page) end |
#index ⇒ Object
7 8 9 10 11 12 |
# File 'app/controllers/admin/pages_controller.rb', line 7 def index @page_title = 'Pages' EffectivePages.(self, :index, Effective::Page) @datatable = Effective::Datatables::Pages.new() if defined?(EffectiveDatatables) end |
#new ⇒ Object
14 15 16 17 18 19 |
# File 'app/controllers/admin/pages_controller.rb', line 14 def new @page = Effective::Page.new() @page_title = 'New Page' EffectivePages.(self, :new, @page) end |
#update ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/admin/pages_controller.rb', line 49 def update @page = Effective::Page.find(params[:id]) @page_title = 'Edit Page' EffectivePages.(self, :update, @page) if @page.update_attributes(page_params) if params[:commit] == 'Save and Edit Content' && defined?(EffectiveRegions) redirect_to effective_regions.edit_path(effective_pages.page_path(@page), :exit => effective_pages.edit_admin_page_path(@page)) elsif params[:commit] == 'Save and Add New' redirect_to effective_pages.new_admin_page_path else flash[:success] = 'Successfully updated page' redirect_to effective_pages.edit_admin_page_path(@page) end else flash.now[:danger] = 'Unable to update page' render :action => :edit end end |