From 4ccdd9fe22eb91c8236dfd7f86b4ef0b0290e267 Mon Sep 17 00:00:00 2001 From: arzynik Date: Tue, 13 Aug 2013 00:56:12 -0700 Subject: [PATCH] added custom restaurant closed dialog --- .../frontend/restaurant.closed.phtml | 7 +++++++ .../default/crunchbutton/layout/html.body.phtml | 1 + www/assets/js/controllers.js | 16 ++++++++++++++++ www/assets/js/pages.js | 6 +++--- www/assets/js/restaurant.js | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 include/views/default/crunchbutton/frontend/restaurant.closed.phtml diff --git a/include/views/default/crunchbutton/frontend/restaurant.closed.phtml b/include/views/default/crunchbutton/frontend/restaurant.closed.phtml new file mode 100644 index 000000000..e58f4968e --- /dev/null +++ b/include/views/default/crunchbutton/frontend/restaurant.closed.phtml @@ -0,0 +1,7 @@ +
+ \ No newline at end of file diff --git a/include/views/default/crunchbutton/layout/html.body.phtml b/include/views/default/crunchbutton/layout/html.body.phtml index d7ba5342e..5e2164bb7 100644 --- a/include/views/default/crunchbutton/layout/html.body.phtml +++ b/include/views/default/crunchbutton/layout/html.body.phtml @@ -163,6 +163,7 @@ TODO: remove this comment
+
diff --git a/www/assets/js/controllers.js b/www/assets/js/controllers.js index 74d7ffd06..c403cea9b 100644 --- a/www/assets/js/controllers.js +++ b/www/assets/js/controllers.js @@ -44,6 +44,22 @@ function RecommendRestaurantCtrl( $scope, $http, RecommendRestaurantService, Acc $scope.modal = AccountModalService; } +function RestaurantClosedCtrl($scope, $rootScope) { + + + $rootScope.$on('restaurantClosedClick', function(e, r) { + if ($scope.$$phase) { + $scope.restaurant = r; + App.dialog.show('.restaurant-closed-container'); + } else { + $rootScope.$apply(function(scope) { + scope.restaurant = r; + App.dialog.show('.restaurant-closed-container'); + }); + } + }); +} + function RecommendFoodCtrl( $scope, $http, RecommendFoodService ) { $scope.recommend = RecommendFoodService; } diff --git a/www/assets/js/pages.js b/www/assets/js/pages.js index e4a145049..4b082fcc3 100644 --- a/www/assets/js/pages.js +++ b/www/assets/js/pages.js @@ -76,16 +76,16 @@ NGApp.controller('default', function ($scope, $http, $location, CommunityAliasSe /** * Show the restaurants */ -NGApp.controller( 'restaurants', function ( $scope, $http, $location, RestaurantsService ) { +NGApp.controller( 'restaurants', function ( $scope, $http, $location, RestaurantsService) { $scope.mealItemClass = App.isAndroid() ? 'meal-food-android' : ''; $scope.restaurants = RestaurantsService; + $scope.display = function() { if ( !this.restaurant.open() ) { - App.alert("This restaurant is currently closed. It will be open during the following hours (" + this.restaurant._tzabbr + "):\n\n" + this.restaurant.closedMessage()); - App.busy.unBusy(); + App.rootScope.$broadcast('restaurantClosedClick', this.restaurant); } else { $location.path('/' + App.restaurants.permalink + '/' + this.restaurant.permalink); } diff --git a/www/assets/js/restaurant.js b/www/assets/js/restaurant.js index a6756d961..fa87b4291 100644 --- a/www/assets/js/restaurant.js +++ b/www/assets/js/restaurant.js @@ -358,7 +358,7 @@ var Restaurant = function(id) { } } } - return ordered.join( '\n' ); + return ordered.join( '
' ); } self.preset = function() {