Skip to content
Permalink
Browse files

Hide sections individually.

  • Loading branch information...
flashwave committed Apr 13, 2019
1 parent bc1a12c commit 626b5e2bbbe0e1e79bc222caf5c2805d7710a477
Showing with 28 additions and 12 deletions.
  1. +28 −12 templates/home/search.twig
@@ -15,36 +15,50 @@
</div>
</form>

<div class="container container--lazy">
{{ container_title('Categories') }}
<a href="#topics" class="link">Topics ({{ forum_topics|length|number_format }})</a>
<a href="#posts" class="link">Posts ({{ forum_posts|length|number_format }})</a>
<a href="#users" class="link">Users ({{ users|length|number_format }})</a>
<a href="#news" class="link">News ({{ news_posts|length|number_format }})</a>
</div>
{% if forum_topics|length > 0 or forum_posts|length > 0 or users|length > 0 or news_posts|length > 0 %}
<div class="container container--lazy">
{{ container_title('<i class="fas fa-folder fa-fw"></i> Categories') }}
{% if forum_topics|length > 0 %}<a href="#topics" class="link">Topics ({{ forum_topics|length|number_format }})</a>{% endif %}
{% if forum_posts|length > 0 %}<a href="#posts" class="link">Posts ({{ forum_posts|length|number_format }})</a>{% endif %}
{% if users|length > 0 %}<a href="#users" class="link">Users ({{ users|length|number_format }})</a>{% endif %}
{% if news_posts|length > 0 %}<a href="#news" class="link">News ({{ news_posts|length|number_format }})</a>{% endif %}
</div>
{% elseif search_query|length > 0 %}
<div class="container container--lazy">
{{ container_title('<i class="fas fa-search-minus fa-fw"></i> Nothing found!') }}

<div class="container__content">
No results found using that query, try something else!
</div>
</div>
{% endif %}

{% if search_query|length > 0 %}
{% if forum_topics|length > 0 %}
<div id="topics" class="container container--lazy">
{{ container_title('Topics (%s)'|format(forum_topics|length|number_format)) }}
{{ container_title('<i class="fas fa-comments fa-fw"></i> Topics (%s)'|format(forum_topics|length|number_format)) }}
{% for topic in forum_topics %}
<a href="{{ url('forum-topic', {'topic': topic.topic_id}) }}" class="link">
{{ topic.topic_title }}
</a><br>
{% endfor %}
</div>
{% endif %}

{% if forum_posts|length > 0 %}
<div id="posts" class="container container--lazy">
{{ container_title('Posts (%s)'|format(forum_posts|length|number_format)) }}
{{ container_title('<i class="fas fa-comment fa-fw"></i> Posts (%s)'|format(forum_posts|length|number_format)) }}

{% for post in forum_posts %}
<a href="{{ url('forum-post', {'post': post.post_id, 'post_fragment': 'p' ~ post.post_id}) }}" class="link">
Reply by {{ post.username }} in "{{ post.topic_title }}"
</a><br>
{% endfor %}
</div>
{% endif %}

{% if users|length > 0 %}
<div id="users" class="container container--lazy">
{{ container_title('Users (%s)'|format(users|length|number_format)) }}
{{ container_title('<i class="fas fa-users fa-fw"></i> Users (%s)'|format(users|length|number_format)) }}

<div class="userlist">
{% for user in users %}
@@ -54,9 +68,11 @@
{% endfor %}
</div>
</div>
{% endif %}

{% if news_posts|length > 0 %}
<div id="news" class="container container--lazy">
{{ container_title('News (%s)'|format(news_posts|length|number_format)) }}
{{ container_title('<i class="fas fa-newspaper fa-fw"></i> News (%s)'|format(news_posts|length|number_format)) }}
{% for post in news_posts %}
<a href="{{ url('news-post', {'post': post.post_id}) }}" class="link">
{{ post.post_title }}

0 comments on commit 626b5e2

Please sign in to comment.
You can’t perform that action at this time.