results.html 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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">{{ _('Suggestions') }}</h4>
  45. </div>
  46. <div class="panel-body">
  47. {% for suggestion in suggestions %}
  48. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
  49. <input type="hidden" name="q" value="{{ suggestion }}">
  50. <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
  51. </form>
  52. {% endfor %}
  53. </div>
  54. </div>
  55. {% endif %}
  56. <div class="panel panel-default">
  57. <div class="panel-heading">
  58. <h4 class="panel-title">{{ _('Links') }}</h4>
  59. </div>
  60. <div class="panel-body">
  61. <form role="form">
  62. <div class="form-group">
  63. <label for="search_url">{{ _('Search URL') }}</label>
  64. <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>
  65. </div>
  66. </form>
  67. <label>{{ _('Download results') }}</label>
  68. <div class="clearfix"></div>
  69. {% for output_type in ('csv', 'json', 'rss') %}
  70. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-left result_download">
  71. <input type="hidden" name="q" value="{{ q }}">
  72. <input type="hidden" name="format" value="{{ output_type }}">
  73. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}
  74. <input type="hidden" name="pageno" value="{{ pageno }}">
  75. <button type="submit" class="btn btn-default">{{ output_type }}</button>
  76. </form>
  77. {% endfor %}
  78. <div class="clearfix"></div>
  79. </div>
  80. </div>
  81. {% if infoboxes %}
  82. {% for infobox in infoboxes %}
  83. {% include 'oscar/infobox.html' %}
  84. {% endfor %}
  85. {% endif %}
  86. </div><!-- /#sidebar_results -->
  87. </div>
  88. {% endblock %}