Module: Bh::FormBuilder::Buttons
- Included in:
- Bh::FormBuilder
- Defined in:
- lib/bh/form_builder/buttons.rb
Overview
What a form is sent with, and what else it offers to press.
Constant Summary collapse
- PILL =
What a button wears: the large pill in the primary color, solid or outlined.
'btn btn-lg rounded-5 theme-primary'- SPACE =
What clears a button of the field or the button above it.
'mt-3 md:mt-4'
Instance Method Summary collapse
-
#button(value = nil, options = {}) ⇒ Object
A button is the builder's too: solid where it submits, which is what one does unless told
type: :button, and outlined where it does not. -
#submit(value = nil, options = {}) ⇒ Object
A submit is the builder's button, solid.
Instance Method Details
#button(value = nil, options = {}) ⇒ Object
A button is the builder's too: solid where it submits, which is what one does unless
told type: :button, and outlined where it does not. A disabled one given a title
says why on hover — Available soon — from a wrapper around it, since a disabled
button hears no mouse; the wrapper then takes the button's place in the column.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bh/form_builder/buttons.rb', line 22 def (value = nil, = {}, &) return (nil, value, &) if value.is_a? Hash wrapped = [:disabled] && [:title] fill = [:type].to_s == 'button' ? 'btn-outline' : 'btn-solid' classes = @template.class_names PILL, fill, (SPACE unless wrapped) = super(value, with_classes(.except(:title), classes), &) wrapped ? tooltipped(, [:title]) : end |
#submit(value = nil, options = {}) ⇒ Object
A submit is the builder's button, solid.
14 15 16 |
# File 'lib/bh/form_builder/buttons.rb', line 14 def submit(value = nil, = {}) super(value, with_classes(, "#{PILL} btn-solid #{SPACE}")) end |