Module: Wallaby::ModelDecorator::FieldHelpers
- Included in:
- Wallaby::ModelDecorator
- Defined in:
- lib/interfaces/wallaby/model_decorator/field_helpers.rb
Overview
Field helper for model decorator
Instance Method Summary collapse
-
#form_label_of(field_name) ⇒ String
Form label for a given field.
-
#form_metadata_of(field_name) ⇒ Hash
Form metadata information for a given field.
-
#form_type_of(field_name) ⇒ String, Symbol
Form type for a given field.
-
#index_label_of(field_name) ⇒ String
Index label for a given field.
-
#index_metadata_of(field_name) ⇒ Hash
Index metadata information for a given field.
-
#index_type_of(field_name) ⇒ String, Symbol
Index type for a given field.
-
#label_of(field_name) ⇒ String
Label for a given field.
-
#metadata_of(field_name) ⇒ Hash
Metadata information for a given field.
-
#show_label_of(field_name) ⇒ String
Show label for a given field.
-
#show_metadata_of(field_name) ⇒ Hash
Show metadata information for a given field.
-
#show_type_of(field_name) ⇒ String, Symbol
Show type for a given field.
-
#type_of(field_name) ⇒ String, Symbol
Type for a given field.
Instance Method Details
#form_label_of(field_name) ⇒ String
67 68 69 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 67 def form_label_of(field_name) (field_name)[:label] end |
#form_metadata_of(field_name) ⇒ Hash
61 62 63 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 61 def (field_name) form_fields[field_name] || {} end |
#form_type_of(field_name) ⇒ String, Symbol
73 74 75 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 73 def form_type_of(field_name) validate_presence_of field_name, (field_name)[:type] end |
#index_label_of(field_name) ⇒ String
31 32 33 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 31 def index_label_of(field_name) (field_name)[:label] end |
#index_metadata_of(field_name) ⇒ Hash
25 26 27 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 25 def (field_name) index_fields[field_name] || {} end |
#index_type_of(field_name) ⇒ String, Symbol
37 38 39 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 37 def index_type_of(field_name) validate_presence_of field_name, (field_name)[:type] end |
#label_of(field_name) ⇒ String
13 14 15 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 13 def label_of(field_name) (field_name)[:label] end |
#metadata_of(field_name) ⇒ Hash
7 8 9 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 7 def (field_name) fields[field_name] || {} end |
#show_label_of(field_name) ⇒ String
49 50 51 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 49 def show_label_of(field_name) (field_name)[:label] end |
#show_metadata_of(field_name) ⇒ Hash
43 44 45 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 43 def (field_name) show_fields[field_name] || {} end |
#show_type_of(field_name) ⇒ String, Symbol
55 56 57 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 55 def show_type_of(field_name) validate_presence_of field_name, (field_name)[:type] end |
#type_of(field_name) ⇒ String, Symbol
19 20 21 |
# File 'lib/interfaces/wallaby/model_decorator/field_helpers.rb', line 19 def type_of(field_name) validate_presence_of field_name, (field_name)[:type] end |