You are here

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

Default theme implementation for thumbs 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_li_attributes: Attributes for the up li.
  • up_attributes: Attributes for the up div or link.
  • up_url: Url to vote up.
  • up_percent: Score of up votes.
  • percent_attributes: Attributes for the percent display div.
  • down_percent: Score of down votes.
  • down_li_attributes: Attributes for the down li.
  • down_url: Url to vote Down.
  • down_attributes: Attributes for down div or link.
  • undo: Link to undo placed vote.
  • undo_attributes: Attributes for undo div.
  • info_description: Extra textual info to display.

File

templates/rate-template-thumbs-up-down.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for thumbs 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_li_attributes: Attributes for the up li.
  11. * - up_attributes: Attributes for the up div or link.
  12. * - up_url: Url to vote up.
  13. * - up_percent: Score of up votes.
  14. * - percent_attributes: Attributes for the percent display div.
  15. * - down_percent: Score of down votes.
  16. * - down_li_attributes: Attributes for the down li.
  17. * - down_url: Url to vote Down.
  18. * - down_attributes: Attributes for down div or link.
  19. * - undo: Link to undo placed vote.
  20. * - undo_attributes: Attributes for undo div.
  21. * - info_description: Extra textual info to display.
  22. *
  23. * @ingroup themeable
  24. */
  25. #}
  26. <div{{ widget_attributes }}>
  27. <ul>
  28. <li{{ up_li_attributes }}>
  29. {% if has_voted or not can_vote %}
  30. <div{{ up_attributes }}>{{ 'Up'|t }}</div>
  31. {% else %}
  32. <a {{ up_attributes }} href="{{ up_url }}">{{ 'Up'|t }}</a>
  33. {% endif %}
  34. <div{{ percent_attributes }}>{{ up_percent }}%</div>
  35. </li>
  36. <li{{ down_li_attributes }}>
  37. {% if has_voted or not can_vote %}
  38. <div{{ down_attributes }}>{{ 'Down'|t }}</div>
  39. {% else %}
  40. <a {{ down_attributes }} href="{{ down_url }}">{{ 'Down'|t }}</a>
  41. {% endif %}
  42. <div{{ percent_attributes }}>{{ down_percent }}%</div>
  43. </li>
  44. </ul>
  45. {% if undo %}
  46. <div{{ undo_attributes }}>{{ undo }}</div>
  47. {% endif %}
  48. {{ info_description }}
  49. </div>