Module: Admin::PagesHelper
Instance Method Summary
collapse
#_display_name, #filter_reference, #tag_reference
Methods included from NodeHelper
#expanded, #expanded_rows, #expander, #homepage, #icon, #node_title, #page_type, #prepare_page, #render_node, #render_nodes, #render_search_node, #show_all?, #spinner
Methods included from UrlHelper
#build_url, #default_route?, #extract_base_url, #format_path, #generate_page_url, #lookup_page_path
Instance Method Details
#class_of_page ⇒ Object
5
6
7
|
# File 'app/helpers/admin/pages_helper.rb', line 5
def class_of_page
@page.class
end
|
#clean_page_description(page) ⇒ Object
17
18
19
|
# File 'app/helpers/admin/pages_helper.rb', line 17
def clean_page_description(page)
page.description.to_s.strip.gsub(/\t/, '').gsub(/\s+/, ' ')
end
|
#filter ⇒ Object
9
10
11
|
# File 'app/helpers/admin/pages_helper.rb', line 9
def filter
@page.parts.first.filter if @page.parts.respond_to?(:any?) && @page.parts.any?
end
|
13
14
15
|
# File 'app/helpers/admin/pages_helper.rb', line 13
def meta_errors?
!!(@page.errors[:slug] or @page.errors[:breadcrumb])
end
|
#parent_page_options(current_site, page) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/helpers/admin/pages_helper.rb', line 21
def parent_page_options(current_site, page)
parent_pages = Page.parent_pages(current_site.homepage_id).to_a
parent_pages << page.parent if page.parent && parent_pages.exclude?(page.parent)
parent_pages.reject! { |p| p.id == page.id }
return options_for_select([[t('select.none'), '']], '') if root_page?(current_site, page)
options = parent_pages.map { |p| [p.title, p.id] }
options_for_select(options, page.parent.id)
end
|
#revert_confirmation_message(version) ⇒ Object
40
41
42
43
44
|
# File 'app/helpers/admin/pages_helper.rb', line 40
def revert_confirmation_message(version)
date = version[:update_date]
time = version[:update_time]
"Are you sure you want to revert the page to the version before the change made on #{date} at #{time}? All changes made after that will be lost."
end
|
#root_page?(current_site, page) ⇒ Boolean
36
37
38
|
# File 'app/helpers/admin/pages_helper.rb', line 36
def root_page?(current_site, page)
page.id.present? && page.id == current_site.homepage_id
end
|