diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue index 1bd7531ec..ff7803162 100644 --- a/vue/src/components/RecipeContextMenu.vue +++ b/vue/src/components/RecipeContextMenu.vue @@ -31,6 +31,9 @@ {{ $t("Print") }} + + + {{ $t("Export") }} @@ -202,6 +205,21 @@ export default { addToShopping() { this.$bvModal.show(`shopping_${this.modal_id}`) }, + copyToNew: function () { + let recipename = window.prompt(this.$t("copy_to_new"), this.$t("recipe_name")) + let apiClient = new ApiApiFactory() + apiClient.retrieveRecipe(this.recipe.id).then((results) => { + apiClient + .createRecipe({ ...results.data, ...{ id: undefined, name: recipename } }) + .then((newrecipe) => { + StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE) + window.open(this.resolveDjangoUrl("view_recipe", newrecipe.data.id)) + }) + .catch((error) => { + StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE) + }) + }) + }, }, } diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 8942d03e6..722b7fc0f 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -297,6 +297,8 @@ "Foods": "Foods", "review_shopping": "Review shopping entries before saving", "view_recipe": "View Recipe", + "copy_to_new": "Copy To New Recipe", + "recipe_name": "Recipe Name", "paste_ingredients_placeholder": "Paste ingredient list here...", "paste_ingredients": "Paste Ingredients", "ingredient_list": "Ingredient List"