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
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/admin/pages_controller.rb', line 26 def create @page = Effective::Page.new(page_params) @page_title = 'New 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
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/controllers/admin/pages_controller.rb', line 75 def destroy @page = Effective::Page.find(params[:id]) 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
47 48 49 50 51 52 |
# File 'app/controllers/admin/pages_controller.rb', line 47 def edit @page = Effective::Page.find(params[:id]) @page_title = 'Edit Page' end |
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/admin/pages_controller.rb', line 7 def index if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0') @datatable = Effective::Datatables::Pages.new() else @datatable = EffectivePagesDatatable.new(self) end @page_title = 'Pages' end |
#new ⇒ Object
19 20 21 22 23 24 |
# File 'app/controllers/admin/pages_controller.rb', line 19 def new @page = Effective::Page.new() @page_title = 'New Page' end |
#update ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/admin/pages_controller.rb', line 54 def update @page = Effective::Page.find(params[:id]) @page_title = 'Edit 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 |