UI test/review

This commit is contained in:
Bernd Bestel
2020-11-08 19:00:12 +01:00
parent d82fd09fba
commit 3e3321bf11
33 changed files with 796 additions and 640 deletions

View File

@@ -13,7 +13,14 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/batteries');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/batteries');
}
});
},
function(xhr)
@@ -30,7 +37,14 @@
{
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/batteries');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/batteries');
}
});
},
function(xhr)

View File

@@ -122,12 +122,12 @@ $('.input-group-chore-period-type').on('change', function(e)
$(".period-type-input").addClass("d-none");
$(".period-type-" + periodType).removeClass("d-none");
$('#chore-period-type-info').text("");
$('#chore-period-type-info').attr("title", "");
$("#period_config").val("");
if (periodType === 'manually')
{
$('#chore-period-type-info').text(__t('This means the next execution of this chore is not scheduled'));
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is not scheduled'));
}
else if (periodType === 'dynamic-regular')
{
@@ -135,32 +135,32 @@ $('.input-group-chore-period-type').on('change', function(e)
$("#period_days").attr("min", "0");
$("#period_days").attr("max", "9999");
$("#period_days").parent().find(".invalid-feedback").text(__t('This cannot be negative'));
$('#chore-period-type-info').text(__t('This means the next execution of this chore is scheduled %s days after the last execution', periodDays.toString()));
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled %s days after the last execution', periodDays.toString()));
}
else if (periodType === 'daily')
{
$('#chore-period-type-info').text(__t('This means the next execution of this chore is scheduled 1 day after the last execution'));
$('#chore-period-interval-info').text(__t('This means the next execution of this chore should only be scheduled every %s days', periodInterval.toString()));
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled 1 day after the last execution'));
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s days', periodInterval.toString()));
}
else if (periodType === 'weekly')
{
$('#chore-period-type-info').text(__t('This means the next execution of this chore is scheduled 1 day after the last execution, but only for the weekdays selected below'));
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled 1 day after the last execution, but only for the weekdays selected below'));
$("#period_config").val($(".period-type-weekly input:checkbox:checked").map(function() { return this.value; }).get().join(","));
$('#chore-period-interval-info').text(__t('This means the next execution of this chore should only be scheduled every %s weeks', periodInterval.toString()));
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s weeks', periodInterval.toString()));
}
else if (periodType === 'monthly')
{
$('#chore-period-type-info').text(__t('This means the next execution of this chore is scheduled on the below selected day of each month'));
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled on the below selected day of each month'));
$("label[for='period_days']").text(__t("Day of month"));
$("#period_days").attr("min", "1");
$("#period_days").attr("max", "31");
$("#period_days").parent().find(".invalid-feedback").text(__t('The amount must be between %1$s and %2$s', "1", "31"));
$('#chore-period-interval-info').text(__t('This means the next execution of this chore should only be scheduled every %s months', periodInterval.toString()));
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s months', periodInterval.toString()));
}
else if (periodType === 'yearly')
{
$('#chore-period-type-info').text(__t('This means the next execution of this chore is scheduled 1 year after the last execution'));
$('#chore-period-interval-info').text(__t('This means the next execution of this chore should only be scheduled every %s years', periodInterval.toString()));
$('#chore-period-type-info').attr("title", __t('This means the next execution of this chore is scheduled 1 year after the last execution'));
$('#chore-period-interval-info').attr("title", __t('This means the next execution of this chore should only be scheduled every %s years', periodInterval.toString()));
}
Grocy.FrontendHelpers.ValidateForm('chore-form');
@@ -176,23 +176,23 @@ $('.input-group-chore-assignment-type').on('change', function(e)
if (assignmentType === 'no-assignment')
{
$('#chore-assignment-type-info').text(__t('This means the next execution of this chore will not be assigned to anyone'));
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will not be assigned to anyone'));
}
else if (assignmentType === 'who-least-did-first')
{
$('#chore-assignment-type-info').text(__t('This means the next execution of this chore will be assigned to the one who executed it least'));
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will be assigned to the one who executed it least'));
$("#assignment_config").attr("required", "");
$("#assignment_config").removeAttr("disabled");
}
else if (assignmentType === 'random')
{
$('#chore-assignment-type-info').text(__t('This means the next execution of this chore will be assigned randomly'));
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will be assigned randomly'));
$("#assignment_config").attr("required", "");
$("#assignment_config").removeAttr("disabled");
}
else if (assignmentType === 'in-alphabetical-order')
{
$('#chore-assignment-type-info').text(__t('This means the next execution of this chore will be assigned to the next one in alphabetical order'));
$('#chore-assignment-type-info').attr("title", __t('This means the next execution of this chore will be assigned to the next one in alphabetical order'));
$("#assignment_config").attr("required", "");
$("#assignment_config").removeAttr("disabled");
}

View File

@@ -13,7 +13,14 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/locations');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/locations');
}
});
},
function(xhr)
@@ -30,7 +37,14 @@
{
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/locations');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/locations');
}
});
},
function(xhr)

View File

@@ -1,19 +1,58 @@
$('#save-product-button').on('click', function(e)
function saveProductPicture(result, location, jsonData)
{
var productId = Grocy.EditObjectId || result.created_object_id;
Grocy.Components.UserfieldsForm.Save(() =>
{
if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave)
{
Grocy.Api.UploadFile($("#product-picture")[0].files[0], 'productpictures', jsonData.picture_file_name,
(result) =>
{
var returnTo = GetUriParam('returnto');
if (GetUriParam("closeAfterCreation") !== undefined)
{
window.close();
}
else if (returnTo !== undefined)
{
window.location.href = U(returnTo) + '?createdproduct=' + encodeURIComponent($('#name').val());
}
else
{
window.location.href = U(location + productId);
}
},
(xhr) =>
{
Grocy.FrontendHelpers.EndUiBusy("product-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
else
{
var returnTo = GetUriParam('returnto');
if (GetUriParam("closeAfterCreation") !== undefined)
{
window.close();
}
else if (returnTo !== undefined)
{
window.location.href = U(returnTo) + '?createdproduct=' + encodeURIComponent($('#name').val());
}
else
{
window.location.href = U(location + productId);
}
}
});
}
$('.save-product-button').on('click', function(e)
{
e.preventDefault();
var redirectDestination = U('/products');
var returnTo = GetUriParam('returnto');
if (returnTo !== undefined)
{
redirectDestination = U(returnTo) + '?createdproduct=' + encodeURIComponent($('#name').val());
}
if (Grocy.ProductEditFormRedirectUri !== undefined)
{
redirectDestination = Grocy.ProductEditFormRedirectUri;
}
var jsonData = $('#product-form').serializeJSON({ checkboxUncheckedValue: "0" });
var parentProductId = jsonData.product_id;
delete jsonData.product_id;
@@ -31,80 +70,23 @@
jsonData.picture_file_name = someRandomStuff + $("#product-picture")[0].files[0].name;
}
const location = $(e.currentTarget).attr('data-location') == 'return' ? '/products?product=' : '/product/';
if (Grocy.EditMode == 'create')
{
Grocy.Api.Post('objects/products', jsonData,
(result) => saveProductPicture(result, location, jsonData));
return;
}
if (Grocy.DeleteProductPictureOnSave)
{
jsonData.picture_file_name = null;
}
if (Grocy.EditMode === 'create')
{
Grocy.Api.Post('objects/products', jsonData,
Grocy.Api.DeleteFile(Grocy.ProductPictureFileName, 'productpictures', {},
function(result)
{
Grocy.EditObjectId = result.created_object_id;
if (prefillBarcode !== undefined)
{
var jsonDataBarcode = {};
jsonDataBarcode.barcode = prefillBarcode;
jsonDataBarcode.product_id = result.created_object_id;
jsonDataBarcode.qu_factor_purchase_to_stock = jsonData.qu_factor_purchase_to_stock;
jsonDataBarcode.shopping_location_id = jsonData.shopping_location_id;
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
function(result)
{
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("barcode-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
}
);
}
Grocy.Components.UserfieldsForm.Save(function()
{
if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave)
{
Grocy.Api.UploadFile($("#product-picture")[0].files[0], 'productpictures', jsonData.picture_file_name,
function(result)
{
if (GetUriParam("closeAfterCreation") !== undefined)
{
window.close();
}
else if (redirectDestination == "reload")
{
window.location.reload();
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);;
}
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("product-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
else
{
if (GetUriParam("closeAfterCreation") !== undefined)
{
window.close();
}
else if (redirectDestination == "reload")
{
window.location.reload();
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);;
}
}
});
// Nothing to do
},
function(xhr)
{
@@ -113,77 +95,15 @@
}
);
}
else
{
if (Grocy.DeleteProductPictureOnSave)
Grocy.Api.Put('objects/products/' + Grocy.EditObjectId, jsonData,
(result) => saveProductPicture(result, location, jsonData),
function(xhr)
{
Grocy.Api.DeleteFile(Grocy.ProductPictureFileName, 'productpictures', {},
function(result)
{
// Nothing to do
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("product-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
};
Grocy.Api.Put('objects/products/' + Grocy.EditObjectId, jsonData,
function(result)
{
Grocy.Components.UserfieldsForm.Save(function()
{
if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteProductPictureOnSave)
{
Grocy.Api.UploadFile($("#product-picture")[0].files[0], 'productpictures', jsonData.picture_file_name,
function(result)
{
if (GetUriParam("closeAfterCreation") !== undefined)
{
window.close();
}
else if (redirectDestination == "reload")
{
window.location.reload();
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);;
}
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("product-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
else
{
if (GetUriParam("closeAfterCreation") !== undefined)
{
window.close();
}
else if (redirectDestination == "reload")
{
window.location.reload();
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);;
}
}
});
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("product-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
Grocy.FrontendHelpers.EndUiBusy("product-form");
console.error(xhr);
}
);
});
Grocy.Api.Get('stock/products/' + Grocy.EditObjectId,
@@ -342,21 +262,23 @@ $("#allow_partial_units_in_stock").on("click", function()
Grocy.FrontendHelpers.ValidateForm("product-form");
});
$('#product-picture').change(function()
$("#product-picture").on("change", function(e)
{
if ($(this).val())
{
Grocy.DeleteProductPictureOnSave = false;
}
$("#product-picture-label").removeClass("d-none");
$("#product-picture-label-none").addClass("d-none");
$("#delete-current-product-picture-on-save-hint").addClass("d-none");
$("#current-product-picture").addClass("d-none");
Grocy.DeleteProductPictureOnSave = false;
});
Grocy.DeleteProductPictureOnSave = false;
$('#delete-current-product-picture-button').on('click', function(e)
$("#delete-current-product-picture-button").on("click", function(e)
{
Grocy.DeleteProductPictureOnSave = true;
$("#current-product-picture").addClass("d-none");
$("#delete-current-product-picture-on-save-hint").removeClass("d-none");
$("#delete-current-product-picture-button").addClass("disabled");
$("#product-picture-label").addClass("d-none");
$("#product-picture-label-none").removeClass("d-none");
});
if (Grocy.EditMode === 'create')

View File

@@ -19,14 +19,62 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
if (typeof GetUriParam("qu-unit") !== "undefined")
if ($("#create_inverse").is(":checked"))
{
window.location.href = U("/quantityunit/" + GetUriParam("qu-unit"));
jsonData.to_qu_id = inverse_to_qu_id;
jsonData.from_qu_id = inverse_from_qu_id;
jsonData.factor = 1 / jsonData.factor;
//Create Inverse
Grocy.Api.Post('objects/quantity_unit_conversions', jsonData,
function(result)
{
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
if (typeof GetUriParam("qu-unit") !== "undefined")
{
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U("/quantityunit/" + GetUriParam("qu-unit"));
}
}
else
{
window.parent.postMessage(WindowMessageBag("ProductQUConversionChanged"), U("/product/" + GetUriParam("product")));
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/product/" + GetUriParam("product")));
}
});
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("quconversion-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
else
{
window.parent.postMessage(WindowMessageBag("ProductQUConversionChanged"), U("/product/" + GetUriParam("product")));
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/product/" + GetUriParam("product")));
if (typeof GetUriParam("qu-unit") !== "undefined")
{
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U("/quantityunit/" + GetUriParam("qu-unit"));
}
}
else
{
window.parent.postMessage(WindowMessageBag("ProductQUConversionChanged"), U("/product/" + GetUriParam("product")));
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/product/" + GetUriParam("product")));
}
}
});
},
@@ -36,37 +84,6 @@
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
if ($("#create_inverse").is(":checked"))
{
jsonData.to_qu_id = inverse_to_qu_id;
jsonData.from_qu_id = inverse_from_qu_id;
jsonData.factor = 1 / jsonData.factor;
//Create Inverse
Grocy.Api.Post('objects/quantity_unit_conversions', jsonData,
function(result)
{
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
if (typeof GetUriParam("qu-unit") !== "undefined")
{
window.location.href = U("/quantityunit/" + GetUriParam("qu-unit"));
}
else
{
window.parent.postMessage(WindowMessageBag("ProductQUConversionChanged"), U("/product/" + GetUriParam("product")));
window.parent.postMessage(WindowMessageBag("CloseAllModals"), U("/product/" + GetUriParam("product")));
}
});
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("quconversion-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
}
);
}
}
else
{
@@ -77,7 +94,14 @@
{
if (typeof GetUriParam("qu-unit") !== "undefined")
{
window.location.href = U("/quantityunit/" + GetUriParam("qu-unit"));
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U("/quantityunit/" + GetUriParam("qu-unit"));
}
}
else
{
@@ -124,7 +148,7 @@ $("#create_inverse").on("change", function()
if (value)
{
$('#qu-conversion-inverse-info').removeClass('d-none');
$('#qu-conversion-inverse-info').removeClass('d-none');
}
else
{

View File

@@ -1,4 +1,4 @@
$('#save-quantityunit-button').on('click', function(e)
$('.save-quantityunit-button').on('click', function(e)
{
e.preventDefault();
@@ -14,6 +14,11 @@
redirectDestination = U('/quantityunits');
}
if ($(e.currentTarget).attr('data-location') == "continue")
{
redirectDestination = "reload";
}
if (Grocy.EditMode === 'create')
{
Grocy.Api.Post('objects/quantity_units', jsonData,
@@ -22,17 +27,25 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
if (redirectDestination == "reload")
if (GetUriParam("embedded") !== undefined)
{
window.location.reload();
}
else if (redirectDestination == "stay")
{
// Do nothing
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);
if (redirectDestination == "reload")
{
window.location.href = U("/quantityunit/" + result.created_object_id.toString());
}
else if (redirectDestination == "stay")
{
// Do nothing
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);
}
}
});
},
@@ -50,17 +63,25 @@
{
Grocy.Components.UserfieldsForm.Save(function()
{
if (redirectDestination == "reload")
if (GetUriParam("embedded") !== undefined)
{
window.location.reload();
}
else if (redirectDestination == "stay")
{
// Do nothing
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);
if (redirectDestination == "reload")
{
window.location.reload();
}
else if (redirectDestination == "stay")
{
// Do nothing
}
else
{
window.location.href = redirectDestination.replace("editobjectid", Grocy.EditObjectId);
}
}
});
},
@@ -154,8 +175,7 @@ $(document).on('click', '.qu-conversion-delete-button', function(e)
Grocy.Api.Delete('objects/quantity_unit_conversions/' + objectId, {},
function(result)
{
Grocy.QuantityUnitEditFormRedirectUri = "reload";
$('#save-quantityunit-button').click();
window.location.reload();
},
function(xhr)
{
@@ -167,19 +187,6 @@ $(document).on('click', '.qu-conversion-delete-button', function(e)
});
});
$(document).on('click', '.qu-conversion-edit-button', function(e)
{
var id = $(e.currentTarget).attr('data-qu-conversion-id');
Grocy.QuantityUnitEditFormRedirectUri = U("/quantityunitconversion/" + id.toString() + "?qu-unit=editobjectid");
$('#save-quantityunit-button').click();
});
$("#qu-conversion-add-button").on("click", function(e)
{
Grocy.QuantityUnitEditFormRedirectUri = U("/quantityunitconversion/new?qu-unit=editobjectid");
$('#save-quantityunit-button').click();
});
$("#test-quantityunit-plural-forms-button").on("click", function(e)
{
e.preventDefault();

View File

@@ -1,6 +1,6 @@
function saveRecipePicture(result, location, jsonData)
{
$recipeId = Grocy.EditObjectId || result.created_object_id;
var recipeId = Grocy.EditObjectId || result.created_object_id;
Grocy.Components.UserfieldsForm.Save(() =>
{
if (jsonData.hasOwnProperty("picture_file_name") && !Grocy.DeleteRecipePictureOnSave)
@@ -8,7 +8,7 @@
Grocy.Api.UploadFile($("#recipe-picture")[0].files[0], 'recipepictures', jsonData.picture_file_name,
(result) =>
{
window.location.href = U(location + $recipeId);
window.location.href = U(location + recipeId);
},
(xhr) =>
{
@@ -19,7 +19,7 @@
}
else
{
window.location.href = U(location + $recipeId);
window.location.href = U(location + recipeId);
}
});
}

View File

@@ -63,7 +63,6 @@ $("#search").on("keyup", Delay(function()
recipesTables.search(value).draw();
$(".recipe-gallery-item").removeClass("d-none");
console.log($(".recipe-gallery-item .card-title:not(:contains_case_insensitive(" + value + "))"));
$(".recipe-gallery-item .card-title:not(:contains_case_insensitive(" + value + "))").parent().parent().parent().addClass("d-none");
}, 200));

View File

@@ -13,7 +13,14 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/shoppinglocations');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/shoppinglocations');
}
});
},
function(xhr)
@@ -30,7 +37,14 @@
{
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/shoppinglocations');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/shoppinglocations');
}
});
},
function(xhr)

View File

@@ -13,7 +13,14 @@
Grocy.EditObjectId = result.created_object_id;
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/taskcategories');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/taskcategories');
}
});
},
function(xhr)
@@ -30,7 +37,14 @@
{
Grocy.Components.UserfieldsForm.Save(function()
{
window.location.href = U('/taskcategories');
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = U('/taskcategories');
}
});
},
function(xhr)

View File

@@ -12,7 +12,14 @@
Grocy.Api.Post('objects/userentities', jsonData,
function(result)
{
window.location.href = redirectUrl;
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = redirectUrl;
}
},
function(xhr)
{
@@ -26,7 +33,14 @@
Grocy.Api.Put('objects/userentities/' + Grocy.EditObjectId, jsonData,
function(result)
{
window.location.href = redirectUrl;
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = redirectUrl;
}
},
function(xhr)
{

View File

@@ -16,7 +16,14 @@
Grocy.Api.Post('objects/userfields', jsonData,
function(result)
{
window.location.href = redirectUrl;
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = redirectUrl;
}
},
function(xhr)
{
@@ -30,7 +37,14 @@
Grocy.Api.Put('objects/userfields/' + Grocy.EditObjectId, jsonData,
function(result)
{
window.location.href = redirectUrl;
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
else
{
window.location.href = redirectUrl;
}
},
function(xhr)
{