You are here

rate-template-yesno.html.twig in Rate 8

Default theme implementation for yes/no voting display.

Available variables:

  • widget_attributes: Attributes for outer div.
  • has_voted: Boolean if user has voted.
  • user_voted: What the user voted.
  • yes_li_attributes: Attributes for yes li.
  • yes_attributes: Attributes for yes div or link.
  • up_votes: Number of up/yes votes.
  • up_url: Url to vote yes/up.
  • no_li_attributes: Attributes for no li.
  • no_attributes: Attributes for no div or link.
  • score_attributes: Attributes for vote total div.
  • down_votes: Number of down/no votes.
  • down_url: Url to vote no/down.
  • undo: Link to undo placed vote.
  • undo_attributes: Attributes for undo div.
  • info_description: Extra textual info to display.

File

templates/rate-template-yesno.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for yes/no 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. * - yes_li_attributes: Attributes for yes li.
  11. * - yes_attributes: Attributes for yes div or link.
  12. * - up_votes: Number of up/yes votes.
  13. * - up_url: Url to vote yes/up.
  14. * - no_li_attributes: Attributes for no li.
  15. * - no_attributes: Attributes for no div or link.
  16. * - score_attributes: Attributes for vote total div.
  17. * - down_votes: Number of down/no votes.
  18. * - down_url: Url to vote no/down.
  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. <div class="item-list">
  28. <ul>
  29. <li{{ yes_li_attributes }}>
  30. {% if (has_voted or not can_vote) %}
  31. <div{{ yes_attributes }}>{{ 'Yes'|t }}</div>
  32. {% else %}
  33. <a {{ yes_attributes }} href="{{ up_url }}">{{ 'Yes'|t }}</a>
  34. {% endif %}
  35. <div{{ score_attributes }}>{{ up_votes }}</div>
  36. </li>
  37. <li{{ no_li_attributes }}>
  38. {% if (has_voted or not can_vote) %}
  39. <div{{ no_attributes }}>{{ 'No'|t }}</div>
  40. {% else %}
  41. <a {{ no_attributes }} href="{{ down_url }}">{{ 'No'|t }}</a>
  42. {% endif %}
  43. <div {{ score_attributes }}>{{ down_votes }}</div>
  44. </li>
  45. </ul>
  46. </div>
  47. {% if undo %}
  48. <div{{ undo_attributes }}>{{ undo }}</div>
  49. {% endif %}
  50. {{ info_description }}
  51. </div>