rails_bootstrap_form 0.9.8 → 0.9.9

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: 73b8b86f78e40f77d36ba3857ef15c9efe939480d327011ba083132d48668654
4
- data.tar.gz: 897ed641bdc6147d29698901a0b9f37ce71a46d0581734a844cf03666fbf5c20
3
+ metadata.gz: 4d162d5f0c75c1cb4197b2a39c2a97507701b9551a36ed8dec2d0c854d1f1765
4
+ data.tar.gz: ed59ebe1781a986acaa02e21d58a0de124bd28db51416ab95651394bd77c3c60
5
5
  SHA512:
6
- metadata.gz: 0b5ee6a90da2f11246c01c6f41f01d0fe067cd07ba26b56773e50b6c67c3b87e67d8714694c0c11240d31cb8d58255c58610dbf6304cea21fd547abdc718f8db
7
- data.tar.gz: 1554395fcabb6df7f38722c5a26eb680b8436c7bd54f9567477db6b302208872d53417abca1d219a89f48c7fcff8ff8b22e9c26aafa194c79bd683eb83a2ed85
6
+ metadata.gz: ce0eb94537c026a961c5323567e150c4c3c962252d6e670317a08176d6dc70c65aca0c70ea66dbf1ab90b874f25363218fc6fe084d819282b9310618e9853a2f
7
+ data.tar.gz: 5b7c554cc34e2e9d603f623a263bef1ad019fe2e9ff0c27a276e2c2196a92502d28d1a123e0c9ec93d38115e4c78c0174b8ef6500d3278e86908c25e094dfba6
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ 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.9](https://github.com/shivam091/rails_bootstrap_form/compare/v0.9.8...v0.9.9) - 2023-07-02
8
+
9
+ - Code smell fixes and removed `role="form"` from demo application and readme.
10
+
7
11
  ## [0.9.8](https://github.com/shivam091/rails_bootstrap_form/compare/v0.9.7...v0.9.8) - 2023-07-01
8
12
 
9
13
  ### What's fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_bootstrap_form (0.9.8)
4
+ rails_bootstrap_form (0.9.9)
5
5
  actionpack (~> 7.0)
6
6
  activemodel (~> 7.0)
7
7
 
data/README.md CHANGED
@@ -97,7 +97,7 @@ To get started, use the `bootstrap_form_for` helper in place of the Rails [`form
97
97
  This generates the following HTML:
98
98
 
99
99
  ```html
100
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
100
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
101
101
  <div class="mb-3">
102
102
  <label class="form-label required" for="user_email">Email address</label>
103
103
  <input class="form-control" aria-required="true" required="required" type="email" name="user[email]" id="user_email">
@@ -135,7 +135,7 @@ To get started, use the `bootstrap_form_with` helper in place of the Rails [`for
135
135
  This generates the following HTML:
136
136
 
137
137
  ```html
138
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
138
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
139
139
  <div class="mb-3">
140
140
  <label class="form-label required" for="user_email">Email address</label>
141
141
  <input class="form-control" aria-required="true" required="required" type="email" name="user[email]" id="user_email">
@@ -203,7 +203,7 @@ Here's an example of a form where one field uses different layout:
203
203
  This generates the following HTML:
204
204
 
205
205
  ```html
206
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
206
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
207
207
  <div class="mb-3">
208
208
  <label class="form-label required" for="user_name">Name</label>
209
209
  <input class="form-control" aria-required="true" required="required" type="text" name="user[name]" id="user_name">
@@ -346,7 +346,7 @@ Here's an example of how it looks like:
346
346
  This generates the following HTML:
347
347
 
348
348
  ```html
349
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
349
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
350
350
  <div class="mb-3">
351
351
  <label class="form-label required" for="user_email">Email address</label>
352
352
  <input class="form-control" aria-required="true" required="required" type="email" name="user[email]" id="user_email">
@@ -379,7 +379,7 @@ Here's an example of how it looks like by default:
379
379
  This generates the following HTML:
380
380
 
381
381
  ```html
382
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
382
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
383
383
  <div class="row mb-3">
384
384
  <label class="col-form-label col-sm-2 required" for="user_email">Email address</label>
385
385
  <div class="col-sm-10">
@@ -416,7 +416,7 @@ The `label_col_wrapper_class` and `field_col_wrapper_class` css classes can also
416
416
  This generates the following HTML:
417
417
 
418
418
  ```html
419
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
419
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
420
420
  <div class="row mb-3">
421
421
  <label class="col-form-label col-sm-2 required" for="user_name">Name</label>
422
422
  <div class="col-sm-10">
@@ -470,7 +470,7 @@ Here's an example of how it looks like:
470
470
  This generates the following HTML:
471
471
 
472
472
  ```html
473
- <form role="form" novalidate="novalidate" class="new_user row row-cols-lg-auto g-3 align-items-center" id="new_user" action="/users" accept-charset="UTF-8" method="post">
473
+ <form novalidate="novalidate" class="new_user row row-cols-lg-auto g-3 align-items-center" id="new_user" action="/users" accept-charset="UTF-8" method="post">
474
474
  <div class="col-12">
475
475
  <label class="form-label visually-hidden required" for="user_email">Email address</label>
476
476
  <input class="form-control" aria-required="true" required="required" placeholder="Email address" type="email" name="user[email]" id="user_email">
@@ -921,7 +921,7 @@ Our `fields_for` helper accepts the same arguments as the [default Rails helper]
921
921
  This generates the following HTML:
922
922
 
923
923
  ```html
924
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
924
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
925
925
  <div class="mb-3">
926
926
  <label class="form-label required" for="user_email">Email address</label>
927
927
  <input autocomplete="new-email" class="form-control" aria-required="true" required="required" type="email" name="user[email]" id="user_email">
@@ -984,7 +984,7 @@ By setting `bootstrap` option on `bootstrap_form_for` or `bootstrap_form_with`,
984
984
  This generates the following HTML:
985
985
 
986
986
  ```html
987
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
987
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
988
988
  <div class="row mb-3">
989
989
  <label class="col-form-label col-sm-2 required" for="user_email">Email address</label>
990
990
  <div class="col-sm-10">
@@ -1930,7 +1930,7 @@ The `floating` option can be used to enable Bootstrap floating labels. This opti
1930
1930
  This generates the following HTML:
1931
1931
 
1932
1932
  ```html
1933
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
1933
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
1934
1934
  <div class="mb-3">
1935
1935
  <div class="form-floating">
1936
1936
  <input class="form-control" aria-required="true" required="required" placeholder="Name" type="text" name="user[name]" id="user_name">
@@ -1994,7 +1994,7 @@ By default, fields that have validation errors will be outlined in red and the e
1994
1994
  This generates the following HTML:
1995
1995
 
1996
1996
  ```html
1997
- <form role="form" novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
1997
+ <form novalidate="novalidate" class="new_user" id="new_user" action="/users" accept-charset="UTF-8" method="post">
1998
1998
  <div class="mb-3">
1999
1999
  <label class="form-label required is-invalid" for="user_email">Email address</label>
2000
2000
  <input class="form-control is-invalid" aria-required="true" required="required" type="email" name="user[email]" id="user_email">
@@ -6,5 +6,5 @@
6
6
 
7
7
  RailsBootstrapForm.configure do |config|
8
8
  # to make forms non-compliant with W3C.
9
- config.default_form_attributes = {role: "form", novalidate: true}
9
+ config.default_form_attributes = {novalidate: true}
10
10
  end
@@ -36,6 +36,8 @@ module RailsBootstrapForm
36
36
  end
37
37
  end
38
38
 
39
+ private
40
+
39
41
  def supress_form_field_errors
40
42
  original_proc = ActionView::Base.field_error_proc
41
43
  ActionView::Base.field_error_proc = RailsBootstrapForm.field_error_proc
@@ -43,8 +45,6 @@ module RailsBootstrapForm
43
45
  ensure
44
46
  ActionView::Base.field_error_proc = original_proc
45
47
  end
46
-
47
- private :supress_form_field_errors
48
48
  end
49
49
  end
50
50
  end
@@ -30,6 +30,8 @@ module RailsBootstrapForm
30
30
  super(record_name, record_object, fields_options, &block)
31
31
  end
32
32
 
33
+ private
34
+
33
35
  def apply_default_form_options(options)
34
36
  options[:html] ||= {}
35
37
  options[:html].reverse_merge!(RailsBootstrapForm.config.default_form_attributes)
@@ -49,7 +51,5 @@ module RailsBootstrapForm
49
51
  fields_options = bootstrap.deep_merge!(fields_options)
50
52
  fields_options
51
53
  end
52
-
53
- private :apply_default_form_options, :fields_for_options, :apply_default_form_classes
54
54
  end
55
55
  end
@@ -177,6 +177,8 @@ module RailsBootstrapForm
177
177
  self.field_class ||= css_class
178
178
  end
179
179
 
180
+ private
181
+
180
182
  def set_defaults
181
183
  @disabled = false
182
184
 
@@ -216,7 +218,5 @@ module RailsBootstrapForm
216
218
 
217
219
  @render_as_button = false
218
220
  end
219
-
220
- private :set_defaults
221
221
  end
222
222
  end
@@ -21,37 +21,29 @@ module RailsBootstrapForm
21
21
  include Buttons
22
22
  include Choice
23
23
 
24
- def self.included(base_class)
25
- def sanitized_tag_name(attribute, value)
26
- # label's `for` attribute needs to match checkbox/radio button tag's id, IE sanitized value, IE
27
- # https://github.com/rails/rails/blob/5-0-stable/actionview/lib/action_view/helpers/tags/base.rb#L123-L125
28
- "#{@object_name}_#{attribute}_#{value.to_s.gsub(/\s/, "_").gsub(/[^-[[:word:]]]/, "").mb_chars.downcase}"
29
- end
30
-
31
- def control_specific_class(field_tag_name)
32
- "rails-bootstrap-forms-#{field_tag_name.to_s.tr("_", "-")}"
33
- end
34
-
35
- def is_size_valid?(bootstrap)
36
- bootstrap.size && %i(sm lg).include?(bootstrap.size)
37
- end
38
-
39
- def field_offset_class(label_col_wrapper_class)
40
- label_col_wrapper_class.gsub(/\bcol-(\w+)-(\d)\b/, 'offset-\1-\2')
41
- end
42
-
43
- def add_css_class!(options, css_class)
44
- the_class = [options[:class], css_class].compact
45
- options[:class] = the_class if the_class.present?
46
- end
47
-
48
- # def remove_css_class!(options, css_class)
49
- # the_class = options[:class].to_s.split(" ")
50
- # options[:class] = (the_class - [css_class]).compact.join(" ")
51
- # options.delete(:class) if options[:class].blank?
52
- # end
53
-
54
- private :control_specific_class, :is_size_valid?, :add_css_class!
24
+ private
25
+
26
+ def sanitized_tag_name(attribute, value)
27
+ # label's `for` attribute needs to match checkbox/radio button tag's id, IE sanitized value, IE
28
+ # https://github.com/rails/rails/blob/5-0-stable/actionview/lib/action_view/helpers/tags/base.rb#L123-L125
29
+ "#{@object_name}_#{attribute}_#{value.to_s.gsub(/\s/, "_").gsub(/[^-[[:word:]]]/, "").mb_chars.downcase}"
30
+ end
31
+
32
+ def field_offset_class(label_col_wrapper_class)
33
+ label_col_wrapper_class.gsub(/\bcol-(\w+)-(\d)\b/, 'offset-\1-\2')
34
+ end
35
+
36
+ def add_css_class!(options, css_class)
37
+ the_class = [options[:class], css_class].compact
38
+ options[:class] = the_class if the_class.present?
39
+ end
40
+
41
+ def control_specific_class(field_tag_name)
42
+ "rails-bootstrap-forms-#{field_tag_name.to_s.tr("_", "-")}"
43
+ end
44
+
45
+ def is_size_valid?(bootstrap)
46
+ bootstrap.size && %i(sm lg).include?(bootstrap.size)
55
47
  end
56
48
  end
57
49
  end
@@ -3,6 +3,6 @@
3
3
  # -*- warn_indent: true -*-
4
4
 
5
5
  module RailsBootstrapForm
6
- VERSION = "0.9.8".freeze
6
+ VERSION = "0.9.9".freeze
7
7
  REQUIRED_RAILS_VERSION = "~> 7.0".freeze
8
8
  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.9.8
4
+ version: 0.9.9
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-07-01 00:00:00.000000000 Z
11
+ date: 2023-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: generator_spec