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
28
29
30
31
32
33
34
|
# File 'app/helpers/tang/application_helper.rb', line 28
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
5
6
7
|
# File 'app/helpers/tang/application_helper.rb', line 5
def created_datetime(date)
date.strftime('%Y/%m/%d %H:%M')
end
|
#current_customer ⇒ Object
24
25
26
|
# File 'app/helpers/tang/application_helper.rb', line 24
def current_customer
@current_customer
end
|
#customer_plan_cost(customer, plan) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'app/helpers/tang/application_helper.rb', line 13
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
9
10
11
|
# File 'app/helpers/tang/application_helper.rb', line 9
def plan_cost(plan)
"#{number_to_currency(plan.amount.to_f / 100.0)}/#{plan.interval}"
end
|
#will_paginate(collection_or_options = nil, options = {}) ⇒ Object
36
37
38
39
40
|
# File 'app/helpers/tang/application_helper.rb', line 36
def will_paginate(collection_or_options = nil, options = {})
options, collection_or_options = collection_or_options, nil if collection_or_options.is_a? Hash
options = options.merge renderer: BootstrapLinkRenderer unless options[:renderer]
super(*[collection_or_options, options].compact)
end
|