temp fix for restaurant saving

This commit is contained in:
arzynik 2012-10-18 12:20:09 -04:00
parent 48bafe9029
commit e37a193fb0
2 changed files with 37 additions and 13 deletions

View File

@ -317,8 +317,17 @@
<tr>
<td colspan="2" style="text-align: right;"><br />
<div class="action-button green admin-restaurant-save">
<span>Save Restaurant</span>
<div class="action-button action-button-small green admin-restaurant-save-details">
<span>Save Details</span>
</div>
<div class="action-button action-button-small green admin-restaurant-save-hours" style="margin-right: 10px;">
<span>Save Hours</span>
</div>
<div class="action-button action-button-small green admin-restaurant-save-dishes" style="margin-right: 10px;">
<span>Save Dishes</span>
</div>
<div class="action-button action-button-small green admin-restaurant-save" style="margin-right: 10px;">
<span>Save All</span>
</div>
</td>
</tr>

View File

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