Verb-less Generic Entity Interactions

This commit is contained in:
Christopher Forkner 2019-01-08 13:14:15 -07:00
parent e416695cc4
commit 6b41e5212c
27 changed files with 69 additions and 69 deletions

View File

@ -52,7 +52,7 @@ $(document).on('click', '.battery-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/batteries/' + objectId, Grocy.Api.Delete('object/batteries/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/batteries'); window.location.href = U('/batteries');

View File

@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/batteries', jsonData, Grocy.Api.Post('object/batteries', jsonData,
function(result) function(result)
{ {
window.location.href = U('/batteries'); window.location.href = U('/batteries');
@ -21,7 +21,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/batteries/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/batteries/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/batteries'); window.location.href = U('/batteries');
@ -45,7 +45,7 @@ $('#battery-form input').keydown(function(event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('battery-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('battery-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/chores', jsonData, Grocy.Api.Post('object/chores', jsonData,
function(result) function(result)
{ {
window.location.href = U('/chores'); window.location.href = U('/chores');
@ -21,7 +21,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/chores/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/chores/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/chores'); window.location.href = U('/chores');

View File

@ -52,7 +52,7 @@ $(document).on('click', '.chore-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/chores/' + objectId, Grocy.Api.Delete('object/chores/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/chores'); window.location.href = U('/chores');

View File

@ -34,7 +34,7 @@ equipmentTable.on('select', function(e, dt, type, indexes)
function DisplayEquipment(id) function DisplayEquipment(id)
{ {
Grocy.Api.Get('get-object/equipment/' + id, Grocy.Api.Get('object/equipment/' + id,
function(equipmentItem) function(equipmentItem)
{ {
$(".selected-equipment-name").text(equipmentItem.name); $(".selected-equipment-name").text(equipmentItem.name);
@ -98,7 +98,7 @@ $(document).on('click', '.equipment-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/equipment/' + objectId, Grocy.Api.Delete('object/equipment/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/equipment'); window.location.href = U('/equipment');

View File

@ -15,10 +15,10 @@
{ {
jsonData.instruction_manual_file_name = null; jsonData.instruction_manual_file_name = null;
} }
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/equipment', jsonData, Grocy.Api.Post('object/equipment', jsonData,
function(result) function(result)
{ {
if (jsonData.hasOwnProperty("instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave) if (jsonData.hasOwnProperty("instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave)
@ -64,7 +64,7 @@
); );
}; };
Grocy.Api.Post('edit-object/equipment/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/equipment/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
if (jsonData.hasOwnProperty("instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave) if (jsonData.hasOwnProperty("instruction_manual_file_name") && !Grocy.DeleteInstructionManualOnSave)
@ -105,7 +105,7 @@ $('#equipment-form input').keydown(function(event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('equipment-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('equipment-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -24,7 +24,7 @@
productDetails.product.barcode += ',' + addBarcode; productDetails.product.barcode += ',' + addBarcode;
} }
Grocy.Api.Post('edit-object/products/' + productDetails.product.id, productDetails.product, Grocy.Api.Put('object/products/' + productDetails.product.id, productDetails.product,
function (result) { }, function (result) { },
function(xhr) function(xhr)
{ {

View File

@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/locations', jsonData, Grocy.Api.Post('object/locations', jsonData,
function(result) function(result)
{ {
window.location.href = U('/locations'); window.location.href = U('/locations');
@ -21,7 +21,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/locations/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/locations/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/locations'); window.location.href = U('/locations');
@ -45,7 +45,7 @@ $('#location-form input').keydown(function (event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('location-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('location-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -52,7 +52,7 @@ $(document).on('click', '.location-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/locations/' + objectId, Grocy.Api.Delete('object/locations/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/locations'); window.location.href = U('/locations');

View File

@ -58,7 +58,7 @@ $(document).on('click', '.apikey-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/api_keys/' + objectId, Grocy.Api.Delete('object/api_keys/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/manageapikeys'); window.location.href = U('/manageapikeys');

View File

@ -25,7 +25,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/products', jsonData, Grocy.Api.Post('object/products', jsonData,
function (result) function (result)
{ {
if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave) if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave)
@ -71,7 +71,7 @@
); );
}; };
Grocy.Api.Post('edit-object/products/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/products/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave) if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave)
@ -110,7 +110,7 @@ $('#barcode-taginput').tagsManager({
if (Grocy.EditMode === 'edit') if (Grocy.EditMode === 'edit')
{ {
Grocy.Api.Get('get-object/products/' + Grocy.EditObjectId, Grocy.Api.Get('object/products/' + Grocy.EditObjectId,
function (product) function (product)
{ {
if (product.barcode !== null && product.barcode.length > 0) if (product.barcode !== null && product.barcode.length > 0)
@ -182,7 +182,7 @@ $('#product-form input').keydown(function(event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('product-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('product-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/product_groups', jsonData, Grocy.Api.Post('object/product_groups', jsonData,
function(result) function(result)
{ {
window.location.href = U('/productgroups'); window.location.href = U('/productgroups');
@ -21,7 +21,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/product_groups/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/product_groups/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/productgroups'); window.location.href = U('/productgroups');
@ -45,7 +45,7 @@ $('#product-group-form input').keydown(function (event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('product-group-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('product-group-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -52,7 +52,7 @@ $(document).on('click', '.product-group-delete-button', function(e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/product_groups/' + objectId, Grocy.Api.Delete('object/product_groups/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/productgroups'); window.location.href = U('/productgroups');

View File

@ -59,7 +59,7 @@ $(document).on('click', '.product-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/products/' + objectId, Grocy.Api.Delete('object/products/' + objectId,
function (result) function (result)
{ {
window.location.href = U('/products'); window.location.href = U('/products');

View File

@ -32,7 +32,7 @@
productDetails.product.barcode += ',' + addBarcode; productDetails.product.barcode += ',' + addBarcode;
} }
Grocy.Api.Post('edit-object/products/' + productDetails.product.id, productDetails.product, Grocy.Api.Put('object/products/' + productDetails.product.id, productDetails.product,
function (result) { }, function (result) { },
function(xhr) function(xhr)
{ {

View File

@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/quantity_units', jsonData, Grocy.Api.Post('object/quantity_units', jsonData,
function(result) function(result)
{ {
window.location.href = U('/quantityunits'); window.location.href = U('/quantityunits');
@ -21,7 +21,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/quantity_units/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/quantity_units/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/quantityunits'); window.location.href = U('/quantityunits');
@ -45,7 +45,7 @@ $('#quantityunit-form input').keydown(function(event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('quantityunit-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('quantityunit-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -52,7 +52,7 @@ $(document).on('click', '.quantityunit-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/quantity_units/' + objectId, Grocy.Api.Delete('object/quantity_units/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/quantityunits'); window.location.href = U('/quantityunits');

View File

@ -5,7 +5,7 @@
var jsonData = $('#recipe-form').serializeJSON(); var jsonData = $('#recipe-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("recipe-form"); Grocy.FrontendHelpers.BeginUiBusy("recipe-form");
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/recipes'); window.location.href = U('/recipes');
@ -113,8 +113,8 @@ $(document).on('click', '.recipe-pos-delete-button', function(e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { }); Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { });
Grocy.Api.Delete('delete-object/recipes_pos/' + objectId, Grocy.Api.Delete('object/recipes_pos/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectId); window.location.href = U('/recipe/' + Grocy.EditObjectId);
@ -150,8 +150,8 @@ $(document).on('click', '.recipe-include-delete-button', function(e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { }); Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { });
Grocy.Api.Delete('delete-object/recipes_nestings/' + objectId, Grocy.Api.Delete('object/recipes_nestings/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectId); window.location.href = U('/recipe/' + Grocy.EditObjectId);
@ -178,10 +178,10 @@ $(document).on('click', '.recipe-pos-order-missing-button', function(e)
jsonData.amount = productAmount; jsonData.amount = productAmount;
jsonData.note = L('Added for recipe #1', recipeName); jsonData.note = L('Added for recipe #1', recipeName);
Grocy.Api.Post('add-object/shopping_list', jsonData, Grocy.Api.Post('object/shopping_list', jsonData,
function(result) function(result)
{ {
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function () { }, function () { }); Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function () { }, function () { });
window.location.href = U('/recipe/' + Grocy.EditObjectId); window.location.href = U('/recipe/' + Grocy.EditObjectId);
}, },
function(xhr) function(xhr)
@ -202,7 +202,7 @@ $(document).on('click', '.recipe-pos-edit-button', function (e)
{ {
var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id'); var recipePosId = $(e.currentTarget).attr('data-recipe-pos-id');
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(),
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/' + recipePosId); window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/' + recipePosId);
@ -219,7 +219,7 @@ $(document).on('click', '.recipe-include-edit-button', function (e)
var id = $(e.currentTarget).attr('data-recipe-include-id'); var id = $(e.currentTarget).attr('data-recipe-include-id');
var recipeId = $(e.currentTarget).attr('data-recipe-included-recipe-id'); var recipeId = $(e.currentTarget).attr('data-recipe-included-recipe-id');
console.log(recipeId); console.log(recipeId);
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(),
function(result) function(result)
{ {
$("#recipe-include-editform-title").text(L("Edit included recipe")); $("#recipe-include-editform-title").text(L("Edit included recipe"));
@ -238,7 +238,7 @@ $(document).on('click', '.recipe-include-edit-button', function (e)
$("#recipe-pos-add-button").on("click", function(e) $("#recipe-pos-add-button").on("click", function(e)
{ {
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(),
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/new'); window.location.href = U('/recipe/' + Grocy.EditObjectId + '/pos/new');
@ -252,7 +252,7 @@ $("#recipe-pos-add-button").on("click", function(e)
$("#recipe-include-add-button").on("click", function(e) $("#recipe-include-add-button").on("click", function(e)
{ {
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), Grocy.Api.Put('object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(),
function(result) function(result)
{ {
$("#recipe-include-editform-title").text(L("Add included recipe")); $("#recipe-include-editform-title").text(L("Add included recipe"));
@ -280,7 +280,7 @@ $('#save-recipe-include-button').on('click', function(e)
if (editMode === 'create') if (editMode === 'create')
{ {
Grocy.Api.Post('add-object/recipes_nestings', jsonData, Grocy.Api.Post('object/recipes_nestings', jsonData,
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectId); window.location.href = U('/recipe/' + Grocy.EditObjectId);
@ -293,7 +293,7 @@ $('#save-recipe-include-button').on('click', function(e)
} }
else else
{ {
Grocy.Api.Post('edit-object/recipes_nestings/' + nestingId, jsonData, Grocy.Api.Put('object/recipes_nestings/' + nestingId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectId); window.location.href = U('/recipe/' + Grocy.EditObjectId);

View File

@ -9,7 +9,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/recipes_pos', jsonData, Grocy.Api.Post('object/recipes_pos', jsonData,
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectParentId); window.location.href = U('/recipe/' + Grocy.EditObjectParentId);
@ -23,7 +23,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/recipes_pos/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/recipes_pos/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/recipe/' + Grocy.EditObjectParentId); window.location.href = U('/recipe/' + Grocy.EditObjectParentId);

View File

@ -63,7 +63,7 @@ $("#selectedRecipeDeleteButton").on('click', function(e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/recipes/' + objectId, Grocy.Api.Delete('object/recipes/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/recipes'); window.location.href = U('/recipes');

View File

@ -64,7 +64,7 @@ $(document).on('click', '.shoppinglist-delete-button', function (e)
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id'); var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
Grocy.FrontendHelpers.BeginUiBusy(); Grocy.FrontendHelpers.BeginUiBusy();
Grocy.Api.Delete('delete-object/shopping_list/' + shoppingListItemId, Grocy.Api.Delete('object/shopping_list/' + shoppingListItemId,
function(result) function(result)
{ {
$('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function() $('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function()

View File

@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/shopping_list', jsonData, Grocy.Api.Post('object/shopping_list', jsonData,
function(result) function(result)
{ {
window.location.href = U('/shoppinglist'); window.location.href = U('/shoppinglist');
@ -21,7 +21,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/shopping_list/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/shopping_list/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/shoppinglist'); window.location.href = U('/shoppinglist');

View File

@ -52,7 +52,7 @@ $(document).on('click', '.task-category-delete-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/task_categories/' + objectId, Grocy.Api.Delete('object/task_categories/' + objectId,
function(result) function(result)
{ {
window.location.href = U('/taskcategories'); window.location.href = U('/taskcategories');

View File

@ -7,7 +7,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/task_categories', jsonData, Grocy.Api.Post('object/task_categories', jsonData,
function(result) function(result)
{ {
window.location.href = U('/taskcategories'); window.location.href = U('/taskcategories');
@ -21,7 +21,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/task_categories/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/task_categories/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/taskcategories'); window.location.href = U('/taskcategories');
@ -45,7 +45,7 @@ $('#task-category-form input').keydown(function (event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('task-category-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('task-category-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -11,7 +11,7 @@
if (Grocy.EditMode === 'create') if (Grocy.EditMode === 'create')
{ {
Grocy.Api.Post('add-object/tasks', jsonData, Grocy.Api.Post('object/tasks', jsonData,
function(result) function(result)
{ {
window.location.href = U('/tasks'); window.location.href = U('/tasks');
@ -25,7 +25,7 @@
} }
else else
{ {
Grocy.Api.Post('edit-object/tasks/' + Grocy.EditObjectId, jsonData, Grocy.Api.Put('object/tasks/' + Grocy.EditObjectId, jsonData,
function(result) function(result)
{ {
window.location.href = U('/tasks'); window.location.href = U('/tasks');
@ -49,7 +49,7 @@ $('#task-form input').keydown(function(event)
if (event.keyCode === 13) //Enter if (event.keyCode === 13) //Enter
{ {
event.preventDefault(); event.preventDefault();
if (document.getElementById('task-form').checkValidity() === false) //There is at least one validation error if (document.getElementById('task-form').checkValidity() === false) //There is at least one validation error
{ {
return false; return false;

View File

@ -123,7 +123,7 @@ $(document).on('click', '.delete-task-button', function (e)
{ {
if (result === true) if (result === true)
{ {
Grocy.Api.Delete('delete-object/tasks/' + objectId, Grocy.Api.Delete('object/tasks/' + objectId,
function(result) function(result)
{ {
$('#task-' + objectId + '-row').fadeOut(500, function () $('#task-' + objectId + '-row').fadeOut(500, function ()

View File

@ -83,11 +83,11 @@ $app->group('/api', function()
$this->get('/get-openapi-specification', '\Grocy\Controllers\OpenApiController:DocumentationSpec'); $this->get('/get-openapi-specification', '\Grocy\Controllers\OpenApiController:DocumentationSpec');
// Generic entity interaction // Generic entity interaction
$this->get('/get-objects/{entity}', '\Grocy\Controllers\GenericEntityApiController:GetObjects'); $this->get('/object/{entity}', '\Grocy\Controllers\GenericEntityApiController:GetObjects');
$this->get('/get-object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:GetObject'); $this->get('/object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:GetObject');
$this->post('/add-object/{entity}', '\Grocy\Controllers\GenericEntityApiController:AddObject'); $this->post('/object/{entity}', '\Grocy\Controllers\GenericEntityApiController:AddObject');
$this->put('/edit-object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:EditObject'); $this->put('/object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:EditObject');
$this->delete('/delete-object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:DeleteObject'); $this->delete('/object/{entity}/{objectId}', '\Grocy\Controllers\GenericEntityApiController:DeleteObject');
// System // System
$this->get('/system/get-db-changed-time', '\Grocy\Controllers\SystemApiController:GetDbChangedTime'); $this->get('/system/get-db-changed-time', '\Grocy\Controllers\SystemApiController:GetDbChangedTime');
@ -99,10 +99,10 @@ $app->group('/api', function()
$this->delete('/file/{group}', '\Grocy\Controllers\FilesApiController:DeleteFile'); $this->delete('/file/{group}', '\Grocy\Controllers\FilesApiController:DeleteFile');
// Users // Users
$this->get('/users/get', '\Grocy\Controllers\UsersApiController:GetUsers'); $this->get('/users', '\Grocy\Controllers\UsersApiController:GetUsers');
$this->post('/users/create', '\Grocy\Controllers\UsersApiController:CreateUser'); $this->post('/users', '\Grocy\Controllers\UsersApiController:CreateUser');
$this->put('/users/edit/{userId}', '\Grocy\Controllers\UsersApiController:EditUser'); $this->put('/users/{userId}', '\Grocy\Controllers\UsersApiController:EditUser');
$this->delete('/users/delete/{userId}', '\Grocy\Controllers\UsersApiController:DeleteUser'); $this->delete('/users/{userId}', '\Grocy\Controllers\UsersApiController:DeleteUser');
// User // User
$this->get('/user/settings/{settingKey}', '\Grocy\Controllers\UsersApiController:GetUserSetting'); $this->get('/user/settings/{settingKey}', '\Grocy\Controllers\UsersApiController:GetUserSetting');