mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 03:25:50 +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
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
|
||||
{
|
||||
value = "";
|
||||
}
|
||||
|
||||
|
||||
choresOverviewTable.search(value).draw();
|
||||
});
|
||||
|
||||
@@ -41,7 +41,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");
|
||||
|
||||
|
||||
choresOverviewTable.column(4).search(value).draw();
|
||||
});
|
||||
|
||||
@@ -61,15 +61,15 @@ $(document).on('click', '.track-chore-button', function(e)
|
||||
document.activeElement.blur();
|
||||
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
|
||||
var choreId = $(e.currentTarget).attr('data-chore-id');
|
||||
var choreName = $(e.currentTarget).attr('data-chore-name');
|
||||
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
|
||||
Grocy.Api.Get('chores/track-chore-execution/' + choreId + '?tracked_time=' + trackedTime,
|
||||
Grocy.Api.Post('chores/' + choreId + '/execute?tracked_time=' + trackedTime,
|
||||
function()
|
||||
{
|
||||
Grocy.Api.Get('chores/get-chore-details/' + choreId,
|
||||
Grocy.Api.Get('chores/' + choreId,
|
||||
function(result)
|
||||
{
|
||||
var choreRow = $('#chore-' + choreId + '-row');
|
||||
@@ -128,7 +128,7 @@ $(document).on('click', '.track-chore-button', function(e)
|
||||
function RefreshStatistics()
|
||||
{
|
||||
var nextXDays = $("#info-due-chores").data("next-x-days");
|
||||
Grocy.Api.Get('chores/get-current',
|
||||
Grocy.Api.Get('chores',
|
||||
function(result)
|
||||
{
|
||||
var dueCount = 0;
|
||||
@@ -146,7 +146,7 @@ function RefreshStatistics()
|
||||
dueCount++;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#info-due-chores").text(Pluralize(dueCount, L('#1 chore is due to be done within the next #2 days', dueCount, nextXDays), L('#1 chores are due to be done within the next #2 days', dueCount, nextXDays)));
|
||||
$("#info-overdue-chores").text(Pluralize(overdueCount, L('#1 chore is overdue to be done', overdueCount), L('#1 chores are overdue to be done', overdueCount)));
|
||||
},
|
||||
|
Reference in New Issue
Block a user