Class: Refinery::Pages::Url::Localised

Inherits:
Refinery::Pages::Url show all
Defined in:
lib/refinery/pages/url.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Refinery::Pages::Url

build, #initialize

Constructor Details

This class inherits a constructor from Refinery::Pages::Url

Class Method Details

.handle?(page) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/refinery/pages/url.rb', line 6

def self.handle?(page)
  page.link_url.present?
end

Instance Method Details

#urlObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/refinery/pages/url.rb', line 10

def url
  current_url = page.link_url

  if current_url =~ %r{^/} &&
    Refinery::I18n.current_frontend_locale != Refinery::I18n.default_frontend_locale
    current_url = "/#{Refinery::I18n.current_frontend_locale}#{current_url}"
  end

  current_url
end