Class: Locomotive::Steam::UrlBuilderService
- Inherits:
-
Object
- Object
- Locomotive::Steam::UrlBuilderService
- Defined in:
- lib/locomotive/steam/services/url_builder_service.rb
Instance Method Summary collapse
- #_public_submission_url_for(content_type) ⇒ Object
- #_url_for(page, locale = nil) ⇒ Object
- #prefix(url) ⇒ Object
- #public_submission_url_for(content_type) ⇒ Object
- #url_for(page, locale = nil) ⇒ Object
Instance Method Details
#_public_submission_url_for(content_type) ⇒ Object
32 33 34 |
# File 'lib/locomotive/steam/services/url_builder_service.rb', line 32 def _public_submission_url_for(content_type) "/entry_submissions/#{content_type.slug}" end |
#_url_for(page, locale = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/locomotive/steam/services/url_builder_service.rb', line 12 def _url_for(page, locale = nil) [''].tap do |segments| locale ||= current_locale same_locale = locale.to_sym == site.default_locale.to_sym # if the prefix_default_locale is enabled, we need to # add the locale no matter if the locale is the same as the default one if site.prefix_default_locale || !same_locale segments << locale end # fullpath segments << sanitized_fullpath(page, same_locale) end.compact.join('/') end |
#prefix(url) ⇒ Object
36 37 38 |
# File 'lib/locomotive/steam/services/url_builder_service.rb', line 36 def prefix(url) mounted_on ? "#{mounted_on}#{url}" : url end |
#public_submission_url_for(content_type) ⇒ Object
28 29 30 |
# File 'lib/locomotive/steam/services/url_builder_service.rb', line 28 def public_submission_url_for(content_type) prefix(_public_submission_url_for(content_type)) end |
#url_for(page, locale = nil) ⇒ Object
8 9 10 |
# File 'lib/locomotive/steam/services/url_builder_service.rb', line 8 def url_for(page, locale = nil) prefix(_url_for(page, locale)) end |