Class: Spina::Pages::LocationComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Spina::Pages::LocationComponent
- Defined in:
- app/components/spina/pages/location_component.rb
Instance Attribute Summary collapse
-
#f ⇒ Object
Returns the value of attribute f.
Instance Method Summary collapse
- #default_parent_pages_path ⇒ Object
-
#initialize(f, page = nil) ⇒ LocationComponent
constructor
A new instance of LocationComponent.
- #main_collection_option ⇒ Object
- #resources ⇒ Object
Constructor Details
#initialize(f, page = nil) ⇒ LocationComponent
Returns a new instance of LocationComponent.
5 6 7 8 |
# File 'app/components/spina/pages/location_component.rb', line 5 def initialize(f, page = nil) @f = f @page = page end |
Instance Attribute Details
#f ⇒ Object
Returns the value of attribute f.
3 4 5 |
# File 'app/components/spina/pages/location_component.rb', line 3 def f @f end |
Instance Method Details
#default_parent_pages_path ⇒ Object
24 25 26 |
# File 'app/components/spina/pages/location_component.rb', line 24 def default_parent_pages_path helpers.spina.admin_parent_pages_path(resource_id: @page&.resource_id, parent_id: @page&.parent_id, page_id: @page&.id) end |
#main_collection_option ⇒ Object
18 19 20 21 22 |
# File 'app/components/spina/pages/location_component.rb', line 18 def main_collection_option [t("spina.pages.main_collection"), nil, data: { parent_pages_url: helpers.spina.admin_parent_pages_path }] end |
#resources ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/components/spina/pages/location_component.rb', line 10 def resources [main_collection_option] + Spina::Resource.order(:label).map do |resource| [resource.label, resource.id, data: { parent_pages_url: helpers.spina.admin_parent_pages_path(resource_id: resource.id) }] end end |