Class: Search::LocatorRecordPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::LocatorRecordPresenter
show all
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/locator_record_presenter.rb
Instance Attribute Summary
#current_account, #options, #url_helper
Instance Method Summary
collapse
#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
#confirmed_at ⇒ Object
47
48
49
|
# File 'app/presenters/search/locator_record_presenter.rb', line 47
def confirmed_at
h.render_date r.confirmed_at
end
|
#customer_link ⇒ Object
14
15
16
|
# File 'app/presenters/search/locator_record_presenter.rb', line 14
def customer_link
h.link_to(r.customer_name, h.customer_path(r.customer_id))
end
|
#distance ⇒ Object
18
19
20
|
# File 'app/presenters/search/locator_record_presenter.rb', line 18
def distance
"#{r.distance.to_f.round(2)} mi."
end
|
#features ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/presenters/search/locator_record_presenter.rb', line 22
def features
feats = []
feats << "Retailer" if r.is_retailer
feats << "Installer" if r.is_installer
feats << "Electrician" if r.is_electrician
feats << "Remodeller/Contractor" if r.is_remodel_contractor
feats << "Maintains WY Stock" if r.maintains_wy_stock
feats << "Has WY In Floor Display" if r.has_in_floor_display
feats << "Has WY Countertop Display" if r.has_countertop_display
feats << "Has WY Marketing Materials" if r.has_marketing_materials
feats << "Has had WY Visit on #{h.render_date(r.date_of_wy_visit)}" if r.has_had_wy_visit
feats << "Supports Flooring" if r.supports_flooring
feats << "Supports Snow Melting" if r.supports_snowmelting
feats << "Supports Roof Deicing" if r.supports_roof_deicing
feats << "Supports Comfort Products" if r.supports_comfort_products
feats.join(', ')
end
|
#full_address ⇒ Object
51
52
53
54
55
56
57
|
# File 'app/presenters/search/locator_record_presenter.rb', line 51
def full_address
address = []
address << r.street1 if r.has_columns?(:street1)
address << r.street2 if r.has_columns?(:street2)
address << "#{r.city}, #{r.state_code} #{r.zip}" if r.has_columns?(:city, :state_code, :zip)
content_tag(:p, address.map(&:presence).compact.join("<br>").html_safe, class: 'text-nowrap')
end
|
#is_inactive ⇒ Object
6
7
8
|
# File 'app/presenters/search/locator_record_presenter.rb', line 6
def is_inactive
h.y r.is_inactive
end
|
#star_status_level ⇒ Object
40
41
42
43
44
45
|
# File 'app/presenters/search/locator_record_presenter.rb', line 40
def star_status_level
status = r.star_status_level || 0
h.capture do
status.times { h.concat h.fa_icon('star', style: 'color: gold') }
end
end
|
#state ⇒ Object
10
11
12
|
# File 'app/presenters/search/locator_record_presenter.rb', line 10
def state
LocatorRecord.human_state_name(r.state)
end
|