123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- {% set page_title = _("Search") %}
- {% extends theme("layout.html") %}
- {% block content %}
- {% from theme('macros.html') import render_pagination, group_field, topic_pages %}
- <ul class="breadcrumb">
- <li><a href="{{ url_for('forum.index') }}">{% trans %}Forum{% endtrans %}</a></li>
- <li class="active">{% trans %}Search{% endtrans %}</li>
- </ul>
- {% if result['post'] %}
- <h3>{% trans %}Posts{% endtrans %}</h3>
- <table class="table table-bordered">
- <tbody>
- {% for post in result['post'].all() %}
- <tr>
- <td>
- <table class="table table-borderless">
- <tr>
- {% if post.user_id %}
- {% if post.user.avatar %}
- <td width="1">
- <img src="{{ post.user.avatar }}" alt="Avatar" height="100" width="100">
- </td>
- {% endif %}
- <td>
- <a href="{{ post.user.url }}">
- <span style="font-weight:bold">{{ post.user.username }}</span> <!-- TODO: Implement userstyles -->
- </a>
- {%- if post.user|is_online %}
- <span class="label label-success">Online</span>
- {%- else %}
- <span class="label label-default">Offline</span>
- {%- endif %}
- <div class="profile primary-group">
- {{ post.user.primary_group.name }}
- </div>
- </td>
- <td class="pull-right">
- {% trans %}Posts{% endtrans %}: {{ post.user.post_count }}<br />
- {% trans %}Registered since{% endtrans %}: {{ post.user.date_joined|format_date('%b %d %Y') }}<br />
- </td>
- {% else %}
- <td>
- <strong>{{ post.username }}</strong>
- <br />
- {% trans %}Guest{% endtrans %}
- </td>
- {% endif %}
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <div class="post_body" id="pid{{ post.id }}">
- {% autoescape false %}
- {{ post.content|markup }}
- {% endautoescape %}
- </div>
- </td>
- </tr>
- {% else %}
- <tr>
- <td>{% trans %}No posts found matching your search criteria.{% endtrans %}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endif %}
- {% if result['user'] %}
- <h3>{% trans %}Users{% endtrans %}</h3>
- <table class="table table-bordered">
- <thead>
- <tr>
- <th>#</th>
- <th>{% trans %}Username{% endtrans %}</th>
- <th>{% trans %}Posts{% endtrans %}</th>
- <th>{% trans %}Date registered{% endtrans %}</th>
- <th>{% trans %}Group{% endtrans %}</th>
- </tr>
- </thead>
- <tbody>
- {% for user in result['user'].all() %}
- <tr>
- <td>{{ user.id }}</td>
- <td><a href="{{ user.url }}">{{ user.username }}</a></td>
- <td>{{ user.post_count }}</td>
- <td>{{ user.date_joined|format_date('%b %d %Y') }}</td>
- <td>{{ user.primary_group.name }}</td>
- </tr>
- {% else %}
- <tr>
- <td colspan="5">{% trans %}No users found matching your search criteria.{% endtrans %}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endif %}
- {% if result['topic'] %}
- <h3>{% trans %}Topics{% endtrans %}</h3>
- <table class="table table-bordered">
- <thead>
- <tr>
- <th colspan="2">{% trans %}Topic{% endtrans %}</th>
- <th>{% trans %}Posts{% endtrans %}</th>
- <th>{% trans %}Views{% endtrans %}</th>
- <th>{% trans %}Last Post{% endtrans %}</th>
- </tr>
- </thead>
- <tbody>
- {% for topic in result['topic'].all() %}
- <tr>
- <td width="4%">
- {% if topic.locked %}
- <span class="fa fa-locked" style="font-size: 2em"></span>
- {% else %}
- <span class="fa fa-comment-o" style="font-size: 2em"></span>
- {% endif %}
- </td>
- <td>
- <div>
- <a href="{{ topic.url }}">{{ topic.title }}</a>
- <!-- Topic Pagination -->
- {{ topic_pages(topic, flaskbb_config["POSTS_PER_PAGE"]) }}
- <br />
- <small>
- {% trans %}by{% endtrans %}
- {% if topic.user_id %}
- <a href="{{ topic.user.url }}">{{ topic.user.username }}</a>
- {% else %}
- {{ topic.username }}
- {% endif %}
- </small>
- </div>
- </td>
- <td>
- {{ topic.post_count }}
- </td>
- <td>
- {{ topic.views }}
- </td>
- <td>
- <a href="{{ topic.last_post.url }}">{{ topic.last_post.date_created|time_since }}</a><br />
- <small>
- {% trans %}by{% endtrans %}
- {% if topic.last_post.user_id %}
- <a href="{{ topic.last_post.user.url }}">{{ topic.last_post.user.username }}</a>
- {% else %}
- {{ topic.last_post.username }}
- {% endif %}
- </small>
- </td>
- </tr>
- {% else %}
- <tr>
- <td colspan="5">{% trans %}No topics found matching your search criteria.{% endtrans %}</td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endif %}
- {% if result['forum'] %}
- <h3>{% trans %}Forums{% endtrans %}</h3>
- <table class="table table-bordered">
- <thead class="categoryhead">
- <tr>
- <th colspan="2"><strong>{% trans %}Forum{% endtrans %}</strong></th>
- <th width="85" align="center" style="white-space: nowrap"><strong>{% trans %}Topics{% endtrans %}</strong></th>
- <th width="85" align="center" style="white-space: nowrap"><strong>{% trans %}Posts{% endtrans %}</strong></th>
- <th width="200" align="center" style="white-space: nowrap"><strong>{% trans %}Last Post{% endtrans %}</strong></th>
- </tr>
- </thead>
- <tbody class="forumbody">
- {% for forum in result['forum'].all() %}
- <tr>
- <td align="center" valign="center" width="4%">
- {% if forum.external %}
- <span class="fa fa-external-link" style="font-size: 2em"></span>
- </td>
- <td valign="top">
- <strong><a href="{{ forum.external }}">{{ forum.title }}</a></strong>
- <div class="forum-description">
- {% autoescape false %}
- {{ forum.description|markup }}
- {% endautoescape %}
- </div>
- </td>
- <td valign="top" align="center" style="white-space: nowrap">-</td>
- <td valign="top" align="center" style="white-space: nowrap">-</td>
- <td valign="top" align="right" style="white-space: nowrap">-</td>
- <!-- End external -->
- {% else %}
- {% if forum.locked %}
- <span class="fa fa-lock" style="font-size: 2em"></span>
- {% else %}
- <span class="fa fa-comments-o" style="font-size: 2em"></span>
- {% endif %}
- </td>
- <td valign="top">
- <strong><a href="{{ forum.url }}">{{ forum.title }}</a></strong>
- <div class="forum-description">
- {% autoescape false %}
- {{ forum.description|markup }}
- {% endautoescape %}
- {% if forum.show_moderators %}
- <div class="forum-moderators">
- {% trans %}Moderators{% endtrans %}:
- {% for moderator in forum.moderators %}
- <a href="{{ url_for('user.profile', username=moderator.username) }}">{{ moderator.username }}</a>{% if not loop.last %}, {% endif %}
- {% endfor %}
- </div>
- {% endif %}
- </div>
- </td>
- <td valign="top" align="center" style="white-space: nowrap">{{ forum.topic_count }}</td>
- <td valign="top" align="center" style="white-space: nowrap">{{ forum.post_count }}</td>
- <td valign="top" align="right" style="white-space: nowrap">
- {% if forum.last_post_id %}
- <a href="{{ forum.last_post.url }}" title="{{ forum.last_post.topic.title }}">
- <strong>{{ forum.last_post.topic.title|crop_title }}</strong>
- </a>
- <br />
- {{ forum.last_post.date_created|time_since }}<br />
- {% trans %}by{% endtrans %}
- {% if forum.last_post.user_id %}
- <a href="{{ url_for('user.profile', username=forum.last_post.user.username) }}">{{ forum.last_post.user.username }}</a>
- {% else %}
- {{ forum.last_post.username }}
- {% endif %}
- {% else %}
- {% trans %}No posts.{% endtrans %}
- {% endif %}
- {% endif %}
- </td>
- </tr>
- {% else %}
- <tr>
- <td colspan="5">
- {% trans %}No forums found matching your search criteria.{% endtrans %}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% endif %}
- {% endblock %}
|