-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Cornul11/frontend
Initial location collection
- Loading branch information
Showing
30 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
button.onclick = function () { | ||
let startPos; | ||
let geoSuccess = function (position) { | ||
// Do magic with location | ||
startPos = position; | ||
document.getElementById('startLat').innerHTML = startPos.coords.latitude; | ||
document.getElementById('startLon').innerHTML = startPos.coords.longitude; | ||
}; | ||
let geoError = function (error) { | ||
switch (error.code) { | ||
case error.TIMEOUT: | ||
// The user didn't accept the callout | ||
console.log('DENIED!'); | ||
break; | ||
} | ||
}; | ||
navigator.geolocation.getCurrentPosition(geoSuccess, geoError); | ||
}; | ||
*/ | ||
button = document.getElementById("mainButton"); | ||
|
||
let startPos; | ||
let geoOptions = { | ||
enableHighAccuracy: true, | ||
maximumAge: 60 * 1000, // get new position data every minute | ||
}; | ||
|
||
let geoSuccess = function (position) { | ||
startPos = position; | ||
console.log('updated pos'); | ||
document.getElementById('startLat').innerHTML = startPos.coords.latitude; | ||
document.getElementById('startLon').innerHTML = startPos.coords.longitude; | ||
}; | ||
let geoError = function (error) { | ||
console.log('Error occurred. Error code: ' + error.code); | ||
// error.code can be: | ||
// 0: unknown error | ||
// 1: permission denied | ||
// 2: position unavailable (error response from location provider) | ||
// 3: timed out | ||
}; | ||
|
||
let watchId = navigator.geolocation.watchPosition(geoSuccess, geoError, geoOptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Location</title> | ||
{% load static %} | ||
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet"> | ||
</head> | ||
<body> | ||
<button id="mainButton" type="button" class="btn btn-primary">Primary</button> | ||
|
||
<p id="startLat">0</p><br> | ||
<p id="startLon">0</p> | ||
<!-- script at the end to load the page faster --> | ||
{% load static %} | ||
<script src="{% static "js/location.js" %}"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.urls import path | ||
|
||
from . import views | ||
|
||
urlpatterns = [ | ||
path('', views.index), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.shortcuts import render_to_response | ||
|
||
|
||
def index(request): | ||
return render_to_response('collector.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
Django==2.2.6 | ||
psycopg2-binary==2.8.4 | ||
pytz==2019.3 | ||
sqlparse==0.3.0 | ||
|
||
sqlparse==0.3.0 |