Show actions to score related content to everyone

We were only showing these actions to users with small screens and to
mouse users on hover. Keyboard users or users with a touch screen of a
medium or large size could never find out the actions were there.
This commit is contained in:
Javi Martín
2021-06-23 17:56:24 +02:00
parent e5070fb172
commit f298a308c2
3 changed files with 8 additions and 17 deletions

View File

@@ -2491,7 +2491,6 @@ table {
@include breakpoint(medium) {
.score-actions {
display: none;
float: right;
}
}
@@ -2499,14 +2498,6 @@ table {
&:first-child {
border-top: 1px solid $border;
}
&:hover {
background: #f9f9f9;
.score-actions {
display: block;
}
}
}
h3 {

View File

@@ -5,13 +5,11 @@
score_positive_related_content_path(related),
method: :put,
remote: true,
id: "score-positive-related-#{related.id}",
class: "score-positive" %>
<%= link_to t("related_content.score_negative"),
score_negative_related_content_path(related),
method: :put,
remote: true,
id: "score-negative-related-#{related.id}",
class: "score-negative" %>
</span>

View File

@@ -97,9 +97,10 @@ shared_examples "relationable" do |relationable_model_name|
visit relationable.url
within("#related-content-list") do
find("#related-content-#{related_content.opposite_related_content.id}").hover
find("#score-positive-related-#{related_content.opposite_related_content.id}").click
expect(page).not_to have_css "#score-positive-related-#{related_content.opposite_related_content.id}"
click_link "Yes"
expect(page).not_to have_link "Yes"
expect(page).not_to have_link "No"
end
expect(related_content.related_content_scores.find_by(user_id: user.id, related_content_id: related_content.id).value).to eq(1)
@@ -113,9 +114,10 @@ shared_examples "relationable" do |relationable_model_name|
visit relationable.url
within("#related-content-list") do
find("#related-content-#{related_content.opposite_related_content.id}").hover
find("#score-negative-related-#{related_content.opposite_related_content.id}").click
expect(page).not_to have_css "#score-negative-related-#{related_content.opposite_related_content.id}"
click_link "No"
expect(page).not_to have_link "Yes"
expect(page).not_to have_link "No"
end
expect(related_content.related_content_scores.find_by(user_id: user.id, related_content_id: related_content.id).value).to eq(-1)