Module: NdrUi::Bootstrap::FormControlClass
- Included in:
- NdrUi::BootstrapBuilder
- Defined in:
- app/builders/ndr_ui/bootstrap/form_control_class.rb
Overview
The CSS class form-control needs to be added to the following form elements:
> select > textarea > input > input
input[type="datetime"]
input[type="datetime-local"]
input[type="date"]
input[type="month"]
input[type="time"]
input[type="week"]
input[type="number"]
input[type="email"]
input[type="url"]
input[type="search"]
input[type="tel"]
input[type="color"]
and this mixin does it for the elements marked “>”
Class Method Summary collapse
Class Method Details
.add_form_control_class(method_name) ⇒ Object
24 25 26 27 28 29 |
# File 'app/builders/ndr_ui/bootstrap/form_control_class.rb', line 24 def self.add_form_control_class(method_name) define_method(method_name) do |label, *args, &proc| = (args., %w(form-control)) super(label, *(args << ), &proc) end end |
.add_select_control_class ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/builders/ndr_ui/bootstrap/form_control_class.rb', line 31 def self.add_select_control_class define_method('select') do |label, choices, *args, &proc| # TODO: Ruby 1.8 doesn't support optional arguments with `define_method`: , = *args ||= {} ||= {} = (, %w(form-control)) super(label, choices, , , &proc) end end |