bootstrap_concerns 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bootstrap_concerns/components_helper.rb +10 -1
- data/lib/bootstrap_concerns/form_builder.rb +5 -25
- 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: cbdccc03f2b09a57b38af5f47d1f60288ddc0af04163573b0094814a600217a3
|
|
4
|
+
data.tar.gz: 0d313a2a4e341cfa4e09a48bc71b2db63e305cdb7aa689b5928435330e2a0702
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3957e30ad08155d5f34981d916605351526c2c10c2acbf304d92a9bcf377712dd9ca13007599bd1174c56ce9612f3aca5cfc6d0affac703131307b409e406ee5
|
|
7
|
+
data.tar.gz: 7746542bf8d745d66c47ef3c56979c748a2fc8b75981a478a1e04d52e7988cd3be5c23072ba924502209831d56a642535d2017b6ef6ea00496a2f750b7a73b5e
|
|
@@ -14,6 +14,14 @@ module BootstrapConcerns
|
|
|
14
14
|
icon("check-circle-fill")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# A link to a section of the current page. A bare fragment resolves against the address bar, so the
|
|
18
|
+
# query string survives the click, and the link opts out of Turbo Drive, which would fetch the
|
|
19
|
+
# document again where the browser simply scrolls. Everything else is bs_link_to's: a button unless
|
|
20
|
+
# told `button: false`.
|
|
21
|
+
def bs_anchor_to(name, anchor, **html_options)
|
|
22
|
+
bs_link_to(name, "##{anchor}", html_options.deep_merge(data: {turbo: false}))
|
|
23
|
+
end
|
|
24
|
+
|
|
17
25
|
def bs_button_tag(content_or_options = nil, options = nil, &)
|
|
18
26
|
normalized_options =
|
|
19
27
|
if content_or_options.is_a?(Hash)
|
|
@@ -68,7 +76,8 @@ module BootstrapConcerns
|
|
|
68
76
|
html_options ||= {}
|
|
69
77
|
end
|
|
70
78
|
|
|
71
|
-
normalized_html_options.
|
|
79
|
+
button = normalized_html_options.delete(:button) { true }
|
|
80
|
+
normalized_html_options.merge!(Option.options_with_button_class(normalized_html_options)) if button
|
|
72
81
|
|
|
73
82
|
public_send(
|
|
74
83
|
method_name,
|
|
@@ -7,8 +7,6 @@ module BootstrapConcerns
|
|
|
7
7
|
FORM_SELECT_BASE_CLASS = "form-select".freeze
|
|
8
8
|
REQUIRED_CLASS = "required".freeze
|
|
9
9
|
|
|
10
|
-
delegate :content_tag, :concat, to: :@template, private: true
|
|
11
|
-
|
|
12
10
|
def bs_button(value = nil, options = {}, &)
|
|
13
11
|
normalized_options = value.is_a?(Hash) ? value : options
|
|
14
12
|
normalized_options.deep_merge!(Option.options_with_button_class(normalized_options))
|
|
@@ -55,21 +53,11 @@ module BootstrapConcerns
|
|
|
55
53
|
end
|
|
56
54
|
|
|
57
55
|
def bs_form_group(method, type, *args)
|
|
58
|
-
options = args.find { it.is_a?(Hash) && it.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
concat bs_label(method, options.slice(:required))
|
|
64
|
-
if input_group_flag
|
|
65
|
-
concat(content_tag(:div, class: "input-group") do
|
|
66
|
-
public_send("bs_#{type}", method, *args)
|
|
67
|
-
end)
|
|
68
|
-
concat error_message(method, outside: true)
|
|
69
|
-
else
|
|
70
|
-
concat(public_send("bs_#{type}", method, *args))
|
|
71
|
-
concat error_message(method)
|
|
72
|
-
end
|
|
56
|
+
options = args.find { it.is_a?(Hash) && it.has_key?(:required) }.to_h
|
|
57
|
+
|
|
58
|
+
@template.content_tag(:div, class: ComponentsHelper::MARGIN) do
|
|
59
|
+
@template.concat bs_label(method, options.slice(:required))
|
|
60
|
+
@template.concat public_send("bs_#{type}", method, *args)
|
|
73
61
|
end
|
|
74
62
|
end
|
|
75
63
|
|
|
@@ -177,14 +165,6 @@ module BootstrapConcerns
|
|
|
177
165
|
|
|
178
166
|
private
|
|
179
167
|
|
|
180
|
-
def error_message(method, outside: false)
|
|
181
|
-
return "".html_safe if object.errors[method].blank?
|
|
182
|
-
|
|
183
|
-
classes = ["invalid-feedback"]
|
|
184
|
-
classes << "d-block" if outside
|
|
185
|
-
content_tag(:div, object.errors[method].join(", "), class: classes.join(" "))
|
|
186
|
-
end
|
|
187
|
-
|
|
188
168
|
def options_with_form_check_input_class(options)
|
|
189
169
|
Option.options_with_base_class(options, FORM_CHECK_INPUT_BASE_CLASS)
|
|
190
170
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bootstrap_concerns
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Evan Brooks
|
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
94
|
version: '0'
|
|
95
95
|
requirements: []
|
|
96
|
-
rubygems_version: 4.0.
|
|
96
|
+
rubygems_version: 4.0.20
|
|
97
97
|
specification_version: 4
|
|
98
98
|
summary: Concerns for building Bootstrap components with Ruby on Rails.
|
|
99
99
|
test_files: []
|