home » zplus/freepost.git
Author zPlus <-> 2016-03-19 06:40:05
Committer zPlus <-> 2016-03-19 06:40:05
Commit dc75391 (patch)
Tree c41d2da
Parent(s)

Votes template: remove vote arrows if user is not logged in


commits diff: 76b2407..dc75391
4 files changed, 25 insertions, 11 deletionsdownload


Diffstat
-rw-r--r-- template/comment.twig 3
-rw-r--r-- template/index.twig 3
-rw-r--r-- template/post.twig 3
-rw-r--r-- template/vote.twig 27

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+2/-1 M   template/comment.twig
index 8cacf9f..55b1c2d
old size: 2K - new size: 2K
@@ -19,7 +19,8 @@
19 19 target: 'comment',
20 20 hash_id: comment.hashId,
21 21 vote: votes[comment.id] is defined ? votes[comment.id].vote : null,
22 - vote_count: comment.vote
22 + vote_count: comment.vote,
23 + user: user is defined ? user : null
23 24 } only
24 25 %}
25 26

+2/-1 M   template/index.twig
index 4c612e0..82ee175
old size: 1K - new size: 1K
@@ -23,7 +23,8 @@
23 23 target: 'post',
24 24 hash_id: post.hashId,
25 25 vote: votes[post.id] is defined ? votes[post.id].vote : null,
26 - vote_count: post.vote
26 + vote_count: post.vote,
27 + user: user is defined ? user : null
27 28 } only
28 29 %}
29 30

+2/-1 M   template/post.twig
index ef27fbc..a917f06
old size: 2K - new size: 2K
@@ -18,7 +18,8 @@
18 18 target: 'post',
19 19 hash_id: post.hashId,
20 20 vote: votes.post[post.id] is defined ? votes.post[post.id].vote : null,
21 - vote_count: post.vote
21 + vote_count: post.vote,
22 + user: user is defined ? user : null
22 23 } only
23 24 %}
24 25

+19/-8 M   template/vote.twig
index 3288e0f..c3f3c74
old size: 888B - new size: 1K
@@ -5,17 +5,28 @@
5 5 # - hash_id: the post/comment hashId
6 6 # - vote: (optional) the vote already cast by current logged in user
7 7 # - vote_count: the sum of votes for this post/comment
8 + # - user: reference to logged in user
8 9 #}
9 10
10 11 <span class="vote">
11 - <a href="vote?up&{{ target }}={{ hash_id }}" target="vote_sink" class="{{ vote is defined and vote == 1 ? 'upvoted' }}" onclick="vote ('up', this.parentNode)">
12 - <img title="bump" alt="bump" src="images/upvote.png" />
13 - </a>
14 12
15 - {# Show number of votes #}
16 - <span class="count">{{ vote_count }}</span>
13 + {% if user %}
14 +
15 + <a href="vote?up&{{ target }}={{ hash_id }}" target="vote_sink" class="{{ vote is defined and vote == 1 ? 'upvoted' }}" onclick="vote ('up', this.parentNode)">
16 + <img title="bump" alt="bump" src="images/upvote.png" />
17 + </a>
17 18
18 - <a href="vote?down&{{ target }}={{ hash_id }}" target="vote_sink" class="{{ vote is defined and vote == -1 ? 'downvoted' }}" onclick="vote ('down', this.parentNode)">
19 - <img title="sink" alt="sink" src="images/downvote.png" />
20 - </a>
19 + {# Show number of votes #}
20 + <span class="count">{{ vote_count }}</span>
21 +
22 + <a href="vote?down&{{ target }}={{ hash_id }}" target="vote_sink" class="{{ vote is defined and vote == -1 ? 'downvoted' }}" onclick="vote ('down', this.parentNode)">
23 + <img title="sink" alt="sink" src="images/downvote.png" />
24 + </a>
25 +
26 + {% else %}
27 +
28 + {{ vote_count ~ ' vote' ~ (vote_count != 1 ? 's') }}
29 +
30 + {% endif %}
31 +
21 32 </span>
21 32 = \ No newline at end of file