Enabled likes-on-comments in mobile view

This commit is contained in:
Thorsten Claus
2021-02-27 10:46:43 +01:00
committed by Benjamin Neff
parent 35f1cd61b1
commit 06a0dc68a9
5 changed files with 30 additions and 3 deletions

View File

@@ -75,8 +75,8 @@
onLike: function(evt){
evt.preventDefault();
var link = $(evt.target).closest(".like-action"),
likeCounter = $(evt.target).closest(".stream-element").find(".like-count");
var link = $(evt.target).closest(".like-action").first(),
likeCounter = $(evt.target).find(".like-count").first();
if(!link.hasClass("loading") && link.hasClass("inactive")) {
Diaspora.Mobile.PostActions.like(likeCounter, link);

View File

@@ -24,7 +24,7 @@
.comments > .comment,
.comment.new-comment-form-wrapper {
margin: 0;
border-top: 1px dotted $border-grey;
padding: 10px 0;

View File

@@ -71,12 +71,21 @@
.entypo-heart.active { color: $red; }
}
.comment-stats {
@extend .post-stats;
bottom: 25px;
}
.post-action {
display: flex;
margin: 0 7px;
.disabled { color: $medium-gray; }
}
.comment-action {
@extend .post-action;
}
.add-comment-switcher { padding-top: 10px; }

View File

@@ -39,6 +39,21 @@ module MobileHelper
end
end
def mobile_like_comment_icon(comment)
puts "Mobile like on comment!"
if current_user && current_user.liked?(comment)
link_to content_tag(:span, comment.likes.size, class: "count like-count"),
"#",
data: {url: comment_like_path(comment.id, current_user.like_for(comment).id)},
class: "entypo-heart like-action active"
else
link_to content_tag(:span, comment.likes.size, class: "count like-count"),
"#",
data: {url: comment_likes_path(comment.id)},
class: "entypo-heart like-action inactive"
end
end
def mobile_comment_icon(post)
link_to content_tag(:span, post.comments.size, class: "count comment-count"),
new_post_comment_path(post),

View File

@@ -21,3 +21,6 @@
%div{class: direction_for(comment.text)}
= comment.message.markdownified
.comment-stats
.comment-action
= mobile_like_comment_icon(comment)