From 7e6b1d3638544c03e9202ddc7ab868a1927c0a68 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 1 Oct 2022 19:25:18 +0200 Subject: [PATCH 1/2] added move and copy buttons to ingredient --- .../apps/RecipeEditView/RecipeEditView.vue | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 6313710f..389d9237 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -576,6 +576,21 @@ {{ $t("Copy_template_reference") }} + + + @@ -648,7 +663,8 @@ v-if="recipe !== undefined">
+ class="d-block d-md-none btn btn-block btn-danger shadow-none btn-sm"> {{ $t("Delete") }}
@@ -1039,6 +1055,12 @@ export default { this.recipe.steps.splice(new_index < 0 ? 0 : new_index, 0, step) this.sortSteps() }, + moveIngredient: function (step, ingredient, new_index) { + step.ingredients.splice(step.ingredients.indexOf(ingredient), 1) + step.ingredients.splice(new_index < 0 ? 0 : new_index, 0, ingredient) + this.sortIngredients(step) + }, + addFoodType: function (tag, index) { let [tmp, step, id] = index.split("_") @@ -1212,6 +1234,10 @@ export default { } }) }, + duplicateIngredient: function (step, ingredient) { + delete ingredient.id + step.ingredients.push(ingredient) + } }, } From 730344e326c33f03390c0fa01407aa43a1a526f9 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 1 Oct 2022 19:27:09 +0200 Subject: [PATCH 2/2] duplicate ingredient to correct location --- vue/src/apps/RecipeEditView/RecipeEditView.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 389d9237..ad5bf5d2 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -577,7 +577,7 @@ {{ $t("Copy_template_reference") }} @@ -1234,9 +1234,9 @@ export default { } }) }, - duplicateIngredient: function (step, ingredient) { + duplicateIngredient: function (step, ingredient, new_index) { delete ingredient.id - step.ingredients.push(ingredient) + step.ingredients.splice(new_index < 0 ? 0 : new_index, 0, ingredient) } }, }