Module: Tang::ApplicationHelper
- Defined in:
- app/helpers/tang/application_helper.rb
Defined Under Namespace
Classes: BootstrapLinkRenderer
Instance Method Summary
collapse
Instance Method Details
#coupon_off(coupon) ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/helpers/tang/application_helper.rb', line 33
def coupon_off(coupon)
if coupon.percent_off.present?
"#{coupon.percent_off}\% off"
elsif coupon.amount_off.present?
"#{number_to_currency(coupon.amount_off.to_f / 100.0)} off"
end
end
|
#created_datetime(date) ⇒ Object
def created_date(date)
date.strftime('%Y/%m/%d')
end
10
11
12
|
# File 'app/helpers/tang/application_helper.rb', line 10
def created_datetime(date)
date.strftime('%Y/%m/%d %H:%M')
end
|
#current_customer ⇒ Object
29
30
31
|
# File 'app/helpers/tang/application_helper.rb', line 29
def current_customer
@current_customer
end
|
#customer_plan_cost(customer, plan) ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'app/helpers/tang/application_helper.rb', line 18
def customer_plan_cost(customer, plan)
amount_off = 0
if customer.has_subscription_coupon?
amount_off = customer.subscription.discount_for_plan(plan)
elsif customer.coupon.present?
amount_off = customer.discount_for_plan(plan)
end
amount = plan.amount - amount_off
"#{number_to_currency(amount.to_f / 100.0)}/#{plan.interval}"
end
|
#plan_cost(plan) ⇒ Object
14
15
16
|
# File 'app/helpers/tang/application_helper.rb', line 14
def plan_cost(plan)
"#{number_to_currency(plan.amount.to_f / 100.0)}/#{plan.interval}"
end
|
#will_paginate(collection_or_options = nil, options = {}) ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'app/helpers/tang/application_helper.rb', line 41
def will_paginate(collection_or_options = nil, options = {})
if collection_or_options.is_a? Hash
options, collection_or_options = collection_or_options, nil
end
unless options[:renderer]
options = options.merge renderer: BootstrapLinkRenderer
end
super(*[collection_or_options, options].compact)
end
|