Class: OrangeRoute
- Inherits:
-
Orange::SiteCarton
- Object
- Orange::Carton
- Orange::SiteCarton
- OrangeRoute
- Defined in:
- lib/orange-more/sitemap/cartons/route.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Orange::SiteCarton
Methods inherited from Orange::Carton
Class Method Details
.create_home_for_site(site_id, opts = {}) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/orange-more/sitemap/cartons/route.rb', line 40 def self.create_home_for_site(site_id, opts = {}) site_id = OrangeSite.get(site_id) unless site_id.is_a? OrangeSite opts = opts.with_defaults({:orange_site => site_id, :slug => '_index_', :accept_args => false, :link_text => 'Home'}) home = self.new(opts) home.move(:root) home.save home end |
.home_for_site(site_id) ⇒ Object
34 35 36 37 |
# File 'lib/orange-more/sitemap/cartons/route.rb', line 34 def self.home_for_site(site_id) site_id = OrangeSite.get(site_id) unless site_id.is_a? OrangeSite root(:orange_site => site_id) end |
Instance Method Details
#default_slug? ⇒ Boolean
30 31 32 |
# File 'lib/orange-more/sitemap/cartons/route.rb', line 30 def default_slug? /^page-\d+/ =~ slug end |
#full_path ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/orange-more/sitemap/cartons/route.rb', line 20 def full_path self_and_ancestors.inject('') do |path, part| if part.parent # Check if this is a child path = path + part.slug + '/' else # The root slug is just the initial '/' path = path + '/' end end end |