results.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {% extends "oscar/base.html" %}
  2. {% macro search_form_attrs() -%}
  3. {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
  4. <input type="hidden" name="q" value="{{ q|e }}" />
  5. <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
  6. <input type="hidden" name="time_range" value="{{ time_range }}" />
  7. <input type="hidden" name="language" value="{{ current_language }}" />
  8. {%- endmacro %}
  9. {%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&amp;pageno={{ pageno }}{% endif %}{% if time_range %}&amp;time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&amp;language={{ current_language }}{% endif %}{% endmacro -%}
  10. {% block title %}{{ q|e }} - {% endblock %}
  11. {% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ search_url() }}&amp;format=rss">{% endblock %}
  12. {% block content %}
  13. <div class="row">
  14. <div class="col-sm-8" id="main_results">
  15. <h1 class="sr-only">{{ _('Search results') }}</h1>
  16. {% include 'oscar/search.html' %}
  17. {% if answers %}
  18. {% for answer in answers %}
  19. <div class="result well">
  20. <span>{{ answer }}</span>
  21. </div>
  22. {% endfor %}
  23. {% endif %}
  24. {% for result in results %}
  25. <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
  26. {% set index = loop.index %}
  27. {% if result.template %}
  28. {% include get_result_template('oscar', result['template']) %}
  29. {% else %}
  30. {% include 'oscar/result_templates/default.html' %}
  31. {% endif %}
  32. </div>
  33. {% endfor %}
  34. {% if not results and not answers %}
  35. {% include 'oscar/messages/no_results.html' %}
  36. {% endif %}
  37. <div class="clearfix"></div>
  38. {% if paging %}
  39. {% if rtl %}
  40. <div id="pagination">
  41. <div class="pull-left">
  42. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  43. {{ search_form_attrs() }}
  44. <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>
  45. </form>
  46. </div>
  47. <div class="pull-right">
  48. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  49. {{ search_form_attrs() }}
  50. <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button>
  51. </form>
  52. </div>
  53. </div><!-- /#pagination -->
  54. <div class="clearfix"></div>
  55. {% else %}
  56. <div id="pagination">
  57. <div class="pull-left">
  58. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  59. {{ search_form_attrs() }}
  60. <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-backward"></span> {{ _('previous page') }}</button>
  61. </form>
  62. </div>
  63. <div class="pull-right">
  64. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
  65. {{ search_form_attrs() }}
  66. <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
  67. </form>
  68. </div>
  69. </div><!-- /#pagination -->
  70. <div class="clearfix"></div>
  71. {% endif %}
  72. {% endif %}
  73. </div><!-- /#main_results -->
  74. <div class="col-sm-4" id="sidebar_results">
  75. {% if number_of_results != '0' %}
  76. <div class="panel panel-default">
  77. <div class="panel-heading">
  78. <h4 class="panel-title">{{ _('Number of results') }}</h4>
  79. </div>
  80. <div class="panel-body">
  81. {{ number_of_results }}
  82. </div>
  83. </div>
  84. {% endif %}
  85. {% if infoboxes %}
  86. {% for infobox in infoboxes %}
  87. {% include 'oscar/infobox.html' %}
  88. {% endfor %}
  89. {% endif %}
  90. {% if suggestions %}
  91. <div class="panel panel-default">
  92. <div class="panel-heading">
  93. <h4 class="panel-title">{{ _('Suggestions') }}</h4>
  94. </div>
  95. <div class="panel-body">
  96. {% for suggestion in suggestions %}
  97. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item">
  98. <input type="hidden" name="q" value="{{ suggestion }}">
  99. <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
  100. </form>
  101. {% endfor %}
  102. </div>
  103. </div>
  104. {% endif %}
  105. <div class="panel panel-default">
  106. <div class="panel-heading">
  107. <h4 class="panel-title">{{ _('Links') }}</h4>
  108. </div>
  109. <div class="panel-body">
  110. <form role="form">
  111. <div class="form-group">
  112. <label for="search_url">{{ _('Search URL') }}</label>
  113. <input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ search_url() }}" readonly>
  114. </div>
  115. </form>
  116. <label>{{ _('Download results') }}</label>
  117. <div class="clearfix"></div>
  118. {% for output_type in ('csv', 'json', 'rss') %}
  119. <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
  120. {{ search_form_attrs() }}
  121. <input type="hidden" name="format" value="{{ output_type }}">
  122. <button type="submit" class="btn btn-default">{{ output_type }}</button>
  123. </form>
  124. {% endfor %}
  125. <div class="clearfix"></div>
  126. </div>
  127. </div>
  128. </div><!-- /#sidebar_results -->
  129. </div>
  130. {% endblock %}