diff --git a/js/helpers/frontend.js b/js/helpers/frontend.js
index 1c4faf12..94f9d76a 100644
--- a/js/helpers/frontend.js
+++ b/js/helpers/frontend.js
@@ -395,13 +395,14 @@ class GrocyFrontendHelpers
});
}
- MakeYesNoBox(message, selector, callback)
+ MakeYesNoBox(message, selector, cb)
{
var self = this;
this.scope.on('click', selector, function(e)
{
- message = message instanceof Function ? message(e) : message;
+ var target = e.currentTarget;
+ message = message instanceof Function ? message(target) : message;
bootbox.confirm({
message: message,
closeButton: false,
@@ -415,7 +416,7 @@ class GrocyFrontendHelpers
className: 'btn-danger'
}
},
- callback: (result) => callback(result, e)
+ callback: (result) => cb(result, target)
});
});
diff --git a/js/lib/proxy.js b/js/lib/proxy.js
index 901d3578..d36acb54 100644
--- a/js/lib/proxy.js
+++ b/js/lib/proxy.js
@@ -41,7 +41,10 @@ class GrocyProxy
{
// if we need to override UserSettings, we need to copy the object.
// not great, but eh.
+ let tempUs = {}
+ Object.assign(tempUs, this.config.UserSettings);
Object.assign(this.config.UserSettings, RootGrocy.UserSettings);
+ Object.assign(this.config.UserSettings, tempUs);
this.UserSettings = config.UserSettings;
}
diff --git a/js/viewjs/batteryform.js b/js/viewjs/batteryform.js
index 7d229714..2054cf49 100644
--- a/js/viewjs/batteryform.js
+++ b/js/viewjs/batteryform.js
@@ -96,7 +96,7 @@ function batteryformView(Grocy, scope = null)
}
});
- userfieldsform.UserfieldsForm.Load();
+ userfieldsform.Load();
$scope('#name').focus();
Grocy.FrontendHelpers.ValidateForm('battery-form');
diff --git a/js/viewjs/productform.js b/js/viewjs/productform.js
index e8615629..b9869f53 100644
--- a/js/viewjs/productform.js
+++ b/js/viewjs/productform.js
@@ -15,6 +15,7 @@ function productformView(Grocy, scope = null)
// preload some views.
Grocy.PreloadView("productgroupform");
Grocy.PreloadView("productbarcodeform");
+ Grocy.PreloadView("quantityunitconversionform");
var shoppinglocationpicker = Grocy.Use("shoppinglocationpicker");
var userfields = Grocy.Use("userfieldsform");
diff --git a/js/viewjs/recipes.js b/js/viewjs/recipes.js
index f7c81386..6853df54 100644
--- a/js/viewjs/recipes.js
+++ b/js/viewjs/recipes.js
@@ -121,9 +121,9 @@
);
Grocy.FrontendHelpers.MakeYesNoBox(
- (e) =>
+ (target) =>
{
- var objectName = $(e.currentTarget).attr('data-recipe-name');
+ var objectName = $(target).attr('data-recipe-name');
return __t('Are you sure to put all missing ingredients for recipe "%s" on the shopping list?', objectName) +
"
" +
__t("Uncheck ingredients to not put them on the shopping list") +
@@ -131,9 +131,9 @@
$scope("#missing-recipe-pos-list")[0].outerHTML.replace("d-none", "");
},
'.recipe-shopping-list',
- (result, e) =>
+ (result, target) =>
{
- var objectId = $(e.currentTarget).attr('data-recipe-id');
+ var objectId = $(target).attr('data-recipe-id');
if (result === true)
{
Grocy.FrontendHelpers.BeginUiBusy();
@@ -160,15 +160,15 @@
);
Grocy.FrontendHelpers.MakeYesNoBox(
- (e) =>
+ (target) =>
{
- var objectName = $(e.currentTarget).attr('data-recipe-name');
+ var objectName = $(target).attr('data-recipe-name');
return __t('Are you sure to consume all ingredients needed by recipe "%s" (ingredients marked with "only check if any amount is in stock" will be ignored)?', objectName);
},
'.recipe-consume',
- (result, e) =>
+ (result, targetElement) =>
{
- var target = $(e.currentTarget);
+ var target = $(targetElement);
var objectName = target.attr('data-recipe-name');
var objectId = target.attr('data-recipe-id');
if (result === true)
diff --git a/js/viewjs/shoppinglist.js b/js/viewjs/shoppinglist.js
index aa99d4d8..ace9a14b 100644
--- a/js/viewjs/shoppinglist.js
+++ b/js/viewjs/shoppinglist.js
@@ -7,7 +7,7 @@ import { WindowMessageBag } from '../helpers/messagebag';
function shoppinglistView(Grocy, scope = null)
{
var $scope = $;
- var top = scope != null ? $(scope) : top;
+ var top = scope != null ? $(scope) : $(document);
var viewport = scope != null ? $(scope) : $(window);
if (scope != null)
diff --git a/views/batteryform.blade.php b/views/batteryform.blade.php
index e979263d..17873cda 100644
--- a/views/batteryform.blade.php
+++ b/views/batteryform.blade.php
@@ -24,8 +24,12 @@ EditObjectId: {{ $battery->id }},