Sha256: ffd0de5ae74560f046f593d0929387e84ca01bc4691db732d580a660d2717103

Contents?: true

Size: 1.79 KB

Versions: 25

Compression:

Stored size: 1.79 KB

Contents

module E9Crm::LeadsHelper
  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

  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

  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

  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

  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

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

      </div>
    HTML
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
e9_crm-0.1.34 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.33 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.32 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.31 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.30 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.29 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.28 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.27 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.26 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.25 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.24 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.23 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.22 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.21 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.20 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.19 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.18 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.17 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.16 app/helpers/e9_crm/leads_helper.rb
e9_crm-0.1.14 app/helpers/e9_crm/leads_helper.rb