added location detection to location page

This commit is contained in:
arzynik 2013-08-13 09:00:23 -07:00
parent 0bb40daee5
commit 628c7f2805
2 changed files with 13 additions and 4 deletions

View File

@ -19,7 +19,7 @@
</td>
<td>
<div class="location-detect">
<div class="location-detect-icon"></div>
<div class="location-detect-icon" ng-click="locEat()"></div>
<div class="location-detect-loader"></div>
</div>
</td>

View File

@ -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();
});
};
});