Include count in mobile post action link (reshare, comment and like)
This commit is contained in:
parent
32233ccb99
commit
18256f3709
4 changed files with 28 additions and 22 deletions
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
onLike: function(evt){
|
onLike: function(evt){
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
var link = $(evt.target),
|
var link = $(evt.target).closest(".like-action"),
|
||||||
likeCounter = $(evt.target).closest(".stream-element").find(".like-count");
|
likeCounter = $(evt.target).closest(".stream-element").find(".like-count");
|
||||||
|
|
||||||
if(!link.hasClass("loading") && link.hasClass("inactive")) {
|
if(!link.hasClass("loading") && link.hasClass("inactive")) {
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
onReshare: function(evt) {
|
onReshare: function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
var link = $(this),
|
var link = $(this).closest(".reshare-action"),
|
||||||
href = link.attr("href"),
|
href = link.attr("href"),
|
||||||
confirmText = link.attr("title");
|
confirmText = link.attr("title");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,16 +43,15 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.count {
|
.count {
|
||||||
|
color: $text-color;
|
||||||
|
font-family: $font-family-base;
|
||||||
|
font-size: $font-size-base;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
|
vertical-align: top;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-count-group {
|
|
||||||
display: flex;
|
|
||||||
margin: 0 7px;
|
|
||||||
}
|
|
||||||
|
|
||||||
[class^="entypo"] {
|
[class^="entypo"] {
|
||||||
color: $text-grey;
|
color: $text-grey;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
|
|
@ -73,6 +72,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-action {
|
.post-action {
|
||||||
|
display: flex;
|
||||||
|
margin: 0 7px;
|
||||||
|
|
||||||
.disabled { color: $medium-gray; }
|
.disabled { color: $medium-gray; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,25 +7,30 @@ module MobileHelper
|
||||||
reshare = Reshare.where(author_id: current_user.person_id,
|
reshare = Reshare.where(author_id: current_user.person_id,
|
||||||
root_guid: absolute_root.guid).first
|
root_guid: absolute_root.guid).first
|
||||||
klass = reshare.present? ? "active" : "inactive"
|
klass = reshare.present? ? "active" : "inactive"
|
||||||
link_to "", reshares_path(root_guid: absolute_root.guid),
|
link_to content_tag(:span, post.reshares.size, class: "count reshare-count"),
|
||||||
|
reshares_path(root_guid: absolute_root.guid),
|
||||||
title: t("reshares.reshare.reshare_confirmation", author: absolute_root.author_name),
|
title: t("reshares.reshare.reshare_confirmation", author: absolute_root.author_name),
|
||||||
class: "entypo-reshare reshare-action #{klass}"
|
class: "entypo-reshare reshare-action #{klass}"
|
||||||
else
|
else
|
||||||
content_tag :div, nil, class: "entypo-reshare reshare-action disabled"
|
content_tag :div,
|
||||||
|
content_tag(:span, post.reshares.size, class: "count reshare-count"),
|
||||||
|
class: "entypo-reshare reshare-action disabled"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
content_tag :div, nil, class: "entypo-reshare reshare-action disabled"
|
content_tag :div,
|
||||||
|
content_tag(:span, post.reshares.size, class: "count reshare-count"),
|
||||||
|
class: "entypo-reshare reshare-action disabled"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def mobile_like_icon(post)
|
def mobile_like_icon(post)
|
||||||
if current_user && current_user.liked?(post)
|
if current_user && current_user.liked?(post)
|
||||||
link_to "",
|
link_to content_tag(:span, post.likes.size, class: "count like-count"),
|
||||||
"#",
|
"#",
|
||||||
data: {url: post_like_path(post.id, current_user.like_for(post).id)},
|
data: {url: post_like_path(post.id, current_user.like_for(post).id)},
|
||||||
class: "entypo-heart like-action active"
|
class: "entypo-heart like-action active"
|
||||||
else
|
else
|
||||||
link_to "",
|
link_to content_tag(:span, post.likes.size, class: "count like-count"),
|
||||||
"#",
|
"#",
|
||||||
data: {url: post_likes_path(post.id)},
|
data: {url: post_likes_path(post.id)},
|
||||||
class: "entypo-heart like-action inactive"
|
class: "entypo-heart like-action inactive"
|
||||||
|
|
@ -33,7 +38,9 @@ module MobileHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def mobile_comment_icon(post)
|
def mobile_comment_icon(post)
|
||||||
link_to "", new_post_comment_path(post), class: "entypo-comment comment-action inactive"
|
link_to content_tag(:span, post.comments.size, class: "count comment-count"),
|
||||||
|
new_post_comment_path(post),
|
||||||
|
class: "entypo-comment comment-action inactive"
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_comments_link(post, klass="")
|
def show_comments_link(post, klass="")
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
.post-stats
|
.post-stats
|
||||||
- if post.public?
|
- if post.public?
|
||||||
.icon-count-group
|
.post-action
|
||||||
.post-action= mobile_reshare_icon(post)
|
= mobile_reshare_icon(post)
|
||||||
%span.reshare-count.count= post.reshares.size
|
|
||||||
|
|
||||||
.icon-count-group
|
.post-action
|
||||||
.post-action= mobile_comment_icon(post)
|
= mobile_comment_icon(post)
|
||||||
%span.comment-count.count= post.comments.size
|
|
||||||
|
|
||||||
.icon-count-group
|
.post-action
|
||||||
.post-action= mobile_like_icon(post)
|
= mobile_like_icon(post)
|
||||||
%span.like-count.count= post.likes.size
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue