results.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {% extends "oscar/base.html" %}
  2. {% block title %}{{ q }} - {% endblock %}
  3. {% block content %}
  4. <div class="row">
  5. <div class="col-sm-8" id="main_results">
  6. <h1 class="sr-only">{{ _('Search results') }}</h1>
  7. {% include 'oscar/search.html' %}
  8. {% if answers %}
  9. {% for answer in answers %}
  10. <div class="result well">
  11. <span>{{ answer }}</span>
  12. </div>
  13. {% endfor %}
  14. {% endif %}
  15. {% for result in results %}
  16. <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
  17. {% set index = loop.index %}
  18. {% if result.template %}{% include 'oscar/result_templates/'+result['template'] %}{% else %}{% include 'oscar/result_templates/default.html' %}{% endif %}
  19. </div>
  20. {% endfor %}
  21. {% if not results %}
  22. {% include 'oscar/messages/no_results.html' %}
  23. {% endif %}
  24. <div class="clearfix"></div>
  25. {% if paging %}
  26. <div id="pagination">
  27. <div class="pull-left">
  28. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  29. <input type="hidden" name="q" value="{{ q }}" />
  30. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
  31. <input type="hidden" name="pageno" value="{{ pageno-1 }}" />
  32. <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-backward"></span> {{ _('previous page') }}</button>
  33. </form>
  34. </div>
  35. <div class="pull-right">
  36. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  37. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
  38. <input type="hidden" name="q" value="{{ q }}" />
  39. <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
  40. <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
  41. </form>
  42. </div>
  43. </div><!-- /#pagination -->
  44. <div class="clearfix"></div>
  45. {% endif %}
  46. </div><!-- /#main_results -->
  47. <div class="col-sm-4" id="sidebar_results">
  48. {% if suggestions %}
  49. <div class="panel panel-default">
  50. <div class="panel-heading">
  51. <h4 class="panel-title">{{ _('Suggestions') }}</h4>
  52. </div>
  53. <div class="panel-body">
  54. {% for suggestion in suggestions %}
  55. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
  56. <input type="hidden" name="q" value="{{ suggestion }}">
  57. <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
  58. </form>
  59. {% endfor %}
  60. </div>
  61. </div>
  62. {% endif %}
  63. <div class="panel panel-default">
  64. <div class="panel-heading">
  65. <h4 class="panel-title">{{ _('Links') }}</h4>
  66. </div>
  67. <div class="panel-body">
  68. <form role="form">
  69. <div class="form-group">
  70. <label for="search_url">{{ _('Search URL') }}</label>
  71. <input type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ base_url }}?q={{ q|urlencode }}&pageno={{ pageno }}{% if selected_categories %}&category_{{ selected_categories|join("&category_") }}{% endif %}" readonly>
  72. </div>
  73. </form>
  74. <label>{{ _('Download results') }}</label>
  75. <div class="clearfix"></div>
  76. {% for output_type in ('csv', 'json', 'rss') %}
  77. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-left result_download">
  78. <input type="hidden" name="q" value="{{ q }}">
  79. <input type="hidden" name="format" value="{{ output_type }}">
  80. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}
  81. <input type="hidden" name="pageno" value="{{ pageno }}">
  82. <button type="submit" class="btn btn-default">{{ output_type }}</button>
  83. </form>
  84. {% endfor %}
  85. <div class="clearfix"></div>
  86. </div>
  87. </div>
  88. {% if infoboxes %}
  89. {% for infobox in infoboxes %}
  90. {% include 'oscar/infobox.html' %}
  91. {% endfor %}
  92. {% endif %}
  93. </div><!-- /#sidebar_results -->
  94. </div>
  95. {% endblock %}