comfy_bootstrap_form 4.0.5 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +1 -4
- data/lib/comfy_bootstrap_form/form_builder.rb +28 -2
- data/lib/comfy_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: f748f321101c2f0f88499a1d4bc0bc64528e4476dec757cf777d8f0c401f8f73
|
4
|
+
data.tar.gz: d257304f9ddcf1f62a713d2b1af1b2771bb49291607e3f148b5c312c3a4b847e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 751de8df7d4ad259428c50fc9df981cbb217471bf90cca3db10efb4c7fd493e24b30dc8cdcc86541932c98e79fcf32ebb54fdb3576ebfd6f2475c62061e2985f
|
7
|
+
data.tar.gz: 8cd0df58261044d8afd54ec00fd1a2a5ced9c6f32e22b410f3406a3fac45047abe103a1e67e610044d33b4772f96c2e599f75ad5d5a5e6ada28bc4149828a644
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -101,13 +101,10 @@ color_field file_field phone_field text_field
|
|
101
101
|
date_field month_field range_field time_field
|
102
102
|
datetime_field number_field search_field url_field
|
103
103
|
email_field password_field text_area week_field
|
104
|
+
date_select time_select datetime_select
|
104
105
|
collection_radio_buttons collection_check_boxes
|
105
106
|
```
|
106
107
|
|
107
|
-
Helpers for DateTime selects are not implemented as it's better to choose one of
|
108
|
-
many Javascript timepickers out there. For example, [Flatpickr](https://github.com/chmln/flatpickr)
|
109
|
-
is a good one.
|
110
|
-
|
111
108
|
Singular `radio_button` is not implemented as it doesn't make sense to wrap one
|
112
109
|
radio button input in Bootstrap markup.
|
113
110
|
|
@@ -11,6 +11,10 @@ module ComfyBootstrapForm
|
|
11
11
|
text_field time_field url_field week_field
|
12
12
|
].freeze
|
13
13
|
|
14
|
+
DATE_SELECT_HELPERS = %w[
|
15
|
+
date_select datetime_select time_select
|
16
|
+
].freeze
|
17
|
+
|
14
18
|
delegate :content_tag, :capture, :concat, to: :@template
|
15
19
|
|
16
20
|
# Bootstrap settings set on the form itself
|
@@ -41,9 +45,31 @@ module ComfyBootstrapForm
|
|
41
45
|
RUBY_EVAL
|
42
46
|
end
|
43
47
|
|
44
|
-
# Wrapper for select
|
48
|
+
# Wrapper for datetime select helpers. Boostrap options are sent via options hash:
|
49
|
+
#
|
50
|
+
# date_select :birthday, bootstrap: {label: {text: "Custom"}}
|
51
|
+
#
|
52
|
+
DATE_SELECT_HELPERS.each do |select_helper|
|
53
|
+
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
54
|
+
def #{select_helper}(method, options = {}, html_options = {}, &block)
|
55
|
+
bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
|
56
|
+
return super if bootstrap.disabled
|
57
|
+
|
58
|
+
add_css_class!(html_options, "d-inline-block w-auto")
|
59
|
+
add_css_class!(html_options, "custom-select") if bootstrap.custom_control
|
60
|
+
|
61
|
+
draw_form_group(bootstrap, method, html_options) do
|
62
|
+
content_tag(:div, class: "#{select_helper}") do
|
63
|
+
super(method, options, html_options, &block)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
RUBY_EVAL
|
68
|
+
end
|
69
|
+
|
70
|
+
# Wrapper for select helper. Boostrap options are sent via options hash:
|
45
71
|
#
|
46
|
-
# select :choices, ["a", "b"],
|
72
|
+
# select :choices, ["a", "b"], bootstrap: {label: {text: "Custom"}}
|
47
73
|
#
|
48
74
|
def select(method, choices = nil, options = {}, html_options = {}, &block)
|
49
75
|
bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Khabarov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|