macros.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {% macro page_title(title='', parent='', page=0) -%}
  2. {% if title %}{{ title }}{% if page > 1 %} | {% trans page=page %}Page {{ page }}{% endtrans %}{% endif %} | {% if parent %}{{ parent }} | {% endif %}{% endif %}{{ settings.board_name }}
  3. {%- endmacro %}
  4. {# Guest avatar #}
  5. {% macro avatar_guest(size=None) -%}
  6. {{ STATIC_URL }}avatars/{% if size %}{{ size }}_{% endif %}avatar_guest.jpg
  7. {%- endmacro %}
  8. {# Messages list macro #}
  9. {% macro messages_list(messages) %}
  10. {% if messages %}
  11. <div class="messages-list">
  12. {% for message in messages %}
  13. {{ draw_message(message) }}
  14. {% endfor %}
  15. </div>
  16. {% endif %}
  17. {% endmacro %}
  18. {# Render single message #}
  19. {% macro draw_message(message, class='') %}
  20. <div class="alert alert-{{ message.type }}{% if class %} {{ class }}{% endif %}">
  21. {{ draw_message_icon(message) }} <p><strong>{{ message.message }}</strong></p>
  22. </div>
  23. {%- endmacro %}
  24. {# Render icon #}
  25. {% macro draw_message_icon(message) -%}
  26. <div class="alert-icon"><span><i class="icon-{% if message.type == 'error' -%}remove
  27. {%- elif message.type == 'success' -%}ok
  28. {%- elif message.type == 'info' -%}info-sign
  29. {%- else -%}warning-sign
  30. {%- endif %} icon-white"></i></span></div>
  31. {%- endmacro %}
  32. {# Render pagination label #}
  33. {% macro pager_label(pagination) -%}
  34. {%- trans current_page=('<strong>' ~ pagination['page'] ~ '</strong>')|safe, pages=('<strong>' ~ pagination['total'] ~ '</strong>')|safe -%}
  35. Page {{ current_page }} of {{ pages }}
  36. {%- endtrans -%}
  37. {%- endmacro %}
  38. {% macro itemprop_bread() -%}
  39. itemprop="breadcrumb"
  40. {%- endmacro %}
  41. {% macro parents_list(forums) -%}
  42. {% for forum in forums %}
  43. <li><a href="{% if loop.first %}{{ url('index') }}#{{ forum.slug }}{% else %}{{ url(forum.type, forum=forum.pk, slug=forum.slug) }}{% endif %}">{{ forum.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  44. {% endfor %}
  45. {%- endmacro %}
  46. {% macro wrap(item, wrap, extra='') -%}
  47. <{{ wrap }}{% if extra %} {{ extra|safe }}{% endif %}>{{ item }}</{{ wrap }}>
  48. {%- endmacro %}
  49. {% macro thread_flags(thread) -%}
  50. <ul class="unstyled thread-flags">
  51. {% if thread.replies_reported and ((forum is defined and acl.threads.can_mod_posts(forum)) or acl.threads.can_mod_posts(thread.forum)) %}
  52. <li class="flag-reported"><i class="icon-warning-sign tooltip-top" title="{% trans %}This thread has reported replies{% endtrans %}"></i></li>
  53. {% endif %}
  54. {% if thread.replies_moderated %}
  55. <li class="flag-notreviewed"><i class="icon-question-sign tooltip-top" title="{% trans %}This thread has unreviewed replies{% endtrans %}"></i></li>
  56. {% endif %}
  57. {% if thread.weight == 2 %}
  58. <li class="flag-announcement"><i class="icon-star tooltip-top" title="{% trans %}This thread is an annoucement{% endtrans %}"></i></li>
  59. {% endif %}
  60. {% if thread.weight == 1 %}
  61. <li class="flag-sticky"><i class="icon-star-empty tooltip-top" title="{% trans %}This thread is sticky{% endtrans %}"></i></li>
  62. {% endif %}
  63. {% if thread.moderated %}
  64. <li class="flag-notreviewed"><i class="icon-eye-close tooltip-top" title="{% trans %}This thread awaits review{% endtrans %}"></i></li>
  65. {% endif %}
  66. {% if thread.deleted %}
  67. <li class="flag-deleted"><i class="icon-trash tooltip-top" title="{% trans %}This thread is deleted{% endtrans %}"></i></li>
  68. {% endif %}
  69. {% if thread.closed %}
  70. <li class="flag-closed"><i class="icon-lock tooltip-top" title="{% trans %}This thread is closed{% endtrans %}"></i></li>
  71. {% endif %}
  72. </ul>
  73. {%- endmacro %}