Sha256: 90eb7e322f561ace4ba9925886a000986fc5792a9179ee6daf7a71407a913856

Contents?: true

Size: 956 Bytes

Versions: 14

Compression:

Stored size: 956 Bytes

Contents

require_relative "deferred"
require "active_support/core_ext/string/inflections"

module Administrate
  module Field
    class Base
      def self.with_options(options = {})
        Deferred.new(self, options)
      end

      def self.html_class
        field_type.dasherize
      end

      def self.searchable?
        false
      end

      def initialize(attribute, data, page, options = {})
        @attribute = attribute
        @data = data
        @page = page
        @options = options
      end

      def self.permitted_attribute(attr)
        attr
      end

      def html_class
        self.class.html_class
      end

      def name
        attribute.to_s
      end

      def to_partial_path
        "/fields/#{self.class.field_type}/#{page}"
      end

      attr_reader :attribute, :data, :page

      protected

      attr_reader :options

      def self.field_type
        to_s.split("::").last.underscore
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
administrate-0.7.0 lib/administrate/field/base.rb
administrate-0.6.0 lib/administrate/field/base.rb
administrate-0.5.0 lib/administrate/field/base.rb
administrate-0.4.0 lib/administrate/field/base.rb
administrate-0.3.0 lib/administrate/field/base.rb
administrate-0.2.2 lib/administrate/field/base.rb
administrate-0.2.1 lib/administrate/field/base.rb
administrate-0.2.0 lib/administrate/field/base.rb
administrate-0.2.0.rc1 lib/administrate/field/base.rb
administrate-0.1.5 lib/administrate/field/base.rb
administrate-0.1.4 lib/administrate/field/base.rb
administrate-0.1.3 lib/administrate/fields/base.rb
administrate-0.1.2 lib/administrate/fields/base.rb
administrate-0.1.1 lib/administrate/fields/base.rb