bootstrap_concerns 0.1.7 → 0.2.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 +30 -0
- data/lib/bootstrap_concerns/option.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba655663c795075c156c70c9108f2217e471e1c583959d7525a35f458eaa654b
|
4
|
+
data.tar.gz: 5774c7622b992edfe253f983db3770a3bf4ceac04a1ff36f4a0066687a9b1cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40feafe7374290bb64df22597b5e777443794a10239ec3b0b8a6942fcbbc23653091f33913cc55ab85de13da6167a6294521825da67bcd8372d9fe4c236713b7
|
7
|
+
data.tar.gz: a18e89ca538f6f5eabf0e948a0660e8a735c5df6b701ebdb2b33d2ce3902ae6fb46cabb81f9f5630ce87753ff50f938d13ccac08c62f9bf3047923c67612fe47
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module BootstrapConcerns
|
2
2
|
module ComponentsHelper
|
3
|
+
SEARCH_COL_MARGIN = "mb-3".freeze
|
4
|
+
|
3
5
|
def assign_icon
|
4
6
|
icon("box-arrow-in-left", "Assign")
|
5
7
|
end
|
@@ -16,6 +18,22 @@ module BootstrapConcerns
|
|
16
18
|
bs_link_or_button_to(:button_to, name, options, html_options, &)
|
17
19
|
end
|
18
20
|
|
21
|
+
def bs_errors(record)
|
22
|
+
return if record.errors.empty?
|
23
|
+
|
24
|
+
content_tag(:div, class: "alert alert-danger alert-dismissible fade show mt-3") do
|
25
|
+
concat content_tag(:h5, "Errors")
|
26
|
+
concat(
|
27
|
+
content_tag(:ul, class: "mb-0") do
|
28
|
+
record.errors.full_messages.each do |message|
|
29
|
+
concat content_tag(:li, message)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
)
|
33
|
+
concat content_tag(:button, nil, type: "button", class: "btn-close", data: {bs_dismiss: "alert"})
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
19
37
|
def bs_link_or_button_to(method_name, name, options, html_options, &)
|
20
38
|
normalized_html_options =
|
21
39
|
if block_given?
|
@@ -39,6 +57,18 @@ module BootstrapConcerns
|
|
39
57
|
bs_link_or_button_to(:link_to, name, options, html_options, &)
|
40
58
|
end
|
41
59
|
|
60
|
+
def bs_search_col(&)
|
61
|
+
content_tag(:div, class: "col-12 col-sm #{SEARCH_COL_MARGIN}", &)
|
62
|
+
end
|
63
|
+
|
64
|
+
def bs_search_submit_col
|
65
|
+
content_tag(:div, class: "col-auto #{SEARCH_COL_MARGIN}") do
|
66
|
+
content_tag(:button, BootstrapConcerns::Option.options_with_button_class) do
|
67
|
+
search_icon
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
42
72
|
def copy_icon
|
43
73
|
icon("files", "Copy")
|
44
74
|
end
|
@@ -4,7 +4,7 @@ module BootstrapConcerns
|
|
4
4
|
DEFAULT_BUTTON_COLOR = "primary".freeze
|
5
5
|
|
6
6
|
class << self
|
7
|
-
def options_with_button_class(options)
|
7
|
+
def options_with_button_class(options = {})
|
8
8
|
color = prefixed_option(options, key: :color, prefix: BUTTON_BASE_CLASS, default: DEFAULT_BUTTON_COLOR)
|
9
9
|
size = prefixed_option(options, key: :size, prefix: BUTTON_BASE_CLASS)
|
10
10
|
options_with_base_class(options, BUTTON_BASE_CLASS, color, size)
|