You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.9 KiB

4 years ago
  1. {% extends 'base.html' %}
  2. {% from 'bootstrap/pagination.html' import render_pagination %}
  3. {% from 'macros.html' import photo_card, user_card with context %}
  4. {% block title %}搜索: {{ q }}{% endblock %}
  5. {% block content %}
  6. <div class="page-header">
  7. <h1>搜索: {{ q }}</h1>
  8. </div>
  9. <div class="row">
  10. <div class="col-md-3">
  11. <div class="nav nav-pills flex-column" role="tablist" aria-orientation="vertical">
  12. <a class="nav-item nav-link {% if category == 'photo' %}active{% endif %}"
  13. href="{{ url_for('.search', q=q, category='photo') }}">照片</a>
  14. <a class="nav-item nav-link {% if category == 'user' %}active{% endif %}"
  15. href="{{ url_for('.search', q=q, category='user') }}">用户</a>
  16. <a class="nav-item nav-link {% if category == 'tag' %}active{% endif %}"
  17. href="{{ url_for('.search', q=q, category='tag') }}">标签</a>
  18. </div>
  19. </div>
  20. <div class="col-md-9">
  21. {% if results %}
  22. <h5>{{ results|length }} 结果</h5>
  23. {% for item in results %}
  24. {% if category == 'photo' %}
  25. {{ photo_card(item) }}
  26. {% elif category == 'user' %}
  27. {{ user_card(item) }}
  28. {% else %}
  29. <a class="badge badge-light" href="{{ url_for('.show_tag', tag_id=item.id) }}">
  30. {{ item.name }} {{ item.photos|length }}
  31. </a>
  32. {% endif %}
  33. {% endfor %}
  34. {% else %}
  35. <h5 class="tip">无结果</h5>
  36. {% endif %}
  37. </div>
  38. </div>
  39. {% if results %}
  40. <div class="page-footer">
  41. {{ render_pagination(pagination, align='right') }}
  42. </div>
  43. {% endif %}
  44. {% endblock %}