bootstrap_form 4.5.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +46 -0
  3. data/.gitignore +16 -1
  4. data/.rubocop.yml +17 -14
  5. data/CHANGELOG.md +32 -1
  6. data/CONTRIBUTING.md +65 -5
  7. data/Dangerfile +5 -7
  8. data/Dockerfile +26 -0
  9. data/Gemfile +4 -3
  10. data/README.md +63 -40
  11. data/UPGRADE-4.0.md +1 -1
  12. data/UPGRADE-5.0.md +25 -0
  13. data/bootstrap_form.gemspec +8 -6
  14. data/demo/app/assets/config/manifest.js +1 -2
  15. data/demo/app/helpers/bootstrap_helper.rb +4 -4
  16. data/demo/app/views/bootstrap/form.html.erb +13 -0
  17. data/demo/app/views/layouts/application.html.erb +3 -3
  18. data/demo/config/environments/development.rb +1 -1
  19. data/demo/config/puma.rb +2 -2
  20. data/demo/db/schema.rb +2 -2
  21. data/docker-compose.yml +70 -0
  22. data/gemfiles/5.2.gemfile +2 -15
  23. data/gemfiles/6.0.gemfile +2 -17
  24. data/gemfiles/6.1.gemfile +4 -0
  25. data/gemfiles/edge.gemfile +2 -17
  26. data/lib/bootstrap_form/components/labels.rb +1 -1
  27. data/lib/bootstrap_form/components/validation.rb +1 -1
  28. data/lib/bootstrap_form/configuration.rb +1 -2
  29. data/lib/bootstrap_form/form_builder.rb +2 -4
  30. data/lib/bootstrap_form/form_group.rb +21 -10
  31. data/lib/bootstrap_form/form_group_builder.rb +6 -8
  32. data/lib/bootstrap_form/helpers/bootstrap.rb +11 -10
  33. data/lib/bootstrap_form/inputs/base.rb +5 -5
  34. data/lib/bootstrap_form/inputs/check_box.rb +8 -22
  35. data/lib/bootstrap_form/inputs/collection_select.rb +1 -0
  36. data/lib/bootstrap_form/inputs/file_field.rb +3 -15
  37. data/lib/bootstrap_form/inputs/grouped_collection_select.rb +1 -0
  38. data/lib/bootstrap_form/inputs/radio_button.rb +7 -25
  39. data/lib/bootstrap_form/inputs/select.rb +1 -0
  40. data/lib/bootstrap_form/inputs/time_zone_select.rb +1 -0
  41. data/lib/bootstrap_form/version.rb +1 -1
  42. data/lib/bootstrap_form.rb +1 -2
  43. metadata +24 -6
  44. data/.travis.yml +0 -35
@@ -8,28 +8,16 @@ module BootstrapForm
8
8
 
9
9
  included do
10
10
  def file_field_with_bootstrap(name, options={})
11
- options = options.reverse_merge(control_class: "custom-file-input")
11
+ options = options.reverse_merge(control_class: "form-control")
12
12
  form_group_builder(name, options) do
13
- content_tag(:div, class: "custom-file") do
14
- input_with_error(name) do
15
- file_field_input(name, options)
16
- end
13
+ input_with_error(name) do
14
+ file_field_without_bootstrap(name, options)
17
15
  end
18
16
  end
19
17
  end
20
18
 
21
19
  bootstrap_alias :file_field
22
20
  end
23
-
24
- private
25
-
26
- def file_field_input(name, options)
27
- placeholder = options.delete(:placeholder) || "Choose file"
28
- placeholder_opts = { class: "custom-file-label" }
29
- placeholder_opts[:for] = options[:id] if options[:id].present?
30
-
31
- file_field_without_bootstrap(name, options) + label(name, placeholder, placeholder_opts)
32
- end
33
21
  end
34
22
  end
35
23
  end
@@ -12,6 +12,7 @@ module BootstrapForm
12
12
  def grouped_collection_select_with_bootstrap(method, collection, group_method,
13
13
  group_label_method, option_key_method,
14
14
  option_value_method, options={}, html_options={})
15
+ html_options = html_options.reverse_merge(control_class: "form-select")
15
16
  form_group_builder(method, options, html_options) do
16
17
  input_with_error(method) do
17
18
  grouped_collection_select_without_bootstrap(method, collection, group_method,
@@ -10,11 +10,11 @@ module BootstrapForm
10
10
  def radio_button_with_bootstrap(name, value, *args)
11
11
  options = args.extract_options!.symbolize_keys!
12
12
  radio_button_options = options.except(:class, :label, :label_class, :error_message, :help,
13
- :inline, :custom, :hide_label, :skip_label, :wrapper_class)
13
+ :inline, :hide_label, :skip_label, :wrapper_class)
14
14
 
15
15
  radio_button_options[:class] = radio_button_classes(name, options)
16
16
 
17
- content_tag(:div, class: radio_button_wrapper_class(options)) do
17
+ tag.div(class: radio_button_wrapper_class(options)) do
18
18
  html = radio_button_without_bootstrap(name, value, radio_button_options)
19
19
  html.concat(radio_button_label(name, value, options)) unless options[:skip_label]
20
20
  html.concat(generate_error(name)) if options[:error_message]
@@ -34,43 +34,25 @@ module BootstrapForm
34
34
  end
35
35
 
36
36
  def radio_button_classes(name, options)
37
- classes = [options[:class]]
38
- classes << (options[:custom] ? "custom-control-input" : "form-check-input")
37
+ classes = Array(options[:class]) << "form-check-input"
39
38
  classes << "is-invalid" if error?(name)
40
39
  classes << "position-static" if options[:skip_label] || options[:hide_label]
41
40
  classes.flatten.compact
42
41
  end
43
42
 
44
43
  def radio_button_label_class(options)
45
- classes = []
46
- classes << (options[:custom] ? "custom-control-label" : "form-check-label")
44
+ classes = ["form-check-label"]
47
45
  classes << options[:label_class]
48
46
  classes << hide_class if options[:hide_label]
49
47
  classes.flatten.compact
50
48
  end
51
49
 
52
50
  def radio_button_wrapper_class(options)
53
- classes = []
54
- classes << if options[:custom]
55
- custom_radio_button_wrapper_class(options)
56
- else
57
- standard_radio_button_wrapper_class(options)
58
- end
59
- classes << options[:wrapper_class] if options[:wrapper_class].present?
60
- classes.flatten.compact
61
- end
62
-
63
- def standard_radio_button_wrapper_class(options)
64
- classes = %w[form-check]
51
+ classes = ["form-check"]
65
52
  classes << "form-check-inline" if layout_inline?(options[:inline])
66
53
  classes << "disabled" if options[:disabled]
67
- classes
68
- end
69
-
70
- def custom_radio_button_wrapper_class(options)
71
- classes = %w[custom-control custom-radio]
72
- classes << "custom-control-inline" if layout_inline?(options[:inline])
73
- classes
54
+ classes << options[:wrapper_class] if options[:wrapper_class].present?
55
+ classes.flatten.compact
74
56
  end
75
57
  end
76
58
  end
@@ -8,6 +8,7 @@ module BootstrapForm
8
8
 
9
9
  included do
10
10
  def select_with_bootstrap(method, choices=nil, options={}, html_options={}, &block)
11
+ html_options = html_options.reverse_merge(control_class: "form-select")
11
12
  form_group_builder(method, options, html_options) do
12
13
  prepend_and_append_input(method, options) do
13
14
  select_without_bootstrap(method, choices, options, html_options, &block)
@@ -8,6 +8,7 @@ module BootstrapForm
8
8
 
9
9
  included do
10
10
  def time_zone_select_with_bootstrap(method, priority_zones=nil, options={}, html_options={})
11
+ html_options = html_options.reverse_merge(control_class: "form-select")
11
12
  form_group_builder(method, options, html_options) do
12
13
  input_with_error(method) do
13
14
  time_zone_select_without_bootstrap(method, priority_zones, options, html_options)
@@ -1,3 +1,3 @@
1
1
  module BootstrapForm
2
- VERSION = "4.5.0".freeze
2
+ VERSION = "5.0.0".freeze
3
3
  end
@@ -2,8 +2,7 @@
2
2
  # name and not in the usual autoload-reachable way.
3
3
  # The following line is definitely need to make `bootstrap_form` work.
4
4
  if ::Rails::VERSION::STRING > "6"
5
- require Gem::Specification.find_by_name("actiontext").gem_dir + # rubocop:disable Rails/DynamicFindBy
6
- "/app/helpers/action_text/tag_helper"
5
+ require "#{Gem::Specification.find_by_name('actiontext').gem_dir}/app/helpers/action_text/tag_helper"
7
6
  end
8
7
  require "action_view"
9
8
  require "action_pack"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Potenza
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-04-30 00:00:00.000000000 Z
12
+ date: 2021-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -39,8 +39,22 @@ dependencies:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '5.2'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '5.2'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '5.2'
42
56
  description: bootstrap_form is a rails form builder that makes it super easy to create
43
- beautiful-looking forms using Bootstrap 4
57
+ beautiful-looking forms using Bootstrap 5
44
58
  email:
45
59
  - potenza@gmail.com
46
60
  - carlos.el.lopes@gmail.com
@@ -49,13 +63,14 @@ extensions: []
49
63
  extra_rdoc_files: []
50
64
  files:
51
65
  - ".editorconfig"
66
+ - ".github/workflows/ruby.yml"
52
67
  - ".gitignore"
53
68
  - ".rubocop.yml"
54
- - ".travis.yml"
55
69
  - CHANGELOG.md
56
70
  - CODE_OF_CONDUCT.md
57
71
  - CONTRIBUTING.md
58
72
  - Dangerfile
73
+ - Dockerfile
59
74
  - Gemfile
60
75
  - LICENSE.txt
61
76
  - OLD-README.md
@@ -63,6 +78,7 @@ files:
63
78
  - RELEASING.md
64
79
  - Rakefile
65
80
  - UPGRADE-4.0.md
81
+ - UPGRADE-5.0.md
66
82
  - app/assets/stylesheets/rails_bootstrap_forms.css
67
83
  - bootstrap_form.gemspec
68
84
  - demo/.postcssrc.yml
@@ -125,8 +141,10 @@ files:
125
141
  - demo/public/favicon.ico
126
142
  - demo/test/fixtures/action_text/rich_texts.yml
127
143
  - demo/yarn.lock
144
+ - docker-compose.yml
128
145
  - gemfiles/5.2.gemfile
129
146
  - gemfiles/6.0.gemfile
147
+ - gemfiles/6.1.gemfile
130
148
  - gemfiles/edge.gemfile
131
149
  - lib/bootstrap_form.rb
132
150
  - lib/bootstrap_form/action_view_extensions/form_helper.rb
@@ -180,7 +198,7 @@ homepage: https://github.com/bootstrap-ruby/bootstrap_form
180
198
  licenses:
181
199
  - MIT
182
200
  metadata: {}
183
- post_install_message: Default form attribute role="form" will be dropped in 5.0.0
201
+ post_install_message:
184
202
  rdoc_options: []
185
203
  require_paths:
186
204
  - lib
@@ -199,5 +217,5 @@ rubyforge_project:
199
217
  rubygems_version: 2.7.6
200
218
  signing_key:
201
219
  specification_version: 4
202
- summary: Rails form builder that makes it easy to style forms using Bootstrap 4
220
+ summary: Rails form builder that makes it easy to style forms using Bootstrap 5
203
221
  test_files: []
data/.travis.yml DELETED
@@ -1,35 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.7.1
4
- - 2.6.5
5
- - 2.5.7
6
- gemfile:
7
- - gemfiles/6.0.gemfile
8
- - gemfiles/5.2.gemfile
9
- cache:
10
- bundler: true
11
- script:
12
- - bundle exec rake test
13
-
14
- matrix:
15
- include:
16
- # Bleeding edge Ruby
17
- - rvm: ruby-head
18
- gemfile: gemfiles/edge.gemfile
19
-
20
- # Next version of Rails
21
- - rvm: 2.7.1
22
- gemfile: gemfiles/edge.gemfile
23
-
24
- # Running one job to execute DANGER bot and linting
25
- - rvm: 2.7.1
26
- gemfile: gemfiles/6.0.gemfile
27
- script:
28
- - gem install danger
29
- - danger
30
- - bundle exec rake rubocop
31
-
32
- allow_failures:
33
- - rvm: ruby-head
34
- - rvm: 2.7.1
35
- gemfile: gemfiles/edge.gemfile