Class: Adminable::Attributes::Base
- Inherits:
-
Object
- Object
- Adminable::Attributes::Base
- Defined in:
- lib/adminable/attributes/base.rb
Direct Known Subclasses
Types::BelongsTo, Types::Boolean, Types::Datetime, Types::Decimal, Types::Float, Types::HasMany, Types::Integer, Types::String, Types::Text
Instance Attribute Summary collapse
-
#center ⇒ Object
(also: #center?)
Returns the value of attribute center.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
-
#ransack_name ⇒ Object
readonly
Returns the value of attribute ransack_name.
-
#required ⇒ Object
(also: #required?)
Returns the value of attribute required.
-
#show ⇒ Object
(also: #show?)
Returns the value of attribute show.
-
#wysiwyg ⇒ Object
(also: #wysiwyg?)
Returns the value of attribute wysiwyg.
Instance Method Summary collapse
- #form_partial_path ⇒ Object
- #index_partial_path ⇒ Object
-
#initialize(name, options = {}) ⇒ Base
constructor
A new instance of Base.
- #strong_parameter ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/adminable/attributes/base.rb', line 7 def initialize(name, = {}) raise 'Base class cannot be initialized' if self.class == Base @name = name @key = [:key] || @name @ransack_name = "#{@name}_cont" @association = [:association] @required = [:required] || false @show = true @center = %w(integer boolean float decimal).include?(type) @wysiwyg = %w(text).include?(type) end |
Instance Attribute Details
#center ⇒ Object Also known as: center?
Returns the value of attribute center.
4 5 6 |
# File 'lib/adminable/attributes/base.rb', line 4 def center @center end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/adminable/attributes/base.rb', line 5 def key @key end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/adminable/attributes/base.rb', line 4 def name @name end |
#ransack_name ⇒ Object (readonly)
Returns the value of attribute ransack_name.
5 6 7 |
# File 'lib/adminable/attributes/base.rb', line 5 def ransack_name @ransack_name end |
#required ⇒ Object Also known as: required?
Returns the value of attribute required.
4 5 6 |
# File 'lib/adminable/attributes/base.rb', line 4 def required @required end |
#show ⇒ Object Also known as: show?
Returns the value of attribute show.
4 5 6 |
# File 'lib/adminable/attributes/base.rb', line 4 def show @show end |
#wysiwyg ⇒ Object Also known as: wysiwyg?
Returns the value of attribute wysiwyg.
4 5 6 |
# File 'lib/adminable/attributes/base.rb', line 4 def wysiwyg @wysiwyg end |
Instance Method Details
#form_partial_path ⇒ Object
37 38 39 |
# File 'lib/adminable/attributes/base.rb', line 37 def form_partial_path "adminable/resources/form/#{type}" end |
#index_partial_path ⇒ Object
33 34 35 |
# File 'lib/adminable/attributes/base.rb', line 33 def index_partial_path "index/#{type}" end |
#strong_parameter ⇒ Object
29 30 31 |
# File 'lib/adminable/attributes/base.rb', line 29 def strong_parameter key end |
#type ⇒ Object
25 26 27 |
# File 'lib/adminable/attributes/base.rb', line 25 def type self.class.name.demodulize.underscore end |