You are here

opigno-user-stats-block.html.twig in Opigno statistics 3.x

Default theme implementation to display user stats block.

Available variables:

  • stats: array of user statistics data.

File

templates/opigno-user-stats-block.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display user stats block.
  5. *
  6. * Available variables:
  7. * - stats: array of user statistics data.
  8. */
  9. #}
  10. <ul class="statistics-list opigno-user-statistics">
  11. {% for item in stats %}
  12. <li class="statistics-list__item">
  13. <span class="title">{{ item.title }}</span>
  14. <div>
  15. <span class="number">{{ item.amount|trim|first == '0' ? '-' : item.amount }}</span>
  16. {% if item.progress|trim|first == '-' %}
  17. {% set progress_class = 'progress down' %}
  18. {% elseif item.progress|trim|first == '0' %}
  19. {% set progress_class = 'progress' %}
  20. {% else %}
  21. {% set progress_class = 'progress up' %}
  22. {% endif %}
  23. <span class="{{ progress_class }}">
  24. {% if item.progress matches '/^\\d+$/' and item.progress > 0 %}
  25. {{ '+' ~ item.progress }}
  26. {% elseif item.progress|trim|first == '0' %}
  27. {{ '-' }}
  28. {% else %}
  29. {{ item.progress }}
  30. {% endif %}
  31. <i class="fi fi-rr-arrow-right"></i>
  32. </span>
  33. </div>
  34. </li>
  35. {% endfor %}
  36. </ul>