Module: LeadsHelper

Defined in:
app/helpers/leads_helper.rb

Instance Method Summary collapse

Instance Method Details

#label_for_lead(lead) ⇒ Object



37
38
39
# File 'app/helpers/leads_helper.rb', line 37

def label_for_lead(lead)
  lead_tag(lead)
end

#lead_autocomplete_tag(lead) ⇒ Object



33
34
35
# File 'app/helpers/leads_helper.rb', line 33

def lead_autocomplete_tag(lead)
  lead_tag(lead)
end

#lead_edges(lead) ⇒ Object



17
18
19
20
21
# File 'app/helpers/leads_helper.rb', line 17

def lead_edges(lead)
  edges =
    (lead.parent_id ? '' : '') +
    (lead.children.size > 0 ? '' : '')
end

#lead_id(lead) ⇒ Object



2
3
4
5
# File 'app/helpers/leads_helper.rb', line 2

def lead_id(lead)
  return nil if lead.nil?
  lead.origin_label ? "[#{lead.origin_label}]" : ''
end


28
29
30
31
# File 'app/helpers/leads_helper.rb', line 28

def lead_link(lead)
  return nil if lead.nil?
  link_to(lead_tag(lead), lead)
end

#lead_no_textObject



7
8
9
# File 'app/helpers/leads_helper.rb', line 7

def lead_no_text
  '(No text)'
end

#lead_tag(lead) ⇒ Object



23
24
25
26
# File 'app/helpers/leads_helper.rb', line 23

def lead_tag(lead)
  return nil if lead.nil?
  lead_edges(lead) + lead_id(lead) + ' ' + lead_truncated_text(lead)
end

#lead_truncated_text(lead) ⇒ Object



11
12
13
14
15
# File 'app/helpers/leads_helper.rb', line 11

def lead_truncated_text(lead)
  return nil if lead.nil?
  text = lead.text || lead_no_text
  text.slice(0..25) + (text.size > 25 ? '...' : '')
end

#leads_recent_objects_partialTrue

Returns indicates a custom partial should be used, see list_helper.rb.

Returns:

  • (True)

    indicates a custom partial should be used, see list_helper.rb



47
48
49
# File 'app/helpers/leads_helper.rb', line 47

def leads_recent_objects_partial
  true
end

#leads_search_formObject



41
42
43
# File 'app/helpers/leads_helper.rb', line 41

def leads_search_form
  render('/leads/quick_search_form')
end