polaris_view_helpers 0.0.1 → 0.0.2
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/polaris_view_helpers/helper.rb +69 -67
- data/lib/polaris_view_helpers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c3748555b4c3a22d0cabe1552387577b4ba8c14
|
4
|
+
data.tar.gz: 80e24b8191c24799b028809f39202cfacbb25086
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdec0d069d36a97cde752090dbbfedaaf3b0d3ec7af43be1690f8edbc4760449a036187c238caad1fad9138134543ac2af1873e3cd4613d774143c3e97139ca8
|
7
|
+
data.tar.gz: 97db3d61d02332b0769e1eaed3e1d13281dbdffcc2e99d521eca625f308fb63c0dcbecb31354290732805b06eb75216cb115b82a4ae5f19ec04b0272c7f3f5de
|
@@ -1,83 +1,85 @@
|
|
1
|
-
module PolarisViewHelpers
|
1
|
+
module PolarisViewHelpers
|
2
|
+
module Helper
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
def polaris_banner(options, &block)
|
5
|
+
render(
|
6
|
+
partial: 'polaris/banner',
|
7
|
+
locals: { options: options, block: block }
|
8
|
+
)
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
def polaris_banner_actions(&block)
|
12
|
+
render(
|
13
|
+
partial: 'polaris/banner_actions',
|
14
|
+
locals: { block: block }
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def polaris_button_link_to(name = nil, link_destination = nil, button_options = nil, &block)
|
19
|
+
if block_given?
|
20
|
+
button_options, link_destination, name = link_destination, name, nil
|
21
|
+
end
|
22
|
+
button_options ||= {}
|
16
23
|
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
additional_classes = ""
|
25
|
+
(button_options[:modifiers] || []).each do |modifier|
|
26
|
+
additional_classes += "Polaris-Button--#{modifier} "
|
27
|
+
end
|
28
|
+
render(
|
29
|
+
partial: 'polaris/button_link_to',
|
30
|
+
locals: {
|
31
|
+
name: name,
|
32
|
+
block: block,
|
33
|
+
additional_classes: additional_classes,
|
34
|
+
link_destination: link_destination,
|
35
|
+
method: button_options[:method]
|
36
|
+
}
|
37
|
+
)
|
20
38
|
end
|
21
|
-
button_options ||= {}
|
22
39
|
|
23
|
-
|
24
|
-
|
25
|
-
|
40
|
+
def polaris_model_errors model
|
41
|
+
render(
|
42
|
+
partial: 'polaris/model_errors',
|
43
|
+
locals: { model: model }
|
44
|
+
)
|
26
45
|
end
|
27
|
-
render(
|
28
|
-
partial: 'polaris/button_link_to',
|
29
|
-
locals: {
|
30
|
-
name: name,
|
31
|
-
block: block,
|
32
|
-
additional_classes: additional_classes,
|
33
|
-
link_destination: link_destination,
|
34
|
-
method: button_options[:method]
|
35
|
-
}
|
36
|
-
)
|
37
|
-
end
|
38
46
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
def polaris_page_actions(options)
|
48
|
+
render(
|
49
|
+
partial: 'polaris/page_actions',
|
50
|
+
locals: options
|
51
|
+
)
|
52
|
+
end
|
45
53
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
54
|
+
def polaris_button_tag(name, button_options)
|
55
|
+
additional_classes = ""
|
56
|
+
(button_options[:modifiers] || []).each do |modifier|
|
57
|
+
additional_classes += "Polaris-Button--#{modifier} "
|
58
|
+
end
|
52
59
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
60
|
+
button_options[:additional_classes] = additional_classes
|
61
|
+
button_options[:name] = name
|
62
|
+
render(
|
63
|
+
partial: 'polaris/button_tag',
|
64
|
+
locals: button_options
|
65
|
+
)
|
57
66
|
end
|
58
67
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
locals: button_options
|
64
|
-
)
|
65
|
-
end
|
68
|
+
def polaris_annotated_section_text_field(form, attribute, element_type = :text_field, &block)
|
69
|
+
unless attribute.is_a? Array
|
70
|
+
attribute = [attribute]
|
71
|
+
end
|
66
72
|
|
67
|
-
|
68
|
-
|
69
|
-
|
73
|
+
render(
|
74
|
+
partial: 'polaris/annotated_section_text_field',
|
75
|
+
locals: {
|
76
|
+
form: form,
|
77
|
+
attribute: attribute,
|
78
|
+
element_type: element_type,
|
79
|
+
block: block
|
80
|
+
}
|
81
|
+
)
|
70
82
|
end
|
71
83
|
|
72
|
-
render(
|
73
|
-
partial: 'polaris/annotated_section_text_field',
|
74
|
-
locals: {
|
75
|
-
form: form,
|
76
|
-
attribute: attribute,
|
77
|
-
element_type: element_type,
|
78
|
-
block: block
|
79
|
-
}
|
80
|
-
)
|
81
84
|
end
|
82
|
-
|
83
85
|
end
|