From 0254f7ee0969f976d536118198bf752029dcd494 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 1 Jul 2023 15:12:38 +0100 Subject: [PATCH] Fix confirmation prompt when granting or revoking roles --- app/helpers/user_roles_helper.rb | 2 +- test/helpers/user_roles_helper_test.rb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/helpers/user_roles_helper.rb b/app/helpers/user_roles_helper.rb index c7516a51c..a8bc06b6e 100644 --- a/app/helpers/user_roles_helper.rb +++ b/app/helpers/user_roles_helper.rb @@ -28,7 +28,7 @@ module UserRolesHelper svg_icon = tag.source(:srcset => image_path("#{image}.svg"), :type => "image/svg+xml") png_icon = image_tag("#{image}.png", :srcset => image_path("#{image}.svg"), :size => "20x20", :border => 0, :alt => alt, :title => title) icon = tag.picture(svg_icon + png_icon) - icon = link_to(icon, url, :method => :post, :confirm => confirm) if url + icon = link_to(icon, url, :method => :post, :data => { :confirm => confirm }) if url end icon diff --git a/test/helpers/user_roles_helper_test.rb b/test/helpers/user_roles_helper_test.rb index 9c9d31e60..287504cb4 100644 --- a/test/helpers/user_roles_helper_test.rb +++ b/test/helpers/user_roles_helper_test.rb @@ -25,7 +25,7 @@ class UserRolesHelperTest < ActionView::TestCase user = create(:user) icon = role_icon(user, "moderator") expected = <<~HTML.delete("\n") - + Grant moderator access @@ -37,7 +37,7 @@ class UserRolesHelperTest < ActionView::TestCase moderator_user = create(:moderator_user) icon = role_icon(moderator_user, "moderator") expected = <<~HTML.delete("\n") - + Revoke moderator access @@ -82,13 +82,13 @@ class UserRolesHelperTest < ActionView::TestCase user = create(:user) icons = role_icons(user) expected = <<~HTML.delete("\n") - + Grant administrator access - + Grant moderator access @@ -100,13 +100,13 @@ class UserRolesHelperTest < ActionView::TestCase moderator_user = create(:moderator_user) icons = role_icons(moderator_user) expected = <<~HTML.delete("\n") - + Grant administrator access - + Revoke moderator access @@ -118,13 +118,13 @@ class UserRolesHelperTest < ActionView::TestCase super_user = create(:super_user) icons = role_icons(super_user) expected = <<~HTML.delete("\n") - + Revoke administrator access - + Revoke moderator access -- 2.39.5