diff --git a/include/views/default/crunchbutton/frontend/restaurant.phtml b/include/views/default/crunchbutton/frontend/restaurant.phtml index ed92d921c..0e0efc4ff 100644 --- a/include/views/default/crunchbutton/frontend/restaurant.phtml +++ b/include/views/default/crunchbutton/frontend/restaurant.phtml @@ -52,13 +52,13 @@
- - + +
Begin by clicking on anything from our curated menu - on the left! - below! + on the left! + below!
@@ -67,8 +67,6 @@ Add ${{order.info.deliveryMinDiff}} from menu to meet delivery minimum. - -
@@ -155,9 +153,7 @@
- -
- +
@@ -171,8 +167,11 @@
+
+ + + -

Your Info

diff --git a/include/views/default/crunchbutton/layout/html.body.phtml b/include/views/default/crunchbutton/layout/html.body.phtml index 974e50831..e6b722ea4 100644 --- a/include/views/default/crunchbutton/layout/html.body.phtml +++ b/include/views/default/crunchbutton/layout/html.body.phtml @@ -139,6 +139,7 @@ TODO: remove this comment TEST: logout TEST: clear loc TEST: go home + TEST: go location
© YouBeo. All rights reserved. diff --git a/www/assets/css/style.css b/www/assets/css/style.css index bd23c418e..2c1a82a60 100644 --- a/www/assets/css/style.css +++ b/www/assets/css/style.css @@ -979,6 +979,20 @@ html[xmlns] .clearfix { } @media only screen and (max-width : 1023px) { + + .order-begin{ + margin-right: auto !important; + margin-left: auto !important; + margin-bottom: 30px !important; + } + + .order-begin .desktop{ + display: none !important; + } + .order-begin .mobile{ + display: inline !important; + } + .home-tagline, .home-welcome { text-align: center; } @@ -1999,7 +2013,7 @@ html[xmlns] .clearfix { clear: right; margin-right: 5px; } - .payment-form { + .payment-form, .is-closet{ width: 630px; float: right; } @@ -2473,7 +2487,7 @@ html[xmlns] .clearfix { text-align: center; } - .restaurant-items, .restaurant-pic-wrapper, .cart-items, .payment-form { + .restaurant-items, .restaurant-pic-wrapper, .cart-items, .payment-form, .is-closet { float: none; width: 625px; margin: 0 auto; @@ -2800,7 +2814,12 @@ strong { .order-begin .text{ width: 300px; } - + .order-begin .desktop{ + display: inline; + } + .order-begin .mobile{ + display: none; + } /** * unused blurs diff --git a/www/assets/js/app.js b/www/assets/js/app.js index 359fc2a71..4589068e0 100644 --- a/www/assets/js/app.js +++ b/www/assets/js/app.js @@ -75,43 +75,6 @@ App.toggleMenu = function() { }; - -/** - * Loads up "community" keyword pages - */ - /* - TODO: replace this method by the CommunityAliasService - */ -App.routeAlias = function( id, success, error ) { - id = id.replace('/','').toLowerCase(); - alias = App.aliases[id] || false; - success = success || function(){}; - error = error || function(){}; - - if (alias) { - // Get the location of the alias - var loc = App.locations[alias.id_community]; - - if (loc.loc_lat && loc.loc_lon) { - - var res = new Location({ - lat: loc.loc_lat, - lon: loc.loc_lon, - type: 'alias', - verified: true, - prep: alias.prep, - city: alias.name_alt, - address: alias.name_alt - }); - success({alias: res}); - return; - } - } - - error(); -}; - - App.NGinit = function() { $('body').attr('ng-controller', 'AppController'); angular.bootstrap(document,['NGApp']); diff --git a/www/assets/js/location.js b/www/assets/js/location.js index a3d703320..e86704821 100644 --- a/www/assets/js/location.js +++ b/www/assets/js/location.js @@ -23,12 +23,15 @@ var Location = function( params ) { var result = results[0] || results; - switch ( result.types ) { - default: - case 'administrative_area_level_1': - self._properties.city = result.address_components[0].long_name; - self._properties.detail = 1; - break; + if( typeof result.types === 'string' ) { + var type = result.types; + } else { + for( x in result.types ){ + var type = result.types[x]; + } + } + + switch ( type ) { case 'locality': self._properties.city = result.address_components[0].long_name; self._properties.region = result.address_components[2].short_name; @@ -49,6 +52,11 @@ var Location = function( params ) { self._properties.region = result.address_components[3].short_name; self._properties.detail = 4; break; + default: + case 'administrative_area_level_1': + self._properties.city = result.address_components[0].long_name; + self._properties.detail = 1; + break; } for (var i = 0; i < result.address_components.length; i++) { diff --git a/www/assets/js/pages.js b/www/assets/js/pages.js index c2ffd889c..cfc47fd72 100644 --- a/www/assets/js/pages.js +++ b/www/assets/js/pages.js @@ -141,6 +141,7 @@ NGApp.controller( 'location', function ($scope, $http, $location, RestaurantsSer $scope.topCommunities = App.topCommunities; $scope.location = LocationService; +<<<<<<< HEAD // @todo: this function prevents angular from rendering on phonegap correctly until it gets a response back from google (about 9 seconds) setTimeout(function() { @@ -148,6 +149,10 @@ NGApp.controller( 'location', function ($scope, $http, $location, RestaurantsSer }, 100 ); +======= + $scope.location.init(); + +>>>>>>> e392b90937395a7db9f7d1fda27c8c4e9486c83e $scope.yourArea = $scope.location.position.pos().city() || 'your area'; $scope.restaurantsService = RestaurantsService; @@ -203,7 +208,7 @@ NGApp.controller( 'location', function ($scope, $http, $location, RestaurantsSer /** * restaurant page */ -NGApp.controller('restaurant', function ($scope, $http, $routeParams, RestaurantService, OrderService, CreditService, GiftCardService) { +NGApp.controller('restaurant', function ($scope, $http, $routeParams, RestaurantService, OrderService, CreditService, GiftCardService, PositionsService) { // we dont need to put all the Service methods and variables at the $scope - it is expensive @@ -328,62 +333,30 @@ NGApp.controller('restaurant', function ($scope, $http, $routeParams, Restaurant document.title = $scope.restaurant.name + ' | Food Delivery | Order from ' + ( community.name ? community.name : 'Local') + ' Restaurants | Crunchbutton'; + var position = PositionsService; + var address = position.pos(); + + // If the typed address is different of the user address the typed one will be used #1152 + if( address.type() == 'user' && address.valid( 'order' ) ){ + if( order._useCompleteAddress ){ + $scope.order.form.address = address.formatted(); + } else { + $scope.order.form.address = address.entered(); + } + } $('.body').css({ 'min-height': $('.restaurant-items').height()}); }); - - // Finally Load the restaurant - restaurantService.init(); $('.config-icon').addClass('config-icon-mobile-hide'); $('.nav-back').addClass('nav-back-show'); $('.content').removeClass('smaller-width'); $('.content').removeClass('short-meal-list'); - - - -/* - // If the typed address is different of the user address the typed one will be used #1152 - if (false && App.loc.changeLocationAddressHasChanged && App.loc.pos() && App.loc.pos().addressEntered && App.loc.pos().addressEntered != service.account.user.address) { - // Give some time to google.maps.Geocoder() load - var validatedAddress = function () { - if (google && google.maps && google.maps.Geocoder) { - var addressToVerify = App.loc.pos().addressEntered; - // Success the address was found - var success = function (results) { - var address = results[0]; - if (address) { - // Valid if the address is acceptable - if (App.loc.validateAddressType(address)) { - // If the flag useCompleteAddress is true - if (App.useCompleteAddress) { - $('[name=pay-address]').val(App.loc.formatedAddress(address)); - $('.user-address').html(App.loc.formatedAddress(address)); - } else { - $('[name=pay-address]').val(addressToVerify); - $('.user-address').html(addressToVerify); - } - } else { - console.log('Invalid address: ' + addressToVerify); - } - } - }; - // Error, do nothing - var error = function () {}; - App.loc.doGeocode(addressToVerify, success, error); - } else { - setTimeout(function () { - validatedAddress(); - }, 10); - } - } - validatedAddress(); - } - -*/ + // Finally Load the restaurant + restaurantService.init(); }); diff --git a/www/assets/js/services.order.js b/www/assets/js/services.order.js index c52f9baf4..8519fc216 100644 --- a/www/assets/js/services.order.js +++ b/www/assets/js/services.order.js @@ -10,9 +10,7 @@ NGApp.factory('OrderService', function ($http, $location, $rootScope, AccountSer // If this variable is true the restaurant's page will be loaded after the location get started service.location.loadRestaurantsPage = false; - setTimeout(function() { - service.location._start(); - }, 10); + service.location.init(); // Default values service.form = { diff --git a/www/assets/js/services.position.js b/www/assets/js/services.position.js index 6fac714ca..29c054147 100644 --- a/www/assets/js/services.position.js +++ b/www/assets/js/services.position.js @@ -2,6 +2,7 @@ NGApp.factory('PositionsService', function () { var service = { bounding: null, + initied: false, locs: [] } @@ -147,13 +148,13 @@ NGApp.factory('LocationService', function ($location, RestaurantsService, Positi /** * initilize location functions */ - service._start = function () { + service.init = function () { // this method could not be called twice - if (App._locationInitied) { + if (service.initied){ return; } - App._locationInitied = true; + service.initied = true; // 1) set bounding to maxmind results if we have them if (App.config.loc.lat && App.config.loc.lon) {