Class: Search::ActivityTextPresenter

Inherits:
ActivityPresenter
  • Object
show all
Defined in:
app/presenters/search/activity_text_presenter.rb

Overview

Presenter: activity text presenter.

Instance Method Summary collapse

Instance Method Details



8
9
10
# File 'app/presenters/search/activity_text_presenter.rb', line 8

def activity_link
  r.activity_type_task_type
end

#assigned_resourceObject



4
5
6
# File 'app/presenters/search/activity_text_presenter.rb', line 4

def assigned_resource
  r.assigned_resource_full_name
end

#campaignObject



40
41
42
43
44
# File 'app/presenters/search/activity_text_presenter.rb', line 40

def campaign
  return unless r.has_columns?(:campaign_id, :campaign_name) && r.campaign_id && r.campaign_name

  r.campaign_name.to_s
end

#compact_notesObject



50
51
52
53
54
# File 'app/presenters/search/activity_text_presenter.rb', line 50

def compact_notes
  cn = r.try(:notes) || r.try(:description)
  cn = cn.gsub(/\[.*\]/, '').strip if cn
  cn
end

#contactObject



34
35
36
37
38
# File 'app/presenters/search/activity_text_presenter.rb', line 34

def contact
  return unless r.has_columns?(:contact_id, :contact_full_name) && r.contact_id && r.contact_full_name

  "#{r.contact_full_name} (#{r.contact_id})"
end

#customerObject



28
29
30
31
32
# File 'app/presenters/search/activity_text_presenter.rb', line 28

def customer
  return unless r.has_columns?(:customer_id, :customer_full_name) && r.customer_id && r.customer_full_name

  "#{r.customer.full_name} (CN#{r.customer_id})"
end

#customer_watch_symbolObject



12
13
14
15
16
17
# File 'app/presenters/search/activity_text_presenter.rb', line 12

def customer_watch_symbol
  res = []
  res << 'Watched' if r.customer_watch
  res << 'Open Sales Activity' if r.customer_open_sales_activity
  res.join('-')
end

#notes_indicatorObject



46
47
48
# File 'app/presenters/search/activity_text_presenter.rb', line 46

def notes_indicator
  h.text_only(compact_notes)
end

#resourceObject



19
20
21
22
23
24
25
26
# File 'app/presenters/search/activity_text_presenter.rb', line 19

def resource
  return unless r.has_columns?(:resource_id, :resource_type) && r.resource_type && r.resource_id

  res = r.resource_type.constantize.find(r.resource_id)
  return unless res

  res.to_s
end