Class: Caisson::Helpers::Form::Builder::FieldBuilder::Nature
- Inherits:
-
Object
- Object
- Caisson::Helpers::Form::Builder::FieldBuilder::Nature
- Defined in:
- lib/caisson/helpers/form/builder/field_builder/nature.rb
Class Method Summary collapse
-
.all ⇒ Object
************************************************************************************* PUBLIC CLASS METHODS *************************************************************************************.
Instance Method Summary collapse
-
#get(options = {}) ⇒ Object
************************************************************************************* PUBLIC INSTANCE METHODS *************************************************************************************.
-
#initialize(record, name) ⇒ Nature
constructor
************************************************************************************* CONSTRUCTOR *************************************************************************************.
Constructor Details
#initialize(record, name) ⇒ Nature
************************************************************************************* CONSTRUCTOR *************************************************************************************
9 10 11 12 |
# File 'lib/caisson/helpers/form/builder/field_builder/nature.rb', line 9 def initialize(record, name) @record = record @name = name.to_s end |
Class Method Details
.all ⇒ Object
************************************************************************************* PUBLIC CLASS METHODS *************************************************************************************
18 19 20 21 22 |
# File 'lib/caisson/helpers/form/builder/field_builder/nature.rb', line 18 def self.all ['checkbox', 'password', 'percent', 'select', 'text', 'textarea'] #TODO #'autocomplete', 'check-icon', 'country', 'file', 'money', 'static', 'switch', 'radio', 'upload', 'ticklist', 'time_field' end |
Instance Method Details
#get(options = {}) ⇒ Object
************************************************************************************* PUBLIC INSTANCE METHODS *************************************************************************************
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/caisson/helpers/form/builder/field_builder/nature.rb', line 28 def get(={}) .reverse_merge!(force: nil) if [:force] return force([:force]) elsif @record.fields[@name] return case @record.fields[@name].[:type].to_s.downcase when 'array' then 'ticklist' when 'boolean' then 'checkbox' when 'percent' then 'percent' when 'time' then 'time_field' else nature_by_name end else return nature_by_name end end |