From a6046155a201117d9184efe61cdcb962bf4028b2 Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Thu, 17 Apr 2025 15:39:44 +0200 Subject: [PATCH] Replace link with button in relationable scores --- app/assets/stylesheets/layout.scss | 10 +++++++++- app/views/relationable/_score.html.erb | 24 ++++++++++++------------ spec/shared/system/relationable.rb | 12 ++++++------ 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 377ea5716..28d25fbb0 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -2134,7 +2134,7 @@ table { text-align: center; } - a { + button { font-weight: bold; margin-right: $line-height; text-decoration: none; @@ -2152,6 +2152,14 @@ table { &::before { margin-right: $font-icon-margin; } + + &:hover { + cursor: pointer; + } + } + + form { + display: inline; } } diff --git a/app/views/relationable/_score.html.erb b/app/views/relationable/_score.html.erb index ef66c7b4e..812a4563e 100644 --- a/app/views/relationable/_score.html.erb +++ b/app/views/relationable/_score.html.erb @@ -1,15 +1,15 @@ <%= t("related_content.is_related") %> - - <%= link_to t("related_content.score_positive"), - score_positive_related_content_path(related), - method: :put, - remote: true, - class: "score-positive" %> +
+ <%= button_to t("related_content.score_positive"), + score_positive_related_content_path(related), + method: :put, + remote: true, + class: "score-positive" %> - <%= link_to t("related_content.score_negative"), - score_negative_related_content_path(related), - method: :put, - remote: true, - class: "score-negative" %> - + <%= button_to t("related_content.score_negative"), + score_negative_related_content_path(related), + method: :put, + remote: true, + class: "score-negative" %> +
diff --git a/spec/shared/system/relationable.rb b/spec/shared/system/relationable.rb index 32e657b9d..4e1c0cce3 100644 --- a/spec/shared/system/relationable.rb +++ b/spec/shared/system/relationable.rb @@ -146,10 +146,10 @@ shared_examples "relationable" do |relationable_model_name| visit polymorphic_path(relationable) within("#related-content-list") do - click_link "Yes" + click_button "Yes" - expect(page).not_to have_link "Yes" - expect(page).not_to have_link "No" + expect(page).not_to have_button "Yes" + expect(page).not_to have_button "No" end end @@ -163,10 +163,10 @@ shared_examples "relationable" do |relationable_model_name| visit polymorphic_path(relationable) within("#related-content-list") do - click_link "No" + click_button "No" - expect(page).not_to have_link "Yes" - expect(page).not_to have_link "No" + expect(page).not_to have_button "Yes" + expect(page).not_to have_button "No" end end