Module: RulesEngineView::FormFields

Defined in:
lib/rules_engine_view/form_fields.rb

Instance Method Summary collapse

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, options = {})        
  form_label = re_build_form_label(" ".html_safe, options.except(:required).merge(:span => re_label_span(options)))
  form_data_label = re_build_form_label(label_tag(name, label, re_options_exclude(options)), re_options_exclude(options).merge(:required => options[:required]))
  form_data = re_build_form_data(check_box_tag(name, value, checked, re_options_exclude(options)), options.merge(:text => form_data_label, :class=>'re-form-field-checkbox', :span => re_data_span(options))) 
  re_build_form_field(form_label + form_data, options.merge(:span => re_field_span(options)))
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, message)
  return '' if model.errors.empty?
  re_error_on_tag(message)
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(options = {})
  form_label = re_build_form_label(" ".html_safe, options.merge(:span => re_label_span(options)))
  form_data = re_build_form_data(" ".html_safe, options.merge(:span => re_data_span(options))) 
  re_build_form_field(form_label + form_data, options.merge(:span => re_field_span(options)))
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 = "", options = {})        
  form_label = re_build_form_label(label, options.merge(:span => re_label_span(options)))
  form_data = re_build_form_data("", options.merge(:text => text, :span => re_data_span(options))) 
  re_build_form_field(form_label + form_data, options.merge(:span => re_field_span(options)))
end