From 628c7f28053a49ee37018c64c5a867db9fe3700f Mon Sep 17 00:00:00 2001 From: arzynik Date: Tue, 13 Aug 2013 09:00:23 -0700 Subject: [PATCH] added location detection to location page --- .../default/crunchbutton/frontend/location.phtml | 2 +- www/assets/js/pages.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/views/default/crunchbutton/frontend/location.phtml b/include/views/default/crunchbutton/frontend/location.phtml index 30b9beae2..a2ab740bb 100644 --- a/include/views/default/crunchbutton/frontend/location.phtml +++ b/include/views/default/crunchbutton/frontend/location.phtml @@ -19,7 +19,7 @@
-
+
diff --git a/www/assets/js/pages.js b/www/assets/js/pages.js index 4b082fcc3..f9041c645 100644 --- a/www/assets/js/pages.js +++ b/www/assets/js/pages.js @@ -181,6 +181,10 @@ NGApp.controller( 'location', function ($scope, $http, $location, RestaurantsSer $scope.recommend.greetings = false; $scope.locationError = true; }); + + var proceed = function() { + App.go('/' + App.restaurants.permalink); + }; // lets eat button $scope.letsEat = function() { @@ -194,9 +198,7 @@ NGApp.controller( 'location', function ($scope, $http, $location, RestaurantsSer // Verify if the address has restaurant $scope.restaurantsService.list( // Success - function(){ - $location.path( '/' + App.restaurants.permalink ); - }, + proceed, // Error function(){ $scope.$broadcast( 'locationError' ); @@ -209,6 +211,13 @@ NGApp.controller( 'location', function ($scope, $http, $location, RestaurantsSer ); } } + + $scope.locEat = function() { + $scope.location.getLocationByBrowser(function(loc) { + $scope.location.position.addLocation(loc); + proceed(); + }); + }; });