on master help sign in
oscar template: improve result page

* add paging support * add suggestion panel * add links panel

commitb91b77e335c0b0f2dca2b261c64414c96fdb2412 authorThomas Pointhuber <thomas.pointhuber@gmx.at> dateSat 27 Sep 2014, 14:44 (12 years ago) parent6fa5f02
2 files changed+88−6
searx/static/oscar/css/oscar.css+13−1 searx/templates/oscar/results.html+75−5
searx/static/oscar/css/oscar.css+13−1
@@ -15,7 +15,7 @@ body {
1515 bottom: 0;
1616 width: 100%;
1717 /* Set the fixed height of the footer here */
18− height: 40px;
18+ height: 60px;
1919}
2020
2121input[type=checkbox]:checked ~ .label_hide_if_checked {
@@ -51,3 +51,15 @@ input[type=checkbox]:not(:checked) ~ .label_hide_if_not_checked {
5151 max-height: 128px;
5252 min-height: 128px;
5353}
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 @@
55 <div class="col-sm-8" id="main_results">
66 <h1 class="sr-only">{{ _('Search results') }}</h1>
77 {% include 'oscar/search.html' %}
8−
8+
99 {% for result in results %}
1010 <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
1111 {% set index = loop.index %}
1212 {% if result.template %}{% include 'oscar/result_templates/'+result['template'] %}{% else %}{% include 'oscar/result_templates/default.html' %}{% endif %}
1313 </div>
1414 {% endfor %}
15−
15+
1616 <div class="clearfix"></div>
17−
18− </div>
17+
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+
1941 <div class="col-sm-4" id="sidebar_results">
20− </div>
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>
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 -->
2191 </div>
2292{% endblock %}