app/controllers/admin/pages_controller.rb in effective_pages-1.0.15 vs app/controllers/admin/pages_controller.rb in effective_pages-1.0.16

- old
+ new

@@ -4,26 +4,30 @@ layout (EffectivePages.layout.kind_of?(Hash) ? EffectivePages.layout[:admin] : EffectivePages.layout) def index @page_title = 'Pages' + + EffectivePages.authorized?(self, :admin, :effective_pages) EffectivePages.authorized?(self, :index, Effective::Page) @datatable = Effective::Datatables::Pages.new() if defined?(EffectiveDatatables) end def new @page = Effective::Page.new() @page_title = 'New Page' + EffectivePages.authorized?(self, :admin, :effective_pages) EffectivePages.authorized?(self, :new, @page) end def create @page = Effective::Page.new(page_params) @page_title = 'New Page' + EffectivePages.authorized?(self, :admin, :effective_pages) EffectivePages.authorized?(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)) @@ -41,17 +45,19 @@ def edit @page = Effective::Page.find(params[:id]) @page_title = 'Edit Page' + EffectivePages.authorized?(self, :admin, :effective_pages) EffectivePages.authorized?(self, :edit, @page) end def update @page = Effective::Page.find(params[:id]) @page_title = 'Edit Page' + EffectivePages.authorized?(self, :admin, :effective_pages) EffectivePages.authorized?(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)) @@ -68,9 +74,10 @@ end def destroy @page = Effective::Page.find(params[:id]) + EffectivePages.authorized?(self, :admin, :effective_pages) EffectivePages.authorized?(self, :destroy, @page) if @page.destroy flash[:success] = 'Successfully deleted page' else