Use .gps_* in the template and add translations.

Instead of .gps.x use .gps_x and add some "is defined" and
stuff.

Also mark some strings for translation in here.
This commit is contained in:
Elrond 2012-03-14 20:13:42 +01:00
parent ca722c3caf
commit e0b2b245fe

View File

@ -17,24 +17,27 @@
#} #}
{% block geolocation_map %} {% block geolocation_map %}
{% if media.media_data.has_key('gps') {% if app_config['geolocation_map_visible']
and app_config['geolocation_map_visible'] and media.media_data.gps_latitude is defined
and media.media_data.gps %} and media.media_data.gps_latitude
<h3 class="sidedata">Location</h3> and media.media_data.gps_longitude is defined
and media.media_data.gps_longitude %}
<h3 class="sidedata">{% trans %}Location{% endtrans %}</h3>
<div> <div>
{% set gps = media.media_data.gps %} {%- set lon = media.media_data.gps_longitude %}
{%- set lat = media.media_data.gps_latitude %}
{%- set osm_url = "http://openstreetmap.org/?mlat={lat}&mlon={lon}".format(lat=lat, lon=lon) %}
<div id="tile-map" style="width: 100%; height: 196px;"> <div id="tile-map" style="width: 100%; height: 196px;">
<input type="hidden" id="gps-longitude" <input type="hidden" id="gps-longitude"
value="{{ gps.longitude }}" /> value="{{ lon }}" />
<input type="hidden" id="gps-latitude" <input type="hidden" id="gps-latitude"
value="{{ gps.latitude }}" /> value="{{ lat }}" />
</div> </div>
<p> <p>
<small> <small>
View on {% trans -%}
<a href="http://openstreetmap.org/?mlat={{ gps.latitude }}&mlon={{ gps.longitude }}"> View on <a href="{{ osm_url }}">OpenStreetMap</a>
OpenStreetMap {%- endtrans %}
</a>
</small> </small>
</p> </p>
</div> </div>