commit: 2e7723a6c1ce51c6b3830470164ac818126760ae
parent b2c976a5a33f234de1f5c67de0e04034c21c20d8
Author: Thomas Pointhuber <thomas.pointhuber@gmx.at>
Date: Mon, 3 Nov 2014 10:39:47 +0100
[enh] oscar_template: improve result visualisation
* highlight parts of result
* add link to archiv.to
* fix little bugs
* add little icons
* change style of "show map" button
Diffstat:
10 files changed, 66 insertions(+), 17 deletions(-)
diff --git a/searx/static/oscar/css/leaflet.min.css b/searx/static/oscar/css/leaflet.min.css
@@ -55,8 +55,8 @@
.leaflet-touch .leaflet-control-zoom-in{font-size:22px}
.leaflet-touch .leaflet-control-zoom-out{font-size:24px}
.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,0.4);background:#fff;border-radius:5px}
-.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}
-.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}
+.leaflet-control-layers-toggle{background-image:url(../img/map/layers.png);width:36px;height:36px}
+.leaflet-retina .leaflet-control-layers-toggle{background-image:url(../img/map/layers-2x.png);background-size:26px 26px}
.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}
.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}
.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}
diff --git a/searx/static/oscar/css/oscar.min.css b/searx/static/oscar/css/oscar.min.css
@@ -3,11 +3,15 @@ body{margin-bottom:80px}
.footer{position:absolute;bottom:0;width:100%;height:60px}
input[type=checkbox]:checked~.label_hide_if_checked{display:none}
input[type=checkbox]:not(:checked)~.label_hide_if_not_checked{display:none}
+.result_header{margin-bottom:5px;margin-top:20px}.result_header .favicon{margin-bottom:-3px}
+.result_header a{vertical-align:bottom}.result_header a .highlight{font-weight:bold}
+.result-content .highlight{font-weight:bold}
.result-default{clear:both}
.result-images{float:left !important}
.img-thumbnail{margin:5px;max-height:128px;min-height:128px}
.result-videos{clear:both}
.result-torrents{clear:both}
+.result-map{clear:both}
.suggestion_item{margin:2px 5px}
.result_download{margin-right:5px}
#pagination{margin-top:30px;padding-bottom:50px}
@@ -15,3 +19,4 @@ input[type=checkbox]:not(:checked)~.label_hide_if_not_checked{display:none}
.infobox .infobox_part:last-child{margin-bottom:0}
.search_categories{margin:10px 0;text-transform:capitalize}
.cursor-text{cursor:text !important}
+.cursor-pointer{cursor:pointer !important}
diff --git a/searx/static/oscar/less/oscar/cursor.less b/searx/static/oscar/less/oscar/cursor.less
@@ -2,3 +2,7 @@
.cursor-text {
cursor: text !important;
}
+
+.cursor-pointer {
+ cursor: pointer !important;
+}
diff --git a/searx/static/oscar/less/oscar/results.less b/searx/static/oscar/less/oscar/results.less
@@ -1,3 +1,27 @@
+
+.result_header {
+ margin-bottom:5px;
+ margin-top:20px;
+
+ .favicon {
+ margin-bottom:-3px;
+ }
+
+ a {
+ vertical-align: bottom;
+
+ .highlight {
+ font-weight:bold;
+ }
+ }
+}
+
+.result-content {
+ .highlight {
+ font-weight:bold;
+ }
+}
+
// default formating of results
.result-default {
clear: both;
@@ -24,6 +48,11 @@
clear: both;
}
+// map formating of results
+.result-map {
+ clear: both;
+}
+
// suggestion
.suggestion_item {
margin: 2px 5px;
diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html
@@ -66,6 +66,6 @@
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
{% if autocomplete %}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{% endif %}
<script src="{{ url_for('static', filename='js/require-2.1.15.min.js') }}"></script>
- <script src="{{ url_for('static', filename='js/scripts.js') }}"></script>-->
+ <script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
</body>
</html>
diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html
@@ -1,8 +1,11 @@
-<h3>{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
+{% from 'oscar/macros.html' import icon %}
+
+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
+<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
-{% if result.content %}<p>{{ result.content|safe }}</p>{% endif %}
+{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
<div class="clearfix"></div>
diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html
@@ -11,7 +11,7 @@
</div>
<div class="modal-body">
<img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
- {% if result.content %}<p>{{ result.content|safe }}</p>{% endif %}
+ {% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
</div>
<div class="modal-footer">
<div class="clearfix"></div>
diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html
@@ -1,12 +1,16 @@
-<h3>{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
+{% from 'oscar/macros.html' import icon %}
-{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
-
-{% if result.content %}<p>{{ result.content|safe }}</p>{% endif %}
+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
-{% if result.latitude and result.longitude %}
- <button type="button" class="btn btn-default btn-collapse collapsed searx_init_map" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('Show Map') }}" data-btn-text-not-collapsed="{{ _('Hide Map') }}">{{ _('Show Map') }}</button>
+{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
+<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+{% if (result.latitude and result.longitude) or result.boundingbox %}
+ <small> • <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
+{% endif %}
+
+{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
+{% if (result.latitude and result.longitude) or result.boundingbox %}
<div class="collapse" id="result-map-{{ index }}">
<div style="height:300px; width:100%; margin: 10px 0;" id="osm-map-{{ index }}"></div>
</div>
diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html
@@ -1,14 +1,15 @@
{% from 'oscar/macros.html' import icon %}
-<h3>{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
+<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
<p>{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span></p>
<p><a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} magnet link</a></p>
-{% if result.content %}<p>{{ result.content|safe }}</p>{% endif %}
+{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
<div class="clearfix"></div>
diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html
@@ -1,11 +1,14 @@
-<h3>{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
+{% from 'oscar/macros.html' import icon %}
+
+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
-
+<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+
<div class="container-fluid">
<div class="row">
<img class="thumbnail col-xs-6 col-sm-4 col-md-4" src="{{ result.thumbnail|safe }}" />
- {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif %}
+ {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
</div>
</div>