From 912688fca16e9aabd30322e746e1f2adbe2c3510 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Tue, 18 Nov 2014 14:37:48 +0100 Subject: [PATCH 1/4] Rudimentary smart box on the landing page --- app.py | 9 +++++++++ views/index.html | 31 ++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index cab4b75..1b011a6 100755 --- a/app.py +++ b/app.py @@ -30,6 +30,15 @@ def showMap(threewords): return template('index', err="Could not find location {}".format(threewords)) +@get('/latlng/,') +def showMapFromLatLng(lat, lng): + try: + threewords = these.three_words((lat, lng)) + return template('map', lat=lat, lng=lng, threewords=threewords) + except: + return template('index', + err="Could not find location {}".format(threewords)) + # API @get('/api/,') diff --git a/views/index.html b/views/index.html index 931c71a..bd5a8f7 100644 --- a/views/index.html +++ b/views/index.html @@ -8,8 +8,33 @@ + + - +
% if err: @@ -30,7 +55,7 @@ - -->
From fa44970fd1f975a2c8c9b676911ced651987926d Mon Sep 17 00:00:00 2001 From: Tim Head Date: Tue, 18 Nov 2014 14:37:48 +0100 Subject: [PATCH 2/4] Rudimentary smart box on the landing page --- app.py | 9 +++++++++ views/index.html | 31 ++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index cab4b75..1b011a6 100755 --- a/app.py +++ b/app.py @@ -30,6 +30,15 @@ def showMap(threewords): return template('index', err="Could not find location {}".format(threewords)) +@get('/latlng/,') +def showMapFromLatLng(lat, lng): + try: + threewords = these.three_words((lat, lng)) + return template('map', lat=lat, lng=lng, threewords=threewords) + except: + return template('index', + err="Could not find location {}".format(threewords)) + # API @get('/api/,') diff --git a/views/index.html b/views/index.html index 931c71a..bd5a8f7 100644 --- a/views/index.html +++ b/views/index.html @@ -8,8 +8,33 @@ + + - +
% if err: @@ -30,7 +55,7 @@ - -->
From cc80f74dec0ba994812f6ee703b133767f79d941 Mon Sep 17 00:00:00 2001 From: Tim Head Date: Tue, 18 Nov 2014 15:40:05 +0100 Subject: [PATCH 3/4] Smarter landing page --- app.py | 1 + static/js/app.js | 4 ++- views/index.html | 76 ++++++++++++++++++++++-------------------------- 3 files changed, 38 insertions(+), 43 deletions(-) diff --git a/app.py b/app.py index 1b011a6..d6b360a 100755 --- a/app.py +++ b/app.py @@ -30,6 +30,7 @@ def showMap(threewords): return template('index', err="Could not find location {}".format(threewords)) + @get('/latlng/,') def showMapFromLatLng(lat, lng): try: diff --git a/static/js/app.js b/static/js/app.js index ce17a06..a0f64fc 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -134,6 +134,8 @@ var These3Words = (function () { return { - Map: Map + Map: Map, + apiGet: apiGet, + apiGetFromLatLng: apiGetFromLatLng }; }()); diff --git a/views/index.html b/views/index.html index bd5a8f7..4b96b8a 100644 --- a/views/index.html +++ b/views/index.html @@ -9,32 +9,9 @@ - + - +
% if err: @@ -55,23 +32,38 @@ -
+ From 46e6d883dce1b2ecc8626d8278a8a2fa11aaef6d Mon Sep 17 00:00:00 2001 From: Tim Head Date: Tue, 18 Nov 2014 15:46:56 +0100 Subject: [PATCH 4/4] More tidying up from Tims rebase screw up --- app.py | 9 --------- views/index.html | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/app.py b/app.py index fe44171..d6b360a 100755 --- a/app.py +++ b/app.py @@ -30,15 +30,6 @@ def showMap(threewords): return template('index', err="Could not find location {}".format(threewords)) -@get('/latlng/,') -def showMapFromLatLng(lat, lng): - try: - threewords = these.three_words((lat, lng)) - return template('map', lat=lat, lng=lng, threewords=threewords) - except: - return template('index', - err="Could not find location {}".format(threewords)) - @get('/latlng/,') def showMapFromLatLng(lat, lng): diff --git a/views/index.html b/views/index.html index 1e6fd61..4b96b8a 100644 --- a/views/index.html +++ b/views/index.html @@ -11,7 +11,7 @@ - +
% if err: