Class: Administrate::Field::Base
- Inherits:
-
Object
- Object
- Administrate::Field::Base
- Defined in:
- lib/administrate/field/base.rb
Direct Known Subclasses
Associative, Boolean, DateTime, Email, Number, Password, Select, String, Text, Time
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Class Method Summary collapse
- .html_class ⇒ Object
- .permitted_attribute(attr, _options = nil) ⇒ Object
- .searchable? ⇒ Boolean
- .with_options(options = {}) ⇒ Object
Instance Method Summary collapse
- #html_class ⇒ Object
-
#initialize(attribute, data, page, options = {}) ⇒ Base
constructor
A new instance of Base.
- #name ⇒ Object
- #to_partial_path ⇒ Object
Constructor Details
#initialize(attribute, data, page, options = {}) ⇒ Base
Returns a new instance of Base.
19 20 21 22 23 24 25 |
# File 'lib/administrate/field/base.rb', line 19 def initialize(attribute, data, page, = {}) @attribute = attribute @data = data @page = page @resource = .delete(:resource) @options = end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
43 44 45 |
# File 'lib/administrate/field/base.rb', line 43 def attribute @attribute end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
43 44 45 |
# File 'lib/administrate/field/base.rb', line 43 def data @data end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
43 44 45 |
# File 'lib/administrate/field/base.rb', line 43 def page @page end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
43 44 45 |
# File 'lib/administrate/field/base.rb', line 43 def resource @resource end |
Class Method Details
.html_class ⇒ Object
11 12 13 |
# File 'lib/administrate/field/base.rb', line 11 def self.html_class field_type.dasherize end |
.permitted_attribute(attr, _options = nil) ⇒ Object
27 28 29 |
# File 'lib/administrate/field/base.rb', line 27 def self.permitted_attribute(attr, = nil) attr end |
.searchable? ⇒ Boolean
15 16 17 |
# File 'lib/administrate/field/base.rb', line 15 def self.searchable? false end |
Instance Method Details
#html_class ⇒ Object
31 32 33 |
# File 'lib/administrate/field/base.rb', line 31 def html_class self.class.html_class end |
#name ⇒ Object
35 36 37 |
# File 'lib/administrate/field/base.rb', line 35 def name attribute.to_s end |
#to_partial_path ⇒ Object
39 40 41 |
# File 'lib/administrate/field/base.rb', line 39 def to_partial_path "/fields/#{self.class.field_type}/#{page}" end |