aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/plugins
diff options
context:
space:
mode:
authorJessica Tallon <jessica@megworld.co.uk>2014-10-09 19:20:13 +0100
committerJessica Tallon <jessica@megworld.co.uk>2014-10-09 19:20:13 +0100
commited48454558a91961b6e03fc51b8a4bf785d48d1e (patch)
tree792294c842fe5643a2d8f66be366805f621d4ece /mediagoblin/plugins
parent9a1fc423ac298c2ddf078d91ea1302c135285781 (diff)
parentc0434db46910e891313495b5ae94cbbe1dd08058 (diff)
downloadmediagoblin-ed48454558a91961b6e03fc51b8a4bf785d48d1e.tar.lz
mediagoblin-ed48454558a91961b6e03fc51b8a4bf785d48d1e.tar.xz
mediagoblin-ed48454558a91961b6e03fc51b8a4bf785d48d1e.zip
Merge branch 'location'
Add Location model which holds textual, geolocation coordiantes or postal addresses. This migrates data off Image model metadata onto the general Location model. It also adds the ability for location to be set on MediaEntry, User, MediaComment and Collection models. The geolocation plugin has been updated so that the location can be displayed in more general places rather than explicitely on the MediaEntry view. If GPS coordiantes are set for the User the profile page will also have the OSM provided by the geolocation plugin.
Diffstat (limited to 'mediagoblin/plugins')
-rw-r--r--mediagoblin/plugins/geolocation/__init__.py6
-rw-r--r--mediagoblin/plugins/geolocation/templates/mediagoblin/plugins/geolocation/map.html13
2 files changed, 9 insertions, 10 deletions
diff --git a/mediagoblin/plugins/geolocation/__init__.py b/mediagoblin/plugins/geolocation/__init__.py
index 5d14590e..06aab68e 100644
--- a/mediagoblin/plugins/geolocation/__init__.py
+++ b/mediagoblin/plugins/geolocation/__init__.py
@@ -21,13 +21,13 @@ PLUGIN_DIR = os.path.dirname(__file__)
def setup_plugin():
config = pluginapi.get_config('mediagoblin.plugins.geolocation')
-
+
# Register the template path.
pluginapi.register_template_path(os.path.join(PLUGIN_DIR, 'templates'))
pluginapi.register_template_hooks(
- {"image_sideinfo": "mediagoblin/plugins/geolocation/map.html",
- "image_head": "mediagoblin/plugins/geolocation/map_js_head.html"})
+ {"location_info": "mediagoblin/plugins/geolocation/map.html",
+ "location_head": "mediagoblin/plugins/geolocation/map_js_head.html"})
hooks = {
diff --git a/mediagoblin/plugins/geolocation/templates/mediagoblin/plugins/geolocation/map.html b/mediagoblin/plugins/geolocation/templates/mediagoblin/plugins/geolocation/map.html
index 70f837ff..8da6f0ee 100644
--- a/mediagoblin/plugins/geolocation/templates/mediagoblin/plugins/geolocation/map.html
+++ b/mediagoblin/plugins/geolocation/templates/mediagoblin/plugins/geolocation/map.html
@@ -17,14 +17,13 @@
#}
{% block geolocation_map %}
- {% if media.media_data.gps_latitude is defined
- and media.media_data.gps_latitude
- and media.media_data.gps_longitude is defined
- and media.media_data.gps_longitude %}
- <h3>{% trans %}Location{% endtrans %}</h3>
+ {% if model.location
+ and model.get_location.position
+ and model.get_location.position.latitude
+ and model.get_location.position.longitude %}
<div>
- {%- set lon = media.media_data.gps_longitude %}
- {%- set lat = media.media_data.gps_latitude %}
+ {%- set lon = model.get_location.position.longitude %}
+ {%- set lat = model.get_location.position.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;">
<input type="hidden" id="gps-longitude"