Class: Search::DeliveryPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::DeliveryPresenter
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/delivery_presenter.rb
Overview
Renders CRM delivery search result rows as HTML cells.
Wraps a ViewDelivery projection and produces links to the delivery,
order, and customer plus formatted currency and state values.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#created_at ⇒ String
Created-at timestamp rendered through the shared datetime helper.
-
#customer_link ⇒ ActiveSupport::SafeBuffer
Linked customer full name → customer show page.
-
#delivery_link ⇒ ActiveSupport::SafeBuffer
Linked delivery number (
DE<id>) → delivery show page. -
#line_total ⇒ String
Line total formatted in the delivery's transaction currency.
-
#order_link ⇒ ActiveSupport::SafeBuffer
Linked order reference number → order show page.
-
#shipped_date ⇒ String
Shipped date and time rendered through the shared datetime helper.
-
#state ⇒ String
Human-readable delivery state name.
-
#updated_at ⇒ String
Updated-at timestamp rendered through the shared datetime helper.
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
#created_at ⇒ String
Created-at timestamp rendered through the shared datetime helper.
50 51 52 |
# File 'app/presenters/search/delivery_presenter.rb', line 50 def created_at h.render_datetime r.created_at end |
#customer_link ⇒ ActiveSupport::SafeBuffer
Linked customer full name → customer show page.
29 30 31 |
# File 'app/presenters/search/delivery_presenter.rb', line 29 def customer_link h.link_to r.customer_full_name, h.customer_path(r.customer_id) end |
#delivery_link ⇒ ActiveSupport::SafeBuffer
Linked delivery number (DE<id>) → delivery show page.
15 16 17 |
# File 'app/presenters/search/delivery_presenter.rb', line 15 def delivery_link h.link_to "DE#{r.id}", h.delivery_path(r.id) end |
#line_total ⇒ String
Line total formatted in the delivery's transaction currency.
36 37 38 |
# File 'app/presenters/search/delivery_presenter.rb', line 36 def line_total h.number_to_currency(r.line_total || 0.0, unit: r.currency_symbol) end |
#order_link ⇒ ActiveSupport::SafeBuffer
Linked order reference number → order show page.
22 23 24 |
# File 'app/presenters/search/delivery_presenter.rb', line 22 def order_link h.link_to r.order_reference_number, h.order_path(r.order_id) end |
#shipped_date ⇒ String
Shipped date and time rendered through the shared datetime helper.
43 44 45 |
# File 'app/presenters/search/delivery_presenter.rb', line 43 def shipped_date h.render_datetime(r.shipped_date) end |
#state ⇒ String
Human-readable delivery state name.
64 65 66 |
# File 'app/presenters/search/delivery_presenter.rb', line 64 def state Delivery.human_state_name(r.state) end |
#updated_at ⇒ String
Updated-at timestamp rendered through the shared datetime helper.
57 58 59 |
# File 'app/presenters/search/delivery_presenter.rb', line 57 def updated_at h.render_datetime r.updated_at end |