Skip to content

Commit

Permalink
[#1082] Placed jQuery for location to bottom of page
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Feb 9, 2015
1 parent 8157837 commit 8c16a72
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions akvo/templates/update_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@

{% block title %}{{project.title}}{% endblock %}

{% block head_js %}
<script>
$(document).ready(function() {
$( "#id_latitude").val(0);
$( "#id_longitude").val(0);
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(storePosition);
}
function storePosition(position) {
$( "#id_latitude").val(position.coords.latitude);
$( "#id_longitude").val(position.coords.longitude);
}
});
</script>
{% endblock %}

{% block maincontent %}
<article class="touch-navbar">
{% include "partials/project_header.html" %}
Expand Down Expand Up @@ -82,3 +66,15 @@ <h4><a href="{% url 'update-main' u.project.id u.id %}">{{u.title}}</a></h4>
</article>

{% endblock %}

{% block jq %}
$( "#id_latitude").val(0);
$( "#id_longitude").val(0);
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(storePosition);
}
function storePosition(position) {
$( "#id_latitude").val(position.coords.latitude);
$( "#id_longitude").val(position.coords.longitude);
}
{% endblock %}

0 comments on commit 8c16a72

Please sign in to comment.