From e37a193fb00578c4a989a85e924e938f6b67eb9d Mon Sep 17 00:00:00 2001 From: arzynik Date: Thu, 18 Oct 2012 12:20:09 -0400 Subject: [PATCH] temp fix for restaurant saving --- .../admin/restaurants/restaurant.phtml | 13 ++++++- www/assets/js/admin.js | 37 +++++++++++++------ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/include/views/default/crunchbutton/admin/restaurants/restaurant.phtml b/include/views/default/crunchbutton/admin/restaurants/restaurant.phtml index 616911ba3..f17370447 100644 --- a/include/views/default/crunchbutton/admin/restaurants/restaurant.phtml +++ b/include/views/default/crunchbutton/admin/restaurants/restaurant.phtml @@ -317,8 +317,17 @@
-
- Save Restaurant +
+ Save Details +
+
+ Save Hours +
+
+ Save Dishes +
+
+ Save All
diff --git a/www/assets/js/admin.js b/www/assets/js/admin.js index 65ea49a9f..69ab7f6d7 100644 --- a/www/assets/js/admin.js +++ b/www/assets/js/admin.js @@ -183,7 +183,19 @@ $(function() { } $('.admin-restaurant-save').live('click', function() { - saveRestaurant(); + saveRestaurant(true); + }); + + $('.admin-restaurant-save-details').live('click', function() { + saveRestaurant(false); + }); + + $('.admin-restaurant-save-hours').live('click', function() { + saveHours(); + }); + + $('.admin-restaurant-save-dishes').live('click', function() { + saveDishes(); }); var saveDishes = function(complete) { @@ -252,7 +264,7 @@ $(function() { }); } - var saveRestaurant = function() { + var saveRestaurant = function(all) { var selector = 'input.dataset-restaurant, select.dataset-restaurant, textarea.dataset-restaurant'; var id = App.restaurant; @@ -260,11 +272,13 @@ $(function() { App.cache('Restaurant', id, function() { var restaurant = getValues(selector, this); restaurant.save(function() { - saveHours(function() { - saveDishes(function() { - + if (all) { + saveHours(function() { + saveDishes(function() { + + }); }); - }); + } }); }); } else { @@ -274,12 +288,13 @@ $(function() { App.cache('Restaurant', r.id_restaurant, function() { App.restaurant = this.id_restaurant; - saveHours(function() { - saveDishes(function() { - location.href = '/admin/restaurants/' + App.restaurant; + if (all) { + saveHours(function() { + saveDishes(function() { + location.href = '/admin/restaurants/' + App.restaurant; + }); }); - }); - + } }); }); }