polaris_view_helpers 1.2.7 → 1.2.8

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: c45c1a8e7a83e1dd336010e7676114066afe5a7a20b5e20bd3da4a4fbae5c73e
4
- data.tar.gz: 22043400ee35ec6812daf502464ae0a1ea2f343c27f3ef3195875b8441ed78a7
3
+ metadata.gz: 6b79e57706ef11800c0d27dcc55d59af042681c0596a7d25afc6bfebe85cd842
4
+ data.tar.gz: 89f83a5f90afa5dab5ef5c0034f4662a18e6db3027fe3d6d752ebe5e9e1939fb
5
5
  SHA512:
6
- metadata.gz: 80d8820ad4bfb0cd7223a1a3346d278cb3e20b162436585c7d47c62160ef76e53f88d4aac2e70156cd17b3205b5895be7d44c287de6af4517b34ac718c464140
7
- data.tar.gz: ce8985cadc17a3137316dadee1c7e7ab317070d7a668dc23d59ea68d9bfd802eeb6b9d6f84cefad05c30fc6bc3dab44be06edf0c0626a0379b89c38cad82254e
6
+ metadata.gz: 98fb1faf0e7a6a00b50627e840140e913816e22c7acdc202e67ee60b421eef71eb7e99338c05e99cc36fe8a752cc7c7b057aa9679d9f80b5e5023c10e6f3e57f
7
+ data.tar.gz: 4dc81872f466b23bddff1a906fd6e3edf186cd21d3fe88dd0f0df2c9f1263485cada0fd28f3e9a96c43bab902f6023c3c3c1eea5c5c3b6c095ddf7506b0bb326
@@ -1,4 +1,4 @@
1
- <div class="Polaris-Card">
1
+ <div class="Polaris-Card <%= extra_class %>">
2
2
  <% if heading.present? %>
3
3
  <div class="Polaris-Card__Header">
4
4
  <h2 class="Polaris-Heading"><%= heading %></h2>
@@ -0,0 +1,5 @@
1
+ <span class="Polaris-Icon">
2
+ <span class="Polaris-Text--root Polaris-Text--bodySm Polaris-Text--regular Polaris-Text--visuallyHidden">
3
+ </span>
4
+ <%= pvh_svg name %>
5
+ </span>
@@ -5,6 +5,8 @@
5
5
  <li><%= message %></li>
6
6
  <% end %>
7
7
  </ul>
8
+
9
+ <%= capture(&block) %>
8
10
  <% end %>
9
11
  <p>&nbsp;</p>
10
12
  <% end %>
@@ -0,0 +1,3 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" class="Polaris-Icon__Svg" focusable="false" aria-hidden="true">
2
+ <path fill-rule="evenodd" d="M0 10a10 10 0 1020 0 10 10 0 00-20 0zm15.2-1.8a1 1 0 00-1.4-1.4L9 11.6 6.7 9.3a1 1 0 00-1.4 1.4l3 3c.4.4 1 .4 1.4 0l5.5-5.5z" fill="#5C5F62"/>
3
+ </svg>
@@ -14,6 +14,22 @@ module PolarisViewHelpers
14
14
  "pri-#{SecureRandom.hex(8)}"
15
15
  end
16
16
 
17
+ def polaris_icon(name = 'CircleTickMajor')
18
+ render(
19
+ partial: 'polaris/icon',
20
+ locals: {
21
+ name: name,
22
+ }
23
+ )
24
+ end
25
+
26
+ def pvh_svg(name)
27
+ our_path = File.dirname(__FILE__)
28
+ file_path = File.join(our_path, "..", "..", "app/views/polaris/icons/#{name}.svg")
29
+ return File.read(file_path).html_safe if File.exists?(file_path)
30
+ "(#{name} not found)"
31
+ end
32
+
17
33
  def polaris_choice_list(form:, attribute:, title:, selected:, choices:, data: nil)
18
34
  render(
19
35
  partial: 'polaris/choice_list',
@@ -70,8 +86,10 @@ module PolarisViewHelpers
70
86
  )
71
87
  end
72
88
 
73
- def polaris_layout_section(secondary: false, &block)
89
+ def polaris_layout_section(secondary: false, one_half: false, &block)
74
90
  extra_class = secondary ? "Polaris-Layout__Section--secondary" : ""
91
+ extra_class += " "
92
+ extra_class += one_half ? "Polaris-Layout__Section--oneHalf" : ""
75
93
  render(
76
94
  partial: 'polaris/layout_section',
77
95
  locals: { block: block, extra_class: extra_class }
@@ -168,10 +186,10 @@ module PolarisViewHelpers
168
186
  )
169
187
  end
170
188
 
171
- def polaris_model_errors model
189
+ def polaris_model_errors model, &block
172
190
  render(
173
191
  partial: 'polaris/model_errors',
174
- locals: { model: model }
192
+ locals: { model: model, block: block }
175
193
  )
176
194
  end
177
195
 
@@ -346,10 +364,10 @@ module PolarisViewHelpers
346
364
  )
347
365
  end
348
366
 
349
- def polaris_card(heading = nil, footer: nil, &block)
367
+ def polaris_card(heading = nil, footer: nil, extra_class: "", &block)
350
368
  render(
351
369
  partial: 'polaris/card',
352
- locals: { block: block, heading: heading, footer: footer }
370
+ locals: { block: block, heading: heading, footer: footer, extra_class: extra_class }
353
371
  )
354
372
  end
355
373
 
@@ -1,3 +1,3 @@
1
1
  module PolarisViewHelpers
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polaris_view_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-07 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -65,6 +65,7 @@ files:
65
65
  - app/views/polaris/_form_layout_item.html.erb
66
66
  - app/views/polaris/_form_layout_item_select.html.erb
67
67
  - app/views/polaris/_heading.html.erb
68
+ - app/views/polaris/_icon.html.erb
68
69
  - app/views/polaris/_layout.html.erb
69
70
  - app/views/polaris/_layout_section.html.erb
70
71
  - app/views/polaris/_link_to.html.erb
@@ -85,6 +86,7 @@ files:
85
86
  - app/views/polaris/banner_icons/_info.html.erb
86
87
  - app/views/polaris/banner_icons/_success.html.erb
87
88
  - app/views/polaris/banner_icons/_warning.html.erb
89
+ - app/views/polaris/icons/CircleTickMajor.svg
88
90
  - lib/polaris_view_helpers.rb
89
91
  - lib/polaris_view_helpers/helper.rb
90
92
  - lib/polaris_view_helpers/version.rb