polaris_view_helpers 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/polaris/_choice_list.html.erb +4 -11
- data/lib/polaris_view_helpers/helper.rb +3 -1
- data/lib/polaris_view_helpers/version.rb +1 -1
- data/test/dummy/app/views/home/_choice_list.html.erb +13 -10
- data/test/dummy/log/development.log +1237 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb350c97d9f4063794f97420ef07de74ee65607f9fa3dbd35792fde52c0445f2
|
4
|
+
data.tar.gz: 6c10d00a1e9ea7bde7dc383e175ecc7fd6e9398acf2e5eef723cc7352bbb0382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b49a12e68c8f9d6706a2bd696b69ceb70691724ef348b4543dd5714f5d4d425c76476e5ae14f7ab2ca4b7d0cdd86e380443f427c5dfda538beab6baadf5f9691
|
7
|
+
data.tar.gz: 5f30baf5dba65018085be12faaf6fddb6f1bf699de4638adfbadc98831d6aeac30687a5953691395cc19d5338de4f7580c03030221bae2d3efded66c11520312
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% listname =
|
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
|
-
|
14
|
-
|
15
|
-
|
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,10 +1,13 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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 %>
|