Sha256: 0188cba339b62451fb892199b7da57dafc255fff4a61c2f4781102ce2e78f2af

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module Para
  module FormHelper
    def para_form_for(resource, options = {}, &block)
      default_options = {
        as: :resource,
        wrapper: :horizontal_form,
        html: { class: '' }
      }

      options = default_options.deep_merge(options)

      options[:html][:class] = [
        options[:html][:class].presence,
        'form-horizontal form-group-separated'
      ].compact.join(' ')

      unless options.key?(:url)
        options[:url] = @component.relation_path(resource)
      end

      if options.fetch(:fixed_actions, true)
        default_options[:html][:class] << ' form-fixed-actions'
      end

      simple_form_for(resource, options, &block)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
para-0.4.0 app/helpers/para/form_helper.rb