From 4fbf080e2f6abc19a6be72def07588429033c891 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 13 Sep 2021 12:39:29 +0200 Subject: [PATCH 1/6] basics --- .../templates/edit_internal_recipe_v2.html | 38 +++++++++ cookbook/views/edit.py | 2 +- .../apps/RecipeEditView/RecipeEditView.vue | 48 +++++++++++ vue/src/apps/RecipeEditView/main.js | 10 +++ vue/vue.config.js | 4 + vue/webpack-stats.json | 85 +++++++++++-------- 6 files changed, 149 insertions(+), 38 deletions(-) create mode 100644 cookbook/templates/edit_internal_recipe_v2.html create mode 100644 vue/src/apps/RecipeEditView/RecipeEditView.vue create mode 100644 vue/src/apps/RecipeEditView/main.js diff --git a/cookbook/templates/edit_internal_recipe_v2.html b/cookbook/templates/edit_internal_recipe_v2.html new file mode 100644 index 000000000..564b96e8a --- /dev/null +++ b/cookbook/templates/edit_internal_recipe_v2.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} +{% load render_bundle from webpack_loader %} +{% load static %} +{% load i18n %} +{% load l10n %} + +{% block title %}{% trans 'Edit Recipe' %}{% endblock %} + +{% block extra_head %} + +{% endblock %} + +{% block content %} + +
+ +
+ + +{% endblock %} + + +{% block script %} + {% if debug %} + + {% else %} + + {% endif %} + + + + {% render_bundle 'edit_internal_recipe' %} +{% endblock %} \ No newline at end of file diff --git a/cookbook/views/edit.py b/cookbook/views/edit.py index 767c18eaf..c0785d386 100644 --- a/cookbook/views/edit.py +++ b/cookbook/views/edit.py @@ -57,7 +57,7 @@ def internal_recipe_update(request, pk): recipe_instance = get_object_or_404(Recipe, pk=pk, space=request.space) return render( - request, 'forms/edit_internal_recipe.html', {'recipe': recipe_instance} + request, 'edit_internal_recipe_v2.html', {'recipe': recipe_instance} ) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue new file mode 100644 index 000000000..47b62002f --- /dev/null +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -0,0 +1,48 @@ + + + + + + + diff --git a/vue/src/apps/RecipeEditView/main.js b/vue/src/apps/RecipeEditView/main.js new file mode 100644 index 000000000..c07b4ee6a --- /dev/null +++ b/vue/src/apps/RecipeEditView/main.js @@ -0,0 +1,10 @@ +import Vue from 'vue' +import App from './RecipeEditView' +import i18n from '@/i18n' + +Vue.config.productionTip = false + +new Vue({ + i18n, + render: h => h(App), +}).$mount('#app') diff --git a/vue/vue.config.js b/vue/vue.config.js index dd90c6855..70ec49183 100644 --- a/vue/vue.config.js +++ b/vue/vue.config.js @@ -29,6 +29,10 @@ const pages = { entry: './src/apps/ModelListView/main.js', chunks: ['chunk-vendors'] }, + 'edit_internal_recipe': { + entry: './src/apps/RecipeEditView/main.js', + chunks: ['chunk-vendors'] + }, } module.exports = { diff --git a/vue/webpack-stats.json b/vue/webpack-stats.json index 6012bb6a7..e9d414942 100644 --- a/vue/webpack-stats.json +++ b/vue/webpack-stats.json @@ -1,119 +1,130 @@ { "status": "done", "assets": { - "../../templates/sw.js": { - "name": "../../templates/sw.js", - "path": "../../templates/sw.js" - }, - "css/chunk-vendors.css": { - "name": "css/chunk-vendors.css", - "path": "css/chunk-vendors.css" - }, "js/chunk-vendors.js": { "name": "js/chunk-vendors.js", - "path": "js/chunk-vendors.js" + "path": "js\\chunk-vendors.js", + "publicPath": "http://localhost:8080/js/chunk-vendors.js" + }, + "js/edit_internal_recipe.js": { + "name": "js/edit_internal_recipe.js", + "path": "js\\edit_internal_recipe.js", + "publicPath": "http://localhost:8080/js/edit_internal_recipe.js" }, "js/import_response_view.js": { "name": "js/import_response_view.js", - "path": "js/import_response_view.js" - }, - "css/model_list_view.css": { - "name": "css/model_list_view.css", - "path": "css/model_list_view.css" + "path": "js\\import_response_view.js", + "publicPath": "http://localhost:8080/js/import_response_view.js" }, "js/model_list_view.js": { "name": "js/model_list_view.js", - "path": "js/model_list_view.js" + "path": "js\\model_list_view.js", + "publicPath": "http://localhost:8080/js/model_list_view.js" }, "js/offline_view.js": { "name": "js/offline_view.js", - "path": "js/offline_view.js" + "path": "js\\offline_view.js", + "publicPath": "http://localhost:8080/js/offline_view.js" }, "js/recipe_search_view.js": { "name": "js/recipe_search_view.js", - "path": "js/recipe_search_view.js" + "path": "js\\recipe_search_view.js", + "publicPath": "http://localhost:8080/js/recipe_search_view.js" }, "js/recipe_view.js": { "name": "js/recipe_view.js", - "path": "js/recipe_view.js" + "path": "js\\recipe_view.js", + "publicPath": "http://localhost:8080/js/recipe_view.js" }, "js/supermarket_view.js": { "name": "js/supermarket_view.js", - "path": "js/supermarket_view.js" + "path": "js\\supermarket_view.js", + "publicPath": "http://localhost:8080/js/supermarket_view.js" }, "js/user_file_view.js": { "name": "js/user_file_view.js", - "path": "js/user_file_view.js" + "path": "js\\user_file_view.js", + "publicPath": "http://localhost:8080/js/user_file_view.js" }, "recipe_search_view.html": { "name": "recipe_search_view.html", - "path": "recipe_search_view.html" + "path": "recipe_search_view.html", + "publicPath": "http://localhost:8080/recipe_search_view.html" }, "recipe_view.html": { "name": "recipe_view.html", - "path": "recipe_view.html" + "path": "recipe_view.html", + "publicPath": "http://localhost:8080/recipe_view.html" }, "offline_view.html": { "name": "offline_view.html", - "path": "offline_view.html" + "path": "offline_view.html", + "publicPath": "http://localhost:8080/offline_view.html" }, "import_response_view.html": { "name": "import_response_view.html", - "path": "import_response_view.html" + "path": "import_response_view.html", + "publicPath": "http://localhost:8080/import_response_view.html" }, "supermarket_view.html": { "name": "supermarket_view.html", - "path": "supermarket_view.html" + "path": "supermarket_view.html", + "publicPath": "http://localhost:8080/supermarket_view.html" }, "user_file_view.html": { "name": "user_file_view.html", - "path": "user_file_view.html" + "path": "user_file_view.html", + "publicPath": "http://localhost:8080/user_file_view.html" }, "model_list_view.html": { "name": "model_list_view.html", - "path": "model_list_view.html" + "path": "model_list_view.html", + "publicPath": "http://localhost:8080/model_list_view.html" + }, + "edit_internal_recipe.html": { + "name": "edit_internal_recipe.html", + "path": "edit_internal_recipe.html", + "publicPath": "http://localhost:8080/edit_internal_recipe.html" }, "manifest.json": { "name": "manifest.json", - "path": "manifest.json" + "path": "manifest.json", + "publicPath": "http://localhost:8080/manifest.json" } }, "chunks": { "recipe_search_view": [ - "css/chunk-vendors.css", "js/chunk-vendors.js", "js/recipe_search_view.js" ], "recipe_view": [ - "css/chunk-vendors.css", "js/chunk-vendors.js", "js/recipe_view.js" ], "offline_view": [ - "css/chunk-vendors.css", "js/chunk-vendors.js", "js/offline_view.js" ], "import_response_view": [ - "css/chunk-vendors.css", "js/chunk-vendors.js", "js/import_response_view.js" ], "supermarket_view": [ - "css/chunk-vendors.css", "js/chunk-vendors.js", "js/supermarket_view.js" ], "user_file_view": [ - "css/chunk-vendors.css", "js/chunk-vendors.js", "js/user_file_view.js" ], "model_list_view": [ - "css/chunk-vendors.css", "js/chunk-vendors.js", - "css/model_list_view.css", "js/model_list_view.js" + ], + "edit_internal_recipe": [ + "js/chunk-vendors.js", + "js/edit_internal_recipe.js" ] - } + }, + "publicPath": "http://localhost:8080/" } \ No newline at end of file From b86c9d295a34adf74d53548b2a85210c6c9626a6 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 13 Sep 2021 14:06:19 +0200 Subject: [PATCH 2/6] basic errors fixed --- .../templates/edit_internal_recipe_v2.html | 4 +- .../apps/RecipeEditView/RecipeEditView.vue | 722 +++++++++++++++++- vue/src/locales/en.json | 21 +- 3 files changed, 736 insertions(+), 11 deletions(-) diff --git a/cookbook/templates/edit_internal_recipe_v2.html b/cookbook/templates/edit_internal_recipe_v2.html index 564b96e8a..92f5f6796 100644 --- a/cookbook/templates/edit_internal_recipe_v2.html +++ b/cookbook/templates/edit_internal_recipe_v2.html @@ -12,7 +12,7 @@ {% block content %} -
+
@@ -30,7 +30,7 @@ diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 47b62002f..00dfda207 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -1,5 +1,426 @@ @@ -10,31 +431,316 @@ import {BootstrapVue} from 'bootstrap-vue' import 'bootstrap-vue/dist/bootstrap-vue.css' -import {ResolveUrlMixin} from "@/utils/utils"; +import {resolveDjangoUrl, ResolveUrlMixin, StandardToasts} from "@/utils/utils"; +import Multiselect from "vue-multiselect"; +import {ApiApiFactory} from "@/utils/openapi/api"; +import LoadingSpinner from "@/components/LoadingSpinner"; Vue.use(BootstrapVue) export default { name: 'RecipeSearchView', mixins: [ResolveUrlMixin], - components: {}, + components: {Multiselect, LoadingSpinner}, data() { return { - + recipe_id: window.RECIPE_ID, + recipe: undefined, + recipe_changed: undefined, + keywords: [], + keywords_loading: false, + foods: [], + foods_loading: false, + units: [], + units_loading: false, + files: [], + files_loading: false, + recipes: [], + recipes_loading: false, + message: '', } }, - computed: { - - }, + computed: {}, mounted() { + this.loadRecipe() + this.searchUnits('') + this.searchFoods('') + this.searchKeywords('') + this.searchFiles('') + this.searchRecipes('') + + + //TODO find out what this did and fix it + // this._keyListener = function (e) { + // if (e.code === "Space" && e.ctrlKey) { + // e.preventDefault(); // present "Save Page" from getting triggered. + // + // for (el of e.path) { + // if (el.id !== undefined && el.id.includes('id_card_step_')) { + // let step = this.recipe.steps[el.id.replace('id_card_step_', '')] + // this.addIngredient(step) + // } + // } + // } + // }; + // document.addEventListener('keydown', this._keyListener.bind(this)); + this.$i18n.locale = window.CUSTOM_LOCALE }, + created() { + window.addEventListener('beforeunload', this.warnPageLeave) + }, + beforeUnmount() { + document.removeEventListener('keydown', this._keyListener); + }, watch: { - + recipe: { + deep: true, + handler() { + this.recipe_changed = this.recipe_changed !== undefined; + } + } }, methods: { + warnPageLeave: function (event) { + if (this.recipe_changed) { + event.returnValue = '' + return '' + } + }, + loadRecipe: function () { + let apiFactory = new ApiApiFactory() + + apiFactory.retrieveRecipe(this.recipe_id).then(response => { + this.recipe = response.data; + this.loading = false + + + //TODO workaround function until view is properly refactored, loads name of selected sub recipe so the input can find its label + this.recipe.steps.forEach(s => { + if (s.step_recipe != null) { + this.recipes.push(s.step_recipe_data) + } + }) + console.log('after step loop') + }).catch((err) => { + this.loading = false + console.log(err) + StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + }) + }, + updateRecipe: function (view_after) { + let apiFactory = new ApiApiFactory() + + this.sortSteps() + for (let s of this.recipe.steps) { + this.sortIngredients(s) + + } + apiFactory.updateRecipe(this.recipe_id, this.recipe, + {}).then((response) => { + console.log(response) + StandardToasts.makeStandardToast(StandardToasts.SUCCESS_UPDATE) + this.recipe_changed = false + if (view_after) { + location.href = resolveDjangoUrl('view_recipe', this.recipe_id) + } + }).catch((err) => { + console.log(err) + StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + }) + }, + imageChanged: function (event) { + let apiFactory = new ApiApiFactory() + + if (event.target.files && event.target.files[0]) { + let fd = new FormData() + fd.append('image', event.target.files[0]) + apiFactory.imageRecipe("{% url 'api:recipe-detail' recipe.pk %}" + 'image/', fd, {headers: {'Content-Type': 'multipart/form-data'}}).then((response) => { + + console.log(response) + StandardToasts.makeStandardToast(StandardToasts.SUCCESS_UPDATE) + }).catch((err) => { + console.log(err) + StandardToasts.makeStandardToast(StandardToasts.FAIL_UPDATE) + }) + + let reader = new FileReader(); + reader.onload = function (e) { + //TODO load new image to view + } + reader.readAsDataURL(event.target.files[0]); + } + }, + addStep: function () { //TODO see if default can be generated from options request + this.recipe.steps.push( + {'instruction': '', ingredients: [], type: 'TEXT', show_as_header: true} + ) + }, + sortSteps: function () { + this.recipe.steps.forEach(function (element, index) { + element.order = index + }); + }, + sortIngredients: function (step) { + step.ingredients.forEach(function (element, index) { + element.order = index + }); + }, + addIngredient: function (step) { //TODO see if default can be generated from options request + step.ingredients.push({ + 'food': null, + 'unit': { + 'name': '{{request.user.userpreference.default_unit}}' + }, + 'amount': 0, + 'note': '', + 'order': 0, + 'is_header': false, + 'no_amount': false + }) + this.sortIngredients(step) + this.$nextTick(() => document.getElementById(`amount_${this.recipe.steps.indexOf(step)}_${step.ingredients.length - 1}`).focus()) + + }, + removeIngredient: function (step, ingredient) { + if (confirm(this.$t('confirm_delete', {object: this.$t('Ingredient')}))) { + step.ingredients = step.ingredients.filter(item => item !== ingredient) + } + }, + removeStep: function (step) { + if (confirm(this.$t('confirm_delete', {object: this.$t('Step')}))) { + this.recipe.steps = this.recipe.steps.filter(item => item !== step) + } + }, + moveStep: function (step, new_index) { + this.recipe.steps.splice(this.recipe.steps.indexOf(step), 1); + this.recipe.steps.splice((new_index < 0 ? 0 : new_index), 0, step); + this.sortSteps() + }, + addFoodType: function (tag, index) { + let [tmp, step, id] = index.split('_') + + let new_food = this.recipe.steps[step].ingredients[id] + new_food.food = {'name': tag} + this.foods.push(new_food.food) + this.recipe.steps[step].ingredients[id] = new_food + }, + addUnitType: function (tag, index) { + let [tmp, step, id] = index.split('_') + + let new_unit = this.recipe.steps[step].ingredients[id] + new_unit.unit = {'name': tag} + this.units.push(new_unit.unit) + this.recipe.steps[step].ingredients[id] = new_unit + }, + addKeyword: function (tag) { + let new_keyword = {'label': tag, 'name': tag} + this.recipe.keywords.push(new_keyword) + }, + searchKeywords: function (query) { + let apiFactory = new ApiApiFactory() + + this.keywords_loading = true + apiFactory.listKeywords({query: {query: query}}).then((response) => { + this.keywords = response.data.results; + this.keywords_loading = false + }).catch((err) => { + console.log(err) + StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + }) + }, + searchFiles: function (query) { + let apiFactory = new ApiApiFactory() + + this.files_loading = true + apiFactory.listUserFiles({query: {query: query}}).then((response) => { + this.files = response.data + this.files_loading = false + }).catch((err) => { + console.log(err) + StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + }) + }, + searchRecipes: function (query) { + let apiFactory = new ApiApiFactory() + + this.recipes_loading = true + apiFactory.listRecipes({query: {query: query}}).then((response) => { + this.recipes = response.data.results + this.recipes_loading = false + }).catch((err) => { + console.log(err) + StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + }) + }, + searchUnits: function (query) { + let apiFactory = new ApiApiFactory() + + this.units_loading = true + apiFactory.listUnits({query: {query: query}}).then((response) => { + this.units = response.data.results; + + if (this.recipe !== undefined) { + for (let s of this.recipe.steps) { + for (let i of s.ingredients) { + if (i.unit !== null && i.unit.id === undefined) { + this.units.push(i.unit) + } + } + } + } + this.units_loading = false + }).catch((err) => { + StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + }) + }, + searchFoods: function (query) { + let apiFactory = new ApiApiFactory() + + this.foods_loading = true + apiFactory.listFoods({query: {query: query}}).then((response) => { + this.foods = response.data.results + + if (this.recipe !== undefined) { + for (let s of this.recipe.steps) { + for (let i of s.ingredients) { + if (i.food !== null && i.food.id === undefined) { + this.foods.push(i.food) + } + } + } + } + + this.foods_loading = false + }).catch((err) => { + StandardToasts.makeStandardToast(StandardToasts.FAIL_FETCH) + }) + }, + scrollToStep: function (step_index) { + document.getElementById('id_step_' + step_index).scrollIntoView({behavior: 'smooth'}); + }, + addNutrition: function () { + this.recipe.nutrition = {} + }, + removeNutrition: function () { + this.recipe.nutrition = null + }, + copyTemplateReference: function (index, ingredient) { + const el = document.createElement('textarea'); + + let tag = `\u007B\u007B ingredients[${index}] \u007D\u007D`; + if (ingredient.food !== null) { + tag += `\u007B# ${ingredient.food.name} #\u007D` + } + el.value = tag + document.body.appendChild(el); + el.select(); + document.execCommand('copy'); + document.body.removeChild(el); + } } } diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 896baa240..b463b12b2 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -7,6 +7,8 @@ "success_creating_resource": "Successfully created a resource!", "success_updating_resource": "Successfully updated a resource!", "success_deleting_resource": "Successfully deleted a resource!", + "step_time_minutes": "Step time in minutes", + "confirm_delete": "Are you sure you want to delete this {object}?", "import_running": "Import running, please wait!", "all_fields_optional": "All fields are optional and can be left empty.", @@ -21,6 +23,10 @@ "Step_start_time": "Step start time", "Sort_by_new": "Sort by new", "Recipes_per_page": "Recipes per Page", + "Show_as_header": "Show as header", + "Hide_as_header": "Hide as header", + "Copy_template_reference": "Copy template reference", + "Save_and_View": "Save & View", "Manage_Books": "Manage Books", "Meal_Plan": "Meal Plan", @@ -41,6 +47,15 @@ "Merge_Keyword": "Merge Keyword", "Hide_Keywords": "Hide Keywords", "Hide_Recipes": "Hide Recipes", + "Move_Up": "Move up", + "Move_Down": "Move down", + "Step_Name": "Step Name", + "Step_Type": "Step Type", + "Make_Header": "Make_Header", + "Make_Ingredient": "Make_Ingredient", + "Enable_Amount": "Enable Amount", + "Disable_Amount": "Disable Amount", + "Add_Step": "Add_Step", "Keywords": "Keywords", "Books": "Books", @@ -59,6 +74,7 @@ "Link": "Link", "Add": "Add", "New": "New", + "Note": "Note", "Success": "Success", "Failure": "Failure", "Ingredients": "Ingredients", @@ -131,5 +147,8 @@ "Create_New_Keyword": "Add New Keyword", "Create_New_Unit": "Add New Unit", "and_up": "& Up", - "Unrated": "Unrated" + "Instructions": "Instructions", + "Unrated": "Unrated", + "Time": "Time", + "Text": "Text" } From b9ff4387ad884abc5fccf906136db6a9b5cb8e3e Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 13 Sep 2021 14:26:54 +0200 Subject: [PATCH 3/6] first rendering version --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 00dfda207..ceb2f740d 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -101,14 +101,14 @@ -
+

- - + + @@ -238,7 +238,7 @@ -

@@ -390,6 +390,8 @@

+ +
From f009e105ecbfa0516a1cf9b152e1ac9b1a7b8cca Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 13 Sep 2021 15:21:15 +0200 Subject: [PATCH 4/6] recipe search fixed --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index ceb2f740d..254057f96 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -413,7 +413,7 @@ - {{ $t('View') }} {{ $t('Delete') }} @@ -433,7 +433,7 @@ import {BootstrapVue} from 'bootstrap-vue' import 'bootstrap-vue/dist/bootstrap-vue.css' -import {resolveDjangoUrl, ResolveUrlMixin, StandardToasts} from "@/utils/utils"; +import {ApiMixin, resolveDjangoUrl, ResolveUrlMixin, StandardToasts} from "@/utils/utils"; import Multiselect from "vue-multiselect"; import {ApiApiFactory} from "@/utils/openapi/api"; import LoadingSpinner from "@/components/LoadingSpinner"; @@ -442,7 +442,7 @@ Vue.use(BootstrapVue) export default { name: 'RecipeSearchView', - mixins: [ResolveUrlMixin], + mixins: [ResolveUrlMixin, ApiMixin], components: {Multiselect, LoadingSpinner}, data() { return { @@ -646,7 +646,7 @@ export default { let apiFactory = new ApiApiFactory() this.keywords_loading = true - apiFactory.listKeywords({query: {query: query}}).then((response) => { + apiFactory.listKeywords( query).then((response) => { this.keywords = response.data.results; this.keywords_loading = false }).catch((err) => { @@ -667,11 +667,9 @@ export default { }) }, searchRecipes: function (query) { - let apiFactory = new ApiApiFactory() - this.recipes_loading = true - apiFactory.listRecipes({query: {query: query}}).then((response) => { - this.recipes = response.data.results + this.genericAPI(this.Models.RECIPE, this.Actions.LIST, {query:query}).then(result => { + this.recipes = result.data.results this.recipes_loading = false }).catch((err) => { console.log(err) @@ -682,7 +680,7 @@ export default { let apiFactory = new ApiApiFactory() this.units_loading = true - apiFactory.listUnits({query: {query: query}}).then((response) => { + apiFactory.listUnits(query).then((response) => { this.units = response.data.results; if (this.recipe !== undefined) { @@ -703,7 +701,7 @@ export default { let apiFactory = new ApiApiFactory() this.foods_loading = true - apiFactory.listFoods({query: {query: query}}).then((response) => { + apiFactory.listFoods( query).then((response) => { this.foods = response.data.results if (this.recipe !== undefined) { From b75254130210ec13274bae83d239c1d22370fd67 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 13 Sep 2021 17:25:39 +0200 Subject: [PATCH 5/6] added markdown editor for instructions --- vue/package.json | 2 + .../apps/RecipeEditView/RecipeEditView.vue | 95 ++++++++++++------- 2 files changed, 65 insertions(+), 32 deletions(-) diff --git a/vue/package.json b/vue/package.json index bd983e93a..1ee1ba174 100644 --- a/vue/package.json +++ b/vue/package.json @@ -9,6 +9,7 @@ }, "dependencies": { "@babel/eslint-parser": "^7.13.14", + "@kangc/v-md-editor": "^1.7.7", "@kevinfaguiar/vue-twemoji-picker": "^5.7.4", "@riophae/vue-treeselect": "^0.4.0", "axios": "^0.21.1", @@ -16,6 +17,7 @@ "core-js": "^3.14.0", "lodash": "^4.17.21", "moment": "^2.29.1", + "prismjs": "^1.24.1", "vue": "^2.6.14", "vue-class-component": "^7.2.3", "vue-clickaway": "^2.2.2", diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 254057f96..1b681d4c9 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -66,32 +66,47 @@
+