Sha256: 4e3a2bd4baa5cb0c17a9378018d22d97e60804a2b7dab5527240e40ae55cb5f4
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
module Effective class PagesController < ApplicationController def show @pages = Effective::Page.all @pages = @pages.published unless EffectivePages.authorized?(self, :admin, :effective_pages) @page = @pages.find(params[:id]) raise ActiveRecord::RecordNotFound unless @page.present? # Incase .find() isn't raising it raise Effective::AccessDenied.new('Access Denied', :show, @page) unless @page.roles_permit?(current_user) EffectivePages.authorized?(self, :show, @page) @page_title = @page.title @meta_description = @page.meta_description @canonical_url = effective_pages.page_url(@page) if EffectivePages.authorized?(self, :admin, :effective_pages) flash.now[:warning] = [ 'Hi Admin!', ('You are viewing a hidden page.' unless @page.published?), 'Click here to', ("<a href='#{effective_regions.edit_path(effective_pages.page_path(@page))}' class='alert-link' data-no-turbolink='true' data-turbolinks='false'>edit page content</a> or" unless admin_edit?), ("<a href='#{effective_pages.edit_admin_page_path(@page)}' class='alert-link'>edit page settings</a>.") ].compact.join(' ') end render @page.template, layout: @page.layout, locals: { page: @page } end private def admin_edit? EffectivePages.authorized?(self, :admin, :effective_posts) && (params[:edit].to_s == 'true') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
effective_pages-2.0.8 | app/controllers/effective/pages_controller.rb |
effective_pages-2.0.7 | app/controllers/effective/pages_controller.rb |