diff --git a/public/js/extensions.js b/public/js/extensions.js index 9ed9e1f8..df3e80d6 100644 --- a/public/js/extensions.js +++ b/public/js/extensions.js @@ -195,8 +195,3 @@ function getQRCodeForAPIKey(apikey_type, apikey_key) } return getQRCodeForContent(content); } - -function SanitizeHtml(input) -{ - return $("
").text(input).html(); -} diff --git a/public/viewjs/batteries.js b/public/viewjs/batteries.js index 71e1a216..0829ebe4 100644 --- a/public/viewjs/batteries.js +++ b/public/viewjs/batteries.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.battery-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-battery-name')); + var objectName = $(e.currentTarget).attr('data-battery-name'); var objectId = $(e.currentTarget).attr('data-battery-id'); bootbox.confirm({ diff --git a/public/viewjs/chores.js b/public/viewjs/chores.js index a120bd6f..7d3ca85a 100644 --- a/public/viewjs/chores.js +++ b/public/viewjs/chores.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.chore-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-chore-name')); + var objectName = $(e.currentTarget).attr('data-chore-name'); var objectId = $(e.currentTarget).attr('data-chore-id'); bootbox.confirm({ diff --git a/public/viewjs/components/productpicker.js b/public/viewjs/components/productpicker.js index f90623c2..16d4bd5f 100644 --- a/public/viewjs/components/productpicker.js +++ b/public/viewjs/components/productpicker.js @@ -162,7 +162,7 @@ $('#product_id_text_input').on('blur', function(e) Grocy.Components.ProductPicker.PopupOpen = true; bootbox.dialog({ - message: __t('"%s" could not be resolved to a product, how do you want to proceed?', SanitizeHtml(input)), + message: __t('"%s" could not be resolved to a product, how do you want to proceed?', input), title: __t('Create or assign product'), onEscape: function() { diff --git a/public/viewjs/equipment.js b/public/viewjs/equipment.js index ebfb003c..0bdb87e5 100644 --- a/public/viewjs/equipment.js +++ b/public/viewjs/equipment.js @@ -68,7 +68,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.equipment-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-equipment-name')); + var objectName = $(e.currentTarget).attr('data-equipment-name'); var objectId = $(e.currentTarget).attr('data-equipment-id'); bootbox.confirm({ diff --git a/public/viewjs/locations.js b/public/viewjs/locations.js index 6bab2dcf..28947d3a 100644 --- a/public/viewjs/locations.js +++ b/public/viewjs/locations.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.location-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-location-name')); + var objectName = $(e.currentTarget).attr('data-location-name'); var objectId = $(e.currentTarget).attr('data-location-id'); bootbox.confirm({ diff --git a/public/viewjs/mealplan.js b/public/viewjs/mealplan.js index 13c4c00e..002ffee5 100644 --- a/public/viewjs/mealplan.js +++ b/public/viewjs/mealplan.js @@ -563,7 +563,7 @@ $(document).on('click', '.recipe-order-missing-button', function(e) // to prevent that the tooltip stays until clicked anywhere else document.activeElement.blur(); - var objectName = SanitizeHtml($(e.currentTarget).attr('data-recipe-name')); + var objectName = $(e.currentTarget).attr('data-recipe-name'); var objectId = $(e.currentTarget).attr('data-recipe-id'); var button = $(this); var servings = $(e.currentTarget).attr('data-mealplan-servings'); @@ -667,7 +667,7 @@ $(document).on('click', '.recipe-consume-button', function(e) // to prevent that the tooltip stays until clicked anywhere else document.activeElement.blur(); - var objectName = SanitizeHtml($(e.currentTarget).attr('data-recipe-name')); + var objectName = $(e.currentTarget).attr('data-recipe-name'); var objectId = $(e.currentTarget).attr('data-recipe-id'); var servings = $(e.currentTarget).attr('data-mealplan-servings'); diff --git a/public/viewjs/productgroups.js b/public/viewjs/productgroups.js index 40587899..af64c63d 100644 --- a/public/viewjs/productgroups.js +++ b/public/viewjs/productgroups.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.product-group-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-group-name')); + var objectName = $(e.currentTarget).attr('data-group-name'); var objectId = $(e.currentTarget).attr('data-group-id'); bootbox.confirm({ diff --git a/public/viewjs/products.js b/public/viewjs/products.js index 77d1da70..5934c4b0 100644 --- a/public/viewjs/products.js +++ b/public/viewjs/products.js @@ -38,7 +38,7 @@ if (typeof GetUriParam("product-group") !== "undefined") $(document).on('click', '.product-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-product-name')); + var objectName = $(e.currentTarget).attr('data-product-name'); var objectId = $(e.currentTarget).attr('data-product-id'); Grocy.Api.Get('stock/products/' + objectId, diff --git a/public/viewjs/quantityunits.js b/public/viewjs/quantityunits.js index 8b5cc35f..9d5766a1 100644 --- a/public/viewjs/quantityunits.js +++ b/public/viewjs/quantityunits.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.quantityunit-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-quantityunit-name')); + var objectName = $(e.currentTarget).attr('data-quantityunit-name'); var objectId = $(e.currentTarget).attr('data-quantityunit-id'); bootbox.confirm({ diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js index a736b9f3..3c1db7bd 100644 --- a/public/viewjs/recipeform.js +++ b/public/viewjs/recipeform.js @@ -126,7 +126,7 @@ $('#recipe-form input').keydown(function(event) $(document).on('click', '.recipe-pos-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-recipe-pos-name')); + var objectName = $(e.currentTarget).attr('data-recipe-pos-name'); var objectId = $(e.currentTarget).attr('data-recipe-pos-id'); bootbox.confirm({ @@ -163,7 +163,7 @@ $(document).on('click', '.recipe-pos-delete-button', function(e) $(document).on('click', '.recipe-include-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-recipe-include-name')); + var objectName = $(e.currentTarget).attr('data-recipe-include-name'); var objectId = $(e.currentTarget).attr('data-recipe-include-id'); bootbox.confirm({ @@ -200,7 +200,7 @@ $(document).on('click', '.recipe-include-delete-button', function(e) $(document).on('click', '.recipe-pos-show-note-button', function(e) { - var note = SanitizeHtml($(e.currentTarget).attr('data-recipe-pos-note')); + var note = $(e.currentTarget).attr('data-recipe-pos-note'); bootbox.alert(note); }); diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js index e2fe7e49..1e4d835b 100644 --- a/public/viewjs/recipes.js +++ b/public/viewjs/recipes.js @@ -98,7 +98,7 @@ $(".recipe-delete").on('click', function(e) { e.preventDefault(); - var objectName = SanitizeHtml($(e.currentTarget).attr('data-recipe-name')); + var objectName = $(e.currentTarget).attr('data-recipe-name'); var objectId = $(e.currentTarget).attr('data-recipe-id'); bootbox.confirm({ @@ -135,7 +135,7 @@ $(".recipe-delete").on('click', function(e) $(document).on('click', '.recipe-shopping-list', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-recipe-name')); + var objectName = $(e.currentTarget).attr('data-recipe-name'); var objectId = $(e.currentTarget).attr('data-recipe-id'); bootbox.confirm({ @@ -181,7 +181,7 @@ $(document).on('click', '.recipe-shopping-list', function(e) $(".recipe-consume").on('click', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-recipe-name')); + var objectName = $(e.currentTarget).attr('data-recipe-name'); var objectId = $(e.currentTarget).attr('data-recipe-id'); bootbox.confirm({ diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js index 27802080..7bdf28d6 100644 --- a/public/viewjs/shoppinglist.js +++ b/public/viewjs/shoppinglist.js @@ -77,7 +77,7 @@ $(".status-filter-message").on("click", function() $("#delete-selected-shopping-list").on("click", function() { - var objectName = SanitizeHtml($("#selected-shopping-list option:selected").text()); + var objectName = $("#selected-shopping-list option:selected").text(); var objectId = $("#selected-shopping-list").val(); bootbox.confirm({ @@ -172,7 +172,7 @@ $(document).on('click', '#add-expired-products', function(e) $(document).on('click', '#clear-shopping-list', function(e) { bootbox.confirm({ - message: __t('Are you sure to empty shopping list "%s"?', SanitizeHtml($("#selected-shopping-list option:selected").text())), + message: __t('Are you sure to empty shopping list "%s"?', $("#selected-shopping-list option:selected").text()), closeButton: false, buttons: { confirm: { diff --git a/public/viewjs/shoppinglocations.js b/public/viewjs/shoppinglocations.js index c5bdb6ee..5843ba00 100644 --- a/public/viewjs/shoppinglocations.js +++ b/public/viewjs/shoppinglocations.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.shoppinglocation-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-shoppinglocation-name')); + var objectName = $(e.currentTarget).attr('data-shoppinglocation-name'); var objectId = $(e.currentTarget).attr('data-shoppinglocation-id'); bootbox.confirm({ diff --git a/public/viewjs/taskcategories.js b/public/viewjs/taskcategories.js index 025bfc64..d3953b43 100644 --- a/public/viewjs/taskcategories.js +++ b/public/viewjs/taskcategories.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.task-category-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-category-name')); + var objectName = $(e.currentTarget).attr('data-category-name'); var objectId = $(e.currentTarget).attr('data-category-id'); bootbox.confirm({ diff --git a/public/viewjs/tasks.js b/public/viewjs/tasks.js index e8a84d92..7e93c03d 100644 --- a/public/viewjs/tasks.js +++ b/public/viewjs/tasks.js @@ -119,7 +119,7 @@ $(document).on('click', '.delete-task-button', function(e) { e.preventDefault(); - var objectName = SanitizeHtml($(e.currentTarget).attr('data-task-name')); + var objectName = $(e.currentTarget).attr('data-task-name'); var objectId = $(e.currentTarget).attr('data-task-id'); bootbox.confirm({ diff --git a/public/viewjs/userentities.js b/public/viewjs/userentities.js index e6c5e85a..74bbaf98 100644 --- a/public/viewjs/userentities.js +++ b/public/viewjs/userentities.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.userentity-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-userentity-name')); + var objectName = $(e.currentTarget).attr('data-userentity-name'); var objectId = $(e.currentTarget).attr('data-userentity-id'); bootbox.confirm({ diff --git a/public/viewjs/userfields.js b/public/viewjs/userfields.js index b9b69b28..5d5c2711 100644 --- a/public/viewjs/userfields.js +++ b/public/viewjs/userfields.js @@ -33,7 +33,7 @@ $("#entity-filter").on("change", function() $(document).on('click', '.userfield-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-userfield-name')); + var objectName = $(e.currentTarget).attr('data-userfield-name'); var objectId = $(e.currentTarget).attr('data-userfield-id'); bootbox.confirm({ diff --git a/public/viewjs/users.js b/public/viewjs/users.js index bc17bf8d..d0d4c675 100644 --- a/public/viewjs/users.js +++ b/public/viewjs/users.js @@ -21,7 +21,7 @@ $("#search").on("keyup", Delay(function() $(document).on('click', '.user-delete-button', function(e) { - var objectName = SanitizeHtml($(e.currentTarget).attr('data-user-username')); + var objectName = $(e.currentTarget).attr('data-user-username'); var objectId = $(e.currentTarget).attr('data-user-id'); bootbox.confirm({ diff --git a/views/shoppinglist.blade.php b/views/shoppinglist.blade.php index ae3e0590..00166e90 100644 --- a/views/shoppinglist.blade.php +++ b/views/shoppinglist.blade.php @@ -121,7 +121,8 @@
@@ -195,7 +196,7 @@ - @if(!empty($listItem->product_id)) {{ FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name }}
@endif{!! nl2br(e($listItem->note)) !!} + @if(!empty($listItem->product_id)) {{ FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name }}
@endif{!! nl2br($listItem->note) !!} {{ $listItem->amount }} @if(!empty($listItem->product_id)){{ $__n($listItem->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name_plural) }}@endif @@ -301,7 +302,7 @@ @foreach($listItems as $listItem) - @if(!empty($listItem->product_id)) {{ FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name }}
@endif{!! nl2br(e($listItem->note)) !!} + @if(!empty($listItem->product_id)) {{ FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->name }}
@endif{!! nl2br($listItem->note) !!} {{ $listItem->amount }} @if(!empty($listItem->product_id)){{ $__n($listItem->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $listItem->product_id)->qu_id_purchase)->name_plural) }}@endif