Class: Search::ServiceJobPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::ServiceJobPresenter
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/service_job_presenter.rb
Overview
Presents service job search results with HTML links and formatted values.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#business_phone ⇒ String
Returns the business phone number formatted for display.
-
#cell_phone ⇒ String
Returns the cell phone number formatted for display.
-
#completed_on ⇒ String
Returns the completion date formatted for display.
-
#customer_link ⇒ ActiveSupport::SafeBuffer?
Returns a link to the associated customer, if available.
-
#distance ⇒ String
Returns the distance rounded to two decimal places.
-
#home_phone ⇒ String
Returns the home phone number formatted for display.
-
#job_date ⇒ String
Returns the job date formatted for display.
Methods inherited from BasePresenter
#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u
Constructor Details
This class inherits a constructor from BasePresenter
Instance Method Details
#business_phone ⇒ String
Returns the business phone number formatted for display.
44 45 46 |
# File 'app/presenters/search/service_job_presenter.rb', line 44 def business_phone h.number_to_phone(r.business_phone) end |
#cell_phone ⇒ String
Returns the cell phone number formatted for display.
37 38 39 |
# File 'app/presenters/search/service_job_presenter.rb', line 37 def cell_phone h.number_to_phone(r.cell_phone) end |
#completed_on ⇒ String
Returns the completion date formatted for display.
58 59 60 |
# File 'app/presenters/search/service_job_presenter.rb', line 58 def completed_on h.render_date(r.completed_on) end |
#customer_link ⇒ ActiveSupport::SafeBuffer?
Returns a link to the associated customer, if available.
14 15 16 17 18 |
# File 'app/presenters/search/service_job_presenter.rb', line 14 def customer_link return unless r.has_columns?(:customer_full_name, :customer_id) h.link_to r.customer_full_name, h.customer_path(r.customer_id) end |
#distance ⇒ String
Returns the distance rounded to two decimal places.
23 24 25 |
# File 'app/presenters/search/service_job_presenter.rb', line 23 def distance "#{r.distance.to_f.round(2)} mi." end |
#home_phone ⇒ String
Returns the home phone number formatted for display.
30 31 32 |
# File 'app/presenters/search/service_job_presenter.rb', line 30 def home_phone h.number_to_phone(r.home_phone) end |
#job_date ⇒ String
Returns the job date formatted for display.
51 52 53 |
# File 'app/presenters/search/service_job_presenter.rb', line 51 def job_date h.render_date(r.job_date) end |