You are here

rate-template-number-up-down.html.twig in Rate 8

Default theme implementation for up/down voting display.

Available variables:

  • widget_attributes: Attributes for outer div.
  • has_voted: Boolean if user has voted.
  • user_voted: What the user voted.
  • up_attributes: Attributes for up vote div.
  • up_url: Url to vote up.
  • score_attributes: Attributes for score display div.
  • score: Up votes minus down votes.
  • down_attributes: Attributes for down vote div.
  • down_url: Url to vote down.
  • score: Number of up votes.
  • undo: Link to undo placed vote.
  • undo_attributes: Attributes for undo div.
  • info_description: Extra textual info to display.

File

templates/rate-template-number-up-down.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for up/down voting display.
  5. *
  6. * Available variables:
  7. * - widget_attributes: Attributes for outer div.
  8. * - has_voted: Boolean if user has voted.
  9. * - user_voted: What the user voted.
  10. * - up_attributes: Attributes for up vote div.
  11. * - up_url: Url to vote up.
  12. * - score_attributes: Attributes for score display div.
  13. * - score: Up votes minus down votes.
  14. * - down_attributes: Attributes for down vote div.
  15. * - down_url: Url to vote down.
  16. * - score: Number of up votes.
  17. * - undo: Link to undo placed vote.
  18. * - undo_attributes: Attributes for undo div.
  19. * - info_description: Extra textual info to display.
  20. *
  21. * @ingroup themeable
  22. */
  23. #}
  24. <div{{ widget_attributes }}>
  25. {% if (has_voted or not can_vote) %}
  26. <div{{up_attributes}}>{{ 'Up'|t }}</div>
  27. {% else %}
  28. <a {{ up_attributes }} href="{{ up_url }}">{{ 'Up'|t }}</a>
  29. {% endif %}
  30. <div{{ score_attributes }}>
  31. {{ score }}
  32. </div>
  33. {% if (has_voted or not can_vote) %}
  34. <div{{down_attributes}}> {{ 'Down'|t }}</div>
  35. {% else %}
  36. <a {{ down_attributes }} href="{{ down_url }}">{{ 'Down'|t }}</a>
  37. {% endif %}
  38. {% if undo %}
  39. <div{{ undo_attributes }}>{{ undo }}</div>
  40. {% endif %}
  41. {{ info_description }}
  42. </div>