results.html 8.1 KB

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