Group buttons to check all/none elements
Since they're related, we're making them part of the same list. Instead of finding a way to have the `Select` prefix they had as a label for the list, we're including the "prefix" they had inside their texts, so the text of a button doesn't need any additional context.
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
.check-all-none {
|
||||
float: $global-left;
|
||||
list-style-type: none;
|
||||
margin-#{$global-left}: 0;
|
||||
|
||||
button {
|
||||
@include link;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
|
||||
+ li::before {
|
||||
@include vertical-separator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,10 @@
|
||||
<% end %>
|
||||
|
||||
<%= form_tag form_path, method: :put do %>
|
||||
<p class="check-all-none">
|
||||
<%= t("shared.check") %>:
|
||||
<%= button_tag t("shared.check_all"), type: "button", data: { check_all: field_name } %>
|
||||
|
|
||||
<%= button_tag t("shared.check_none"), type: "button", data: { check_none: field_name } %>
|
||||
</p>
|
||||
<ul class="check-all-none">
|
||||
<li><%= button_tag t("shared.check_all"), type: "button", data: { check_all: field_name } %></li>
|
||||
<li><%= button_tag t("shared.check_none"), type: "button", data: { check_none: field_name } %></li>
|
||||
</ul>
|
||||
|
||||
<%= content %>
|
||||
|
||||
|
||||
@@ -674,9 +674,8 @@ en:
|
||||
author_deleted: User deleted
|
||||
email_deleted: Email deleted
|
||||
back: Go back
|
||||
check: Select
|
||||
check_all: All
|
||||
check_none: None
|
||||
check_all: Select all
|
||||
check_none: Select none
|
||||
collective: Collective
|
||||
flag: Flag as inappropriate
|
||||
follow: "Follow"
|
||||
|
||||
@@ -674,9 +674,8 @@ es:
|
||||
author_deleted: Usuario eliminado
|
||||
email_deleted: Email eliminado
|
||||
back: Volver
|
||||
check: Seleccionar
|
||||
check_all: Todos
|
||||
check_none: Ninguno
|
||||
check_all: Seleccionar todos
|
||||
check_none: Seleccionar ninguno
|
||||
collective: Colectivo
|
||||
flag: Denunciar como inapropiado
|
||||
follow: "Seguir"
|
||||
|
||||
@@ -109,11 +109,11 @@ describe "Moderate budget investments" do
|
||||
|
||||
expect(page).to have_field type: :checkbox, count: 3
|
||||
|
||||
within(".check-all-none") { click_button "All" }
|
||||
within(".check-all-none") { click_button "Select all" }
|
||||
|
||||
expect(all(:checkbox)).to all(be_checked)
|
||||
|
||||
within(".check-all-none") { click_button "None" }
|
||||
within(".check-all-none") { click_button "Select none" }
|
||||
|
||||
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||
end
|
||||
|
||||
@@ -130,11 +130,11 @@ describe "Moderate comments" do
|
||||
|
||||
expect(page).to have_field type: :checkbox, count: 2
|
||||
|
||||
within(".check-all-none") { click_button "All" }
|
||||
within(".check-all-none") { click_button "Select all" }
|
||||
|
||||
expect(all(:checkbox)).to all(be_checked)
|
||||
|
||||
within(".check-all-none") { click_button "None" }
|
||||
within(".check-all-none") { click_button "Select none" }
|
||||
|
||||
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||
end
|
||||
|
||||
@@ -99,11 +99,11 @@ describe "Moderate debates" do
|
||||
|
||||
expect(page).to have_field type: :checkbox, count: 2
|
||||
|
||||
within(".check-all-none") { click_button "All" }
|
||||
within(".check-all-none") { click_button "Select all" }
|
||||
|
||||
expect(all(:checkbox)).to all(be_checked)
|
||||
|
||||
within(".check-all-none") { click_button "None" }
|
||||
within(".check-all-none") { click_button "Select none" }
|
||||
|
||||
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||
end
|
||||
|
||||
@@ -110,11 +110,11 @@ describe "Moderate proposal notifications" do
|
||||
|
||||
expect(page).to have_field type: :checkbox, count: 2
|
||||
|
||||
within(".check-all-none") { click_button "All" }
|
||||
within(".check-all-none") { click_button "Select all" }
|
||||
|
||||
expect(all(:checkbox)).to all(be_checked)
|
||||
|
||||
within(".check-all-none") { click_button "None" }
|
||||
within(".check-all-none") { click_button "Select none" }
|
||||
|
||||
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||
end
|
||||
|
||||
@@ -98,11 +98,11 @@ describe "Moderate proposals" do
|
||||
|
||||
expect(page).to have_field type: :checkbox, count: 3
|
||||
|
||||
within(".check-all-none") { click_button "All" }
|
||||
within(".check-all-none") { click_button "Select all" }
|
||||
|
||||
expect(all(:checkbox)).to all(be_checked)
|
||||
|
||||
within(".check-all-none") { click_button "None" }
|
||||
within(".check-all-none") { click_button "Select none" }
|
||||
|
||||
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user