polaris_view_helpers 0.0.19 → 0.0.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a1b78cbc6782f200454b94ca69dbe8e27d0745908ddedae1b09a9f21663fd27
4
- data.tar.gz: 22438ec7561f28d9f89035c609f4bd9269564562b33a14b5d102d6e3ebb29351
3
+ metadata.gz: fb350c97d9f4063794f97420ef07de74ee65607f9fa3dbd35792fde52c0445f2
4
+ data.tar.gz: 6c10d00a1e9ea7bde7dc383e175ecc7fd6e9398acf2e5eef723cc7352bbb0382
5
5
  SHA512:
6
- metadata.gz: f2e474775918984553f60f36958cbb01c0e125426b7967e584d96a3754a1b822265d830833c98c37805f055eced570336442bbb09e1b404118718511cd3732e2
7
- data.tar.gz: c35e505e3c7cd2a9ce04dbb6aba617bee3ea1f67161611a1dd89f9051d870a0ac15f6e8a9caf516898f14157a3f46332383feaf662a14ea711f67c93bf9f2dff
6
+ metadata.gz: b49a12e68c8f9d6706a2bd696b69ceb70691724ef348b4543dd5714f5d4d425c76476e5ae14f7ab2ca4b7d0cdd86e380443f427c5dfda538beab6baadf5f9691
7
+ data.tar.gz: 5f30baf5dba65018085be12faaf6fddb6f1bf699de4638adfbadc98831d6aeac30687a5953691395cc19d5338de4f7580c03030221bae2d3efded66c11520312
@@ -1,4 +1,4 @@
1
- <% listname = polaris_random_input_name %>
1
+ <% listname = attribute %>
2
2
  <div class="Polaris-FormLayout__Item">
3
3
  <div class="">
4
4
  <fieldset class="Polaris-ChoiceList" id="<%= listname %>" aria-invalid="false">
@@ -10,16 +10,9 @@
10
10
  <label class="Polaris-Choice" for="<%= inputname %>">
11
11
  <span class="Polaris-Choice__Control">
12
12
  <span class="Polaris-RadioButton">
13
- <input
14
- id="<%= inputname %>"
15
- name="<%= listname %>"
16
- type="radio"
17
- class="Polaris-RadioButton__Input"
18
- value="<%= choice[:value] %>"
19
- <%= selected == choice[:value] ? "checked" : "" %>
20
- >
21
- <span class="Polaris-RadioButton__Backdrop"></span>
22
- <span class="Polaris-RadioButton__Icon"></span>
13
+ <%= form.radio_button attribute, choice[:value], checked: selected == choice[:value], class: 'Polaris-RadioButton__Input', id: inputname %>
14
+ <span class="Polaris-RadioButton__Backdrop"></span>
15
+ <span class="Polaris-RadioButton__Icon"></span>
23
16
  </span>
24
17
  </span>
25
18
  <span class="Polaris-Choice__Label"><%= choice[:label] %></span>
@@ -9,10 +9,12 @@ module PolarisViewHelpers
9
9
  "pri-#{SecureRandom.hex(8)}"
10
10
  end
11
11
 
12
- def polaris_choice_list(title:, selected:, choices:)
12
+ def polaris_choice_list(form:, attribute:, title:, selected:, choices:)
13
13
  render(
14
14
  partial: 'polaris/choice_list',
15
15
  locals: {
16
+ form: form,
17
+ attribute: attribute,
16
18
  title: title,
17
19
  selected: selected,
18
20
  choices: choices
@@ -1,3 +1,3 @@
1
1
  module PolarisViewHelpers
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -1,10 +1,13 @@
1
- <%= polaris_choice_list(
2
- title: "Company name",
3
- selected: 'octolabs',
4
- choices: [
5
- {label: "Luther Crop", value: 'luther_corp'},
6
- {label: "OctoLabs", value: 'octolabs'},
7
- {label: "Vought", value: 'vought'}
8
- ]
9
- )%>
10
-
1
+ <%= form_with url: root_url do |form| %>
2
+ <%= polaris_choice_list(
3
+ form: form,
4
+ attribute: 'company_name',
5
+ title: "Company name",
6
+ selected: 'octolabs',
7
+ choices: [
8
+ {label: "Luther Corp", value: 'luther_corp'},
9
+ {label: "OctoLabs", value: 'octolabs'},
10
+ {label: "Vought", value: 'vought'}
11
+ ]
12
+ )%>
13
+ <% end %>