Module: PagesCore::PagePathHelper

Included in:
ApplicationHelper, SitemapsController
Defined in:
app/helpers/pages_core/page_path_helper.rb

Instance Method Summary collapse

Instance Method Details

#page_path(locale, page, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/pages_core/page_path_helper.rb', line 5

def page_path(locale, page, options = {})
  page.localize(locale) do |p|
    return super(locale, p, options) unless p.full_path?

    (PagesCore.config.localizations? ? "/#{locale}/" : "/") +
      escape_page_path(p.full_path) +
      (html_format?(options) ? "" : ".#{options[:format]}") +
      paginated_section(options)
  end
end

#page_url(page_or_locale, page = nil, opts = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/pages_core/page_path_helper.rb', line 16

def page_url(page_or_locale, page = nil, opts = {})
  locale, page = page_url_locale_and_page(page_or_locale, page, opts)

  page.localize(locale) do |p|
    if p.redirects? && html_format?(opts)
      page_redirect_url(locale, p)
    elsif p.full_path
      base_page_url + page_path(locale, p, opts)
    else
      super(locale, p, opts)
    end
  end
end