Module: PagesCore::ApplicationHelper

Includes:
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

Instance Method Details


11
12
13
14
15
16
17
18
# File 'app/helpers/pages_core/application_helper.rb', line 11

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


20
21
22
23
24
25
26
27
28
# File 'app/helpers/pages_core/application_helper.rb', line 20

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