Skip to content

Commit d177832

Browse files
authored
Fix: Add missing form-control-color class for color_field (bootstrap-ruby#739)
1 parent 4cfc7ac commit d177832

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/bootstrap_form/inputs/base.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def bootstrap_field(field_name)
1010
define_method :"#{field_name}_with_bootstrap" do |name, options={}|
1111
warn_deprecated_layout_value(options)
1212
options = options.reverse_merge(control_class: "form-range") if field_name == :range_field
13+
options = options.reverse_merge(control_class: "form-control form-control-color") if field_name == :color_field
1314
form_group_builder(name, options) do
1415
prepend_and_append_input(name, options) do
1516
options[:placeholder] ||= name if options[:floating]

test/bootstrap_fields_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class BootstrapFieldsTest < ActionView::TestCase
99
expected = <<~HTML
1010
<div class="mb-3">
1111
<label class="form-label" for="user_misc">Misc</label>
12-
<input class="form-control" id="user_misc" name="user[misc]" type="color" value="#000000" />
12+
<input class="form-control form-control-color" id="user_misc" name="user[misc]" type="color" value="#000000" />
1313
</div>
1414
HTML
1515
assert_equivalent_html expected, @builder.color_field(:misc)

0 commit comments

Comments
 (0)