Module: Cms9::ApplicationHelper
- Defined in:
- app/helpers/cms9/application_helper.rb
Overview
main application fields displaying helper
Instance Method Summary collapse
-
#check_type(field, options) ⇒ Object
rubocop:disable CyclomaticComplexity.
- #cms9_date_tag(model) ⇒ Object
- #cms9_date_time_tag(model) ⇒ Object
- #cms9_field(field, options = {}) ⇒ Object
- #cms9_image_tag(model, options = {}) ⇒ Object
- #cms9_multiple_choice(model) ⇒ Object
- #cms9_number_tag(model) ⇒ Object
- #cms9_select_single_tag(model) ⇒ Object
- #cms9_text_area_tag(model) ⇒ Object
- #cms9_text_tag(model) ⇒ Object
- #cms9_time_tag(model) ⇒ Object
- #field_blank(field) ⇒ Object
- #field_value(field) ⇒ Object
Instance Method Details
#check_type(field, options) ⇒ Object
rubocop:disable CyclomaticComplexity
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/helpers/cms9/application_helper.rb', line 44 def check_type(field, ) # rubocop:disable CyclomaticComplexity case field.post_field.field_type when 'text', 'number', 'select_single', 'date', 'time', 'date_time' field_value(field) ? '' : cms9_text_tag(field) when 'text_area' then field_value(field) ? '' : cms9_text_area_tag(field) when 'select_multiple' field_value(field) ? '' : cms9_multiple_choice(field) when 'image' then field_blank(field) ? '' : cms9_image_tag(field, ) else '<unsupported type>' end end |
#cms9_date_tag(model) ⇒ Object
32 33 34 |
# File 'app/helpers/cms9/application_helper.rb', line 32 def cms9_date_tag(model) model.to_s end |
#cms9_date_time_tag(model) ⇒ Object
40 41 42 |
# File 'app/helpers/cms9/application_helper.rb', line 40 def cms9_date_time_tag(model) model.to_s end |
#cms9_field(field, options = {}) ⇒ Object
4 5 6 |
# File 'app/helpers/cms9/application_helper.rb', line 4 def cms9_field(field, = {}) check_type(field, ) if field.present? end |
#cms9_image_tag(model, options = {}) ⇒ Object
20 21 22 |
# File 'app/helpers/cms9/application_helper.rb', line 20 def cms9_image_tag(model, = {}) image_tag(model.image.url, ) end |
#cms9_multiple_choice(model) ⇒ Object
16 17 18 |
# File 'app/helpers/cms9/application_helper.rb', line 16 def cms9_multiple_choice(model) model.value.to_s.split("\' ")[0].to_s end |
#cms9_number_tag(model) ⇒ Object
24 25 26 |
# File 'app/helpers/cms9/application_helper.rb', line 24 def cms9_number_tag(model) model.to_s end |
#cms9_select_single_tag(model) ⇒ Object
28 29 30 |
# File 'app/helpers/cms9/application_helper.rb', line 28 def cms9_select_single_tag(model) model.to_s end |
#cms9_text_area_tag(model) ⇒ Object
12 13 14 |
# File 'app/helpers/cms9/application_helper.rb', line 12 def cms9_text_area_tag(model) raw(model.to_s) end |
#cms9_text_tag(model) ⇒ Object
8 9 10 |
# File 'app/helpers/cms9/application_helper.rb', line 8 def cms9_text_tag(model) model.to_s end |
#cms9_time_tag(model) ⇒ Object
36 37 38 |
# File 'app/helpers/cms9/application_helper.rb', line 36 def cms9_time_tag(model) model.to_s end |
#field_blank(field) ⇒ Object
57 58 59 |
# File 'app/helpers/cms9/application_helper.rb', line 57 def field_blank(field) field.blank? end |
#field_value(field) ⇒ Object
61 62 63 |
# File 'app/helpers/cms9/application_helper.rb', line 61 def field_value(field) field.value.blank? end |