From fdf1fd5f5fa6c6aec92f49296c7bda25adee64dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 12 Apr 2024 02:27:44 +0200 Subject: [PATCH] Move links to check all/none on RTL languages Since we don't usually style HTML classes starting with `js-`, we're renaming it, so it's consistent with the `CheckAllNone` name used in the `check_all_none.js` file. --- app/assets/stylesheets/application.scss | 1 + app/assets/stylesheets/check_all_none.scss | 3 +++ app/components/moderation/shared/index_component.html.erb | 2 +- spec/system/moderation/budget_investments_spec.rb | 4 ++-- spec/system/moderation/comments_spec.rb | 4 ++-- spec/system/moderation/debates_spec.rb | 4 ++-- spec/system/moderation/proposal_notifications_spec.rb | 4 ++-- spec/system/moderation/proposals_spec.rb | 4 ++-- 8 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 app/assets/stylesheets/check_all_none.scss diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 766bfa909..c4a6c4adb 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -27,6 +27,7 @@ @import "autocomplete_overrides"; @import "avatar"; @import "banner"; +@import "check_all_none"; @import "comments_count"; @import "datepicker_overrides"; @import "layout"; diff --git a/app/assets/stylesheets/check_all_none.scss b/app/assets/stylesheets/check_all_none.scss new file mode 100644 index 000000000..236286bb9 --- /dev/null +++ b/app/assets/stylesheets/check_all_none.scss @@ -0,0 +1,3 @@ +.check-all-none { + float: $global-left; +} diff --git a/app/components/moderation/shared/index_component.html.erb b/app/components/moderation/shared/index_component.html.erb index d06fb9722..7be39e464 100644 --- a/app/components/moderation/shared/index_component.html.erb +++ b/app/components/moderation/shared/index_component.html.erb @@ -9,7 +9,7 @@ <% end %> <%= form_tag form_path, method: :put do %> -

+

<%= t("shared.check") %>: <%= link_to t("shared.check_all"), "#", data: { check_all: field_name } %> | diff --git a/spec/system/moderation/budget_investments_spec.rb b/spec/system/moderation/budget_investments_spec.rb index 631a86836..be5c48b47 100644 --- a/spec/system/moderation/budget_investments_spec.rb +++ b/spec/system/moderation/budget_investments_spec.rb @@ -112,11 +112,11 @@ describe "Moderate budget investments" do expect(page).to have_field type: :checkbox, count: 3 - within(".js-check") { click_link "All" } + within(".check-all-none") { click_link "All" } expect(all(:checkbox)).to all(be_checked) - within(".js-check") { click_link "None" } + within(".check-all-none") { click_link "None" } all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end diff --git a/spec/system/moderation/comments_spec.rb b/spec/system/moderation/comments_spec.rb index 8d1ff8f31..8d4a31352 100644 --- a/spec/system/moderation/comments_spec.rb +++ b/spec/system/moderation/comments_spec.rb @@ -132,11 +132,11 @@ describe "Moderate comments" do expect(page).to have_field type: :checkbox, count: 2 - within(".js-check") { click_link "All" } + within(".check-all-none") { click_link "All" } expect(all(:checkbox)).to all(be_checked) - within(".js-check") { click_link "None" } + within(".check-all-none") { click_link "None" } all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end diff --git a/spec/system/moderation/debates_spec.rb b/spec/system/moderation/debates_spec.rb index 45675d264..b897348a9 100644 --- a/spec/system/moderation/debates_spec.rb +++ b/spec/system/moderation/debates_spec.rb @@ -101,11 +101,11 @@ describe "Moderate debates" do expect(page).to have_field type: :checkbox, count: 2 - within(".js-check") { click_link "All" } + within(".check-all-none") { click_link "All" } expect(all(:checkbox)).to all(be_checked) - within(".js-check") { click_link "None" } + within(".check-all-none") { click_link "None" } all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end diff --git a/spec/system/moderation/proposal_notifications_spec.rb b/spec/system/moderation/proposal_notifications_spec.rb index 55b7f0c78..a3edcda8e 100644 --- a/spec/system/moderation/proposal_notifications_spec.rb +++ b/spec/system/moderation/proposal_notifications_spec.rb @@ -112,11 +112,11 @@ describe "Moderate proposal notifications" do expect(page).to have_field type: :checkbox, count: 2 - within(".js-check") { click_link "All" } + within(".check-all-none") { click_link "All" } expect(all(:checkbox)).to all(be_checked) - within(".js-check") { click_link "None" } + within(".check-all-none") { click_link "None" } all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end diff --git a/spec/system/moderation/proposals_spec.rb b/spec/system/moderation/proposals_spec.rb index 305a00dc8..21519a1d1 100644 --- a/spec/system/moderation/proposals_spec.rb +++ b/spec/system/moderation/proposals_spec.rb @@ -100,11 +100,11 @@ describe "Moderate proposals" do expect(page).to have_field type: :checkbox, count: 3 - within(".js-check") { click_link "All" } + within(".check-all-none") { click_link "All" } expect(all(:checkbox)).to all(be_checked) - within(".js-check") { click_link "None" } + within(".check-all-none") { click_link "None" } all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end