1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

feat: Add summary to recipe instructions (#4410)

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
boc-the-git 2024-10-23 20:27:47 +11:00 committed by GitHub
parent 99fec90288
commit 3dd61f7742
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 59 additions and 10 deletions

View file

@ -121,9 +121,22 @@
@click="toggleDisabled(index)"
>
<v-card-title :class="{ 'pb-0': !isChecked(index) }">
<span :class="isEditForm ? 'handle' : ''">
<v-icon v-if="isEditForm" size="26" class="pb-1">{{ $globals.icons.arrowUpDown }}</v-icon>
{{ $t("recipe.step-index", { step: index + 1 }) }}
<v-text-field
v-if="isEditForm"
v-model="step.summary"
class="headline handle"
hide-details
dense
solo
flat
:placeholder="$t('recipe.step-index', { step: index + 1 })"
>
<template #prepend>
<v-icon size="26">{{ $globals.icons.arrowUpDown }}</v-icon>
</template>
</v-text-field>
<span v-else>
{{ step.summary ? step.summary : $t("recipe.step-index", { step: index + 1 }) }}
</span>
<template v-if="isEditForm">
<div class="ml-auto">
@ -339,7 +352,7 @@ export default defineComponent({
// ===============================================================
// UI State Helpers
function validateTitle(title: string | undefined) {
function hasSectionTitle(title: string | undefined) {
return !(title === null || title === "" || title === undefined);
}
@ -348,7 +361,7 @@ export default defineComponent({
v.forEach((element: RecipeStep) => {
if (element.id !== undefined) {
showTitleEditor.value[element.id] = validateTitle(element.title);
showTitleEditor.value[element.id] = hasSectionTitle(element.title);
}
});
});
@ -359,7 +372,7 @@ export default defineComponent({
onMounted(() => {
props.value.forEach((element: RecipeStep) => {
if (element.id !== undefined) {
showTitleEditor.value[element.id] = validateTitle(element.title);
showTitleEditor.value[element.id] = hasSectionTitle(element.title);
}
// showCookMode.value = false;
@ -576,7 +589,7 @@ export default defineComponent({
const sectionSteps: number[] = [];
for (let i = index; i < props.value.length; i++) {
if (!(i === index) && validateTitle(props.value[i].title)) {
if (!(i === index) && hasSectionTitle(props.value[i].title)) {
break;
} else {
sectionSteps.push(i);