Skip to content

Commit

Permalink
Only show heart icon when avatars are shown for comment likes
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperTux88 authored and tclaus committed Oct 19, 2023
1 parent 93862e3 commit d8e294e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@

.media {
margin: 0 0 2px;

&:not(.display-avatars) .entypo-heart {
display: none;
}
}

.expand-likes {
Expand Down
14 changes: 9 additions & 5 deletions app/assets/stylesheets/single-post-view.scss
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,15 @@
font-size: 12px;
line-height: 16px;

.bd,
.entypo-heart {
display: inline-block;
}

.bd { display: inline-block; }
img { display: inline; }
}

.display-avatars .entypo-heart {
display: inline-block;
font-size: 16px;
line-height: 18px;
margin-right: 5px;
vertical-align: top;
}
}
4 changes: 1 addition & 3 deletions app/assets/templates/likes-info_tpl.jst.hbs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{{#if likesCount}}
<div class="comment">
<div class="media">
<div class="media{{#if displayAvatars}} display-avatars{{/if}}">
<i class="entypo-heart"></i>

<div class="bd">
{{#unless displayAvatars}}
<a href="#" class="expand-likes gray">
{{t "stream.likes" count=likesCount}}
</a>

{{else}}

{{#each likes}}
{{#linkToAuthor author}}
{{{personImage this 'small' 'micro'}}}
Expand Down
2 changes: 1 addition & 1 deletion features/desktop/comments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Feature: commenting
When "alice@alice.alice" has commented "That's cool" on "Look at this dog"
And I am on "alice@alice.alice"'s page
And I like the comment "That's cool"
Then I should see a heart within comment "That's cool"
Then I should see a like within comment "That's cool"

When I expand likes within comment "That's cool"
Then I should see a micro avatar within comment "That's cool"
Expand Down
4 changes: 2 additions & 2 deletions features/step_definitions/comment_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
find(id: comment_guid).click_link("Like")
end

Then /^I should see a heart within comment "([^"]*)"$/ do |comment_text|
Then /^I should see a like within comment "([^"]*)"$/ do |comment_text|
comment_guid = Comment.find_by(text: comment_text).guid
block = find(id: comment_guid)
expect(block).to have_css(".entypo-heart")
expect(block).to have_css(".expand-likes")
end

When /^I expand likes within comment "([^"]*)"$/ do |comment_text|
Expand Down

0 comments on commit d8e294e

Please sign in to comment.