diff options
Diffstat (limited to 'src/application/templates/bootstrap-3/search.twig')
-rw-r--r-- | src/application/templates/bootstrap-3/search.twig | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/application/templates/bootstrap-3/search.twig b/src/application/templates/bootstrap-3/search.twig new file mode 100644 index 0000000..c8f6315 --- /dev/null +++ b/src/application/templates/bootstrap-3/search.twig @@ -0,0 +1,63 @@ +{% set title = __("Search") %} +{% set formId = "search" %} +{% set formError = getAndClearFormError(formId) %} + +{% extends "base.twig" %} + +{% block content %} + +<div class="page-header margin-top-0"> + <h1>{{ __("Search") }}</h1> +</div> + +{% if formError %} + {% include "components/alert_error.twig" with { message: formError } %} +{% endif %} + +<form action="." method="get"> + <input type="hidden" name="form_id" value="{{ formId }}"> + <input type="hidden" name="_action" value="search"> + <div class="form-group"> + <div class="input-group"> + <input class="form-control" type="search" id="i_query" name="query" value="{{ lastFormField(formId, "query")|default(g.get.query)|default("") }}" required autofocus placeholder="{{ __("Enter your search query...") }}"> + <div class="input-group-btn"> + <button class="btn btn-primary" type="submit">{{ __("Search") }}</button> + </div> + </div> + </div> +</form> + +{% if g.get.query is defined and g.get.query is not null and g.get.query != "" %} + {% if ctx.posts|length > 0 %} + <p>{{ __("%result_count% result(s) in %search_duration% second(s)", { + "result_count": ctx.posts|length, + "search_duration": ctx.search_duration|number_format(2, __(".", context: "Number formatting"), __(",", context: "Number formatting")), + }) }}</p> + <div class="list-group margin-top"> + {% for post in ctx.posts|filter(p => not p.deleted) %} + {% set hasAttachments = ctx.attachments[post.id]|length > 0 %} + {% set postAuthor = ctx.users[post.authorId] %} + <a href="?_action=viewtopic&topic={{ post.topicId|url_encode }}#post-{{ post.id|url_encode }}" class="list-group-item"> + {% if hasAttachments %} + <span class="badge"><span class="fa fa-paperclip"></span></span> + {% endif %} + {{ renderPostSummary(post.content) }}<br> + <span class="text-muted">{{ __("posted by %author% on %post_date% in %topic%", { + "author": '<em>' ~ (postAuthor ? postAuthor.displayName : __("unknown"))|e("html") ~ '</em>', + "post_date": '<span class="_time">' ~ post.postDate.format("c")|e("html") ~ '</span>', + "topic": '<em>' + ~ (topics[post.topicId].isLocked ? '<span class="fa fa-lock text-muted" aria-hidden="true"></span> ' : '') + ~ (topics[post.topicId] ? topics[post.topicId].title : null)|default("unknown")|e("html") ~ '</em>', + }) }}</span> + </a> + {% endfor %} + </div> + {% else %} + <div class="well icon-well text-info margin-top margin-bottom"> + <span class="fa fa-info-circle text-info" aria-hidden="true"></span> + <em>{{ __("No results for this search") }}</em> + </div> + {% endif %} +{% endif %} + +{% endblock %} |