Sha256: 75add1c2f972e5752984bc7456f5647ada97fff0d8849e846096e21cf3582626

Contents?: true

Size: 690 Bytes

Versions: 5

Compression:

Stored size: 690 Bytes

Contents

module Avo
  module Fields
    class IdField < BaseField
      def initialize(name, **args, &block)
        default_value = 'id'

        if name.nil?
          @name = name = default_value
        elsif !name.is_a? String and !name.is_a? Symbol
          args_copy = name
          @name = name = default_value
          args = args_copy
        end

        @defaults = {
          id: name.to_sym,
          readonly: true,
          sortable: true,
          partial_name: 'id-field'
        }

        hide_on [:edit, :new]

        super(name, **args, &block)

        @link_to_resource = args[:link_to_resource].present? ? args[:link_to_resource] : false
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avo-0.5.0.beta9 lib/avo/fields/id_field.rb
avo-0.5.0.beta8 lib/avo/fields/id_field.rb
avo-0.5.0.beta7 lib/avo/fields/id_field.rb
avo-0.5.0.beta6 lib/avo/fields/id_field.rb
avo-0.5.0.beta5 lib/avo/fields/id_field.rb