Module: PagesCore::ApplicationHelper

Includes:
AttachmentsHelper, HeadTagsHelper, ImagesHelper, MetaTagsHelper, OpenGraphTagsHelper, PagePathHelper
Included in:
ApplicationHelper, FrontendController
Defined in:
app/helpers/pages_core/application_helper.rb

Instance Method Summary collapse

Methods included from PagePathHelper

#page_path, #page_url

Methods included from OpenGraphTagsHelper

#open_graph_properties, #open_graph_tags

Methods included from MetaTagsHelper

#default_meta_image, #default_meta_image?, #meta_description, #meta_description?, #meta_image, #meta_image?, #meta_keywords, #meta_keywords?

Methods included from ImagesHelper

#dynamic_image_tag, #original_dynamic_image_tag, #uncropped_dynamic_image_tag

Methods included from HeadTagsHelper

#document_title, #document_title?, #feed_tags, #google_analytics_tags, #head_tag, #rss_link_tag, #typekit_tags

Methods included from AttachmentsHelper

#attachment_path, #download_attachment_path, #page_file_path

Instance Method Details



14
15
16
17
18
19
20
21
22
# File 'app/helpers/pages_core/application_helper.rb', line 14

def page_link(page, options = {})
  link_locale = options[:locale] || locale
  page.localize(link_locale) do |p|
    title = options[:title] || p.name.to_s
    return title unless conditional_options?(options)

    link_to(title, page_link_path(link_locale, p), class: options[:class])
  end
end

#unique_page(page_name, &block) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'app/helpers/pages_core/application_helper.rb', line 24

def unique_page(page_name, &block)
  locale = @locale || I18n.default_locale.to_s
  page = Page.where(unique_name: page_name).first
  if page && block_given?
    output = capture(page.localize(locale), &block)
    concat(output)
  end
  page ? page.localize(locale) : nil
end