From 149020f930d327cf40f480efe11779a89399e4ae Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Tue, 18 May 2021 18:20:41 +0200 Subject: [PATCH] fixed shopping list escaping issue --- cookbook/templates/shopping_list.html | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cookbook/templates/shopping_list.html b/cookbook/templates/shopping_list.html index 63c8572d6..246a5369c 100644 --- a/cookbook/templates/shopping_list.html +++ b/cookbook/templates/shopping_list.html @@ -618,7 +618,7 @@ this.addRecipeToList(response.data, servings) }).catch((err) => { console.log("getRecipes error: ", err); - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, loadShoppingList: function (autosync = false) { @@ -648,7 +648,7 @@ } }).catch((err) => { console.log(err) - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) } else { this.shopping_list = { @@ -685,7 +685,7 @@ } }).catch((err) => { console.log(err) - this.makeToast(gettext('Error'), gettext('There was an error updating a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error updating a resource!") + err.bodyText, 'danger') })) } } @@ -696,7 +696,7 @@ if (this.shopping_list.id === undefined) { return this.$http.post("{% url 'api:shoppinglist-list' %}", this.shopping_list, {}).then((response) => { console.log(response) - this.makeToast(gettext('Updated'), gettext('Object created successfully!'), 'success') + this.makeToast(gettext('Updated'), gettext("Object created successfully!"), 'success') this.loading = false this.shopping_list = response.body @@ -705,18 +705,18 @@ window.history.pushState('shopping_list', '{% trans 'Shopping List' %}', "{% url 'view_shopping' 123456 %}".replace('123456', this.shopping_list_id)); }).catch((err) => { console.log(err) - this.makeToast(gettext('Error'), '{% trans 'There was an error creating a resource!' %}' + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error creating a resource!") + err.bodyText, 'danger') this.loading = false }) } else { return this.$http.put("{% url 'api:shoppinglist-detail' 123456 %}".replace('123456', this.shopping_list.id), this.shopping_list, {}).then((response) => { console.log(response) this.shopping_list = response.body - this.makeToast(gettext('Updated'), gettext('Changes saved successfully!'), 'success') + this.makeToast(gettext('Updated'), gettext("Changes saved successfully!"), 'success') this.loading = false }).catch((err) => { console.log(err) - this.makeToast(gettext('Error'), gettext('There was an error updating a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error updating a resource!") + err.bodyText, 'danger') this.loading = false }) } @@ -837,7 +837,7 @@ this.recipes = response.data.results; }).catch((err) => { console.log("getRecipes error: ", err); - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, getRecipeUrl: function (id) { //TODO generic function that can be reused else were @@ -868,7 +868,7 @@ } } }).catch((err) => { - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, removeRecipeFromList: function (slr) { @@ -882,7 +882,7 @@ this.keywords_loading = false }).catch((err) => { console.log(err) - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, @@ -892,7 +892,7 @@ this.units = response.data; this.units_loading = false }).catch((err) => { - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, searchFoods: function (query) { //TODO move to central component @@ -901,7 +901,7 @@ this.foods = response.data this.foods_loading = false }).catch((err) => { - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, addFoodType: function (tag, index) { //TODO move to central component @@ -920,7 +920,7 @@ this.users = response.data this.users_loading = false }).catch((err) => { - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, searchSupermarket: function (query) { //TODO move to central component @@ -929,7 +929,7 @@ this.supermarkets = response.data this.supermarkets_loading = false }).catch((err) => { - this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger') + this.makeToast(gettext('Error'), gettext("There was an error loading a resource!") + err.bodyText, 'danger') }) }, },