results.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. {% for result in results %}
  9. <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
  10. {% set index = loop.index %}
  11. {% if result.template %}{% include 'oscar/result_templates/'+result['template'] %}{% else %}{% include 'oscar/result_templates/default.html' %}{% endif %}
  12. </div>
  13. {% endfor %}
  14. {% if not results %}
  15. {% include 'oscar/messages/no_results.html' %}
  16. {% endif %}
  17. <div class="clearfix"></div>
  18. {% if paging %}
  19. <div id="pagination">
  20. <div class="pull-left">
  21. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  22. <input type="hidden" name="q" value="{{ q }}" />
  23. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
  24. <input type="hidden" name="pageno" value="{{ pageno-1 }}" />
  25. <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-backward"></span> {{ _('previous page') }}</button>
  26. </form>
  27. </div>
  28. <div class="pull-right">
  29. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  30. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
  31. <input type="hidden" name="q" value="{{ q }}" />
  32. <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
  33. <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
  34. </form>
  35. </div>
  36. </div><!-- /#pagination -->
  37. <div class="clearfix"></div>
  38. {% endif %}
  39. </div><!-- /#main_results -->
  40. <div class="col-sm-4" id="sidebar_results">
  41. {% if suggestions %}
  42. <div class="panel panel-default">
  43. <div class="panel-heading">
  44. <h4 class="panel-title">
  45. <a data-toggle="collapse" data-parent="#accordion" href="#suggestions">{{ _('Suggestions') }}</a>
  46. </h4>
  47. </div>
  48. <div class="panel-body">
  49. {% for suggestion in suggestions %}
  50. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
  51. <input type="hidden" name="q" value="{{ suggestion }}">
  52. <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
  53. </form>
  54. {% endfor %}
  55. </div>
  56. </div>
  57. {% endif %}
  58. <div class="panel panel-default">
  59. <div class="panel-heading">
  60. <h4 class="panel-title">
  61. <a data-toggle="collapse" data-parent="#accordion" href="#links">{{ _('Links') }}</a>
  62. </h4>
  63. </div>
  64. <div class="panel-body">
  65. <form role="form">
  66. <div class="form-group">
  67. <label for="search_url">{{ _('Search URL') }}</label>
  68. <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>
  69. </div>
  70. </form>
  71. <label>{{ _('Download results') }}</label>
  72. <div class="clearfix"></div>
  73. {% for output_type in ('csv', 'json', 'rss') %}
  74. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-left result_download">
  75. <input type="hidden" name="q" value="{{ q }}">
  76. <input type="hidden" name="format" value="{{ output_type }}">
  77. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}
  78. <input type="hidden" name="pageno" value="{{ pageno }}">
  79. <button type="submit" class="btn btn-default">{{ output_type }}</button>
  80. </form>
  81. {% endfor %}
  82. <div class="clearfix"></div>
  83. </div>
  84. </div>
  85. </div><!-- /#sidebar_results -->
  86. </div>
  87. {% endblock %}