mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 20:28:46 -05:00
Merge branch 'develop' into feature/unpin-pins
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<cookbook-edit-card :book="book" v-if="current_page === 1" v-on:editing="cookbook_editing = $event" v-on:refresh="$emit('refresh')" @reload="$emit('reload')"></cookbook-edit-card>
|
||||
</transition>
|
||||
<transition name="flip" mode="out-in">
|
||||
<recipe-card :recipe="display_recipes[0].recipe_content" v-if="current_page > 1" :key="display_recipes[0].recipe"></recipe-card>
|
||||
<recipe-card :recipe="display_recipes[0].recipe_content" v-if="current_page > 1" :key="display_recipes[0].recipe" :use_plural="use_plural"></recipe-card>
|
||||
</transition>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
@@ -20,7 +20,7 @@
|
||||
<cookbook-toc :recipes="recipes" v-if="current_page === 1" v-on:switchRecipe="switchRecipe($event)"></cookbook-toc>
|
||||
</transition>
|
||||
<transition name="flip" mode="out-in">
|
||||
<recipe-card :recipe="display_recipes[1].recipe_content" v-if="current_page > 1 && display_recipes.length === 2" :key="display_recipes[1].recipe"></recipe-card>
|
||||
<recipe-card :recipe="display_recipes[1].recipe_content" v-if="current_page > 1 && display_recipes.length === 2" :key="display_recipes[1].recipe" :use_plural="use_plural"></recipe-card>
|
||||
</transition>
|
||||
</div>
|
||||
<div class="col-md-1" @click="swipeLeft" style="cursor: pointer"></div>
|
||||
@@ -34,7 +34,7 @@ import CookbookEditCard from "./CookbookEditCard"
|
||||
import CookbookToc from "./CookbookToc"
|
||||
import Vue2TouchEvents from "vue2-touch-events"
|
||||
import Vue from "vue"
|
||||
import { ApiApiFactory } from "../utils/openapi/api"
|
||||
import { ApiApiFactory } from "@/utils/openapi/api"
|
||||
|
||||
Vue.use(Vue2TouchEvents)
|
||||
|
||||
@@ -56,6 +56,12 @@ export default {
|
||||
return this.recipes.slice((this.current_page - 1 - 1) * 2, (this.current_page - 1) * 2)
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
let apiClient = new ApiApiFactory()
|
||||
apiClient.retrieveSpace(window.ACTIVE_SPACE_ID).then(r => {
|
||||
this.use_plural = r.data.use_plural
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
current_page: 1,
|
||||
@@ -63,6 +69,7 @@ export default {
|
||||
bounce_left: false,
|
||||
bounce_right: false,
|
||||
cookbook_editing: false,
|
||||
use_plural: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
<b-card-body class="m-0 py-0">
|
||||
<b-card-text class="h-100 my-0 d-flex flex-column" style="text-overflow: ellipsis">
|
||||
<h5 class="m-0 mt-1 text-truncate">{{ item[title] }}</h5>
|
||||
<template v-if="use_plural">
|
||||
<div v-if="item[plural] !== '' && item[plural] !== null" class="m-0 text-truncate">({{ $t("plural_short") }}: {{ item[plural] }})</div>
|
||||
</template>
|
||||
<div class="m-0 text-truncate">{{ item[subtitle] }}</div>
|
||||
<div class="m-0 text-truncate small text-muted" v-if="getFullname">{{ getFullname }}</div>
|
||||
|
||||
@@ -71,7 +74,11 @@
|
||||
<!-- recursively add child cards -->
|
||||
<div class="row" v-if="item.show_children">
|
||||
<div class="col-md-10 offset-md-2">
|
||||
<generic-horizontal-card v-for="child in item[children]" v-bind:key="child.id" :item="child" :model="model" @item-action="$emit('item-action', $event)"> </generic-horizontal-card>
|
||||
<generic-horizontal-card v-for="child in item[children]"
|
||||
v-bind:key="child.id"
|
||||
:item="child" :model="model"
|
||||
:use_plural="use_plural"
|
||||
@item-action="$emit('item-action', $event)"></generic-horizontal-card>
|
||||
</div>
|
||||
</div>
|
||||
<!-- conditionally view recipes -->
|
||||
@@ -146,12 +153,14 @@ export default {
|
||||
item: { type: Object },
|
||||
model: { type: Object },
|
||||
title: { type: String, default: "name" }, // this and the following props need to be moved to model.js and made computed values
|
||||
plural: { type: String, default: "plural_name" },
|
||||
subtitle: { type: String, default: "description" },
|
||||
child_count: { type: String, default: "numchild" },
|
||||
children: { type: String, default: "children" },
|
||||
recipe_count: { type: String, default: "numrecipe" },
|
||||
recipes: { type: String, default: "recipes" },
|
||||
show_context_menu: { type: Boolean, default: true },
|
||||
use_plural: { type: Boolean, default: false},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -16,14 +16,43 @@
|
||||
v-html="calculateAmount(ingredient.amount)"></span>
|
||||
</td>
|
||||
<td @click="done">
|
||||
<span v-if="ingredient.unit !== null && !ingredient.no_amount">{{ ingredient.unit.name }}</span>
|
||||
<template v-if="ingredient.unit !== null && !ingredient.no_amount">
|
||||
<template v-if="!use_plural">
|
||||
<span>{{ ingredient.unit.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="ingredient.unit.plural_name === '' || ingredient.unit.plural_name === null">
|
||||
<span>{{ ingredient.unit.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="ingredient.always_use_plural_unit">{{ ingredient.unit.plural_name}}</span>
|
||||
<span v-else-if="(ingredient.amount * this.ingredient_factor) > 1">{{ ingredient.unit.plural_name }}</span>
|
||||
<span v-else>{{ ingredient.unit.name }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</td>
|
||||
<td @click="done">
|
||||
<template v-if="ingredient.food !== null">
|
||||
<a :href="resolveDjangoUrl('view_recipe', ingredient.food.recipe.id)"
|
||||
v-if="ingredient.food.recipe !== null" target="_blank"
|
||||
rel="noopener noreferrer">{{ ingredient.food.name }}</a>
|
||||
<span v-if="ingredient.food.recipe === null">{{ ingredient.food.name }}</span>
|
||||
v-if="ingredient.food.recipe !== null" target="_blank"
|
||||
rel="noopener noreferrer">{{ ingredient.food.name }}</a>
|
||||
<template v-if="ingredient.food.recipe === null">
|
||||
<template v-if="!use_plural">
|
||||
<span>{{ ingredient.food.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="ingredient.food.plural_name === '' || ingredient.food.plural_name === null">
|
||||
<span>{{ ingredient.food.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="ingredient.always_use_plural_food">{{ ingredient.food.plural_name }}</span>
|
||||
<span v-else-if="ingredient.no_amount">{{ ingredient.food.name }}</span>
|
||||
<span v-else-if="(ingredient.amount * this.ingredient_factor) > 1">{{ ingredient.food.plural_name }}</span>
|
||||
<span v-else>{{ ingredient.food.name }}</span>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</td>
|
||||
<td v-if="detailed">
|
||||
@@ -55,6 +84,7 @@ export default {
|
||||
props: {
|
||||
ingredient: Object,
|
||||
ingredient_factor: {type: Number, default: 1},
|
||||
use_plural:{type: Boolean, default: false},
|
||||
detailed: {type: Boolean, default: true},
|
||||
},
|
||||
mixins: [ResolveUrlMixin],
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<ingredient-component
|
||||
:ingredient="i"
|
||||
:ingredient_factor="ingredient_factor"
|
||||
:use_plural="use_plural"
|
||||
:key="i.id"
|
||||
:detailed="detailed"
|
||||
@checked-state-changed="$emit('checked-state-changed', $event)"
|
||||
@@ -63,6 +64,7 @@ export default {
|
||||
recipe: {type: Number},
|
||||
ingredient_factor: {type: Number, default: 1},
|
||||
servings: {type: Number, default: 1},
|
||||
use_plural: {type: Boolean, default: false},
|
||||
detailed: {type: Boolean, default: true},
|
||||
header: {type: Boolean, default: false},
|
||||
recipe_list: {type: Number, default: undefined},
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</b-input-group>
|
||||
</div>
|
||||
<div class="col-lg-6 d-none d-lg-block d-xl-block">
|
||||
<recipe-card v-if="entryEditing.recipe" :recipe="entryEditing.recipe" :detailed="false"></recipe-card>
|
||||
<recipe-card v-if="entryEditing.recipe" :recipe="entryEditing.recipe" :detailed="false" :use_plural="use_plural"></recipe-card>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3 mb-3">
|
||||
@@ -144,6 +144,7 @@ export default {
|
||||
addshopping: false,
|
||||
reviewshopping: false,
|
||||
},
|
||||
use_plural: false,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -171,7 +172,12 @@ export default {
|
||||
this.entryEditing.servings = newVal
|
||||
},
|
||||
},
|
||||
mounted: function () {},
|
||||
mounted: function () {
|
||||
let apiClient = new ApiApiFactory()
|
||||
apiClient.retrieveSpace(window.ACTIVE_SPACE_ID).then(r => {
|
||||
this.use_plural = r.data.use_plural
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
autoMealPlan: function () {
|
||||
return getUserPreference("mealplan_autoadd_shopping")
|
||||
|
||||
@@ -75,11 +75,15 @@
|
||||
<h6 class="card-title"><i class="fas fa-pepper-hot"></i> {{ $t("Ingredients") }}
|
||||
</h6>
|
||||
|
||||
<ingredients-card :steps="recipe.steps" :header="false" :detailed="false"
|
||||
:servings="recipe.servings"/>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
<ingredients-card
|
||||
:steps="recipe.steps"
|
||||
:header="false"
|
||||
:detailed="false"
|
||||
:servings="recipe.servings"
|
||||
:use_plural="use_plural" />
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<b-badge pill variant="info" v-if="!recipe.internal">{{ $t("External") }}</b-badge>
|
||||
</template>
|
||||
@@ -121,6 +125,7 @@ export default {
|
||||
props: {
|
||||
recipe: Object,
|
||||
meal_plan: Object,
|
||||
use_plural: { type: Boolean, default: false},
|
||||
footer_text: String,
|
||||
footer_icon: String,
|
||||
detailed: {type: Boolean, default: true},
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<div class="col col-md-4"
|
||||
v-if="step.ingredients.length > 0 && (recipe.steps.length > 1 || force_ingredients)">
|
||||
<table class="table table-sm">
|
||||
<ingredients-card :steps="[step]" :ingredient_factor="ingredient_factor"
|
||||
<ingredients-card :steps="[step]" :ingredient_factor="ingredient_factor" :use_plural="use_plural"
|
||||
@checked-state-changed="$emit('checked-state-changed', $event)"/>
|
||||
</table>
|
||||
</div>
|
||||
@@ -90,6 +90,7 @@
|
||||
:index="index"
|
||||
:start_time="start_time"
|
||||
:force_ingredients="true"
|
||||
:use_plural="use_plural"
|
||||
></step-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -149,6 +150,10 @@ export default {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
use_plural: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
step_time: function() {
|
||||
|
||||
Reference in New Issue
Block a user