diff --git a/cookbook/helper/ingredient_parser.py b/cookbook/helper/ingredient_parser.py index 4987e0b5b..ee4b8d916 100644 --- a/cookbook/helper/ingredient_parser.py +++ b/cookbook/helper/ingredient_parser.py @@ -124,7 +124,7 @@ class IngredientParser: def parse_amount(self, x): amount = 0 - unit = '' + unit = None note = '' did_check_frac = False @@ -155,7 +155,7 @@ class IngredientParser: except ValueError: unit = x[end:] - if unit.startswith('(') or unit.startswith('-'): # i dont know any unit that starts with ( or - so its likely an alternative like 1L (500ml) Water or 2-3 + if unit is not None and (unit.startswith('(') or unit.startswith('-')): # i dont know any unit that starts with ( or - so its likely an alternative like 1L (500ml) Water or 2-3 unit = '' note = x return amount, unit, note @@ -230,7 +230,7 @@ class IngredientParser: # a fraction for the amount if len(tokens) > 2: try: - if not unit == '': + if unit is not None: # a unit is already found, no need to try the second argument for a fraction # probably not the best method to do it, but I didn't want to make an if check and paste the exact same thing in the else as already is in the except # noqa: E501 raise ValueError @@ -252,7 +252,7 @@ class IngredientParser: # try to use second argument as unit and everything else as ingredient, use everything as ingredient if it fails # noqa: E501 try: ingredient, note = self.parse_ingredient(tokens[2:]) - if unit == '': + if unit is None: unit = tokens[1] else: note = tokens[1] diff --git a/cookbook/tests/other/test_ingredient_parser.py b/cookbook/tests/other/test_ingredient_parser.py index 5d61fa87d..d2d6b144a 100644 --- a/cookbook/tests/other/test_ingredient_parser.py +++ b/cookbook/tests/other/test_ingredient_parser.py @@ -10,33 +10,33 @@ def test_ingredient_parser(): "4 l Wasser": (4, "l", "Wasser", ""), "½l Wasser": (0.5, "l", "Wasser", ""), "⅛ Liter Sauerrahm": (0.125, "Liter", "Sauerrahm", ""), - "5 Zwiebeln": (5, "", "Zwiebeln", ""), - "3 Zwiebeln, gehackt": (3, "", "Zwiebeln", "gehackt"), - "5 Zwiebeln (gehackt)": (5, "", "Zwiebeln", "gehackt"), - "1 Zwiebel(n)": (1, "", "Zwiebel(n)", ""), - "4 1/2 Zwiebeln": (4.5, "", "Zwiebeln", ""), - "4 ½ Zwiebeln": (4.5, "", "Zwiebeln", ""), + "5 Zwiebeln": (5, None, "Zwiebeln", ""), + "3 Zwiebeln, gehackt": (3, None, "Zwiebeln", "gehackt"), + "5 Zwiebeln (gehackt)": (5, None, "Zwiebeln", "gehackt"), + "1 Zwiebel(n)": (1, None, "Zwiebel(n)", ""), + "4 1/2 Zwiebeln": (4.5, None, "Zwiebeln", ""), + "4 ½ Zwiebeln": (4.5, None, "Zwiebeln", ""), "1/2 EL Mehl": (0.5, "EL", "Mehl", ""), - "1/2 Zwiebel": (0.5, "", "Zwiebel", ""), + "1/2 Zwiebel": (0.5, None, "Zwiebel", ""), "1/5g Mehl, gesiebt": (0.2, "g", "Mehl", "gesiebt"), - "1/2 Zitrone, ausgepresst": (0.5, "", "Zitrone", "ausgepresst"), - "etwas Mehl": (0, "", "etwas Mehl", ""), - "Öl zum Anbraten": (0, "", "Öl zum Anbraten", ""), - "n. B. Knoblauch, zerdrückt": (0, "", "n. B. Knoblauch", "zerdrückt"), + "1/2 Zitrone, ausgepresst": (0.5, None, "Zitrone", "ausgepresst"), + "etwas Mehl": (0, None, "etwas Mehl", ""), + "Öl zum Anbraten": (0, None, "Öl zum Anbraten", ""), + "n. B. Knoblauch, zerdrückt": (0, None, "n. B. Knoblauch", "zerdrückt"), "Kräuter, mediterrane (Oregano, Rosmarin, Basilikum)": ( - 0, "", "Kräuter, mediterrane", "Oregano, Rosmarin, Basilikum"), + 0, None, "Kräuter, mediterrane", "Oregano, Rosmarin, Basilikum"), "600 g Kürbisfleisch (Hokkaido), geschält, entkernt und geraspelt": ( 600, "g", "Kürbisfleisch (Hokkaido)", "geschält, entkernt und geraspelt"), - "Muskat": (0, "", "Muskat", ""), + "Muskat": (0, None, "Muskat", ""), "200 g Mehl, glattes": (200, "g", "Mehl", "glattes"), - "1 Ei(er)": (1, "", "Ei(er)", ""), + "1 Ei(er)": (1, None, "Ei(er)", ""), "1 Prise(n) Salz": (1, "Prise(n)", "Salz", ""), - "etwas Wasser, lauwarmes": (0, "", "etwas Wasser", "lauwarmes"), - "Strudelblätter, fertige, für zwei Strudel": (0, "", "Strudelblätter", "fertige, für zwei Strudel"), - "barrel-aged Bourbon": (0, "", "barrel-aged Bourbon", ""), - "golden syrup": (0, "", "golden syrup", ""), - "unsalted butter, for greasing": (0, "", "unsalted butter", "for greasing"), - "unsalted butter , for greasing": (0, "", "unsalted butter", "for greasing"), # trim + "etwas Wasser, lauwarmes": (0, None, "etwas Wasser", "lauwarmes"), + "Strudelblätter, fertige, für zwei Strudel": (0,None, "Strudelblätter", "fertige, für zwei Strudel"), + "barrel-aged Bourbon": (0, None, "barrel-aged Bourbon", ""), + "golden syrup": (0, None, "golden syrup", ""), + "unsalted butter, for greasing": (0, None, "unsalted butter", "for greasing"), + "unsalted butter , for greasing": (0, None, "unsalted butter", "for greasing"), # trim "1 small sprig of fresh rosemary": (1, "small", "sprig of fresh rosemary", ""), # does not always work perfectly! "75 g fresh breadcrumbs": (75, "g", "fresh breadcrumbs", ""), @@ -49,7 +49,7 @@ def test_ingredient_parser(): "1 Zwiebel gehackt": (1, "Zwiebel", "gehackt", ""), "1 EL Kokosöl": (1, "EL", "Kokosöl", ""), "0.5 paket jäst (à 50 g)": (0.5, "paket", "jäst", "à 50 g"), - "ägg": (0, "", "ägg", ""), + "ägg": (0, None, "ägg", ""), "50 g smör eller margarin": (50, "g", "smör eller margarin", ""), "3,5 l Wasser": (3.5, "l", "Wasser", ""), "3.5 l Wasser": (3.5, "l", "Wasser", ""), @@ -70,4 +70,4 @@ def test_ingredient_parser(): for key, val in expectations.items(): count += 1 parsed = ingredient_parser.parse(key) - assert val == parsed + assert parsed == val diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 635ee15fa..b07aaf35f 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -594,6 +594,7 @@ class IngredientViewSet(viewsets.ModelViewSet): queryset = Ingredient.objects serializer_class = IngredientSerializer permission_classes = [CustomIsUser] + pagination_class = DefaultPagination def get_serializer_class(self): if self.request and self.request.query_params.get('simple', False): @@ -1193,6 +1194,11 @@ def recipe_from_source(request): 'error': True, 'msg': _('Connection Refused.') }, status=400) + except requests.exceptions.MissingSchema: + return JsonResponse({ + 'error': True, + 'msg': _('Bad URL Schema.') + }, status=400) recipe_json, recipe_tree, recipe_html, recipe_images = get_recipe_from_source(data, url, request) if len(recipe_tree) == 0 and len(recipe_json) == 0: return JsonResponse({ diff --git a/docs/install/other.md b/docs/install/other.md index a060b0574..5687536cb 100644 --- a/docs/install/other.md +++ b/docs/install/other.md @@ -58,3 +58,7 @@ apache: I used two paths `` and `` for simplicity. In my case I have ` = recipes` and ` = serve/recipes`. One could also change the matching rules of traefik to have everything under one path. I left out the TLS config in this example for simplicity. + +## WSL + +If you want to install Tandoor on the Windows Subsystem for Linux you can find a detailed post herre https://github.com/TandoorRecipes/recipes/issues/1733 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 77de8bec4..afcc0902f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django==3.2.12 +Django==3.2.13 cryptography==36.0.2 django-annoying==0.10.6 django-autocomplete-light==3.9.4 diff --git a/vue/src/apps/CookbookView/CookbookView.vue b/vue/src/apps/CookbookView/CookbookView.vue index 90f0c92aa..4592d5678 100644 --- a/vue/src/apps/CookbookView/CookbookView.vue +++ b/vue/src/apps/CookbookView/CookbookView.vue @@ -130,10 +130,10 @@ export default { .then((result) => { let new_book = result.data this.refreshData() - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_CREATE) }) - .catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + .catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_CREATE, err) }) }, appendRecipeFilter: function (page, book) { diff --git a/vue/src/apps/ExportView/ExportView.vue b/vue/src/apps/ExportView/ExportView.vue index 0224850ce..5503eaa13 100644 --- a/vue/src/apps/ExportView/ExportView.vue +++ b/vue/src/apps/ExportView/ExportView.vue @@ -117,8 +117,7 @@ export default { this.recipe_list.push(response.data) }) .catch((err) => { - console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) // .then((e) => this.searchRecipes("")) }, @@ -133,7 +132,7 @@ export default { // }) // .catch((err) => { // console.log(err) - // StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + // StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH) // }) // }, diff --git a/vue/src/apps/ImportView/ImportView.vue b/vue/src/apps/ImportView/ImportView.vue index ef4ba770f..2c143741f 100644 --- a/vue/src/apps/ImportView/ImportView.vue +++ b/vue/src/apps/ImportView/ImportView.vue @@ -17,8 +17,10 @@ - Website - + {{ + $t('Website') + }} + Multiple RecipesSingle Recipe - + - + placeholder="https://..." @paste="onURLPaste"> - + v-if="import_multiple"> Import - + :disabled="website_url_list.length < 1" + @click="autoImport()">{{ $t('Import') }} +
@@ -89,7 +90,7 @@ Options + :disabled="recipe_json === undefined">{{ $t('Options') }} @@ -127,9 +128,11 @@
- Click the image you want to import for this - recipe - No additional images found in source. + {{ $t('click_image_import') }}
+ {{ + $t('no_more_images_found') + }}
- Keywords + {{ $t('Keywords') }} @@ -194,7 +197,7 @@ Import + :disabled="recipe_json === undefined">{{ $t('Import') }} @@ -261,31 +264,94 @@ + +

{{ $t('Select_App_To_Import') }}:

+ + + + + Icon + + {{ i.name }} + + + + + + + + + + + + + Icon + + {{ i.name }} + + + + + + + + + + + {{ $t('Importer_Help') }} {{ $t('Documentation') }} + + - + + {{ $t('import_duplicates') }} + - - {{ $t('import_duplicates') }} - - {{ - $t('Help') - }} - - - - + + +
+ {{ $t('Import') }} + +
+
@@ -332,7 +398,15 @@ import {BootstrapVue} from 'bootstrap-vue' import 'bootstrap-vue/dist/bootstrap-vue.css' -import {resolveDjangoStatic, resolveDjangoUrl, ResolveUrlMixin, StandardToasts, ToastMixin} from "@/utils/utils"; +import { + RandomIconMixin, + resolveDjangoStatic, + resolveDjangoUrl, + ResolveUrlMixin, + StandardToasts, + ToastMixin +} from "@/utils/utils"; + import axios from "axios"; import {ApiApiFactory} from "@/utils/openapi/api"; import {INTEGRATIONS} from "@/utils/integration"; @@ -347,6 +421,7 @@ export default { mixins: [ ResolveUrlMixin, ToastMixin, + RandomIconMixin ], components: { LoadingSpinner, @@ -357,10 +432,21 @@ export default { recipe_app_info: function () { return this.INTEGRATIONS.filter(x => x.id === this.recipe_app)[0] }, + INTEGRATIONS_WO: function () { + return this.INTEGRATIONS.filter((int) => { + return int.id !== "DEFAULT" + }) + + }, + INTEGRATIONS_TD: function () { + return this.INTEGRATIONS.filter((int) => { + return int.id === "DEFAULT" + }) + } }, data() { return { - tab_index: 0, + tab_index: 1, collapse_visible: { url: true, options: false, @@ -391,7 +477,8 @@ export default { empty_input: false, edit_name: false, // Bookmarklet - BOOKMARKLET_CODE: window.BOOKMARKLET_CODE + BOOKMARKLET_CODE: window.BOOKMARKLET_CODE, + error: undefined } }, mounted() { @@ -402,6 +489,9 @@ export default { if (window.BOOKMARKLET_IMPORT_ID !== -1) { this.loadRecipe('', false, window.BOOKMARKLET_IMPORT_ID) } + this.INTEGRATIONS.forEach((int) => { + int.icon = this.getRandomFoodIcon() + }) }, methods: { /** @@ -422,12 +512,12 @@ export default { let recipe = response.data apiFactory.imageRecipe(response.data.id, undefined, recipe_json.image).then(response => { // save recipe image if (!silent) { - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) + StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_CREATE) } this.afterImportAction(action, recipe) }).catch(e => { if (!silent) { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE) } this.afterImportAction(action, recipe) }) @@ -436,13 +526,13 @@ export default { this.failed_imports.push(recipe_json.source_url) } if (!silent) { - StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_CREATE) } }) } else { console.log('cant import recipe without data') if (!silent) { - StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_CREATE) } } }, @@ -543,10 +633,11 @@ export default { } return this.recipe_json }).catch((err) => { + this.loading = false if (url !== '') { this.failed_imports.push(url) } - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH, err.response.data.msg) + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) throw "Load Recipe Error" }) }, @@ -577,15 +668,14 @@ export default { window.location.href = resolveDjangoUrl('view_import_response', response.data['import_id']) }).catch((err) => { console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_CREATE) }) }, /** * Handles pasting URLs */ onURLPaste: function (evt) { - this.website_url = evt.clipboardData.getData('text') - this.loadRecipe(false, undefined) + this.loadRecipe(evt.clipboardData.getData('text'), false, undefined) return true; }, /**loadRecipe(false,undefined) diff --git a/vue/src/apps/IngredientEditorView/IngredientEditorView.vue b/vue/src/apps/IngredientEditorView/IngredientEditorView.vue index b546e8be2..35b1c5ba1 100644 --- a/vue/src/apps/IngredientEditorView/IngredientEditorView.vue +++ b/vue/src/apps/IngredientEditorView/IngredientEditorView.vue @@ -4,24 +4,31 @@
- - + + + + + + + + @finish-action="finishGenericAction"/>
@@ -31,14 +38,20 @@ + + + + @finish-action="finishGenericAction()"/>
+ +
@@ -100,7 +113,7 @@ @click="updateIngredient(i)"> - @@ -113,6 +126,9 @@
+ +
@@ -148,6 +164,9 @@ export default { generic_model: null, show_food_delete: false, show_unit_delete: false, + current_page: 1, + total_object_count: 0, + page_size: 50, } }, computed: {}, @@ -176,22 +195,27 @@ export default { } else { this.loading = true let apiClient = new ApiApiFactory() - let params = {'query': {'simple': 1}} + let params = {'query': {'simple': 1,}} if (this.food !== null) { params.query.food = this.food.id } if (this.unit !== null) { params.query.unit = this.unit.id } - apiClient.listIngredients(params).then(result => { - this.ingredients = result.data + apiClient.listIngredients(this.current_page, this.page_size,params).then(result => { + this.ingredients = result.data.results + this.total_object_count = result.data.count this.loading = false }).catch((err) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) this.loading = false }) } }, + pageChange: function (page) { + this.current_page = page + this.refreshList() + }, updateIngredient: function (i) { let update_list = [] if (i === undefined) { @@ -208,21 +232,79 @@ export default { let apiClient = new ApiApiFactory() apiClient.updateIngredient(i.id, i).then(r => { this.$set(i, 'changed', false) - }).catch((r, e) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + }).catch(err => { + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) }) }) }, - deleteIngredient: function (i){ - if (confirm(this.$t('delete_confirmation', this.$t('Ingredient')))){ + deleteIngredient: function (i) { + if (confirm(this.$t('delete_confirmation', this.$t('Ingredient')))) { let apiClient = new ApiApiFactory() apiClient.destroyIngredient(i.id).then(r => { - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_DELETE) + StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_DELETE) this.ingredients = this.ingredients.filter(li => li.id !== i.id) - }).catch(e => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_DELETE) + }).catch(err => { + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_DELETE, err) }) } + }, + finishGenericAction: function (e) { + if (e !== 'cancel') { + if (this.generic_action === this.Actions.DELETE) { + this.ingredients = [] + if (this.generic_model === this.Models.FOOD) { + this.food = null; + } else { + this.unit = null; + } + } + + if (this.generic_action === this.Actions.UPDATE) { + if (this.generic_model === this.Models.FOOD) { + this.food = e.item + this.ingredients.forEach((element, i) => { + if (element.food.id === this.food.id) { + this.ingredients[i].food = this.food + } + }) + } else { + this.unit = e.item + this.ingredients.forEach((element, i) => { + if (element.unit?.id === this.unit.id) { + this.ingredients[i].unit = this.unit + } + }) + } + } + + if (this.generic_action === this.Actions.MERGE) { + if (this.generic_model === this.Models.FOOD) { + this.ingredients.forEach((element, i) => { + if (element.food.id === this.food.id) { + this.ingredients[i].food = e.target_object + } + }) + this.food = e.target_object + } else { + this.ingredients.forEach((element, i) => { + if (element.unit?.id === this.unit.id) { + this.ingredients[i].unit = e.target_object + } + }) + this.unit = e.target_object + } + this.refreshList() + } + } + + if (this.generic_model === this.Models.FOOD) { + this.$refs.food_multiselect.search(''); + } else { + this.$refs.unit_multiselect.search(''); + } + + this.generic_action = null; + this.generic_model = null; } }, diff --git a/vue/src/apps/MealPlanView/MealPlanView.vue b/vue/src/apps/MealPlanView/MealPlanView.vue index 9b0d59b8b..a7131729f 100644 --- a/vue/src/apps/MealPlanView/MealPlanView.vue +++ b/vue/src/apps/MealPlanView/MealPlanView.vue @@ -2,7 +2,7 @@
-
+
{ this.periodChangedCallback(this.current_period) }) - .catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + .catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) this.refreshMealTypes() @@ -473,8 +473,8 @@ export default { updated++ } }) - .catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + .catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) }) }, @@ -488,10 +488,10 @@ export default { .updateMealType(this.meal_types[index].id, this.meal_types[index]) .then((e) => { this.periodChangedCallback(this.current_period) - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_UPDATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_UPDATE) }) - .catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + .catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) } else { this.$set(this.meal_types[index], "editing", true) @@ -504,10 +504,10 @@ export default { .destroyMealType(this.meal_types[index].id) .then((e) => { this.periodChangedCallback(this.current_period) - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_DELETE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_DELETE) }) - .catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_DELETE) + .catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_DELETE, err) }) }, updateEmoji: function (field, value) { @@ -582,8 +582,8 @@ export default { .then((e) => { list.splice(index, 1) }) - .catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + .catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) } }) @@ -634,8 +634,8 @@ export default { let apiClient = new ApiApiFactory() - apiClient.updateMealPlan(entry.id, entry).catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + apiClient.updateMealPlan(entry.id, entry).catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) }, createEntry(entry) { @@ -645,8 +645,8 @@ export default { apiClient .createMealPlan(entry) - .catch((error) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + .catch((err) => { + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) .then((entry_result) => { this.plan_entries.push(entry_result.data) @@ -693,19 +693,24 @@ export default { opacity: 0; } +.calender-row { + height: calc(100% - 240px); +} + .calender-parent { display: flex; flex-direction: column; flex-grow: 1; overflow-x: hidden; overflow-y: hidden; - height: 70vh; + height: 100% } .cv-item { white-space: inherit !important; } + .isHovered { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; } @@ -837,4 +842,10 @@ having to override as much. opacity: 0.5; background: #c8ebfb; } + +@media (max-width: 767.9px) { + .periodLabel { + font-size: 18px !important; + } +} diff --git a/vue/src/apps/ModelListView/ModelListView.vue b/vue/src/apps/ModelListView/ModelListView.vue index 09d523443..c81440774 100644 --- a/vue/src/apps/ModelListView/ModelListView.vue +++ b/vue/src/apps/ModelListView/ModelListView.vue @@ -275,8 +275,7 @@ export default { } }) .catch((err) => { - console.log(err, Object.keys(err)) - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, getThis: function (id, callback) { @@ -292,21 +291,19 @@ export default { this.items_left = [result.data].concat(this.destroyCard(result?.data?.id, this.items_left)) // this creates a deep copy to make sure that columns stay independent this.items_right = [{...result.data}].concat(this.destroyCard(result?.data?.id, this.items_right)) - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_CREATE) }) .catch((err) => { - console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_CREATE, err) }) } else { this.genericAPI(this.this_model, this.Actions.UPDATE, item) .then((result) => { this.refreshThis(item.id) - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_UPDATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_UPDATE) }) .catch((err) => { - console.log(err, err.response) - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) } }, @@ -315,7 +312,7 @@ export default { let api = new ApiApiFactory() food.shopping = true api.createShoppingListEntry({food: food, amount: 1}).then(() => { - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_CREATE) this.refreshCard(food, this.items_left) this.refreshCard({...food}, this.items_right) }) @@ -339,7 +336,7 @@ export default { this.genericAPI(this.this_model, this.Actions.MOVE, {source: source_id, target: target_id}) .then((result) => { this.moveUpdateItem(source_id, target_id) - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_MOVE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_MOVE) }) .catch((err) => { console.log(err) @@ -378,7 +375,7 @@ export default { }) .then((result) => { this.mergeUpdateItem(source_id, target_id) - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_MERGE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_MERGE) }) .catch((err) => { //TODO error checking not working with OpenAPI methods @@ -432,7 +429,7 @@ export default { }) .catch((err) => { console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, getRecipes: function (col, item) { diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 038507708..3297f077c 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -821,8 +821,7 @@ export default { }) .catch((err) => { this.loading = false - console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, updateRecipe: function (view_after) { @@ -850,7 +849,7 @@ export default { apiFactory .updateRecipe(this.recipe_id, this.recipe, {}) .then((response) => { - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_UPDATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_UPDATE) this.recipe_changed = false if (this.create_food) { apiFactory.createFood({ @@ -863,8 +862,7 @@ export default { } }) .catch((err) => { - console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) }, uploadImage: function (file) { @@ -875,11 +873,10 @@ export default { .then((request) => { this.recipe.image = request.data.image this.recipe_changed = false - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_UPDATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_UPDATE) }) .catch((err) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) - console.log(err.request, err.response) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_UPDATE, err) }) } }, @@ -891,11 +888,10 @@ export default { .then((request) => { this.recipe.image = null this.recipe_changed = false - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_DELETE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_DELETE) }) .catch((err) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_DELETE) - console.log(err.request, err.response) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_DELETE, err) }) } }, @@ -990,8 +986,7 @@ export default { this.keywords_loading = false }) .catch((err) => { - console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, searchFiles: function (query) { @@ -1005,8 +1000,7 @@ export default { this.files_loading = false }) .catch((err) => { - console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, searchRecipes: function (query) { @@ -1017,8 +1011,7 @@ export default { this.recipes_loading = false }) .catch((err) => { - console.log(err) - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, searchUnits: function (query) { @@ -1042,7 +1035,7 @@ export default { this.units_loading = false }) .catch((err) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, searchFoods: function (query) { @@ -1067,7 +1060,7 @@ export default { this.foods_loading = false }) .catch((err) => { - StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_FETCH, err) }) }, fileCreated: function (data) { diff --git a/vue/src/apps/RecipeSearchView/RecipeSearchView.vue b/vue/src/apps/RecipeSearchView/RecipeSearchView.vue index c8f4eb01a..831e01610 100644 --- a/vue/src/apps/RecipeSearchView/RecipeSearchView.vue +++ b/vue/src/apps/RecipeSearchView/RecipeSearchView.vue @@ -1496,11 +1496,10 @@ export default { this.genericAPI(this.Models.CUSTOM_FILTER, this.Actions.CREATE, params) .then((result) => { this.search.search_filter = result.data - StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) + StandardToasts.makeStandardToast(this,StandardToasts.SUCCESS_CREATE) }) .catch((err) => { - console.log(err, Object.keys(err)) - StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + StandardToasts.makeStandardToast(this,StandardToasts.FAIL_CREATE, err) }) }, addField: function (field, count) { diff --git a/vue/src/apps/RecipeView/RecipeView.vue b/vue/src/apps/RecipeView/RecipeView.vue index 3250edd9c..bab762da5 100644 --- a/vue/src/apps/RecipeView/RecipeView.vue +++ b/vue/src/apps/RecipeView/RecipeView.vue @@ -233,7 +233,7 @@ export default { this.loadRecipe(window.RECIPE_ID) this.$i18n.locale = window.CUSTOM_LOCALE this.requestWakeLock() - window.addEventListener('resize', this.handleRezise); + window.addEventListener('resize', this.handleResize); }, beforeUnmount() { this.destroyWakeLock() @@ -249,7 +249,7 @@ export default { } } }, - handleRezise: function () { + handleResize: function () { if (document.getElementById('nutrition_container') !== null) { this.ingredient_height = document.getElementById('ingredient_container').clientHeight - document.getElementById('nutrition_container').clientHeight } else { @@ -300,7 +300,7 @@ export default { this.loading = false setTimeout(() => { - this.handleRezise() + this.handleResize() }, 100) }) }, diff --git a/vue/src/apps/ShoppingListView/ShoppingListView.vue b/vue/src/apps/ShoppingListView/ShoppingListView.vue index 12919e80f..cb4720191 100644 --- a/vue/src/apps/ShoppingListView/ShoppingListView.vue +++ b/vue/src/apps/ShoppingListView/ShoppingListView.vue @@ -1,103 +1,124 @@ + + + + + + {{ $t("Create") }} + + + + - - - -
-
-
- {{ s.name }} - + + +
+
+
+ {{ s.name }} + - - - - - -
-
+ > + + + + + +
+
+
+
+ + + +
+
+
- - - - - - - -
-
- - + + + + + {{ $t("Create") }} + + + + - {{ $t("CategoryInstruction") }} - - - - - -
-
- -
-
-
- {{ categoryName(c) }} - - - -
-
-
-
-
-
-
-
- - - - - -
-
- -
-
-
- {{ categoryName(c) }} - - - -
-
-
-
-
-
-
-
+ + {{ $t("CategoryInstruction") }} + + + + + + +
+
+ +
+
+
+ {{ categoryName(c) }} + + + +
+
+
+
+
+
+
+
+ + + + + +
+
+ +
+
+
+ {{ categoryName(c) }} + + + +
+
+
+
+
+
+
+
+
+
+
+
+
- + +
{{ $t("mealplan_autoadd_shopping") }}
- +
@@ -403,7 +517,8 @@
{{ $t("mealplan_autoexclude_onhand") }}
- +
@@ -416,7 +531,8 @@
{{ $t("mealplan_autoinclude_related") }}
- +
@@ -453,7 +569,8 @@
{{ $t("shopping_auto_sync") }}
- +
@@ -466,7 +583,8 @@
{{ $t("shopping_add_onhand") }}
- +
@@ -479,7 +597,8 @@
{{ $t("shopping_recent_days") }}
- +
@@ -492,7 +611,8 @@
{{ $t("filter_to_supermarket") }}
- +
@@ -505,7 +625,8 @@
{{ $t("default_delay") }}
- +
@@ -518,7 +639,7 @@
{{ $t("csv_delim_label") }}
- +
@@ -531,7 +652,7 @@
{{ $t("csv_prefix_label") }}
- +
@@ -544,7 +665,8 @@
{{ $t("left_handed") }}
- +
@@ -561,20 +683,25 @@ -
+
- - - - - + + + + +
@@ -585,23 +712,32 @@ - + - + - + - +
- {{ $t("Reset") }} - {{ $t("Close") }} + {{ + $t("Reset") + }} + + + {{ $t("Close") }} +
@@ -610,7 +746,8 @@ - {{ $t("DelayFor", { hours: delay }) }} + + {{ $t("DelayFor", {hours: delay}) }} - {{ $t("Delete") }} + {{ + $t("Delete") + }} - +