Class: CmAdmin::Models::Field
- Inherits:
-
Object
- Object
- CmAdmin::Models::Field
- Defined in:
- lib/cm_admin/models/field.rb
Instance Attribute Summary collapse
-
#custom_link ⇒ Object
Returns the value of attribute custom_link.
-
#display_if ⇒ Object
Returns the value of attribute display_if.
-
#field_name ⇒ Object
Returns the value of attribute field_name.
-
#field_type ⇒ Object
Returns the value of attribute field_type.
-
#format ⇒ Object
Returns the value of attribute format.
-
#header ⇒ Object
Returns the value of attribute header.
-
#height ⇒ Object
Returns the value of attribute height.
-
#helper_method ⇒ Object
Returns the value of attribute helper_method.
-
#label ⇒ Object
Returns the value of attribute label.
-
#precision ⇒ Object
Returns the value of attribute precision.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#preview ⇒ Object
Returns the value of attribute preview.
-
#suffix ⇒ Object
Returns the value of attribute suffix.
-
#tag_class ⇒ Object
Returns the value of attribute tag_class.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(field_name, attributes = {}) ⇒ Field
constructor
A new instance of Field.
- #set_default_values ⇒ Object
Constructor Details
#initialize(field_name, attributes = {}) ⇒ Field
Returns a new instance of Field.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cm_admin/models/field.rb', line 8 def initialize(field_name, attributes = {}) @field_name = field_name set_default_values attributes.each do |key, value| self.send("#{key.to_s}=", value) end self.height = 50 if self.field_type == :image && self.height.nil? self.width = 50 if self.field_type == :image && self.width.nil? self.display_if = lambda { |arg| return true } if self.display_if.nil? end |
Instance Attribute Details
#custom_link ⇒ Object
Returns the value of attribute custom_link.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def custom_link @custom_link end |
#display_if ⇒ Object
Returns the value of attribute display_if.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def display_if @display_if end |
#field_name ⇒ Object
Returns the value of attribute field_name.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def field_name @field_name end |
#field_type ⇒ Object
Returns the value of attribute field_type.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def field_type @field_type end |
#format ⇒ Object
Returns the value of attribute format.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def format @format end |
#header ⇒ Object
Returns the value of attribute header.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def header @header end |
#height ⇒ Object
Returns the value of attribute height.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def height @height end |
#helper_method ⇒ Object
Returns the value of attribute helper_method.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def helper_method @helper_method end |
#label ⇒ Object
Returns the value of attribute label.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def label @label end |
#precision ⇒ Object
Returns the value of attribute precision.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def precision @precision end |
#prefix ⇒ Object
Returns the value of attribute prefix.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def prefix @prefix end |
#preview ⇒ Object
Returns the value of attribute preview.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def preview @preview end |
#suffix ⇒ Object
Returns the value of attribute suffix.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def suffix @suffix end |
#tag_class ⇒ Object
Returns the value of attribute tag_class.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def tag_class @tag_class end |
#width ⇒ Object
Returns the value of attribute width.
5 6 7 |
# File 'lib/cm_admin/models/field.rb', line 5 def width @width end |
Instance Method Details
#set_default_values ⇒ Object
19 20 21 |
# File 'lib/cm_admin/models/field.rb', line 19 def set_default_values self.tag_class = {} end |