on master help sign in
oscar template: improve result page
b91b77eThomas Pointhuber
searx/static/oscar/css/oscar.css+13−1
@@ -15,7 +15,7 @@ body {
15 bottom: 0;
15 bottom: 0;
16 width: 100%;
16 width: 100%;
17 /* Set the fixed height of the footer here */
17 /* Set the fixed height of the footer here */
18− height: 40px;
18+ height: 60px;
19}
19}
20
20
21input[type=checkbox]:checked ~ .label_hide_if_checked {
21input[type=checkbox]:checked ~ .label_hide_if_checked {
@@ -51,3 +51,15 @@ input[type=checkbox]:not(:checked) ~ .label_hide_if_not_checked {
51 max-height: 128px;
51 max-height: 128px;
52 min-height: 128px;
52 min-height: 128px;
53}
53}
54+
55+.suggestion_item {
56+ margin: 2px 5px;
57+}
58+
59+.result_download {
60+ margin-right: 5px;
61+}
62+
63+#pagination {
64+ margin-top: 30px;
65+}
searx/templates/oscar/results.html+75−5
@@ -5,18 +5,88 @@
5 <div class="col-sm-8" id="main_results">
5 <div class="col-sm-8" id="main_results">
6 <h1 class="sr-only">{{ _('Search results') }}</h1>
6 <h1 class="sr-only">{{ _('Search results') }}</h1>
7 {% include 'oscar/search.html' %}
7 {% include 'oscar/search.html' %}
8−
8+
9 {% for result in results %}
9 {% for result in results %}
10 <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
10 <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
11 {% set index = loop.index %}
11 {% set index = loop.index %}
12 {% if result.template %}{% include 'oscar/result_templates/'+result['template'] %}{% else %}{% include 'oscar/result_templates/default.html' %}{% endif %}
12 {% if result.template %}{% include 'oscar/result_templates/'+result['template'] %}{% else %}{% include 'oscar/result_templates/default.html' %}{% endif %}
13 </div>
13 </div>
14 {% endfor %}
14 {% endfor %}
15−
15+
16 <div class="clearfix"></div>
16 <div class="clearfix"></div>
17−
17+
18− </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+
19 <div class="col-sm-4" id="sidebar_results">
41 <div class="col-sm-4" id="sidebar_results">
42+
43+ {% if suggestions %}
44+ <div class="panel panel-default">
45+ <div class="panel-heading">
46+ <h4 class="panel-title">
47+ <a data-toggle="collapse" data-parent="#accordion" href="#suggestions">{{ _('Suggestions') }}</a>
48+ </h4>
20− </div>
49+ </div>
50+ <div class="panel-body">
51+ {% for suggestion in suggestions %}
52+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
53+ <input type="hidden" name="q" value="{{ suggestion }}">
54+ <button type="submit" class="btn btn-default btn-xs">{{ suggestion }}</button>
55+ </form>
56+ {% endfor %}
57+ </div>
58+ </div>
59+ {% endif %}
60+
61+ <div class="panel panel-default">
62+ <div class="panel-heading">
63+ <h4 class="panel-title">
64+ <a data-toggle="collapse" data-parent="#accordion" href="#links">{{ _('Links') }}</a>
65+ </h4>
66+ </div>
67+ <div class="panel-body">
68+ <form role="form">
69+ <div class="form-group">
70+ <label for="search_url">{{ _('Search URL') }}</label>
71+ <input type="url" class="form-control" name="search_url" value="{{ base_url }}?q={{ q|urlencode }}&pageno={{ pageno }}{% if selected_categories %}&category_{{ selected_categories|join("&category_") }}{% endif %}">
72+ </div>
73+ </form>
74+
75+ <label>{{ _('Download results') }}</label>
76+ <div class="clearfix"></div>
77+ {% for output_type in ('csv', 'json', 'rss') %}
78+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-left result_download">
79+ <input type="hidden" name="q" value="{{ q }}">
80+ <input type="hidden" name="format" value="{{ output_type }}">
81+ {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}
82+ <input type="hidden" name="pageno" value="{{ pageno }}">
83+ <button type="submit" class="btn btn-default">{{ output_type }}</button>
84+ </form>
85+ {% endfor %}
86+ <div class="clearfix"></div>
87+ </div>
88+ </div>
89+
90+ </div><!-- /#sidebar_results -->
21 </div>
91 </div>
22{% endblock %}
92{% endblock %}