Use a button instead of a link to block users

We're continuing to replace links with buttons, for the reasons
explained in commit 5311daadf.

We're also adding an ARIA label since on the same page there might be
several links to block different users.
This commit is contained in:
Javi Martín
2021-12-01 19:35:16 +01:00
parent 9a8a8ce5ce
commit 600a2bd4c2
8 changed files with 15 additions and 9 deletions

View File

@@ -17,8 +17,14 @@
<% if user.hidden? %>
<%= t("moderation.users.index.hidden") %>
<% else %>
<%= link_to t("moderation.users.index.hide"), hide_in_moderation_screen_moderation_user_path(user, request.query_parameters),
method: :put, class: "button hollow alert" %>
<%= render Admin::ActionComponent.new(
:hide_in_moderation_screen,
user,
text: t("moderation.users.index.hide"),
method: :put,
"aria-label": true,
class: "button hollow alert"
) %>
<% end %>
</td>
</tr>

View File

@@ -239,7 +239,7 @@ describe "Admin activity" do
visit moderation_users_path(search: user.username)
within("#moderation_users") do
click_link "Block"
click_button "Block"
end
visit admin_activity_path

View File

@@ -75,7 +75,7 @@ describe "Moderate budget investments" do
click_button "Search"
within "tr", text: investment.author.name do
expect(page).to have_link "Block"
expect(page).to have_button "Block"
end
end

View File

@@ -95,7 +95,7 @@ describe "Moderate comments" do
click_button "Search"
within "tr", text: comment.user.name do
expect(page).to have_link "Block"
expect(page).to have_button "Block"
end
end

View File

@@ -66,7 +66,7 @@ describe "Moderate debates" do
click_button "Search"
within "tr", text: debate.author.name do
expect(page).to have_link "Block"
expect(page).to have_button "Block"
end
end

View File

@@ -70,7 +70,7 @@ describe "Moderate proposal notifications" do
click_button "Search"
within "tr", text: proposal_notification.author.name do
expect(page).to have_link "Block"
expect(page).to have_button "Block"
end
end

View File

@@ -65,7 +65,7 @@ describe "Moderate proposals" do
click_button "Search"
within "tr", text: proposal.author.name do
expect(page).to have_link "Block"
expect(page).to have_button "Block"
end
end

View File

@@ -64,7 +64,7 @@ describe "Moderate users" do
within("#moderation_users") do
expect(page).to have_content citizen.name
expect(page).not_to have_content "Blocked"
click_link "Block"
click_button "Block"
end
within("#moderation_users") do