Class: OrangeRoute
- Inherits:
-
Orange::SiteCarton
- Object
- Orange::Carton
- Orange::SiteCarton
- OrangeRoute
- Includes:
- DataMapper::Transaction::Resource
- Defined in:
- lib/orange-more/sitemap/cartons/route.rb
Constant Summary
Constants inherited from Orange::Carton
Orange::Carton::SCAFFOLD_OPTIONS
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Orange::SiteCarton
Methods inherited from Orange::Carton
add_scaffold, admin, admin_property, as_resource, asset, boolean, date, datetime, expose, form_props, front, front_property, fulltext, id, init, orange, orange_property, scaffold_property, string, text, time, title, #to_s
Methods included from ClassInheritableAttributes
#cattr_accessor, #cattr_reader, #cattr_writer, eval_in_accessor_module, fetch_value, store_value
Class Method Details
.create_home_for_site(site_id, opts = {}) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/orange-more/sitemap/cartons/route.rb', line 36 def self.create_home_for_site(site_id, opts = {}) opts = opts.with_defaults({:orange_site_id => 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
31 32 33 |
# File 'lib/orange-more/sitemap/cartons/route.rb', line 31 def self.home_for_site(site_id) root(:orange_site_id => site_id) end |
Instance Method Details
#full_path ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/orange-more/sitemap/cartons/route.rb', line 21 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 |