results.html 5.5 KB

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