wip
This commit is contained in:
@ -25,7 +25,7 @@
|
|||||||
<b-nav-item variant="link" @click="
|
<b-nav-item variant="link" @click="
|
||||||
navRecipe(r)
|
navRecipe(r)
|
||||||
hide()
|
hide()
|
||||||
">{{ r.name }}
|
">{{ r.name }} <a href="javascript:void(0);">x</a>
|
||||||
</b-nav-item>
|
</b-nav-item>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
@ -38,6 +38,16 @@
|
|||||||
">{{ r.name }}
|
">{{ r.name }}
|
||||||
</b-nav-item>
|
</b-nav-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h5><i class="fas fa-link fa-fw"></i> TEST</h5>
|
||||||
|
|
||||||
|
<div v-for="r in test" :key="`test${r.id}`">
|
||||||
|
<b-nav-item variant="link" @click="
|
||||||
|
navRecipe(r)
|
||||||
|
hide()
|
||||||
|
">{{ r.name }}
|
||||||
|
</b-nav-item>
|
||||||
|
</div>
|
||||||
</b-nav>
|
</b-nav>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
@ -60,7 +70,8 @@ export default {
|
|||||||
related_recipes: [],
|
related_recipes: [],
|
||||||
planned_recipes: [],
|
planned_recipes: [],
|
||||||
pinned_recipes: [],
|
pinned_recipes: [],
|
||||||
recipes: {}
|
recipes: {},
|
||||||
|
test : []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -84,7 +95,7 @@ export default {
|
|||||||
navRecipe: function (recipe) {
|
navRecipe: function (recipe) {
|
||||||
|
|
||||||
if (this.is_recipe_view) {
|
if (this.is_recipe_view) {
|
||||||
this.$emit("switch", this.recipes[recipe.id])
|
this.$emit("switch", recipe)
|
||||||
} else {
|
} else {
|
||||||
window.location.href = this.resolveDjangoUrl("view_recipe", recipe.id)
|
window.location.href = this.resolveDjangoUrl("view_recipe", recipe.id)
|
||||||
}
|
}
|
||||||
@ -93,16 +104,23 @@ export default {
|
|||||||
let apiClient = new ApiApiFactory()
|
let apiClient = new ApiApiFactory()
|
||||||
|
|
||||||
let recipe_list = [...this.related_recipes, ...this.planned_recipes, ...this.pinned_recipes]
|
let recipe_list = [...this.related_recipes, ...this.planned_recipes, ...this.pinned_recipes]
|
||||||
|
|
||||||
let recipe_ids = []
|
let recipe_ids = []
|
||||||
recipe_list.forEach((recipe) => {
|
recipe_list.forEach((recipe) => {
|
||||||
if (!recipe_ids.includes(recipe.id)) {
|
let id = recipe.id
|
||||||
recipe_ids.push(recipe.id)
|
if (id === undefined){
|
||||||
|
id = recipe
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!recipe_ids.includes(id)) {
|
||||||
|
recipe_ids.push(id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log(recipe_list, recipe_ids)
|
||||||
recipe_ids.forEach((id) => {
|
recipe_ids.forEach((id) => {
|
||||||
apiClient.retrieveRecipe(id).then((result) => {
|
apiClient.retrieveRecipe(id).then((result) => {
|
||||||
this.recipes[id] = result.data
|
this.recipes[id] = result.data
|
||||||
|
this.test.push(result.data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -111,12 +129,14 @@ export default {
|
|||||||
let apiClient = new ApiApiFactory()
|
let apiClient = new ApiApiFactory()
|
||||||
|
|
||||||
// get related recipes and save them for later
|
// get related recipes and save them for later
|
||||||
return apiClient.relatedRecipe(this.recipe, {query: {levels: 2}}).then((result) => {
|
if (this.recipe){
|
||||||
this.related_recipes = result.data
|
return apiClient.relatedRecipe(this.recipe, {query: {levels: 2}}).then((result) => {
|
||||||
})
|
this.related_recipes = result.data
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
loadPinnedRecipes: function () {
|
loadPinnedRecipes: function () {
|
||||||
let pinned_recipe_ids = localStorage.getItem('pinned_recipes') || []
|
let pinned_recipe_ids = JSON.parse(localStorage.getItem('pinned_recipes')) || []
|
||||||
this.pinned_recipes = pinned_recipe_ids
|
this.pinned_recipes = pinned_recipe_ids
|
||||||
},
|
},
|
||||||
loadMealPlans: function () {
|
loadMealPlans: function () {
|
||||||
|
@ -1,38 +1,60 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="dropdown d-print-none">
|
<div class="dropdown d-print-none">
|
||||||
<a class="btn shadow-none" href="javascript:void(0);" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="btn shadow-none" href="javascript:void(0);" role="button" id="dropdownMenuLink"
|
||||||
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<i class="fas fa-ellipsis-v fa-lg"></i>
|
<i class="fas fa-ellipsis-v fa-lg"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuLink">
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuLink">
|
||||||
<a class="dropdown-item" :href="resolveDjangoUrl('edit_recipe', recipe.id)"><i class="fas fa-pencil-alt fa-fw"></i> {{ $t("Edit") }}</a>
|
<a class="dropdown-item" :href="resolveDjangoUrl('edit_recipe', recipe.id)"><i
|
||||||
|
class="fas fa-pencil-alt fa-fw"></i> {{ $t("Edit") }}</a>
|
||||||
|
|
||||||
<a class="dropdown-item" :href="resolveDjangoUrl('edit_convert_recipe', recipe.id)" v-if="!recipe.internal"><i class="fas fa-exchange-alt fa-fw"></i> {{ $t("convert_internal") }}</a>
|
<a class="dropdown-item" :href="resolveDjangoUrl('edit_convert_recipe', recipe.id)"
|
||||||
|
v-if="!recipe.internal"><i class="fas fa-exchange-alt fa-fw"></i> {{ $t("convert_internal") }}</a>
|
||||||
|
|
||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<button class="dropdown-item" @click="$bvModal.show(`id_modal_add_book_${modal_id}`)"><i class="fas fa-bookmark fa-fw"></i> {{ $t("Manage_Books") }}</button>
|
<button class="dropdown-item" @click="$bvModal.show(`id_modal_add_book_${modal_id}`)"><i
|
||||||
|
class="fas fa-bookmark fa-fw"></i> {{ $t("Manage_Books") }}
|
||||||
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="dropdown-item" :href="`${resolveDjangoUrl('view_shopping')}?r=[${recipe.id},${servings_value}]`" v-if="recipe.internal" target="_blank" rel="noopener noreferrer">
|
<a class="dropdown-item"
|
||||||
|
:href="`${resolveDjangoUrl('view_shopping')}?r=[${recipe.id},${servings_value}]`"
|
||||||
|
v-if="recipe.internal" target="_blank" rel="noopener noreferrer">
|
||||||
<i class="fas fa-shopping-cart fa-fw"></i> {{ $t("Add_to_Shopping") }}
|
<i class="fas fa-shopping-cart fa-fw"></i> {{ $t("Add_to_Shopping") }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" v-if="recipe.internal" @click="addToShopping" href="#"> <i class="fas fa-shopping-cart fa-fw"></i> {{ $t("create_shopping_new") }} </a>
|
<a class="dropdown-item" v-if="recipe.internal" @click="addToShopping" href="#"> <i
|
||||||
|
class="fas fa-shopping-cart fa-fw"></i> {{ $t("create_shopping_new") }} </a>
|
||||||
|
|
||||||
<a class="dropdown-item" @click="createMealPlan" href="javascript:void(0);"><i class="fas fa-calendar fa-fw"></i> {{ $t("Add_to_Plan") }} </a>
|
<a class="dropdown-item" @click="createMealPlan" href="javascript:void(0);"><i
|
||||||
|
class="fas fa-calendar fa-fw"></i> {{ $t("Add_to_Plan") }} </a>
|
||||||
|
|
||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<button class="dropdown-item" @click="$bvModal.show(`id_modal_cook_log_${modal_id}`)"><i class="fas fa-clipboard-list fa-fw"></i> {{ $t("Log_Cooking") }}</button>
|
<button class="dropdown-item" @click="$bvModal.show(`id_modal_cook_log_${modal_id}`)"><i
|
||||||
|
class="fas fa-clipboard-list fa-fw"></i> {{ $t("Log_Cooking") }}
|
||||||
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<button class="dropdown-item" onclick="window.print()"><i class="fas fa-print fa-fw"></i> {{ $t("Print") }}</button>
|
<button class="dropdown-item" onclick="window.print()"><i class="fas fa-print fa-fw"></i>
|
||||||
|
{{ $t("Print") }}
|
||||||
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="dropdown-item" :href="resolveDjangoUrl('view_export') + '?r=' + recipe.id" target="_blank" rel="noopener noreferrer"><i class="fas fa-file-export fa-fw"></i> {{ $t("Export") }}</a>
|
<a class="dropdown-item" :href="resolveDjangoUrl('view_export') + '?r=' + recipe.id" target="_blank"
|
||||||
|
rel="noopener noreferrer"><i class="fas fa-file-export fa-fw"></i> {{ $t("Export") }}</a>
|
||||||
|
|
||||||
<a href="javascript:void(0);">
|
<a href="javascript:void(0);">
|
||||||
<button class="dropdown-item" @click="createShareLink()" v-if="recipe.internal"><i class="fas fa-share-alt fa-fw"></i> {{ $t("Share") }}</button>
|
<button class="dropdown-item" @click="pinRecipe()"><i class="fas fa-thumbtack fa-fw"></i>
|
||||||
|
{{ $t("Pin") }}
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="javascript:void(0);">
|
||||||
|
<button class="dropdown-item" @click="createShareLink()" v-if="recipe.internal"><i
|
||||||
|
class="fas fa-share-alt fa-fw"></i> {{ $t("Share") }}
|
||||||
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -44,10 +66,17 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
<label v-if="recipe_share_link !== undefined">{{ $t("Public share link") }}</label>
|
<label v-if="recipe_share_link !== undefined">{{ $t("Public share link") }}</label>
|
||||||
<input ref="share_link_ref" class="form-control" v-model="recipe_share_link" />
|
<input ref="share_link_ref" class="form-control" v-model="recipe_share_link"/>
|
||||||
<b-button class="mt-2 mb-3 d-none d-md-inline" variant="secondary" @click="$bvModal.hide(`modal-share-link_${modal_id}`)">{{ $t("Close") }} </b-button>
|
<b-button class="mt-2 mb-3 d-none d-md-inline" variant="secondary"
|
||||||
<b-button class="mt-2 mb-3 ml-md-2" variant="primary" @click="copyShareLink()">{{ $t("Copy") }}</b-button>
|
@click="$bvModal.hide(`modal-share-link_${modal_id}`)">{{ $t("Close") }}
|
||||||
<b-button class="mt-2 mb-3 ml-2 float-right" variant="success" @click="shareIntend()">{{ $t("Share") }} <i class="fa fa-share-alt"></i></b-button>
|
</b-button>
|
||||||
|
<b-button class="mt-2 mb-3 ml-md-2" variant="primary" @click="copyShareLink()">{{
|
||||||
|
$t("Copy")
|
||||||
|
}}
|
||||||
|
</b-button>
|
||||||
|
<b-button class="mt-2 mb-3 ml-2 float-right" variant="success" @click="shareIntend()">{{
|
||||||
|
$t("Share")
|
||||||
|
}} <i class="fa fa-share-alt"></i></b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
@ -62,12 +91,12 @@
|
|||||||
:allow_delete="false"
|
:allow_delete="false"
|
||||||
:modal_title="$t('Create_Meal_Plan_Entry')"
|
:modal_title="$t('Create_Meal_Plan_Entry')"
|
||||||
></meal-plan-edit-modal>
|
></meal-plan-edit-modal>
|
||||||
<shopping-modal :recipe="recipe" :servings="servings_value" :modal_id="modal_id" />
|
<shopping-modal :recipe="recipe" :servings="servings_value" :modal_id="modal_id"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { makeToast, resolveDjangoUrl, ResolveUrlMixin, StandardToasts } from "@/utils/utils"
|
import {makeToast, resolveDjangoUrl, ResolveUrlMixin, StandardToasts} from "@/utils/utils"
|
||||||
import CookLog from "@/components/CookLog"
|
import CookLog from "@/components/CookLog"
|
||||||
import axios from "axios"
|
import axios from "axios"
|
||||||
import AddRecipeToBook from "@/components/Modals/AddRecipeToBook"
|
import AddRecipeToBook from "@/components/Modals/AddRecipeToBook"
|
||||||
@ -75,7 +104,7 @@ import MealPlanEditModal from "@/components/MealPlanEditModal"
|
|||||||
import ShoppingModal from "@/components/Modals/ShoppingModal"
|
import ShoppingModal from "@/components/Modals/ShoppingModal"
|
||||||
import moment from "moment"
|
import moment from "moment"
|
||||||
import Vue from "vue"
|
import Vue from "vue"
|
||||||
import { ApiApiFactory } from "@/utils/openapi/api"
|
import {ApiApiFactory} from "@/utils/openapi/api"
|
||||||
|
|
||||||
Vue.prototype.moment = moment
|
Vue.prototype.moment = moment
|
||||||
|
|
||||||
@ -121,6 +150,11 @@ export default {
|
|||||||
this.servings_value = this.servings === -1 ? this.recipe.servings : this.servings
|
this.servings_value = this.servings === -1 ? this.recipe.servings : this.servings
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
pinRecipe: function () {
|
||||||
|
let pinnedRecipes = JSON.parse(localStorage.getItem('pinned_recipes') )|| []
|
||||||
|
pinnedRecipes.push(this.recipe.id)
|
||||||
|
localStorage.setItem('pinned_recipes', JSON.stringify(pinnedRecipes))
|
||||||
|
},
|
||||||
saveMealPlan: function (entry) {
|
saveMealPlan: function (entry) {
|
||||||
entry.date = moment(entry.date).format("YYYY-MM-DD")
|
entry.date = moment(entry.date).format("YYYY-MM-DD")
|
||||||
|
|
||||||
|
@ -277,14 +277,11 @@
|
|||||||
"copy_markdown_table": "Copy as Markdown Table",
|
"copy_markdown_table": "Copy as Markdown Table",
|
||||||
"in_shopping": "In Shopping List",
|
"in_shopping": "In Shopping List",
|
||||||
"DelayUntil": "Delay Until",
|
"DelayUntil": "Delay Until",
|
||||||
|
"Pin": "Pin",
|
||||||
"mark_complete": "Mark Complete",
|
"mark_complete": "Mark Complete",
|
||||||
"QuickEntry": "Quick Entry",
|
"QuickEntry": "Quick Entry",
|
||||||
"shopping_add_onhand_desc": "Mark food 'On Hand' when checked off shopping list.",
|
"shopping_add_onhand_desc": "Mark food 'On Hand' when checked off shopping list.",
|
||||||
"shopping_add_onhand": "Auto On Hand",
|
"shopping_add_onhand": "Auto On Hand",
|
||||||
"related_recipes": "Related Recipes",
|
"related_recipes": "Related Recipes",
|
||||||
"today_recipes": "Today's Recipes",
|
"today_recipes": "Today's Recipes"
|
||||||
"mark_complete": "Mark Complete",
|
|
||||||
"QuickEntry": "Quick Entry",
|
|
||||||
"shopping_add_onhand_desc": "Mark food 'On Hand' when checked off shopping list.",
|
|
||||||
"shopping_add_onhand": "Auto On Hand"
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user