results.html 5.1 KB

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