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
31
32
33
34
35
36
37
|
# File 'app/helpers/tang/application_helper.rb', line 31
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
8
9
10
|
# File 'app/helpers/tang/application_helper.rb', line 8
def created_datetime(date)
date.strftime('%Y/%m/%d %H:%M')
end
|
#current_customer ⇒ Object
27
28
29
|
# File 'app/helpers/tang/application_helper.rb', line 27
def current_customer
@current_customer
end
|
#customer_plan_cost(customer, plan) ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'app/helpers/tang/application_helper.rb', line 16
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
12
13
14
|
# File 'app/helpers/tang/application_helper.rb', line 12
def plan_cost(plan)
"#{number_to_currency(plan.amount.to_f / 100.0)}/#{plan.interval}"
end
|
#will_paginate(collection_or_options = nil, options = {}) ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'app/helpers/tang/application_helper.rb', line 39
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
|