1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 23:59:45 +02:00

Merge branch 'mealie-next' into feat/filter-shopping-lists

This commit is contained in:
Michael Genson 2024-03-05 09:18:37 -06:00 committed by GitHub
commit c9fdf862a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 514 additions and 341 deletions

View file

@ -132,8 +132,7 @@ export default defineComponent({
const { $auth, i18n } = useContext();
const domMadeThisForm = ref<VForm>();
const newTimelineEvent = ref<RecipeTimelineEventIn>({
// @ts-expect-error - TS doesn't like the $auth global user attribute
subject: i18n.tc("recipe.user-made-this", { user: $auth.user.fullName }),
subject: "",
eventType: "comment",
eventMessage: "",
timestamp: undefined,
@ -178,6 +177,8 @@ export default defineComponent({
}
newTimelineEvent.value.recipeId = props.recipe.id
// @ts-expect-error - TS doesn't like the $auth global user attribute
newTimelineEvent.value.subject = i18n.t("recipe.user-made-this", { user: $auth.user.fullName })
// the user only selects the date, so we set the time to end of day local time
// we choose the end of day so it always comes after "new recipe" events

View file

@ -148,10 +148,6 @@
text: $tc('recipe.link-ingredients'),
event: 'link-ingredients',
},
{
text: $tc('recipe.merge-above'),
event: 'merge-above',
},
{
text: $tc('recipe.upload-image'),
event: 'upload-image'
@ -160,11 +156,26 @@
icon: previewStates[index] ? $globals.icons.edit : $globals.icons.eye,
text: previewStates[index] ? $tc('recipe.edit-markdown') : $tc('markdown-editor.preview-markdown-button-label'),
event: 'preview-step',
divider: true,
},
{
text: $tc('recipe.merge-above'),
event: 'merge-above',
},
{
text: $tc('recipe.move-to-top'),
event: 'move-to-top',
},
{
text: $tc('recipe.move-to-bottom'),
event: 'move-to-bottom',
},
],
},
]"
@merge-above="mergeAbove(index - 1, index)"
@move-to-top="moveTo('top', index)"
@move-to-bottom="moveTo('bottom', index)"
@toggle-section="toggleShowTitle(step.id)"
@link-ingredients="openDialog(index, step.text, step.ingredientReferences)"
@preview-step="togglePreviewState(index)"
@ -531,6 +542,14 @@ export default defineComponent({
}
}
function moveTo(dest: string, source: number) {
if (dest === "top") {
props.value.unshift(props.value.splice(source, 1)[0]);
} else {
props.value.push(props.value.splice(source, 1)[0]);
}
}
const previewStates = ref<boolean[]>([]);
function togglePreviewState(index: number) {
@ -646,6 +665,7 @@ export default defineComponent({
getIngredientByRefId,
showTitleEditor,
mergeAbove,
moveTo,
openDialog,
setIngredientIds,
availableNextStep,