Module: Para::Component::CrudDecorator
- Includes:
- BaseDecorator
- Defined in:
- app/decorators/para/component/crud_decorator.rb
Instance Method Summary collapse
- #page_container_class ⇒ Object
- #path(namespace: :resources, **options) ⇒ Object
- #relation_path(controller_or_resource, *nested_resources, **options) ⇒ Object
Instance Method Details
#page_container_class ⇒ Object
31 32 33 |
# File 'app/decorators/para/component/crud_decorator.rb', line 31 def page_container_class history? ? 'col-md-8' : super end |
#path(namespace: :resources, **options) ⇒ Object
6 7 8 9 |
# File 'app/decorators/para/component/crud_decorator.rb', line 6 def path(namespace: :resources, **) [:model] ||= model_singular_route_key find_path([:admin, self, namespace], ) end |
#relation_path(controller_or_resource, *nested_resources, **options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/decorators/para/component/crud_decorator.rb', line 11 def relation_path(controller_or_resource, *nested_resources, **) nested = nested_resources.any? id_key = nested ? :resource_id : :id if (id = extract_id_from(controller_or_resource)) [id_key] = id elsif Hash === controller_or_resource = controller_or_resource end route_key = route_key_for([id_key], ) [:model] = model_singular_route_key data = [:admin, self, route_key].compact + nested_resources [:action] = action_option_for(, nested: nested) find_path(data, ) end |