Class: Search::ActivityTextPresenter
- Inherits:
-
ActivityPresenter
- Object
- ActivityPresenter
- Search::ActivityTextPresenter
- Defined in:
- app/presenters/search/activity_text_presenter.rb
Overview
Plain-text variant of ActivityPresenter for CSV/Excel exports.
Instance Method Summary collapse
-
#activity_link ⇒ String
Activity task type label (no link).
-
#assigned_resource ⇒ String?
Assigned resource full name (no HTML wrapper).
-
#campaign ⇒ String?
Campaign name (no link).
-
#compact_notes ⇒ String?
Sanitized activity notes/description with bracketed text removed.
-
#contact ⇒ String?
Contact name with id (no link).
-
#customer ⇒ String?
Customer name with account number (no link).
-
#customer_watch_symbol ⇒ String
Textual customer-watch / open-sales-activity indicator.
-
#notes_indicator ⇒ String
Plain-text notes indicator.
-
#resource ⇒ String?
Polymorphic resource record, rendered as its
to_svalue.
Instance Method Details
#activity_link ⇒ String
Activity task type label (no link).
15 16 17 |
# File 'app/presenters/search/activity_text_presenter.rb', line 15 def activity_link r.activity_type_task_type end |
#assigned_resource ⇒ String?
Assigned resource full name (no HTML wrapper).
8 9 10 |
# File 'app/presenters/search/activity_text_presenter.rb', line 8 def assigned_resource r.assigned_resource_full_name end |
#campaign ⇒ String?
Campaign name (no link).
62 63 64 65 66 |
# File 'app/presenters/search/activity_text_presenter.rb', line 62 def campaign return unless r.has_columns?(:campaign_id, :campaign_name) && r.campaign_id && r.campaign_name r.campaign_name.to_s end |
#compact_notes ⇒ String?
Sanitized activity notes/description with bracketed text removed.
78 79 80 81 82 |
# File 'app/presenters/search/activity_text_presenter.rb', line 78 def compact_notes cn = r.try(:notes) || r.try(:description) cn = cn.gsub(/\[.*\]/, '').strip if cn cn end |
#contact ⇒ String?
Contact name with id (no link).
53 54 55 56 57 |
# File 'app/presenters/search/activity_text_presenter.rb', line 53 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 |
#customer ⇒ String?
Customer name with account number (no link).
44 45 46 47 48 |
# File 'app/presenters/search/activity_text_presenter.rb', line 44 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_symbol ⇒ String
Textual customer-watch / open-sales-activity indicator.
22 23 24 25 26 27 |
# File 'app/presenters/search/activity_text_presenter.rb', line 22 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_indicator ⇒ String
Plain-text notes indicator.
71 72 73 |
# File 'app/presenters/search/activity_text_presenter.rb', line 71 def notes_indicator h.text_only(compact_notes) end |
#resource ⇒ String?
Polymorphic resource record, rendered as its to_s value.
32 33 34 35 36 37 38 39 |
# File 'app/presenters/search/activity_text_presenter.rb', line 32 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 |