rails_bootstrap_form 0.3.0 → 0.3.1

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: 54148096404aa5a60bc550aca63ac09e15c0ec5b6bc9de993bd908879d366908
4
- data.tar.gz: 85a7d48bf6ccf530828395265f9aa41db7be3b1bf9fc6a8f83455614449ec02a
3
+ metadata.gz: 70abffa048a738dda1992939b9169a40dd831c2d3413bab1cea5127283e53256
4
+ data.tar.gz: 179f8c46bdde787f36b8dd94d3dd1094cefebb64b6c282369590dde6c697026a
5
5
  SHA512:
6
- metadata.gz: d9569aeb686d7bef2a2c15018c46e14413c35ecb9eb18ce784cc4b074dcfdc2e5205e583cbf9ad85a6d98da8ab2939af772903c12c5d1a2d3bc0812bd908bf4f
7
- data.tar.gz: 6b7222a2477195f38db5b63aeddecf28777e8f1de3dcb17ddbcd3126c747aa61903d411bad1341976590ccfb92e1cab07c93dcb31c4e49e7743b607478acce8b
6
+ metadata.gz: aab81e40e723cf1e83c169cd8b0a67e218a87c589ff3232d2a817ba9aa788ddf9eedb3f3887d7dc551776e2eaf5e3da66421b6b71d6b90a9f43c4446c4b244b5
7
+ data.tar.gz: 15e5b383cd6a6208f112edb2c0cba378e01b320d0728d122b216d7dc288279c3f78af2dad122814b313230944405616d960406a94084d19794d52b4f1e0939c8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_bootstrap_form (0.3.0)
4
+ rails_bootstrap_form (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -4,7 +4,7 @@
4
4
  </div>
5
5
  <div class="card-body">
6
6
  <%= bootstrap_form_for @user, bootstrap_form: {} do |form| %>
7
- <%= form.text_field :name, autocomplete: "new-name", required: true, bootstrap_form: {} %>
7
+ <%= form.text_field :name, autocomplete: "new-name", bootstrap_form: {} %>
8
8
  <%= form.text_field :email, autocomplete: "new-email", bootstrap_form: {} %>
9
9
  <%= form.text_field :password, autocomplete: "new-password" %>
10
10
  <%= form.phone_field :mobile_number %>
@@ -12,8 +12,8 @@
12
12
  <%= form.check_box :terms %>
13
13
  <%= form.range_field :excellence %>
14
14
  <%= form.url_field :blog_url %>
15
- <%= form.url_field :favorite_color %>
16
- <%= form.select :fruit_id, options_for_select(::Fruit.pluck(:name, :id), form.object.fruit_id), include_blank: "Select Favorite Fruit" %>
15
+ <%= form.color_field :favorite_color %>
16
+ <%= form.select :fruit_id, options_for_select(::Fruit.pluck(:name, :id), form.object.fruit_id), {include_blank: "Select Favorite Fruit"} %>
17
17
  <%= form.collection_check_boxes :skill_ids, ::Skill.all, :id, :name do |b| %>
18
18
  <%= b.check_box + b.text %>
19
19
  <% end %>
@@ -22,7 +22,7 @@
22
22
  <%= address_form.text_field :state %>
23
23
  <%= address_form.text_field :city %>
24
24
  <%= address_form.text_field :postal_code %>
25
- <%= address_form.select :country_id, options_for_select(::Country.pluck(:name, :id), address_form.object.country_id), {include_blank: "Select Country", bootstrap: {}} %>
25
+ <%= address_form.select :country_id, options_for_select(::Country.pluck(:name, :id), address_form.object.country_id), {include_blank: "Select Country", bootstrap_form: {}} %>
26
26
  <% end %>
27
27
  <div class="mt-3">
28
28
  <%= form.submit "Register", class: "btn btn-primary" %>
@@ -10,13 +10,17 @@ module RailsBootstrapForm
10
10
  def input_group_wrapper(attribute, bootstrap_options, &block)
11
11
  input = capture(&block) || ActiveSupport::SafeBuffer.new
12
12
 
13
- prepend = attach_input(bootstrap_options, :prepend)
14
- append = attach_input(bootstrap_options, :append)
13
+ if input_group_required?(bootstrap_options)
14
+ prepend = attach_input(bootstrap_options, :prepend)
15
+ append = attach_input(bootstrap_options, :append)
15
16
 
16
- input = prepend + input + append
17
- input += generate_error(attribute)
17
+ input = prepend + input + append
18
+ input += generate_error(attribute)
18
19
 
19
- input = tag.div(input, class: input_group_classes(attribute, bootstrap_options))
20
+ input = tag.div(input, class: input_group_classes(attribute, bootstrap_options))
21
+ else
22
+ input += generate_error(attribute)
23
+ end
20
24
 
21
25
  input
22
26
  end
@@ -42,8 +46,15 @@ module RailsBootstrapForm
42
46
  tag.span(content.html_safe, class: "input-group-text")
43
47
  end
44
48
 
49
+ def input_group_required?(bootstrap_options)
50
+ [
51
+ bootstrap_options.prepend,
52
+ bootstrap_options.append
53
+ ].any?(&:present?)
54
+ end
55
+
45
56
  private :input_group_wrapper, :input_group_classes, :attach_input,
46
- :input_group_content
57
+ :input_group_content, :input_group_required?
47
58
  end
48
59
  end
49
60
  end
@@ -3,6 +3,6 @@
3
3
  # -*- warn_indent: true -*-
4
4
 
5
5
  module RailsBootstrapForm
6
- VERSION = "0.3.0".freeze
6
+ VERSION = "0.3.1".freeze
7
7
  REQUIRED_RAILS_VERSION = "~> 7.0".freeze
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_bootstrap_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harshal LADHE (shivam091)