{#- Search results: where the search looked (a community, which can be set aside), the kinds as pills with their counts, one result per row with where it is, the words found marked, who and when; beside it, the same words in other communities, and when. Overrides Abilian Core's page; drawn in `mockups/templates/search.html`. -#} {% extends "ads_base.html" %} {% block page_title %}{% if q %}{{ _("“%(q)s”", q=q) }} · {% endif %}{{ _("Search") }}{% endblock %} {% block pretitle %}{{ _("Search") }}{% endblock %} {% block heading %}{% if q %}{{ _("Results for “%(q)s”", q=q) }}{% else %}{{ _("Search") }}{% endif %}{% endblock %} {#- What a result is, as an icon: a file by its type, the rest by their kind. -#} {% macro kind_icon(hit) -%} {% set kind = friendly_fqcn(hit["object_type"]) %} {%- if kind == "Document" %}{{ file_icon(hit["name"]) }} {%- elif kind == "Folder" %}{{ folder_icon() }} {%- elif kind == "WikiPage" %}{{ icon("book") }} {%- elif kind == "User" %}{{ icon("user") }} {%- elif kind == "Community" %}{{ icon("users") }} {%- else %}{{ icon("message-circle") }}{% endif -%} {%- endmacro %} {% block body %}
{% if q %}
{{ ngettext("%(num)d result", "%(num)d results", results_count) }}{% if scope %} {{ _("in") }}{% endif %} {% if scope %} {{ m.tile(scope, "sbe-tile--sm") }}{{ scope.name }}{{ icon("x") }} {% if everywhere_count > results_count %}{{ _("Search everywhere") }} ({{ everywhere_count }}){% endif %} {% endif %}
{% if kinds | length > 2 %} {% endif %}
{% if results_count %}
    {% for hit in results %} {% set community = communities.get(hit.get("community_id")) %}
  • {{ kind_icon(hit) }}
    {{ hit.highlights("name") | safe or hit["name"] }} {% if community %}{{ m.tile(community, "sbe-tile--sm") }}{{ community.name }}{% endif %} {% if hit.get("description") %}

    {{ hit.highlights("description") | safe or hit["description"] }}

    {% endif %} {% if hit.get("creator_name") or hit.get("updated_at") %} {{ hit.get("creator_name") or "" }}{% if hit.get("creator_name") and hit.get("updated_at") %} · {% endif %}{% if hit.get("updated_at") %}{{ m.time(hit["updated_at"]) }}{% endif %} {% endif %}
  • {% endfor %}
{% else %}

{{ _("Nothing matches these words here.") }}{% if scope and everywhere_count %} {{ _("Search everywhere") }} ({{ everywhere_count }}){% endif %}

{% endif %} {% if prev_page or next_page %} {% endif %}
{% endif %}
{% if q %} {% endif %}
{% endblock %}