Merge branch 'master' of github.com:crunchbutton/crunchbutton

Conflicts:
	www/assets/js/pages.js
This commit is contained in:
arzynik 2013-08-09 12:49:18 -07:00
commit dc8dc4ef76
8 changed files with 70 additions and 108 deletions

View File

@ -52,13 +52,13 @@
<div ng-show="!order.cart.hasItems()" class="order-begin">
<div class="icon">
<i ng-show="!App.isMobile()" class="icon-arrow-left"></i>
<i ng-show="App.isMobile()" class="icon-arrow-down"></i>
<i class="icon-arrow-left desktop"></i>
<i class="icon-arrow-down mobile"></i>
</div>
<div class="text">
Begin by clicking on anything from our curated menu
<span ng-show="!App.isMobile()"> on the left!</span>
<span ng-show="App.isMobile()"> below!</span>
<span class="desktop"> on the left!</span>
<span class="mobile"> below!</span>
</div>
<div class="divider"></div>
</div>
@ -67,8 +67,6 @@
Add $<span class="delivery-min-diff">{{order.info.deliveryMinDiff}}</span> from menu to meet delivery minimum.
</div>
<!-- Cart's basket -->
<div>
@ -155,9 +153,7 @@
<div class="restaurant-payment-div"></div>
<!-- payment and user info -->
<form class="payment-form main-content-readable" ng-show="order.loaded && order.cart.hasItems()">
<div class="is-closet main-content-readable" >
<div class="restaurant-closed" ng-show="!restaurant.open()">
<div class="restaurant-closed-icon"></div>
<div class="restaurant-closed-content">
@ -171,8 +167,11 @@
</div>
<div class="divider"></div>
</div>
</div>
<!-- payment and user info -->
<form class="payment-form main-content-readable" ng-show="order.loaded && order.cart.hasItems()">
<div ng-show="restaurant._open && order.showForm && order.cart.hasItems()">
<div class="content-item-name"><h1>Your Info</h1></div>

View File

@ -139,6 +139,7 @@ TODO: remove this comment
<a href="javascript:App.test.logout();" class="test-logout">TEST: logout</a>
<a href="javascript:App.test.clearloc();" class="test-clearloc">TEST: clear loc</a>
<a href="javascript:;" ng-click="navigation.link('/')">TEST: go home</a>
<a href="javascript:;" ng-click="navigation.link('/location')">TEST: go location</a>
<? endif ; ?>
<br />
<span class="copyright">&copy; <?=date('Y')?> YouBeo. All rights reserved.</span>

View File

@ -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

View File

@ -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']);

View File

@ -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++) {

View File

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

View File

@ -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 = {

View File

@ -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) {