diff --git a/template/comment.twig b/template/comment.twig index 8cacf9f..55b1c2d 100644 --- a/template/comment.twig +++ b/template/comment.twig @@ -19,7 +19,8 @@ target: 'comment', hash_id: comment.hashId, vote: votes[comment.id] is defined ? votes[comment.id].vote : null, - vote_count: comment.vote + vote_count: comment.vote, + user: user is defined ? user : null } only %} diff --git a/template/index.twig b/template/index.twig index 4c612e0..82ee175 100644 --- a/template/index.twig +++ b/template/index.twig @@ -23,7 +23,8 @@ target: 'post', hash_id: post.hashId, vote: votes[post.id] is defined ? votes[post.id].vote : null, - vote_count: post.vote + vote_count: post.vote, + user: user is defined ? user : null } only %} diff --git a/template/post.twig b/template/post.twig index ef27fbc..a917f06 100644 --- a/template/post.twig +++ b/template/post.twig @@ -18,7 +18,8 @@ target: 'post', hash_id: post.hashId, vote: votes.post[post.id] is defined ? votes.post[post.id].vote : null, - vote_count: post.vote + vote_count: post.vote, + user: user is defined ? user : null } only %} diff --git a/template/vote.twig b/template/vote.twig index 3288e0f..c3f3c74 100644 --- a/template/vote.twig +++ b/template/vote.twig @@ -5,17 +5,28 @@ # - hash_id: the post/comment hashId # - vote: (optional) the vote already cast by current logged in user # - vote_count: the sum of votes for this post/comment + # - user: reference to logged in user #} - - bump - - {# Show number of votes #} - {{ vote_count }} + {% if user %} + + + bump + - - sink - + {# Show number of votes #} + {{ vote_count }} + + + sink + + + {% else %} + + {{ vote_count ~ ' vote' ~ (vote_count != 1 ? 's') }} + + {% endif %} + \ No newline at end of file