Class: Playbook::PbCurrency::Currency
- Inherits:
-
Object
- Object
- Playbook::PbCurrency::Currency
show all
- Includes:
- ActionView::Context, Playbook::Props
- Defined in:
- app/pb_kits/playbook/pb_currency/currency.rb
Instance Method Summary
collapse
#generate_classname, #initialize, #prop
Instance Method Details
#amount_element ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'app/pb_kits/playbook/pb_currency/currency.rb', line 60
def amount_element
whole_part = amount.split(".")
pb_title = Playbook::PbTitle::Title.new(
size: size_value,
text: whole_part.first.to_s,
classname: "pb_currency_value",
dark: dark
)
ApplicationController.renderer.render(
partial: pb_title,
as: :object
)
end
|
#classname ⇒ Object
34
35
36
|
# File 'app/pb_kits/playbook/pb_currency/currency.rb', line 34
def classname
generate_classname("pb_currency_kit", align, size, dark_class)
end
|
#currency_symbol_element ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/pb_kits/playbook/pb_currency/currency.rb', line 38
def currency_symbol_element
pb_dollar_sign = Playbook::PbBody::Body.new(
classname: "dollar_sign",
color: "light",
dark: dark
) { symbol }
ApplicationController.renderer.render(
partial: pb_dollar_sign,
as: :object
)
end
|
#units_element ⇒ Object
75
76
77
78
79
80
81
82
|
# File 'app/pb_kits/playbook/pb_currency/currency.rb', line 75
def units_element
_, decimal_part = amount.split(".")
if unit.nil?
decimal_part.nil? ? ".00" : ".#{decimal_part}"
else
unit
end
end
|