Module: E9Crm::LeadsHelper

Defined in:
app/helpers/e9_crm/leads_helper.rb

Instance Method Summary collapse

Instance Method Details

#custom_offer_form_fields(offer, form) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/e9_crm/leads_helper.rb', line 2

def custom_offer_form_fields(offer, form)
  @offer.parsed_custom_form_data.each do |field|
    field.symbolize_keys!

    case field[:type]
    when 'select'    then render_custom_offer_select(field, form)
    when 'checkbox'  then render_custom_offer_checkbox(field, form)
    when 'radio'     then render_custom_offer_radio(field, form)
    when 'textfield' then render_custom_offer_textfield(field, form)
    when 'textarea'  then render_custom_offer_textarea(field, form)
    end
  end
end

#render_custom_offer_checkbox(field, form) ⇒ Object



27
28
29
30
31
32
33
34
# File 'app/helpers/e9_crm/leads_helper.rb', line 27

def render_custom_offer_checkbox(field, form)
  label_html    = field[:required] ? form.label(field[:name], nil, :class => :req) : form.label(field[:name])
  safe_concat <<-HTML
    <div class="field checkbox">
      #{label_html}
    </div>
  HTML
end

#render_custom_offer_radio(field, form) ⇒ Object



56
57
58
59
60
61
62
# File 'app/helpers/e9_crm/leads_helper.rb', line 56

def render_custom_offer_radio(field, form)
  safe_concat <<-HTML
    <div class="field radio">

    </div>
  HTML
end

#render_custom_offer_select(field, form) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'app/helpers/e9_crm/leads_helper.rb', line 16

def render_custom_offer_select(field, form)
  label_html  = field[:required] ? form.label(field[:name], nil, :class => :req) : form.label(field[:name])
  select_html = form.select field[:name], options_for_select(field[:options])
  safe_concat <<-HTML
    <div class="field">
      #{label_html}
      #{select_html}
    </div>
  HTML
end

#render_custom_offer_textarea(field, form) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'app/helpers/e9_crm/leads_helper.rb', line 46

def render_custom_offer_textarea(field, form)
  label_html = field[:required] ? form.label(field[:name], nil, :class => :req) : form.label(field[:name])

  safe_concat <<-HTML
    <div class="field">
      #{label_html}
    </div>
  HTML
end

#render_custom_offer_textfield(field, form) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'app/helpers/e9_crm/leads_helper.rb', line 36

def render_custom_offer_textfield(field, form)
  label_html = field[:required] ? form.label(field[:name], nil, :class => :req) : form.label(field[:name])

  safe_concat <<-HTML
    <div class="field">
      #{label_html}
    </div>
  HTML
end