vote.twig 1023 B

1234567891011121314151617181920212223242526272829303132
  1. {# Template for up/down vote arrows.
  2. # This template expects these inputs
  3. #
  4. # - target: ('post', 'comment')
  5. # - hash_id: the post/comment hashId
  6. # - vote: (optional) the vote already cast by current logged in user
  7. # - vote_count: the sum of votes for this post/comment
  8. # - user: reference to logged in user
  9. #}
  10. <span class="vote">
  11. {% if user %}
  12. <a href="vote?up&{{ target }}={{ hash_id }}" target="vote_sink" class="{{ vote is defined and vote == 1 ? 'upvoted' }}">
  13. <img title="bump" alt="bump" src="images/upvote.png" />
  14. </a>
  15. {# Show number of votes #}
  16. <span class="count">{{ vote_count }}</span>
  17. <a href="vote?down&{{ target }}={{ hash_id }}" target="vote_sink" class="{{ vote is defined and vote == -1 ? 'downvoted' }}">
  18. <img title="sink" alt="sink" src="images/downvote.png" />
  19. </a>
  20. {% else %}
  21. {{ vote_count ~ ' vote' ~ (vote_count != 1 ? 's') }}
  22. {% endif %}
  23. </span>