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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94e0f3c5edb6565a92ece2f975f82b925f8d4f8e58501fd169d182de470a1b66
4
- data.tar.gz: 2e05af5a850dc55b3b1617434beef3f4b9818f58674dae4f2d9209f89eca6a3c
3
+ metadata.gz: f748f321101c2f0f88499a1d4bc0bc64528e4476dec757cf777d8f0c401f8f73
4
+ data.tar.gz: d257304f9ddcf1f62a713d2b1af1b2771bb49291607e3f148b5c312c3a4b847e
5
5
  SHA512:
6
- metadata.gz: c3556b0c99b48ad38115de529dd71aafe5f4ff39b5d8a988c6e366a55c3d79f809439652421220c0424663dcc5c74bdc2422d1f1e0de278bbc7db091feab7748
7
- data.tar.gz: 3531e4156c12b989201d6b5cc332ff77944e81c04e3f4846f9eaf8effbdf47d2e25c4cc7fb29fa02330392291f57876c09b011378bd4fc25d6caa52f8a443007
6
+ metadata.gz: 751de8df7d4ad259428c50fc9df981cbb217471bf90cca3db10efb4c7fd493e24b30dc8cdcc86541932c98e79fcf32ebb54fdb3576ebfd6f2475c62061e2985f
7
+ data.tar.gz: 8cd0df58261044d8afd54ec00fd1a2a5ced9c6f32e22b410f3406a3fac45047abe103a1e67e610044d33b4772f96c2e599f75ad5d5a5e6ada28bc4149828a644
data/Gemfile CHANGED
@@ -17,4 +17,5 @@ group :test do
17
17
  gem "equivalent-xml"
18
18
  gem "minitest"
19
19
  gem "sqlite3"
20
+ gem "timecop"
20
21
  end
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 helper. Boostrap options are sent via html_options hash:
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"], {}, bootstrap: {label: {text: "Custom"}}
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))
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ComfyBootstrapForm
4
4
 
5
- VERSION = "4.0.5"
5
+ VERSION = "4.0.6"
6
6
 
7
7
  end
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.5
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-07-22 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails