comfy_bootstrap_form 4.0.7 → 4.0.8
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/.gitignore +1 -0
- data/.rubocop.yml +6 -17
- data/Gemfile +1 -1
- data/LICENSE.md +1 -1
- data/README.md +25 -38
- data/Rakefile +1 -0
- data/comfy_bootstrap_form.gemspec +1 -1
- data/demo.png +0 -0
- data/lib/comfy_bootstrap_form/bootstrap_options.rb +1 -1
- data/lib/comfy_bootstrap_form/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f5fa277272eb5da836a4e05b86c6d6ed5b8c83477503a03996b6a6816e62d87
|
4
|
+
data.tar.gz: dd88bf038a1ac1db7e084a263745a66a45d5bab772cc4eea8b6b897ef8b337b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 396e6c5fb5dfe2568131ef03e2cdb8d994b40cb25e61b5aff2bc72d316ac5a7d7219de86cf4cbfa612b640de08651dabd4485f22ca48911850524e086ccfb976
|
7
|
+
data.tar.gz: 6052ea69accbea6fd3a9fc830894b7f92df80465d9e6cf8ead442853261d15727aa1d6a379196589397399a28c4ffa0c045e79b771d78613d973a1ab1b9a976f
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -3,10 +3,6 @@ AllCops:
|
|
3
3
|
Exclude:
|
4
4
|
- demo/**/*
|
5
5
|
|
6
|
-
# -- Performance ---------------------------------------------------------------
|
7
|
-
Performance/Casecmp:
|
8
|
-
Enabled: false
|
9
|
-
|
10
6
|
# -- Metrics -------------------------------------------------------------------
|
11
7
|
Metrics/PerceivedComplexity:
|
12
8
|
Enabled: false
|
@@ -14,15 +10,9 @@ Metrics/PerceivedComplexity:
|
|
14
10
|
Metrics/MethodLength:
|
15
11
|
Enabled: false
|
16
12
|
|
17
|
-
Metrics/MethodLength:
|
18
|
-
Enabled: false
|
19
|
-
|
20
13
|
Metrics/ParameterLists:
|
21
14
|
Enabled: false
|
22
15
|
|
23
|
-
Metrics/LineLength:
|
24
|
-
Max: 120
|
25
|
-
|
26
16
|
Metrics/CyclomaticComplexity:
|
27
17
|
Enabled: false
|
28
18
|
|
@@ -36,7 +26,10 @@ Metrics/AbcSize:
|
|
36
26
|
Enabled: false
|
37
27
|
|
38
28
|
# -- Layout --------------------------------------------------------------------
|
39
|
-
Layout/
|
29
|
+
Layout/LineLength:
|
30
|
+
Max: 120
|
31
|
+
|
32
|
+
Layout/HashAlignment:
|
40
33
|
EnforcedColonStyle: table
|
41
34
|
|
42
35
|
Layout/MultilineOperationIndentation:
|
@@ -48,7 +41,7 @@ Layout/MultilineMethodCallIndentation:
|
|
48
41
|
Layout/MultilineHashBraceLayout:
|
49
42
|
Enabled: false
|
50
43
|
|
51
|
-
Layout/
|
44
|
+
Layout/FirstArrayElementIndentation:
|
52
45
|
EnforcedStyle: consistent
|
53
46
|
|
54
47
|
Layout/EmptyLinesAroundModuleBody:
|
@@ -60,7 +53,7 @@ Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
|
60
53
|
Layout/EmptyLinesAroundClassBody:
|
61
54
|
EnforcedStyle: empty_lines_except_namespace
|
62
55
|
|
63
|
-
Layout/
|
56
|
+
Layout/ParameterAlignment:
|
64
57
|
Enabled: false
|
65
58
|
|
66
59
|
Layout/AccessModifierIndentation:
|
@@ -95,10 +88,6 @@ Style/AsciiComments:
|
|
95
88
|
Enabled: false
|
96
89
|
|
97
90
|
# -- Exceptions ----------------------------------------------------------------
|
98
|
-
Performance/RedundantMerge:
|
99
|
-
Exclude:
|
100
|
-
- 'lib/comfy_bootstrap_form/view_helper.rb'
|
101
|
-
|
102
91
|
Naming/AccessorMethodName:
|
103
92
|
Exclude:
|
104
93
|
- 'lib/comfy_bootstrap_form/bootstrap_options.rb'
|
data/Gemfile
CHANGED
@@ -17,7 +17,7 @@ gem "sqlite3"
|
|
17
17
|
group :development do
|
18
18
|
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
19
19
|
gem "listen", ">= 3.0.5", "< 3.2"
|
20
|
-
gem "rubocop", "0.
|
20
|
+
gem "rubocop", "0.78.0", require: false
|
21
21
|
gem "sassc-rails"
|
22
22
|
gem "web-console", ">= 3.3.0"
|
23
23
|
gem "webpacker"
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -62,10 +62,6 @@ This will generate HTML similar to this:
|
|
62
62
|
</form>
|
63
63
|
```
|
64
64
|
|
65
|
-
Feel free to take a look at the [Demo App](/demo) to see how everything renders.
|
66
|
-
Specifically see [form.html.erb](/demo/app/views/bootstrap/form.html.erb) template
|
67
|
-
for all kinds of different form configurations you can have.
|
68
|
-
|
69
65
|
## Form helpers
|
70
66
|
|
71
67
|
#### bootstrap_form_with
|
@@ -103,6 +99,7 @@ datetime_field number_field search_field url_field
|
|
103
99
|
email_field password_field text_area week_field
|
104
100
|
date_select time_select datetime_select
|
105
101
|
collection_radio_buttons collection_check_boxes
|
102
|
+
rich_text_area
|
106
103
|
```
|
107
104
|
|
108
105
|
Singular `radio_button` is not implemented as it doesn't make sense to wrap one
|
@@ -122,7 +119,7 @@ gem takes care of rendering of labels and inputs for you.
|
|
122
119
|
You may choose to render inputs inline:
|
123
120
|
|
124
121
|
```erb
|
125
|
-
<%= form.collection_check_boxes :choices, Choices.all, :id, :label, bootstrap: {check_inline: true} %>
|
122
|
+
<%= form.collection_check_boxes :choices, Choices.all, :id, :label, bootstrap: { check_inline: true } %>
|
126
123
|
```
|
127
124
|
|
128
125
|
#### Submit
|
@@ -166,7 +163,7 @@ Bootstrap form:
|
|
166
163
|
If you need to add a label:
|
167
164
|
|
168
165
|
```erb
|
169
|
-
<%= form.form_group bootstrap: {label: {text: "Lorem"}} do %>
|
166
|
+
<%= form.form_group bootstrap: { label: {text: "Lorem" }} do %>
|
170
167
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
171
168
|
tempor incididunt ut labore et dolore magna aliqua.
|
172
169
|
<% end %>
|
@@ -190,7 +187,7 @@ prepend: nil
|
|
190
187
|
help: nil
|
191
188
|
error: nil
|
192
189
|
check_inline: false
|
193
|
-
custom_control:
|
190
|
+
custom_control: true
|
194
191
|
```
|
195
192
|
|
196
193
|
Options applied on the form level will apply to all field helpers. Options
|
@@ -198,7 +195,7 @@ on field helpers will override form-level options. For example, here's a form
|
|
198
195
|
where all labels are hidden:
|
199
196
|
|
200
197
|
```erb
|
201
|
-
<%= bootstrap_form_with model: @user, bootstrap: {label: {hide: true}} do |form| %>
|
198
|
+
<%= bootstrap_form_with model: @user, bootstrap: { label: { hide: true }} do |form| %>
|
202
199
|
<%= form.email_field :email %>
|
203
200
|
<%= form.text_field :username %>
|
204
201
|
<% end %>
|
@@ -208,7 +205,7 @@ Here's an example of a form where one field uses different label alignment:
|
|
208
205
|
|
209
206
|
```erb
|
210
207
|
<%= bootstrap_form_with model: @user do |form| %>
|
211
|
-
<%= form.email_field :email, bootstrap: {label_align_class: "text-sm-left"} %>
|
208
|
+
<%= form.email_field :email, bootstrap: { label_align_class: "text-sm-left" } %>
|
212
209
|
<%= form.text_field :username %>
|
213
210
|
<% end %>
|
214
211
|
```
|
@@ -220,7 +217,7 @@ take up 100% of the width. You can change form layout to `horizontal` to put
|
|
220
217
|
labels and corresponding inputs side by side:
|
221
218
|
|
222
219
|
```erb
|
223
|
-
<%= bootstrap_form_with model: @user, bootstrap: {layout: "horizontal"} do |form| %>
|
220
|
+
<%= bootstrap_form_with model: @user, bootstrap: { layout: "horizontal" } do |form| %>
|
224
221
|
<%= form.email_field :email %>
|
225
222
|
<% end %>
|
226
223
|
```
|
@@ -231,7 +228,7 @@ You may choose to render form elements in one line. Please note that this layout
|
|
231
228
|
won't render all form elements. Things like errors messages won't show up right.
|
232
229
|
|
233
230
|
```erb
|
234
|
-
<%= bootstrap_form_with url: "/search", bootstrap: {layout: "inline"} do |form| %>
|
231
|
+
<%= bootstrap_form_with url: "/search", bootstrap: { layout: "inline" } do |form| %>
|
235
232
|
<%= form.text_field :query %>
|
236
233
|
<%= form.submit "Search" %>
|
237
234
|
<% end %>
|
@@ -242,20 +239,20 @@ won't render all form elements. Things like errors messages won't show up right.
|
|
242
239
|
You can change label generated by Rails to something else:
|
243
240
|
|
244
241
|
```erb
|
245
|
-
<%= form.text_field :value, bootstrap: {label: "Custom Label"} %>
|
246
|
-
<%= form.text_field :value, bootstrap: {label: {text: "Custom Label"}} %>
|
242
|
+
<%= form.text_field :value, bootstrap: { label: "Custom Label" } %>
|
243
|
+
<%= form.text_field :value, bootstrap: { label: {text: "Custom Label" }} %>
|
247
244
|
```
|
248
245
|
|
249
246
|
You may hide label completely (it's still there for screen readers):
|
250
247
|
|
251
248
|
```erb
|
252
|
-
<%= form.text_field :value, bootstrap: {label: {hide: true}} %>
|
249
|
+
<%= form.text_field :value, bootstrap: { label: { hide: true }} %>
|
253
250
|
```
|
254
251
|
|
255
252
|
Custom CSS class on the label tag? Sure:
|
256
253
|
|
257
254
|
```erb
|
258
|
-
<%= form.text_field :value, bootstrap: {label: {class: "custom-label"}} %>
|
255
|
+
<%= form.text_field :value, bootstrap: { label: { class: "custom-label" }} %>
|
259
256
|
```
|
260
257
|
|
261
258
|
#### Help Text
|
@@ -263,7 +260,7 @@ Custom CSS class on the label tag? Sure:
|
|
263
260
|
You may attach help text for pretty much any field type:
|
264
261
|
|
265
262
|
```erb
|
266
|
-
<%= form.text_field :value, bootstrap: {help: "Short helpful message"} %>
|
263
|
+
<%= form.text_field :value, bootstrap: { help: "Short helpful message" } %>
|
267
264
|
```
|
268
265
|
|
269
266
|
#### Append and Prepend
|
@@ -272,7 +269,7 @@ Bootstrap allows prepending and appending content to fields via `input-group`.
|
|
272
269
|
Here's how this looks:
|
273
270
|
|
274
271
|
```erb
|
275
|
-
<%= form.text_field :value, bootstrap: {prepend: "$", append: "%"} %>
|
272
|
+
<%= form.text_field :value, bootstrap: { prepend: "$", append: "%" } %>
|
276
273
|
```
|
277
274
|
|
278
275
|
If you want to use something like a button, or other html content do this:
|
@@ -281,17 +278,17 @@ If you want to use something like a button, or other html content do this:
|
|
281
278
|
<% button_html = capture do %>
|
282
279
|
<button class="btn btn-danger">Don't Press</button>
|
283
280
|
<% end %>
|
284
|
-
<%= form.text_field :value, bootstrap: {append: {html: button_html}} %>
|
281
|
+
<%= form.text_field :value, bootstrap: { append: { html: button_html }} %>
|
285
282
|
```
|
286
283
|
|
287
284
|
#### Custom Forms
|
288
285
|
|
289
286
|
Bootstrap can replace native browser form elements with custom ones for checkboxes,
|
290
|
-
radio buttons and file input field. Example usage:
|
287
|
+
radio buttons and file input field. Enabled by default. Example usage:
|
291
288
|
|
292
289
|
```erb
|
293
|
-
<%= form.file_field :photo, bootstrap: {custom_control: true} %>
|
294
|
-
<%= form.collection_radio_buttons :choice, %w[yes no], :to_s, :to_s, bootstrap: {custom_control: true} %>
|
290
|
+
<%= form.file_field :photo, bootstrap: { custom_control: true } %>
|
291
|
+
<%= form.collection_radio_buttons :choice, %w[yes no], :to_s, :to_s, bootstrap: { custom_control: true } %>
|
295
292
|
```
|
296
293
|
|
297
294
|
#### Disabling Bootstrap
|
@@ -300,7 +297,7 @@ You may completely disable bootstrap and use default form builder by passing
|
|
300
297
|
`disabled: true` option. For example:
|
301
298
|
|
302
299
|
```erb
|
303
|
-
<%= form.text_field :username, bootstrap: {disabled: true} %>
|
300
|
+
<%= form.text_field :username, bootstrap: { disabled: true } %>
|
304
301
|
```
|
305
302
|
|
306
303
|
### Gotchas
|
@@ -311,24 +308,14 @@ You may completely disable bootstrap and use default form builder by passing
|
|
311
308
|
messages show up. See: [twbs/bootstrap/issues/25540](https://github.com/twbs/bootstrap/issues/25540)
|
312
309
|
For now adding `.invalid-feeback { display: block }` will work.
|
313
310
|
|
314
|
-
##
|
315
|
-
|
316
|
-
#### Horizontal
|
317
|
-
|
318
|
-

|
319
|
-
|
320
|
-
#### Horizontal With Errors
|
311
|
+
## Demo App
|
321
312
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-

|
327
|
-
|
328
|
-
#### Inline
|
313
|
+
Feel free to take a look at the [Demo App](/demo) to see how everything renders.
|
314
|
+
Specifically see [form.html.erb](/demo/app/views/bootstrap/form.html.erb) template
|
315
|
+
for all kinds of different form configurations you can have.
|
329
316
|
|
330
|
-

|
331
318
|
|
332
319
|
---
|
333
320
|
|
334
|
-
Copyright 2018-
|
321
|
+
Copyright 2018-20 Oleg Khabarov, Released under the [MIT License](LICENSE.md)
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.authors = ["Oleg Khabarov"]
|
12
12
|
s.email = ["oleg@khabarov.ca"]
|
13
13
|
s.homepage = "https://github.com/comfy/comfy-bootstrap-form"
|
14
|
-
s.summary = "Rails form builder for Bootstrap 4 markup that
|
14
|
+
s.summary = "Rails form builder for Bootstrap 4 markup that works!"
|
15
15
|
s.description = "bootstrap_form is a Rails form builder that automatically wraps "\
|
16
16
|
"form elements in Bootstrap 4 markup"
|
17
17
|
s.license = "MIT"
|
data/demo.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfy_bootstrap_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Khabarov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
43
|
- comfy_bootstrap_form.gemspec
|
44
|
+
- demo.png
|
44
45
|
- lib/comfy_bootstrap_form.rb
|
45
46
|
- lib/comfy_bootstrap_form/bootstrap_options.rb
|
46
47
|
- lib/comfy_bootstrap_form/form_builder.rb
|
@@ -69,5 +70,5 @@ rubyforge_project:
|
|
69
70
|
rubygems_version: 2.7.6
|
70
71
|
signing_key:
|
71
72
|
specification_version: 4
|
72
|
-
summary: Rails form builder for Bootstrap 4 markup that
|
73
|
+
summary: Rails form builder for Bootstrap 4 markup that works!
|
73
74
|
test_files: []
|