rails_bootstrap_form 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/Gemfile.lock +1 -1
- data/README.md +51 -42
- data/demo/app/views/users/_horizontal_form.html.erb +1 -1
- data/demo/app/views/users/_inline_form.html.erb +1 -1
- data/lib/rails_bootstrap_form/bootstrap_form_builder.rb +2 -2
- data/lib/rails_bootstrap_form/bootstrap_form_options.rb +16 -10
- data/lib/rails_bootstrap_form/field_wrapper_builder.rb +2 -4
- data/lib/rails_bootstrap_form/helpers/buttons.rb +1 -1
- data/lib/rails_bootstrap_form/helpers/check_box.rb +1 -1
- data/lib/rails_bootstrap_form/helpers/radio_button.rb +1 -1
- data/lib/rails_bootstrap_form/inputs/base.rb +9 -3
- data/lib/rails_bootstrap_form/inputs/check_box.rb +10 -13
- data/lib/rails_bootstrap_form/inputs/collection_check_boxes.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/collection_radio_buttons.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/collection_select.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/color_field.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/grouped_collection_select.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/radio_button.rb +10 -13
- data/lib/rails_bootstrap_form/inputs/range_field.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/rich_text_area.rb +4 -1
- data/lib/rails_bootstrap_form/inputs/select.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/static_field.rb +1 -1
- data/lib/rails_bootstrap_form/inputs/time_zone_select.rb +5 -2
- data/lib/rails_bootstrap_form/inputs/weekday_select.rb +5 -2
- data/lib/rails_bootstrap_form/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ea5c9f97b548a1fbadb720b875c2a0a784ea6184e77b62af1191865bcef46c
|
4
|
+
data.tar.gz: 70f4b371a945958580eb8883868a799deb9b189454a1c8bf97ef263905dd0a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82b6509a781a1acd0ac837b1bd51900a2fa023bc1a55870905c25509fc48d674d1ee164ca309c8cf8446dae4364f815bf639ecab14b4c205c60cca0edd2e0a4b
|
7
|
+
data.tar.gz: f2e4dd5bcd9a4f0f4aa5763d22bc9003118b8f8ad3e56f56c16dc30defd86ea95d877d6b0fdeaca54ffc11eeb32358bf3dd5a388c7165e966c4d9f366d709fef
|
data/CHANGELOG.md
CHANGED
@@ -4,11 +4,22 @@ You can find recent releases with docs in GitHub:
|
|
4
4
|
|
5
5
|
https://github.com/shivam091/rails_bootstrap_form/releases
|
6
6
|
|
7
|
+
## [0.9.0](https://github.com/shivam091/rails_bootstrap_form/compare/v0.8.3...v0.9.0) - 2023-05-31
|
8
|
+
|
9
|
+
### What's new
|
10
|
+
|
11
|
+
- Added `disabled` option to allow user to render default Rails form builder element.
|
12
|
+
|
13
|
+
### BREAKING CHANGES
|
14
|
+
|
15
|
+
- Renamed `wrapper_options` option to `wrapper`
|
16
|
+
- Renamed `bootstrap_form` option to `bootstrap`
|
17
|
+
|
7
18
|
## [0.8.3](https://github.com/shivam091/rails_bootstrap_form/compare/v0.8.2...v0.8.3) - 2023-05-29
|
8
19
|
|
9
20
|
### What's new
|
10
21
|
|
11
|
-
- Added support to specify `
|
22
|
+
- Added support to specify `bootstrap` option on `fields_for` helper ([#30](https://github.com/shivam091/rails_bootstrap_form/issues/30))
|
12
23
|
|
13
24
|
## [0.8.2](https://github.com/shivam091/rails_bootstrap_form/compare/v0.8.1...v0.8.2) - 2023-05-28
|
14
25
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -150,10 +150,11 @@ This generates the following HTML:
|
|
150
150
|
|
151
151
|
## Bootstrap Configuration Options
|
152
152
|
|
153
|
-
Here's a list of all possible options you can pass via `
|
153
|
+
Here's a list of all possible options you can pass via `bootstrap` option that can be attached to the `bootstrap_form_for` or `bootstrap_form_with` or any field helpers inside of it:
|
154
154
|
|
155
155
|
| Option | Description | Default value |
|
156
156
|
| ------ | ------------- | ----------- |
|
157
|
+
| `disabled` | An option to disable **rails_bootstrap_form** helpers. Default rails form builder element is rendered when set to `true` | `false` |
|
157
158
|
| `layout` | Controls layout of form and field helpers. It can be `vertical` `horizontal`, or `inline`. | `vertical` |
|
158
159
|
| `field_class` | A CSS class that will be applied to all form fields. | `form-control` |
|
159
160
|
| `additional_field_class` | An additional CSS class that will be added along with the existing css classes of field helpers. | `nil` |
|
@@ -170,7 +171,7 @@ Here's a list of all possible options you can pass via `bootstrap_form` option t
|
|
170
171
|
| `floating` | An option to control whether the field should have a floating label. | `false` |
|
171
172
|
| `static_field_class` | A CSS class that will be applied to all static fields. | `form-control-plaintext` |
|
172
173
|
| `switch` | An option to control whether the check box should look like Bootstrap switches. | `false` |
|
173
|
-
| `
|
174
|
+
| `wrapper` | An option to control the HTML attributes and options that will be added to a field wrapper. | `{}` |
|
174
175
|
| `size` | An option to control the size of input groups, buttons, labels, and fields. It can be `sm` or `lg`. | `nil` |
|
175
176
|
| `inline` | An option to group checkboxes and radio buttons on the same horizontal row. | `false` |
|
176
177
|
| `label_col_class` | A CSS class that will be applied to all labels when layout is `horizontal`. | `col-form-label` |
|
@@ -187,7 +188,7 @@ Here's an example of a form where one field uses different layout:
|
|
187
188
|
<%= bootstrap_form_for @user do |form| %>
|
188
189
|
<%= form.text_field :name %>
|
189
190
|
<%= form.email_field :email %>
|
190
|
-
<%= form.password_field :password,
|
191
|
+
<%= form.password_field :password, bootstrap: {layout: :horizontal} %>
|
191
192
|
<%= form.check_box :terms, required: true %>
|
192
193
|
<%= form.primary "Register" %>
|
193
194
|
<% end %>
|
@@ -221,6 +222,14 @@ This generates the following HTML:
|
|
221
222
|
</form>
|
222
223
|
```
|
223
224
|
|
225
|
+
### Disabling Bootstrap
|
226
|
+
|
227
|
+
You can completely disable bootstrap and use default form builder by passing `disabled: true` option. For example:
|
228
|
+
|
229
|
+
```erb
|
230
|
+
<%= form.text_field :username, bootstrap: {disabled: true} %>
|
231
|
+
```
|
232
|
+
|
224
233
|
## Supported Form Helpers
|
225
234
|
|
226
235
|
This gem wraps most of the form field helpers. Here's the current list:
|
@@ -284,7 +293,7 @@ Here's an example of how it looks like by default:
|
|
284
293
|

|
285
294
|
|
286
295
|
```erb
|
287
|
-
<%= bootstrap_form_for @user,
|
296
|
+
<%= bootstrap_form_for @user, bootstrap: {layout: :horizontal} do |form| %>
|
288
297
|
<%= form.email_field :email %>
|
289
298
|
<%= form.password_field :password %>
|
290
299
|
<%= form.primary "Sign in" %>
|
@@ -315,9 +324,9 @@ The `label_col_wrapper_class` and `field_col_wrapper_class` css classes can also
|
|
315
324
|

|
316
325
|
|
317
326
|
```erb
|
318
|
-
<%= bootstrap_form_for @user,
|
327
|
+
<%= bootstrap_form_for @user, bootstrap: {layout: :horizontal} do |form| %>
|
319
328
|
<%= form.text_field :name %>
|
320
|
-
<%= form.email_field :username,
|
329
|
+
<%= form.email_field :username, bootstrap: {label_col_wrapper_class: "col-sm-2", field_col_wrapper_class: "col-sm-6"} %>
|
321
330
|
<%= form.password_field :password %>
|
322
331
|
<%= form.fields_for :address, include_id: false do |address_form| %>
|
323
332
|
<%= address_form.select :country_id, options_for_select(::Country.pluck(:name, :id), address_form.object.country_id),
|
@@ -374,7 +383,7 @@ Here's an example of how it looks like:
|
|
374
383
|

|
375
384
|
|
376
385
|
```erb
|
377
|
-
<%= bootstrap_form_for @user,
|
386
|
+
<%= bootstrap_form_for @user, bootstrap: {layout: :inline} do |form| %>
|
378
387
|
<%= form.email_field :email %>
|
379
388
|
<%= form.password_field :password %>
|
380
389
|
<%= form.primary "Sign in" %>
|
@@ -411,7 +420,7 @@ generated by the Rails.
|
|
411
420
|

|
412
421
|
|
413
422
|
```erb
|
414
|
-
<%= form.password_field :password,
|
423
|
+
<%= form.password_field :password, bootstrap: {label_text: "New password"} %>
|
415
424
|
```
|
416
425
|
|
417
426
|
This generates the following HTML:
|
@@ -429,7 +438,7 @@ to those using screen readers.
|
|
429
438
|

|
430
439
|
|
431
440
|
```erb
|
432
|
-
<%= form.password_field :password,
|
441
|
+
<%= form.password_field :password, bootstrap: {hide_label: true} %>
|
433
442
|
```
|
434
443
|
|
435
444
|
This generates the following HTML:
|
@@ -446,7 +455,7 @@ To skip a label, you can set `skip_label` option to `true`. This will not render
|
|
446
455
|

|
447
456
|
|
448
457
|
```erb
|
449
|
-
<%= form.password_field :password,
|
458
|
+
<%= form.password_field :password, bootstrap: {skip_label: true} %>
|
450
459
|
```
|
451
460
|
|
452
461
|
This generates the following HTML:
|
@@ -462,7 +471,7 @@ To add additional CSS class to the label, you can use `additional_label_class` o
|
|
462
471
|

|
463
472
|
|
464
473
|
```erb
|
465
|
-
<%= form.password_field :password,
|
474
|
+
<%= form.password_field :password, bootstrap: {additional_label_class: "text-danger"} %>
|
466
475
|
```
|
467
476
|
|
468
477
|
This generates the following HTML:
|
@@ -508,7 +517,7 @@ You can customize the help text using `help_text` option:
|
|
508
517
|

|
509
518
|
|
510
519
|
```erb
|
511
|
-
<%= form.password_field :password,
|
520
|
+
<%= form.password_field :password, bootstrap: {help_text: "Password should not be disclosed to anyone."} %>
|
512
521
|
```
|
513
522
|
|
514
523
|
This generates the following HTML:
|
@@ -547,7 +556,7 @@ You can use `prepend` and/or `append` options to attach addons to input fields:
|
|
547
556
|

|
548
557
|
|
549
558
|
```erb
|
550
|
-
<%= form.number_field :expected_ctc,
|
559
|
+
<%= form.number_field :expected_ctc, bootstrap: {prepend: "₹", append: ".00"} %>
|
551
560
|
```
|
552
561
|
|
553
562
|
This generates the following HTML:
|
@@ -568,7 +577,7 @@ If you want to attach multiple addons to the input, pass them as an array:
|
|
568
577
|

|
569
578
|
|
570
579
|
```erb
|
571
|
-
<%= form.number_field :expected_ctc,
|
580
|
+
<%= form.number_field :expected_ctc, bootstrap: {prepend: ["Gross", "₹"], append: [".00", "per annum"]} %>
|
572
581
|
```
|
573
582
|
|
574
583
|
This generates the following HTML:
|
@@ -591,7 +600,7 @@ You can also prepend and append buttons. Note that these buttons must contain th
|
|
591
600
|

|
592
601
|
|
593
602
|
```erb
|
594
|
-
<%= form.text_field :search,
|
603
|
+
<%= form.text_field :search, bootstrap: {append: form.secondary("Search")} %>
|
595
604
|
```
|
596
605
|
|
597
606
|
This generates the following HTML:
|
@@ -611,7 +620,7 @@ To add additional CSS class to the input group wrapper, you can use `additional_
|
|
611
620
|

|
612
621
|
|
613
622
|
```erb
|
614
|
-
<%= form.number_field :expected_ctc,
|
623
|
+
<%= form.number_field :expected_ctc, bootstrap: {prepend: "₹", append: ".00", additional_input_group_class: "custom-class"} %>
|
615
624
|
```
|
616
625
|
|
617
626
|
This generates the following HTML:
|
@@ -632,7 +641,7 @@ You can customize size of the input group using `size` option. Input group suppo
|
|
632
641
|

|
633
642
|
|
634
643
|
```erb
|
635
|
-
<%= form.number_field :expected_ctc,
|
644
|
+
<%= form.number_field :expected_ctc, bootstrap: {prepend: "₹", append: ".00", size: :sm} %>
|
636
645
|
```
|
637
646
|
|
638
647
|
This generates the following HTML:
|
@@ -651,7 +660,7 @@ This generates the following HTML:
|
|
651
660
|
## Form Helpers
|
652
661
|
|
653
662
|
Our form helpers accept the same arguments as the default Rails form helpers.
|
654
|
-
In order to apply addition options of `rails_bootstrap_form`, `
|
663
|
+
In order to apply addition options of `rails_bootstrap_form`, `bootstrap` object is passed in `options` argument of the helper.
|
655
664
|
Here's an example of how you pass the arguments for each form helper:
|
656
665
|
|
657
666
|
### check_box
|
@@ -680,7 +689,7 @@ You can set `switch` option to `true` if you want check box to look like switche
|
|
680
689
|

|
681
690
|
|
682
691
|
```erb
|
683
|
-
<%= form.check_box :remember_me,
|
692
|
+
<%= form.check_box :remember_me, bootstrap: {switch: true} %>
|
684
693
|
```
|
685
694
|
|
686
695
|
This generates the following HTML:
|
@@ -811,16 +820,16 @@ This generates the following HTML:
|
|
811
820
|
|
812
821
|
Our `fields_for` helper accepts the same arguments as the [default Rails helper](https://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for).
|
813
822
|
|
814
|
-
`rails_bootstrap_form` allows us to set `
|
823
|
+
`rails_bootstrap_form` allows us to set `bootstrap` option just like `bootstrap_form_for` and `bootstrap_form_with`. By setting this option on fields_for, it applies to all the fields defined for that form:
|
815
824
|
|
816
825
|

|
817
826
|
|
818
827
|
```erb
|
819
828
|
<%= bootstrap_form_for @user do |form| %>
|
820
829
|
<%= form.email_field :email, autocomplete: "new-email" %>
|
821
|
-
<%= form.password_field :password, autocomplete: "new-password",
|
830
|
+
<%= form.password_field :password, autocomplete: "new-password", bootstrap: {layout: :horizontal} %>
|
822
831
|
<%= form.phone_field :mobile_number %>
|
823
|
-
<%= form.fields_for :address, include_id: false,
|
832
|
+
<%= form.fields_for :address, include_id: false, bootstrap: {layout: :horizontal} do |address_form| %>
|
824
833
|
<%= address_form.select :country_id, options_for_select(::Country.pluck(:name, :id), address_form.object.country_id),
|
825
834
|
{include_blank: "Select Country"} %>
|
826
835
|
<% end %>
|
@@ -874,12 +883,12 @@ This generates the following HTML:
|
|
874
883
|
</form>
|
875
884
|
```
|
876
885
|
|
877
|
-
By setting `
|
886
|
+
By setting `bootstrap` option on `bootstrap_form_for` or `bootstrap_form_with`, this option also applies to all the fields defined in fields_for block:
|
878
887
|
|
879
888
|

|
880
889
|
|
881
890
|
```erb
|
882
|
-
<%= bootstrap_form_for @user,
|
891
|
+
<%= bootstrap_form_for @user, bootstrap: {layout: :horizontal} do |form| %>
|
883
892
|
<%= form.email_field :email, autocomplete: "new-email" %>
|
884
893
|
<%= form.password_field :password, autocomplete: "new-password" %>
|
885
894
|
<%= form.phone_field :mobile_number %>
|
@@ -1051,7 +1060,7 @@ This helper will render check box and label for you.
|
|
1051
1060
|

|
1052
1061
|
|
1053
1062
|
```erb
|
1054
|
-
<%= form.radio_button :gender, :male,
|
1063
|
+
<%= form.radio_button :gender, :male, bootstrap: {label_text: "Male"} %>
|
1055
1064
|
```
|
1056
1065
|
|
1057
1066
|
This generates the following HTML:
|
@@ -1068,7 +1077,7 @@ This helper also renders help text if `help_text` option is set or information o
|
|
1068
1077
|

|
1069
1078
|
|
1070
1079
|
```erb
|
1071
|
-
<%= form.radio_button :gender, :male,
|
1080
|
+
<%= form.radio_button :gender, :male, bootstrap: {label_text: "Male", help_text: "Please select your gender"} %>
|
1072
1081
|
```
|
1073
1082
|
|
1074
1083
|
This generates the following HTML:
|
@@ -1236,7 +1245,7 @@ This generates the following HTML:
|
|
1236
1245
|
## Form Options Helpers
|
1237
1246
|
|
1238
1247
|
Our form options helpers accept the same arguments as the default Rails form options helpers.
|
1239
|
-
In order to apply addition options of `rails_bootstrap_form`, `
|
1248
|
+
In order to apply addition options of `rails_bootstrap_form`, `bootstrap` object is passed in `options` argument of the helper.
|
1240
1249
|
Here's an example of how you pass the arguments for each form option helper:
|
1241
1250
|
|
1242
1251
|
### select
|
@@ -1247,7 +1256,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1247
1256
|

|
1248
1257
|
|
1249
1258
|
```erb
|
1250
|
-
<%= form.select :fruit_id, options_for_select(::Fruit.pluck(:name, :id), form.object.fruit_id), {include_blank: "Select fruit",
|
1259
|
+
<%= form.select :fruit_id, options_for_select(::Fruit.pluck(:name, :id), form.object.fruit_id), {include_blank: "Select fruit", bootstrap: {size: :sm, help_text: false}}, {onchange: "this.form.submit();"} %>
|
1251
1260
|
```
|
1252
1261
|
|
1253
1262
|
This generates the following HTML:
|
@@ -1273,7 +1282,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1273
1282
|

|
1274
1283
|
|
1275
1284
|
```erb
|
1276
|
-
<%= form.collection_select :fruit_id, ::Fruit.all, :id, :name, {include_blank: "Select fruit",
|
1285
|
+
<%= form.collection_select :fruit_id, ::Fruit.all, :id, :name, {include_blank: "Select fruit", bootstrap: {help_text: false}}, {selected: form.object.fruit_id, onchange: "this.form.submit();"} %>
|
1277
1286
|
```
|
1278
1287
|
|
1279
1288
|
This generates the following HTML:
|
@@ -1299,7 +1308,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1299
1308
|

|
1300
1309
|
|
1301
1310
|
```erb
|
1302
|
-
<%= form.grouped_collection_select :city, ::Country.includes(:cities), :cities, :name, :id, :name, {include_blank: "Select city",
|
1311
|
+
<%= form.grouped_collection_select :city, ::Country.includes(:cities), :cities, :name, :id, :name, {include_blank: "Select city", bootstrap: {floating: true}}, {onchange: "this.form.submit();"} %>
|
1303
1312
|
```
|
1304
1313
|
|
1305
1314
|
This generates the following HTML:
|
@@ -1343,7 +1352,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1343
1352
|

|
1344
1353
|
|
1345
1354
|
```erb
|
1346
|
-
<%= form.time_zone_select :timezone, ::ActiveSupport::TimeZone.all, {include_blank: "Select time zone",
|
1355
|
+
<%= form.time_zone_select :timezone, ::ActiveSupport::TimeZone.all, {include_blank: "Select time zone", bootstrap: {label_text: "Preferred time zone"}}, {onchange: "this.form.submit();"} %>
|
1347
1356
|
```
|
1348
1357
|
|
1349
1358
|
This generates the following HTML:
|
@@ -1375,7 +1384,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1375
1384
|

|
1376
1385
|
|
1377
1386
|
```erb
|
1378
|
-
<%= form.weekday_select :weekly_off, {selected: "Monday",
|
1387
|
+
<%= form.weekday_select :weekly_off, {selected: "Monday", bootstrap: {label_text: "Week off"}}, {onchange: "this.form.submit();"} %>
|
1379
1388
|
```
|
1380
1389
|
|
1381
1390
|
This generates the following HTML:
|
@@ -1403,7 +1412,7 @@ an argument and takes care of rendering labels, check boxes, and wrapper for you
|
|
1403
1412
|

|
1404
1413
|
|
1405
1414
|
```erb
|
1406
|
-
<%= form.collection_check_boxes :skill_ids, ::Skill.all, :id, :name, {
|
1415
|
+
<%= form.collection_check_boxes :skill_ids, ::Skill.all, :id, :name, {bootstrap: {layout: :horizontal}, onchange: "this.form.submit();"}, {} %>
|
1407
1416
|
```
|
1408
1417
|
|
1409
1418
|
This generates the following HTML:
|
@@ -1468,7 +1477,7 @@ an argument and takes care of rendering labels, radio button, and wrapper for yo
|
|
1468
1477
|

|
1469
1478
|
|
1470
1479
|
```erb
|
1471
|
-
<%= form.collection_radio_buttons :fruit_id, ::Fruit.all, :id, :name, {checked: form.object.fruit_id,
|
1480
|
+
<%= form.collection_radio_buttons :fruit_id, ::Fruit.all, :id, :name, {checked: form.object.fruit_id, bootstrap: {layout: :horizontal}}, {} %>
|
1472
1481
|
```
|
1473
1482
|
|
1474
1483
|
This generates the following HTML:
|
@@ -1504,7 +1513,7 @@ This generates the following HTML:
|
|
1504
1513
|
|
1505
1514
|
The multiple selects that the date and time helpers (`date_select`, `time_select`, `datetime_select`) generate are wrapped inside a `fieldset.rails-bootstrap-forms-[date|time|datetime]-select` tag.
|
1506
1515
|
This is because Bootstrap automatically styles our controls as blocks. This wrapper fixes this defining these selects as `inline-block` and a width of `auto`.
|
1507
|
-
In order to apply addition options of `rails_bootstrap_form`, `
|
1516
|
+
In order to apply addition options of `rails_bootstrap_form`, `bootstrap` object is passed in `options` argument of the helper.
|
1508
1517
|
|
1509
1518
|
### date_select
|
1510
1519
|
|
@@ -1514,7 +1523,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1514
1523
|

|
1515
1524
|
|
1516
1525
|
```erb
|
1517
|
-
<%= form.date_select :interview_date, {selected: form.object.interview_date,
|
1526
|
+
<%= form.date_select :interview_date, {selected: form.object.interview_date, bootstrap: {label_text: "Choose interview date"}}, {onchange: "this.form.submit();"} %>
|
1518
1527
|
```
|
1519
1528
|
|
1520
1529
|
This generates the following HTML:
|
@@ -1566,7 +1575,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1566
1575
|

|
1567
1576
|
|
1568
1577
|
```erb
|
1569
|
-
<%= form.time_select :interview_time, {selected: form.object.interview_time,
|
1578
|
+
<%= form.time_select :interview_time, {selected: form.object.interview_time, bootstrap: {label_text: "Choose interview time"}}, {onchange: "this.form.submit();"} %>
|
1570
1579
|
```
|
1571
1580
|
|
1572
1581
|
This generates the following HTML:
|
@@ -1610,7 +1619,7 @@ Here's an example of how you pass both options and html_options hashes:
|
|
1610
1619
|

|
1611
1620
|
|
1612
1621
|
```erb
|
1613
|
-
<%= form.datetime_select :interview_datetime, {selected: form.object.interview_datetime,
|
1622
|
+
<%= form.datetime_select :interview_datetime, {selected: form.object.interview_datetime, bootstrap: {label_text: "Choose interview date & time"}}, {onchange: "this.form.submit();"} %>
|
1614
1623
|
```
|
1615
1624
|
|
1616
1625
|
This generates the following HTML:
|
@@ -1710,7 +1719,7 @@ To render submit helper as a button helper, you can set `render_as_button` optio
|
|
1710
1719
|

|
1711
1720
|
|
1712
1721
|
```erb
|
1713
|
-
<%= form.primary "Register",
|
1722
|
+
<%= form.primary "Register", bootstrap: {render_as_button: true} %>
|
1714
1723
|
<%= form.secondary do %>
|
1715
1724
|
Sign in
|
1716
1725
|
<% end %>
|
@@ -1755,7 +1764,7 @@ The `floating` option can be used to enable Bootstrap floating labels. This opti
|
|
1755
1764
|

|
1756
1765
|
|
1757
1766
|
```erb
|
1758
|
-
<%= bootstrap_form_for @user,
|
1767
|
+
<%= bootstrap_form_for @user, bootstrap: {floating: true} do |form| %>
|
1759
1768
|
<%= form.text_field :name %>
|
1760
1769
|
<%= form.email_field :username %>
|
1761
1770
|
<%= form.password_field :password %>
|
@@ -1928,13 +1937,13 @@ Some third party plug-ins require an empty but visible label on an input control
|
|
1928
1937
|
The solution is to use a zero-width character for the label, or some other "empty" HTML. For example:
|
1929
1938
|
|
1930
1939
|
```erb
|
1931
|
-
|
1940
|
+
bootstrap: {label_text: "​".html_safe}
|
1932
1941
|
```
|
1933
1942
|
|
1934
1943
|
or
|
1935
1944
|
|
1936
1945
|
```erb
|
1937
|
-
|
1946
|
+
bootstrap: {label_text: "<span></span>".html_safe}
|
1938
1947
|
```
|
1939
1948
|
|
1940
1949
|
## Contributing
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Horizontal layout
|
4
4
|
</div>
|
5
5
|
<div class="card-body">
|
6
|
-
<%= bootstrap_form_for @user,
|
6
|
+
<%= bootstrap_form_for @user, bootstrap: {layout: :horizontal} do |form| %>
|
7
7
|
<%= form.text_field :name, autocomplete: "new-name" %>
|
8
8
|
<%= form.text_field :username, autocomplete: "new-username" %>
|
9
9
|
<%= form.email_field :email, autocomplete: "new-email" %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Inline layout
|
4
4
|
</div>
|
5
5
|
<div class="card-body">
|
6
|
-
<%= bootstrap_form_for @user,
|
6
|
+
<%= bootstrap_form_for @user, bootstrap: {layout: :inline} do |form| %>
|
7
7
|
<%= form.text_field :username, autocomplete: "new-username" %>
|
8
8
|
<%= form.password_field :password, autocomplete: "new-password" %>
|
9
9
|
<%= form.check_box :remember_me %>
|
@@ -15,7 +15,7 @@ module RailsBootstrapForm
|
|
15
15
|
attr_accessor :bootstrap_form_options
|
16
16
|
|
17
17
|
def initialize(object_name, object, template, options)
|
18
|
-
@bootstrap_form_options = RailsBootstrapForm::BootstrapFormOptions.new(options[:
|
18
|
+
@bootstrap_form_options = RailsBootstrapForm::BootstrapFormOptions.new(options[:bootstrap])
|
19
19
|
apply_default_form_options(options)
|
20
20
|
apply_default_form_classes(options)
|
21
21
|
super(object_name, object, template, options)
|
@@ -42,7 +42,7 @@ module RailsBootstrapForm
|
|
42
42
|
|
43
43
|
def fields_for_options(record_object, fields_options)
|
44
44
|
fields_options = record_object if record_object.is_a?(Hash) && record_object.extractable_options?
|
45
|
-
bootstrap_options = {
|
45
|
+
bootstrap_options = {bootstrap: options.fetch(:bootstrap, {})}
|
46
46
|
fields_options = bootstrap_options.deep_merge!(fields_options)
|
47
47
|
fields_options
|
48
48
|
end
|
@@ -6,16 +6,20 @@ module RailsBootstrapForm
|
|
6
6
|
# Container for bootstrap specific form builder options. It controls options
|
7
7
|
# that define form layout, grid sizing, and few other configurable options.
|
8
8
|
# They are passed-in into form builder helper and field helpers via
|
9
|
-
# `:
|
9
|
+
# `:bootstrap` option.
|
10
10
|
#
|
11
11
|
# For example:
|
12
12
|
#
|
13
|
-
# bootstrap_form_with model: @user,
|
14
|
-
# f.text_field :email,
|
13
|
+
# bootstrap_form_with model: @user, bootstrap: {layout: :inline} do |f|
|
14
|
+
# f.text_field :email, bootstrap: {label: {text: "Your email"}}
|
15
15
|
# end
|
16
16
|
#
|
17
17
|
class BootstrapFormOptions
|
18
18
|
|
19
|
+
# Controls whether to render default Rails form builder element.
|
20
|
+
# The default value is `false`.
|
21
|
+
attr_accessor :disabled
|
22
|
+
|
19
23
|
# Controls layout of form and field helpers. It can be "vertical,
|
20
24
|
# "horizontal", or "inline". The default value is `vertical`.
|
21
25
|
attr_accessor :layout
|
@@ -64,8 +68,8 @@ module RailsBootstrapForm
|
|
64
68
|
#
|
65
69
|
# Example:
|
66
70
|
#
|
67
|
-
# form.text_field :dollars,
|
68
|
-
# form.text_field :search,
|
71
|
+
# form.text_field :dollars, bootstrap: {input_group: {prepend: "$", append: ".00"}}
|
72
|
+
# form.text_field :search, bootstrap: {input_group: {append: button_tag("Go", type: :submit, class: "btn btn-secondary")}}
|
69
73
|
#
|
70
74
|
# Raw or HTML content to be prepended to the field.
|
71
75
|
# The default value is `nil`.
|
@@ -93,7 +97,7 @@ module RailsBootstrapForm
|
|
93
97
|
|
94
98
|
# An option to control the HTML attributes and options that will be added to
|
95
99
|
# the field wrapper. The default value is `{}`.
|
96
|
-
attr_accessor :
|
100
|
+
attr_accessor :wrapper
|
97
101
|
|
98
102
|
# An option to control the size of input groups, buttons, labels, and fields.
|
99
103
|
# The valid values are `sm` and `lg`. The default value is `nil`.
|
@@ -103,7 +107,7 @@ module RailsBootstrapForm
|
|
103
107
|
# The default value is `false`.
|
104
108
|
#
|
105
109
|
# Example:
|
106
|
-
# form.collection_radio_buttons :choices, ["yes", "no"], :to_s, :to_s,
|
110
|
+
# form.collection_radio_buttons :choices, ["yes", "no"], :to_s, :to_s, bootstrap: {inline: true}
|
107
111
|
attr_accessor :inline
|
108
112
|
|
109
113
|
# A CSS class that will be applied to all labels when layout is horizontal.
|
@@ -145,7 +149,7 @@ module RailsBootstrapForm
|
|
145
149
|
# to a given form field. For example, we can change grid just for one field:
|
146
150
|
#
|
147
151
|
# bootstrap_form_with model: @user do |f|
|
148
|
-
# f.text_field :email,
|
152
|
+
# f.text_field :email, bootstrap: {label_col_wrapper_class: "col-md-6", field_col_wrapper_class: "col-md-6"}
|
149
153
|
# f.password_field :password
|
150
154
|
# end
|
151
155
|
#
|
@@ -161,11 +165,13 @@ module RailsBootstrapForm
|
|
161
165
|
end
|
162
166
|
end
|
163
167
|
|
164
|
-
%i(inline floating switch skip_label hide_label render_as_button).each do |method|
|
168
|
+
%i(disabled inline floating switch skip_label hide_label render_as_button).each do |method|
|
165
169
|
define_method("#{method}?") { self.send(method) }
|
166
170
|
end
|
167
171
|
|
168
172
|
def set_defaults
|
173
|
+
@disabled = false
|
174
|
+
|
169
175
|
@layout = "vertical"
|
170
176
|
|
171
177
|
@field_class = "form-control"
|
@@ -190,7 +196,7 @@ module RailsBootstrapForm
|
|
190
196
|
|
191
197
|
@switch = false
|
192
198
|
|
193
|
-
@
|
199
|
+
@wrapper = {}
|
194
200
|
|
195
201
|
@size = nil
|
196
202
|
|
@@ -4,9 +4,7 @@
|
|
4
4
|
|
5
5
|
module RailsBootstrapForm
|
6
6
|
module FieldWrapperBuilder
|
7
|
-
def field_wrapper_builder(attribute, options, html_options = nil, &block)
|
8
|
-
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap_form))
|
9
|
-
|
7
|
+
def field_wrapper_builder(attribute, bootstrap_options, options, html_options = nil, &block)
|
10
8
|
field_options = field_css_options(attribute, bootstrap_options, options, html_options.try(:symbolize_keys!))
|
11
9
|
|
12
10
|
field_wrapper(attribute, bootstrap_options, field_options, &block)
|
@@ -52,7 +50,7 @@ module RailsBootstrapForm
|
|
52
50
|
def field_wrapper_options(bootstrap_options)
|
53
51
|
{}.tap do |option|
|
54
52
|
option[:class] = field_wrapper_classes(bootstrap_options)
|
55
|
-
end.merge(bootstrap_options.
|
53
|
+
end.merge(bootstrap_options.wrapper)
|
56
54
|
end
|
57
55
|
|
58
56
|
def field_wrapper_classes(bootstrap_options)
|
@@ -10,7 +10,7 @@ module RailsBootstrapForm
|
|
10
10
|
def self.included(base_class)
|
11
11
|
def render_button(value = nil, options = {}, &block)
|
12
12
|
value, options = nil, value if value.is_a?(Hash)
|
13
|
-
bootstrap_options = bootstrap_form_options.scoped(options.delete(:
|
13
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
14
14
|
|
15
15
|
button_html = if (bootstrap_options.render_as_button? || block)
|
16
16
|
button(value, options, &block)
|
@@ -30,7 +30,7 @@ module RailsBootstrapForm
|
|
30
30
|
def check_box_wrapper_options(bootstrap_options)
|
31
31
|
{}.tap do |option|
|
32
32
|
option[:class] = check_box_wrapper_class(bootstrap_options)
|
33
|
-
end.merge(bootstrap_options.
|
33
|
+
end.merge(bootstrap_options.wrapper)
|
34
34
|
end
|
35
35
|
|
36
36
|
def check_box_label_text(attribute, options, bootstrap_options, &block)
|
@@ -31,7 +31,7 @@ module RailsBootstrapForm
|
|
31
31
|
def radio_button_wrapper_options(bootstrap_options)
|
32
32
|
{}.tap do |option|
|
33
33
|
option[:class] = radio_button_wrapper_class(bootstrap_options)
|
34
|
-
end.merge(bootstrap_options.
|
34
|
+
end.merge(bootstrap_options.wrapper)
|
35
35
|
end
|
36
36
|
|
37
37
|
def radio_button_value(attribute, value)
|
@@ -10,7 +10,10 @@ module RailsBootstrapForm
|
|
10
10
|
class_methods do
|
11
11
|
def bootstrap_field(field_name)
|
12
12
|
define_method(field_name) do |attribute, options = {}|
|
13
|
-
|
13
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
14
|
+
return super(attribute, options) if bootstrap_options.disabled?
|
15
|
+
|
16
|
+
field_wrapper_builder(attribute, bootstrap_options, options) do
|
14
17
|
super(attribute, options)
|
15
18
|
end
|
16
19
|
end
|
@@ -18,9 +21,12 @@ module RailsBootstrapForm
|
|
18
21
|
|
19
22
|
def bootstrap_select_group(field_name)
|
20
23
|
define_method(field_name) do |attribute, options = {}, html_options = {}|
|
21
|
-
options = {
|
24
|
+
options = {bootstrap: {field_class: "form-select"}}.deep_merge!(options)
|
25
|
+
|
26
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
27
|
+
return super(attribute, options, html_options) if bootstrap_options.disabled?
|
22
28
|
|
23
|
-
field_wrapper_builder(attribute, options, html_options) do
|
29
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
24
30
|
tag.fieldset(class: control_specific_class(field_name)) do
|
25
31
|
super(attribute, options, html_options)
|
26
32
|
end
|
@@ -9,7 +9,8 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def check_box(attribute, options = {}, checked_value = "1", unchecked_value = "0", &block)
|
12
|
-
bootstrap_options = bootstrap_form_options.scoped(options.delete(:
|
12
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
13
|
+
return super if bootstrap_options.disabled?
|
13
14
|
|
14
15
|
options[:class] = check_box_classes(attribute, options)
|
15
16
|
|
@@ -25,20 +26,16 @@ module RailsBootstrapForm
|
|
25
26
|
concat(generate_error(attribute)) if (is_invalid?(attribute) && !bootstrap_options.inline?)
|
26
27
|
end
|
27
28
|
|
28
|
-
if bootstrap_options.inline?
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
tag.div(class: field_wrapper_classes(bootstrap_options)) do
|
33
|
-
tag.div(class: check_box_container_classes(bootstrap_options)) do
|
34
|
-
check_box_html
|
35
|
-
end
|
29
|
+
if (bootstrap_options.layout_horizontal? && !bootstrap_options.inline?)
|
30
|
+
tag.div(class: field_wrapper_classes(bootstrap_options)) do
|
31
|
+
tag.div(class: check_box_container_classes(bootstrap_options)) do
|
32
|
+
check_box_html
|
36
33
|
end
|
37
|
-
elsif bootstrap_options.layout_inline?
|
38
|
-
tag.div(class: "col-12") { check_box_html }
|
39
|
-
else
|
40
|
-
check_box_html
|
41
34
|
end
|
35
|
+
elsif bootstrap_options.layout_inline?
|
36
|
+
tag.div(class: "col-12") { check_box_html }
|
37
|
+
else
|
38
|
+
check_box_html
|
42
39
|
end
|
43
40
|
end
|
44
41
|
end
|
@@ -9,6 +9,9 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def collection_check_boxes(attribute, collection, value_method, text_method, options = {}, html_options = {})
|
12
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
13
|
+
return super if bootstrap_options.disabled?
|
14
|
+
|
12
15
|
options[:multiple] = true
|
13
16
|
|
14
17
|
inputs = ActiveSupport::SafeBuffer.new
|
@@ -16,7 +19,7 @@ module RailsBootstrapForm
|
|
16
19
|
collection.each do |object|
|
17
20
|
input_value = value_method.respond_to?(:call) ? value_method.call(object) : object.send(value_method)
|
18
21
|
input_options = {
|
19
|
-
|
22
|
+
bootstrap: {
|
20
23
|
label_text: text_method.respond_to?(:call) ? text_method.call(object) : object.send(text_method),
|
21
24
|
inline: true
|
22
25
|
}
|
@@ -29,7 +32,7 @@ module RailsBootstrapForm
|
|
29
32
|
inputs.prepend(hidden_field(attribute, value: "", multiple: options[:multiple]))
|
30
33
|
end
|
31
34
|
|
32
|
-
field_wrapper_builder(attribute, options, html_options) do
|
35
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
33
36
|
concat(tag.div(class: control_specific_class(:collection_check_boxes)) do
|
34
37
|
concat(inputs)
|
35
38
|
end)
|
@@ -9,12 +9,15 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def collection_radio_buttons(attribute, collection, value_method, text_method, options = {}, html_options = {})
|
12
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
13
|
+
return super if bootstrap_options.disabled?
|
14
|
+
|
12
15
|
inputs = ActiveSupport::SafeBuffer.new
|
13
16
|
|
14
17
|
collection.each do |object|
|
15
18
|
input_value = value_method.respond_to?(:call) ? value_method.call(object) : object.send(value_method)
|
16
19
|
input_options = {
|
17
|
-
|
20
|
+
bootstrap: {
|
18
21
|
label_text: text_method.respond_to?(:call) ? text_method.call(object) : object.send(text_method),
|
19
22
|
inline: true
|
20
23
|
}
|
@@ -27,7 +30,7 @@ module RailsBootstrapForm
|
|
27
30
|
inputs << radio_button(attribute, input_value, input_options)
|
28
31
|
end
|
29
32
|
|
30
|
-
field_wrapper_builder(attribute, options, html_options) do
|
33
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
31
34
|
concat(tag.div(class: control_specific_class(:collection_radio_buttons)) do
|
32
35
|
concat(inputs)
|
33
36
|
end)
|
@@ -9,9 +9,12 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def collection_select(attribute, collection, value_method, text_method, options = {}, html_options = {})
|
12
|
-
options = {
|
12
|
+
options = {bootstrap: {field_class: "form-select"}}.deep_merge!(options)
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
15
18
|
super(attribute, collection, value_method, text_method, options, html_options)
|
16
19
|
end
|
17
20
|
end
|
@@ -9,9 +9,12 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def color_field(attribute, options = {})
|
12
|
-
options = {
|
12
|
+
options = {bootstrap: {field_class: "form-control form-control-color"}}.deep_merge!(options)
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options) do
|
15
18
|
super(attribute, options)
|
16
19
|
end
|
17
20
|
end
|
@@ -9,9 +9,12 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def grouped_collection_select(attribute, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {})
|
12
|
-
options = {
|
12
|
+
options = {bootstrap: {field_class: "form-select"}}.deep_merge!(options)
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
15
18
|
super(attribute, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options)
|
16
19
|
end
|
17
20
|
end
|
@@ -9,7 +9,8 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def radio_button(attribute, value, options = {})
|
12
|
-
bootstrap_options = bootstrap_form_options.scoped(options.delete(:
|
12
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
13
|
+
return super if bootstrap_options.disabled?
|
13
14
|
|
14
15
|
options[:class] = radio_button_classes(attribute, options)
|
15
16
|
|
@@ -25,20 +26,16 @@ module RailsBootstrapForm
|
|
25
26
|
concat(generate_error(attribute)) if (is_invalid?(attribute) && !bootstrap_options.inline?)
|
26
27
|
end
|
27
28
|
|
28
|
-
if bootstrap_options.inline?
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
tag.div(class: field_wrapper_classes(bootstrap_options)) do
|
33
|
-
tag.div(class: radio_button_container_classes(bootstrap_options)) do
|
34
|
-
radio_button_html
|
35
|
-
end
|
29
|
+
if (bootstrap_options.layout_horizontal? && !bootstrap_options.inline?)
|
30
|
+
tag.div(class: field_wrapper_classes(bootstrap_options)) do
|
31
|
+
tag.div(class: radio_button_container_classes(bootstrap_options)) do
|
32
|
+
radio_button_html
|
36
33
|
end
|
37
|
-
elsif bootstrap_options.layout_inline?
|
38
|
-
tag.div(class: "col-12") { radio_button_html }
|
39
|
-
else
|
40
|
-
radio_button_html
|
41
34
|
end
|
35
|
+
elsif bootstrap_options.layout_inline?
|
36
|
+
tag.div(class: "col-12") { radio_button_html }
|
37
|
+
else
|
38
|
+
radio_button_html
|
42
39
|
end
|
43
40
|
end
|
44
41
|
end
|
@@ -9,9 +9,12 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def range_field(attribute, options = {})
|
12
|
-
options = {
|
12
|
+
options = {bootstrap: {field_class: "form-range"}}.deep_merge!(options)
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options) do
|
15
18
|
super(attribute, options)
|
16
19
|
end
|
17
20
|
end
|
@@ -11,7 +11,10 @@ module RailsBootstrapForm
|
|
11
11
|
def rich_text_area(attribute, options = {})
|
12
12
|
options[:class] = ["trix-content", options[:class]].compact.join(" ")
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options) do
|
15
18
|
super(attribute, options)
|
16
19
|
end
|
17
20
|
end
|
@@ -9,9 +9,12 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def select(attribute, choices = nil, options = {}, html_options = {}, &block)
|
12
|
-
options = {
|
12
|
+
options = {bootstrap: {field_class: "form-select"}}.deep_merge!(options)
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
15
18
|
super(attribute, choices, options, html_options, &block)
|
16
19
|
end
|
17
20
|
end
|
@@ -9,9 +9,12 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def time_zone_select(attribute, priority_zones = nil, options = {}, html_options = {})
|
12
|
-
options = {
|
12
|
+
options = {bootstrap: {field_class: "form-select"}}.deep_merge!(options)
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
15
18
|
super(attribute, priority_zones, options, html_options)
|
16
19
|
end
|
17
20
|
end
|
@@ -9,9 +9,12 @@ module RailsBootstrapForm
|
|
9
9
|
|
10
10
|
included do
|
11
11
|
def weekday_select(attribute, options = {}, html_options = {}, &block)
|
12
|
-
options = {
|
12
|
+
options = {bootstrap: {field_class: "form-select"}}.deep_merge!(options)
|
13
13
|
|
14
|
-
|
14
|
+
bootstrap_options = bootstrap_form_options.scoped(options.delete(:bootstrap))
|
15
|
+
return super if bootstrap_options.disabled?
|
16
|
+
|
17
|
+
field_wrapper_builder(attribute, bootstrap_options, options, html_options) do
|
15
18
|
super(attribute, options, html_options, &block)
|
16
19
|
end
|
17
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_bootstrap_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harshal LADHE (shivam091)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: generator_spec
|