3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/effective/pages_controller.rb', line 3
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? 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
|