Module: Para::Component::BaseDecorator

Includes:
ActionDispatch::Routing::PolymorphicRoutes
Included in:
CrudDecorator, FormDecorator, SettingsDecorator
Defined in:
app/decorators/para/component/base_decorator.rb

Instance Method Summary collapse

Instance Method Details

#page_container_classObject



27
28
29
# File 'app/decorators/para/component/base_decorator.rb', line 27

def page_container_class
  'col-xs-12'
end

#path(namespace: nil, **options) ⇒ Object



7
8
9
# File 'app/decorators/para/component/base_decorator.rb', line 7

def path(namespace: nil, **options)
  find_path([:admin, self, namespace].compact, options)
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
# File 'app/decorators/para/component/base_decorator.rb', line 11

def relation_path(controller_or_resource, *nested_resources, **options)
  nested = nested_resources.any?

  if controller_or_resource.is_a?(Hash)
    options = controller_or_resource
    controller_or_resource = nil
  end

  controller_or_resource = nil if controller_or_resource.is_a?(ActiveRecord::Base)

  options[:action] = action_option_for(options, nested: nested)
  components = [:admin, self, controller_or_resource, *nested_resources].compact

  find_path(components, options)
end