Adding eventhandler for Mobile views
This commit is contained in:
parent
06a0dc68a9
commit
9b19be18f2
4 changed files with 22 additions and 8 deletions
|
|
@ -111,6 +111,8 @@
|
|||
self.showCommentBox(commentActionLink);
|
||||
bottomBarContainer.getCommentsContainer().find("time.timeago").timeago();
|
||||
bottomBarContainer.activate();
|
||||
// Inform the comment action for new comments
|
||||
$(".stream").trigger("comments.loaded");
|
||||
},
|
||||
error: function(){
|
||||
bottomBarContainer.deactivate();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@
|
|||
initialize: function() {
|
||||
$(".like-action", ".stream").bind("tap click", this.onLike);
|
||||
$(".reshare-action", ".stream").bind("tap click", this.onReshare);
|
||||
// Add handler to newly loaded comments
|
||||
var self = this;
|
||||
$(".stream").bind("comments.loaded", function() {
|
||||
$(".like-action", ".stream").bind("tap click", self.onLike);
|
||||
});
|
||||
},
|
||||
|
||||
showLoader: function(link) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.post-stats {
|
||||
%stats {
|
||||
float: right;
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
|
@ -71,20 +71,28 @@
|
|||
.entypo-heart.active { color: $red; }
|
||||
}
|
||||
|
||||
.post-stats {
|
||||
@extend %stats;
|
||||
}
|
||||
|
||||
.comment-stats {
|
||||
@extend .post-stats;
|
||||
@extend %stats;
|
||||
bottom: 25px;
|
||||
}
|
||||
|
||||
.post-action {
|
||||
%action {
|
||||
display: flex;
|
||||
margin: 0 7px;
|
||||
|
||||
.disabled { color: $medium-gray; }
|
||||
}
|
||||
|
||||
.post-action {
|
||||
@extend %action;
|
||||
}
|
||||
|
||||
.comment-action {
|
||||
@extend .post-action;
|
||||
@extend %action;
|
||||
}
|
||||
|
||||
.add-comment-switcher { padding-top: 10px; }
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ module MobileHelper
|
|||
end
|
||||
|
||||
def mobile_like_icon(post)
|
||||
if current_user && current_user.liked?(post)
|
||||
if current_user&.liked?(post)
|
||||
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)},
|
||||
|
|
@ -40,8 +40,7 @@ module MobileHelper
|
|||
end
|
||||
|
||||
def mobile_like_comment_icon(comment)
|
||||
puts "Mobile like on comment!"
|
||||
if current_user && current_user.liked?(comment)
|
||||
if 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)},
|
||||
|
|
|
|||
Loading…
Reference in a new issue