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): def showMap(threewords):
try: try:
lat, lng = these.decode(threewords) lat, lng = these.decode(threewords)
return template('map', lat=lat, lng=lng) return template('map', lat=lat, lng=lng, threewords=threewords)
except: except:
return template('index', return template('index',
err="Could not find location {}".format(threewords)) err="Could not find location {}".format(threewords))

View File

@ -4,9 +4,14 @@
<!-- Meta --> <!-- Meta -->
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>these-3-words Map</title> <title>These3Words Map</title>
<!-- Style --> <!-- Style -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<style>
body {
padding-top: 40px;
}
</style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
@ -18,6 +23,7 @@
<p class="lead"> <p class="lead">
Find a location anywhere in the world identified by three simple words. Find a location anywhere in the world identified by three simple words.
</p> </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"> <p id="input3wordsContainer">
<input type="text" class="form-control" id="input3words" placeholder="zeljka-worry-suhai"> <input type="text" class="form-control" id="input3words" placeholder="zeljka-worry-suhai">
</p> </p>
@ -25,6 +31,9 @@
<button id="button3words" class="btn btn-lg btn-primary">Find on Map</button> <button id="button3words" class="btn btn-lg btn-primary">Find on Map</button>
</p> </p>
</main> </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> <script>
(function() { (function() {
var default3words = 'zeljka-worry-suhai'; var default3words = 'zeljka-worry-suhai';

View File

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