Sha256: e5c354f9cac9cdb20d967c46e9998d4185aa2464377ee0cce0563bd7695070b5

Contents?: true

Size: 909 Bytes

Versions: 11

Compression:

Stored size: 909 Bytes

Contents

module Para
  module Component
    module FormDecorator
      include Para::Component::BaseDecorator

      def path(namespace: :resource, **options)
        find_path([:admin, self, namespace], options)
      end

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

        if Hash === controller_or_resource
          options = controller_or_resource
        end

        options[:action] = action_option_for(options, nested: nested)
        data = [:admin, self, :resource, *nested_resources]

        find_path(data, options)
      end

      def page_container_class
        history? ? 'col-md-8' : super
      end

      private

      def action_option_for(options, nested: false)
        if !nested && options[:action].try(:to_sym) == :show
          nil
        else
          options[:action]
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
para-0.8.0 app/decorators/para/component/form_decorator.rb
para-0.7.4.p1 app/decorators/para/component/form_decorator.rb
para-0.7.4 app/decorators/para/component/form_decorator.rb
para-0.7.3.p6 app/decorators/para/component/form_decorator.rb
para-0.7.3.p5 app/decorators/para/component/form_decorator.rb
para-0.7.3.p4 app/decorators/para/component/form_decorator.rb
para-0.7.3.p3 app/decorators/para/component/form_decorator.rb
para-0.7.3.p2 app/decorators/para/component/form_decorator.rb
para-0.7.3.p1 app/decorators/para/component/form_decorator.rb
para-0.7.3 app/decorators/para/component/form_decorator.rb
para-0.7.2 app/decorators/para/component/form_decorator.rb