| 1 | {% extends 'base/base.html' %} |
| 2 | |
| 3 | {% macro generate_forums(forums_data, level=0) %} |
| 4 | {% set panel_type = "main" if level==0 else "sub" %} |
| 5 | <ul class="forum forum__panel_{{panel_type}}"> |
| 6 | {% for forum in forums_data %} |
| 7 | <li class="forum forum__cat_{{panel_type}} forum__level_{{level}}"> |
| 8 | {% if 'http_url' in forum %} |
| 9 | <a href="{{forum['http_url']}}" class="forum_active"> |
| 10 | {% else %} |
| 11 | <a> |
| 12 | {% endif %} |
| 13 | <span class="forum_title">{{ forum.title }}</span> |
| 14 | {% if 'short-desc' in forum %} |
| 15 | <p class="forum_short-desc">{{ forum['short-desc'] }}</p> |
| 16 | {% endif %} |
| 17 | </a> |
| 18 | |
| 19 | {% if 'sub-forums' in forum %} |
| 20 | {{ generate_forums(forum['sub-forums'], level=level+1) }} |
| 21 | {% endif %} |
| 22 | </li> |
| 23 | {% endfor %} |
| 24 | </ul> |
| 25 | {% endmacro %} |
| 26 | |
| 27 | {% block body %} |
| 28 | {% if not forums %} |
| 29 | <p class="message--info">{% trans %}No forums found on this server!{% endtrans %}</p> |
| 30 | {% else %} |
| 31 | <div class="forums"> |
| 32 | {{ generate_forums(forums) }} |
| 33 | </div> |
| 34 | {% endif %} |
| 35 | {% endblock body %} |