mirror of
https://github.com/grocy/grocy.git
synced 2025-10-12 16:44:55 +00:00
API - A bit more RESTful (#140)
* Restful routes * Change public/viewjs to match API routes * Move the GET and POST together. Fixed Typos. PUT for object/user edits. * Verb-less Generic Entity Interactions * Create Grocy.Api.Put * Create Grocy.Api.Delete * Fix Volatile Slim Error order in routes and adjust to english noun
This commit is contained in:
committed by
Bernd Bestel
parent
98d95f80df
commit
0ce8d706a6
@@ -32,7 +32,7 @@ $("#search").on("keyup", function()
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
|
||||
|
||||
shoppingListTable.search(value).draw();
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ $("#status-filter").on("change", function()
|
||||
|
||||
// Transfer CSS classes of selected element to dropdown element (for background)
|
||||
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
|
||||
|
||||
|
||||
shoppingListTable.column(4).search(value).draw();
|
||||
});
|
||||
|
||||
@@ -60,11 +60,11 @@ $(".status-filter-button").on("click", function()
|
||||
$(document).on('click', '.shoppinglist-delete-button', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
Grocy.Api.Get('delete-object/shopping_list/' + shoppingListItemId,
|
||||
Grocy.Api.Delete('object/shopping_list/' + shoppingListItemId,
|
||||
function(result)
|
||||
{
|
||||
$('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function()
|
||||
@@ -84,7 +84,7 @@ $(document).on('click', '.shoppinglist-delete-button', function (e)
|
||||
|
||||
$(document).on('click', '#add-products-below-min-stock-amount', function(e)
|
||||
{
|
||||
Grocy.Api.Get('stock/add-missing-products-to-shoppinglist',
|
||||
Grocy.Api.Post('stock/shoppinglist',
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/shoppinglist');
|
||||
@@ -116,7 +116,7 @@ $(document).on('click', '#clear-shopping-list', function(e)
|
||||
{
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
Grocy.Api.Get('stock/clear-shopping-list',
|
||||
Grocy.Api.Post('stock/clearshoppinglist',
|
||||
function(result)
|
||||
{
|
||||
$('#shoppinglist-table tbody tr').fadeOut(500, function()
|
||||
@@ -140,7 +140,7 @@ $(document).on('click', '#clear-shopping-list', function(e)
|
||||
$(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
var href = $(e.currentTarget).attr('href');
|
||||
|
||||
$("#shopping-list-stock-add-workflow-purchase-form-frame").attr("src", href);
|
||||
@@ -179,7 +179,7 @@ $("#shopping-list-stock-add-workflow-modal").on("hidden.bs.modal", function(e)
|
||||
$(window).on("message", function(e)
|
||||
{
|
||||
var data = e.originalEvent.data;
|
||||
|
||||
|
||||
if (data.Message === "AfterItemAdded")
|
||||
{
|
||||
$(".shoppinglist-delete-button[data-shoppinglist-id='" + data.Payload + "']").click();
|
||||
@@ -212,7 +212,7 @@ $(window).on("message", function(e)
|
||||
$(document).on('click', '#shopping-list-stock-add-workflow-skip-button', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
window.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user