summaryrefslogtreecommitdiff
path: root/searx/templates
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-06-04 09:35:26 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2021-06-09 18:08:23 +0200
commitc75425655fdadf9554b97ae0309a6181acd34ce3 (patch)
tree7fee6892d2a64f2c44db8cb35b079bf823991b8e /searx/templates
parent92c8a8829f2e68e7ceb3b4670ebea4c4e6541a7c (diff)
downloadsearxng-c75425655fdadf9554b97ae0309a6181acd34ce3.tar.gz
searxng-c75425655fdadf9554b97ae0309a6181acd34ce3.zip
[enh] openstreetmap / map template: improve results
implements ideas described in #69 * update the engine * use wikidata * update map.html template
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/oscar/result_templates/map.html91
-rw-r--r--searx/templates/simple/result_templates/map.html74
2 files changed, 89 insertions, 76 deletions
diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html
index 011ccc0bd..6eea2c6d5 100644
--- a/searx/templates/oscar/result_templates/map.html
+++ b/searx/templates/oscar/result_templates/map.html
@@ -3,48 +3,64 @@
{{- result_header(result, favicons, loop.index) -}}
{{- result_sub_header(result, loop.index) -}}
-{%- if (result.latitude and result.longitude) or result.boundingbox -%}
- <small> &bull; <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" 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 -%}
+<div class="container-fluid">
-{# {% if (result.latitude and result.longitude) %}
- <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-geodata-{{ index }}" data-btn-text-collapsed="{{ _('show geodata') }}" data-btn-text-not-collapsed="{{ _('hide geodata') }}">{{ icon('map-marker') }} {{ _('show geodata') }}</a></small>
-{% endif %} #}
+ <div class="row">
+ {%- if result.img_src -%}<img src="{{ image_proxify(result.img_src) }}" title="{{ result.title|striptags }}" class="img-thumbnail">{%- endif -%}
-<div class="container-fluid">
+ {%- if result.type_icon or result.type -%}
+ <p class="result-content">
+ {%- if result.type_icon -%}
+ <img src="{{ image_proxify(result.type_icon) }}" title="{{ result.type|striptags }}" class="img-type">
+ {%- endif -%}
+ {{ result.type if result.type is not none else '' }}
+ </p>
+ {%- endif -%}
-{%- if result.address -%}
-<p class="row result-content result-adress col-xs-12 col-sm-5 col-md-4" itemscope itemtype="http://schema.org/PostalAddress">
- {%- if result.address.name -%}
- <strong itemprop="name">{{ result.address.name }}</strong><br/>
- {%- endif -%}
- {%- if result.address.road -%}
- <span itemprop="streetAddress">
- {%- if result.address.house_number %}{{ result.address.house_number }}, {% endif -%}
- {{- result.address.road -}}
- </span><br/>
- {%- endif -%}
- {%- if result.address.locality -%}
- <span itemprop="addressLocality">{{ result.address.locality }}</span>
- {%- if result.address.postcode %}, <span itemprop="postalCode">{{ result.address.postcode }}</span>{% endif -%}
- <br/>
- {%- endif -%}
- {%- if result.address.country -%}
- <span itemprop="addressCountry">{{ result.address.country }}</span>
- {%- endif -%}
-</p>
-{%- endif %}
-
-{# {% if (result.latitude and result.longitude) %}
- <div class="row collapse col-xs-12 col-sm-5 col-md-4" id="result-geodata-{{ index }}">
- <strong>Longitude:</strong> {{ result.longitude }} <br/>
- <strong>Latitude:</strong> {{ result.latitude }}
- </div>
-{% endif %} #}
+ {%- if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif -%}
-{%- if result.content %}<p class="row result-content col-xs-12 col-sm-12 col-md-12">{{ result.content|safe }}</p>{% endif -%}
+ <table class="result-content result-map-details">
+ {%- if result.address -%}
+ <tr>
+ <th scope="row">
+ {{ result.address_label or _('address') }}
+ </th>
+ <td class="result-content result-adress" itemscope itemtype="http://schema.org/PostalAddress">
+ {%- if result.address.name -%}
+ <strong itemprop="name" class="hidden">{{ result.address.name }}</strong>
+ {%- endif -%}
+ {%- if result.address.road -%}
+ <span itemprop="streetAddress">
+ {%- if result.address.house_number %}{{ result.address.house_number }}, {% endif -%}
+ {{- result.address.road -}}
+ </span><br/>
+ {%- endif -%}
+ {%- if result.address.locality -%}
+ <span itemprop="addressLocality">{{ result.address.locality }}</span>
+ {%- if result.address.postcode %}, <span itemprop="postalCode">{{ result.address.postcode }}</span>{% endif -%}
+ <br/>
+ {%- endif -%}
+ {%- if result.address.country -%}
+ <span itemprop="addressCountry">{{ result.address.country }}</span>
+ {%- endif -%}
+ </td>
+ </tr>
+ {%- endif %}
+ {%- for info in result.data -%}
+ <tr><th scope="row">{{ info.label }}</th><td>{{ info.value|safe }}</td></tr>
+ {%- endfor -%}
+ {%- for link in result.links -%}
+ <tr><th scope="row">{{ link.label }}</th><td><a class="text-info cursor-pointer" href="{{ link.url }}">{{ link.url_label|safe }}</a></td></tr>
+ {%- endfor -%}
+ </table>
-</div>
+ <p class="result-content">
+ {%- if (result.latitude and result.longitude) or result.boundingbox -%}
+ <span><a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" 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></span>
+ {%- endif -%}
+ </p>
+
+ </div>
{%- if (result.latitude and result.longitude) or result.boundingbox -%}
<div class="collapse" id="result-map-{{ index }}">
@@ -52,6 +68,7 @@
</div>
{%- endif -%}
+</div>
{%- if rtl -%}
{{- result_footer_rtl(result, loop.index) -}}
{% else %}
diff --git a/searx/templates/simple/result_templates/map.html b/searx/templates/simple/result_templates/map.html
index 15c89b070..bb62d8440 100644
--- a/searx/templates/simple/result_templates/map.html
+++ b/searx/templates/simple/result_templates/map.html
@@ -3,51 +3,47 @@
{{ result_header(result, favicons, image_proxify) -}}
{{- result_sub_header(result) -}}
-{%- if (result.latitude and result.longitude) or result.boundingbox -%}
- <small> &bull; <a class="btn-collapse collapsed searx_init_map hide_if_nojs" data-target="#result-map-{{ index }}" data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}" 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 %}>{{ icon( 'globe') }} {{ _('show map') }}</a></small>
-{%- endif -%}
-
-{#-
-{% if (result.latitude and result.longitude) %}
- <small> &bull; <a class="btn-collapse disabled_if_nojs" data-target="#result-geodata-{{ index }}" data-btn-text-collapsed="{{ _('show geodata') }}" data-btn-text-not-collapsed="{{ _('hide geodata') }}">{{ icon('location') }} {{ _('show geodata') }}</a></small>
-{% endif %}
--#}
+{%- if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif -%}
-{%- if result.address -%}
-<p itemscope itemtype="http://schema.org/PostalAddress" class="content">
- {%- if result.address.name -%}
- <strong itemprop="name">{{ result.address.name }}</strong><br/>
- {%- endif -%}
- {% if result.address.road -%}
- <span itemprop="streetAddress">
- {%- if result.address.house_number -%}{{- result.address.house_number -}}, {% endif %}
- {{- result.address.road -}}
- </span><br/>
+<table>
+ {%- if result.address -%}
+ <tr>
+ <th scope="row">{{ result.address_label or _('address') }}</th>
+ <td itemscope itemtype="http://schema.org/PostalAddress">
+ {%- if result.address.name -%}
+ <strong itemprop="name" style="display: none">{{ result.address.name }}</strong>
+ {%- endif -%}
+ {% if result.address.road -%}
+ <span itemprop="streetAddress">
+ {%- if result.address.house_number -%}{{- result.address.house_number -}}, {% endif %}
+ {{- result.address.road -}}
+ </span><br/>
+ {%- endif %}
+ {%- if result.address.locality -%}
+ <span itemprop="addressLocality">{{- result.address.locality -}}</span>
+ {%- if result.address.postcode -%}, <span itemprop="postalCode">{{- result.address.postcode -}}</span>{% endif %}
+ <br/>
+ {%- endif -%}
+ {%- if result.address.country -%}
+ <span itemprop="addressCountry">{{- result.address.country -}}</span>
+ {%- endif -%}
+ </td>
+ </tr>
{%- endif %}
- {%- if result.address.locality -%}
- <span itemprop="addressLocality">{{- result.address.locality -}}</span>
- {%- if result.address.postcode -%}, <span itemprop="postalCode">{{- result.address.postcode -}}</span>{% endif %}
- <br/>
- {%- endif -%}
- {%- if result.address.country -%}
- <span itemprop="addressCountry">{{- result.address.country -}}</span>
- {%- endif -%}
-</p>
-{%- endif -%}
+ {%- for info in result.data -%}
+ <tr><th scope="row">{{ info.label }}</th><td>{{ info.value|safe }}</td></tr>
+ {%- endfor -%}
+ {%- for link in result.links -%}
+ <tr><th scope="row">{{ link.label }}</th><td><a class="text-info cursor-pointer" href="{{ link.url }}">{{ link.url|safe }}</a></td></tr>
+ {%- endfor -%}
+</table>
-{%- if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif -%}
+{%- if (result.latitude and result.longitude) or result.boundingbox -%}
+ <small> <a class="btn-collapse collapsed searx_init_map hide_if_nojs" data-target="#result-map-{{ index }}" data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}" 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 %}>{{ icon( 'globe') }} {{ _('show map') }}</a></small>
+{%- endif -%}
{{- result_sub_footer(result, proxify) -}}
-{#-
-{% if (result.latitude and result.longitude) -%}
- <div id="result-geodata-{{ index }}" class="invisible">
- <strong>Longitude:</strong> {{ result.longitude }} <br/>
- <strong>Latitude:</strong> {{ result.latitude }}
- </div>
-{%- endif %}
--#}
-
{% if (result.latitude and result.longitude) or result.boundingbox -%}
<div id="result-map-{{ index }}" class="invisible"><div id="osm-map-{{ index }}" style="height:300px; width:100%; margin: 10px 0;" ></div></div>
{%- endif %}