Module: RulesEngineView::FormFields
- Defined in:
- lib/rules_engine_view/form_fields.rb
Instance Method Summary collapse
- #re_check_box(label, name, value = "1", checked = false, options = {}) ⇒ Object
- #re_error_on(model, message) ⇒ Object
- #re_form_blank(options = {}) ⇒ Object
- #re_form_text(label, text = "", options = {}) ⇒ Object
Instance Method Details
#re_check_box(label, name, value = "1", checked = false, options = {}) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/rules_engine_view/form_fields.rb', line 17 def re_check_box(label, name, value = "1", checked = false, = {}) form_label = re_build_form_label(" ".html_safe, .except(:required).merge(:span => re_label_span())) form_data_label = re_build_form_label(label_tag(name, label, ()), ().merge(:required => [:required])) form_data = re_build_form_data(check_box_tag(name, value, checked, ()), .merge(:text => form_data_label, :class=>'re-form-field-checkbox', :span => re_data_span())) re_build_form_field(form_label + form_data, .merge(:span => re_field_span())) end |
#re_error_on(model, message) ⇒ Object
36 37 38 39 |
# File 'lib/rules_engine_view/form_fields.rb', line 36 def re_error_on(model, ) return '' if model.errors.empty? re_error_on_tag() end |
#re_form_blank(options = {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/rules_engine_view/form_fields.rb', line 30 def re_form_blank( = {}) form_label = re_build_form_label(" ".html_safe, .merge(:span => re_label_span())) form_data = re_build_form_data(" ".html_safe, .merge(:span => re_data_span())) re_build_form_field(form_label + form_data, .merge(:span => re_field_span())) end |
#re_form_text(label, text = "", options = {}) ⇒ Object
24 25 26 27 28 |
# File 'lib/rules_engine_view/form_fields.rb', line 24 def re_form_text(label, text = "", = {}) form_label = re_build_form_label(label, .merge(:span => re_label_span())) form_data = re_build_form_data("", .merge(:text => text, :span => re_data_span())) re_build_form_field(form_label + form_data, .merge(:span => re_field_span())) end |