Sha256: 54bd2c77ec7ba76fbe9e2927c2b8791d35c9946f912ea5893b6d87e1e0289b3d
Contents?: true
Size: 927 Bytes
Versions: 1
Compression:
Stored size: 927 Bytes
Contents
module Locomotive module Steam class UrlBuilderService < Struct.new(:site, :current_locale) def url_for(page, locale = nil) [''].tap do |segments| locale ||= current_locale same_locale = locale.to_sym == site.default_locale.to_sym # locale segments << locale unless same_locale # fullpath segments << sanitized_fullpath(page, same_locale) end.compact.join('/') end def public_submission_url_for(content_type) "/entry_submissions/#{content_type.slug}" end private def sanitized_fullpath(page, same_locale) path = page.fullpath if page.templatized? && page.content_entry path.gsub(Locomotive::Steam::WILDCARD, page.content_entry._slug) elsif path == 'index' same_locale ? '' : nil else path end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
locomotivecms_steam-1.0.0.pre.alpha | lib/locomotive/steam/services/url_builder_service.rb |