Module: Bh::FormBuilder::Adornments
- Included in:
- Bh::FormBuilder
- Defined in:
- lib/bh/form_builder/adornments.rb
Overview
The two controls that carry a unit inside their border: money, and a share of a hundred.
Constant Summary collapse
- PRICE =
What a price takes: no less than nothing, and the cents a currency is counted in. A caller knowing its column's scale says so and overrides the step.
{ min: 0, step: 0.01 }.freeze
- ADORN =
What the wrapper wears. Bootstrap adorns a control by wrapping it, so the border and the padding are the wrapper's and the field inside carries neither.
'form-control form-adorn d-flex'
Instance Method Summary collapse
-
#percentage_field(method, options = {}) ⇒ Object
And a share of a hundred, whose sign follows the number rather than leading it.
-
#price_field(method, options = {}) ⇒ Object
What money is typed into: the number and the currency beside it, inside one border.
Instance Method Details
#percentage_field(method, options = {}) ⇒ Object
And a share of a hundred, whose sign follows the number rather than leading it.
21 22 23 |
# File 'lib/bh/form_builder/adornments.rb', line 21 def percentage_field(method, = {}) adorned method, '%', , ending: true end |
#price_field(method, options = {}) ⇒ Object
What money is typed into: the number and the currency beside it, inside one border.
16 17 18 |
# File 'lib/bh/form_builder/adornments.rb', line 16 def price_field(method, = {}) adorned method, currency_unit, PRICE.merge() end |