Merge pull request #4 from kdungs/master

Merge changes to the webservice
This commit is contained in:
Tim Head 2014-11-17 18:19:33 +01:00
commit 7d657e99ca
3 changed files with 44 additions and 24 deletions

2
app.py
View File

@ -19,7 +19,7 @@ def index():
def showMap(threewords):
try:
lat, lng = these.decode(threewords)
return template('map', lat=lat, lng=lng)
return template('map', lat=lat, lng=lng, threewords=threewords)
except:
return template('index',
err="Could not find location {}".format(threewords))

View File

@ -4,9 +4,14 @@
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>these-3-words Map</title>
<title>These3Words Map</title>
<!-- Style -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<style>
body {
padding-top: 40px;
}
</style>
</head>
<body>
<div class="container">
@ -18,6 +23,7 @@
<p class="lead">
Find a location anywhere in the world identified by three simple words.
</p>
<p class="text-warning">This is a very early pre-alpha release. Don't expect anything to work properly or reproducible. Especially since the underlying word-list will most likely change soon.</p>
<p id="input3wordsContainer">
<input type="text" class="form-control" id="input3words" placeholder="zeljka-worry-suhai">
</p>
@ -25,6 +31,9 @@
<button id="button3words" class="btn btn-lg btn-primary">Find on Map</button>
</p>
</main>
<footer>
<p class="text-center text-muted">Made with ♥ by <a href="https://betatim.github.io/">Tim</a> and <a href="https://dun.gs">Kevin</a>. <a href="https://github.com/betatim/these-3-words">Fork it on GitHub</a>.
</footer>
<script>
(function() {
var default3words = 'zeljka-worry-suhai';

View File

@ -1,24 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<html lang="en">
<head>
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>These3Words Map</title>
<!-- Style -->
<style type="text/css">
html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
</style>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js">
</script>
</head>
<body>
<div id="map-canvas"></div>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: { lat: {{ lat }}, lng: {{ lng }}},
zoom: 14
var loc = {
lat: {{ lat }},
lng: {{ lng }}
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
var map = new google.maps.Map(document.getElementById('map-canvas'), {
center: loc,
zoom: 14
});
var marker = new google.maps.Marker({
position: loc,
map: map,
title: "{{ threewords }}"
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</body>
</html>