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 {
|
.check-all-none {
|
||||||
float: $global-left;
|
float: $global-left;
|
||||||
|
list-style-type: none;
|
||||||
|
margin-#{$global-left}: 0;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@include link;
|
@include link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
+ li::before {
|
||||||
|
@include vertical-separator;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= form_tag form_path, method: :put do %>
|
<%= form_tag form_path, method: :put do %>
|
||||||
<p class="check-all-none">
|
<ul class="check-all-none">
|
||||||
<%= t("shared.check") %>:
|
<li><%= button_tag t("shared.check_all"), type: "button", data: { check_all: field_name } %></li>
|
||||||
<%= button_tag t("shared.check_all"), type: "button", data: { check_all: field_name } %>
|
<li><%= button_tag t("shared.check_none"), type: "button", data: { check_none: field_name } %></li>
|
||||||
|
|
</ul>
|
||||||
<%= button_tag t("shared.check_none"), type: "button", data: { check_none: field_name } %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<%= content %>
|
<%= content %>
|
||||||
|
|
||||||
|
|||||||
@@ -674,9 +674,8 @@ en:
|
|||||||
author_deleted: User deleted
|
author_deleted: User deleted
|
||||||
email_deleted: Email deleted
|
email_deleted: Email deleted
|
||||||
back: Go back
|
back: Go back
|
||||||
check: Select
|
check_all: Select all
|
||||||
check_all: All
|
check_none: Select none
|
||||||
check_none: None
|
|
||||||
collective: Collective
|
collective: Collective
|
||||||
flag: Flag as inappropriate
|
flag: Flag as inappropriate
|
||||||
follow: "Follow"
|
follow: "Follow"
|
||||||
|
|||||||
@@ -674,9 +674,8 @@ es:
|
|||||||
author_deleted: Usuario eliminado
|
author_deleted: Usuario eliminado
|
||||||
email_deleted: Email eliminado
|
email_deleted: Email eliminado
|
||||||
back: Volver
|
back: Volver
|
||||||
check: Seleccionar
|
check_all: Seleccionar todos
|
||||||
check_all: Todos
|
check_none: Seleccionar ninguno
|
||||||
check_none: Ninguno
|
|
||||||
collective: Colectivo
|
collective: Colectivo
|
||||||
flag: Denunciar como inapropiado
|
flag: Denunciar como inapropiado
|
||||||
follow: "Seguir"
|
follow: "Seguir"
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ describe "Moderate budget investments" do
|
|||||||
|
|
||||||
expect(page).to have_field type: :checkbox, count: 3
|
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)
|
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 }
|
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -130,11 +130,11 @@ describe "Moderate comments" do
|
|||||||
|
|
||||||
expect(page).to have_field type: :checkbox, count: 2
|
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)
|
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 }
|
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -99,11 +99,11 @@ describe "Moderate debates" do
|
|||||||
|
|
||||||
expect(page).to have_field type: :checkbox, count: 2
|
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)
|
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 }
|
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -110,11 +110,11 @@ describe "Moderate proposal notifications" do
|
|||||||
|
|
||||||
expect(page).to have_field type: :checkbox, count: 2
|
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)
|
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 }
|
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -98,11 +98,11 @@ describe "Moderate proposals" do
|
|||||||
|
|
||||||
expect(page).to have_field type: :checkbox, count: 3
|
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)
|
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 }
|
all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user