Skip to content

Commit

Permalink
Merge branch 'mealie-next' into feature/push_to_ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
proffalken authored Sep 5, 2023
2 parents 52a0609 + 0a00a6e commit 498d947
Show file tree
Hide file tree
Showing 50 changed files with 1,444 additions and 196 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""added recipe note to shopping list recipe ref
Revision ID: 1825b5225403
Revises: 04ac51cbe9a4
Create Date: 2023-08-14 19:30:49.103185
"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "1825b5225403"
down_revision = "04ac51cbe9a4"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("shopping_list_item_recipe_reference", sa.Column("recipe_note", sa.String(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("shopping_list_item_recipe_reference", "recipe_note")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""remove tool name and slug unique contraints
Revision ID: bcfdad6b7355
Revises: 1825b5225403
Create Date: 2023-08-15 16:25:07.058929
"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "bcfdad6b7355"
down_revision = "1825b5225403"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index("ix_tools_name", table_name="tools")
op.create_index(op.f("ix_tools_name"), "tools", ["name"], unique=False)
op.drop_index("ix_tools_slug", table_name="tools")
op.create_index(op.f("ix_tools_slug"), "tools", ["slug"], unique=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_tools_slug"), table_name="tools")
op.create_index("ix_tools_slug", "tools", ["slug"], unique=True)
op.drop_index(op.f("ix_tools_name"), table_name="tools")
op.create_index("ix_tools_name", "tools", ["name"], unique=True)
# ### end Alembic commands ###
Binary file added frontend/assets/audio/kitchen_alarm.mp3
Binary file not shown.
9 changes: 8 additions & 1 deletion frontend/components/Domain/Recipe/RecipeActionMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
</v-tooltip>
</div>

<RecipeTimerMenu
fab
color="info"
class="mr-1"
/>

<RecipeContextMenu
show-print
:menu-top="false"
Expand Down Expand Up @@ -90,6 +96,7 @@
import { defineComponent, ref, useContext } from "@nuxtjs/composition-api";
import RecipeContextMenu from "./RecipeContextMenu.vue";
import RecipeFavoriteBadge from "./RecipeFavoriteBadge.vue";
import RecipeTimerMenu from "./RecipeTimerMenu.vue";
import RecipeTimelineBadge from "./RecipeTimelineBadge.vue";
import { Recipe } from "~/lib/api/types/recipe";
Expand All @@ -100,7 +107,7 @@ const JSON_EVENT = "json";
const OCR_EVENT = "ocr";
export default defineComponent({
components: { RecipeContextMenu, RecipeFavoriteBadge, RecipeTimelineBadge },
components: { RecipeContextMenu, RecipeFavoriteBadge, RecipeTimerMenu, RecipeTimelineBadge },
props: {
recipe: {
required: true,
Expand Down
25 changes: 17 additions & 8 deletions frontend/components/Domain/Recipe/RecipeCardMobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<v-expand-transition>
<v-card
:ripple="false"
class="mx-auto"
:class="isFlat ? 'mx-auto flat' : 'mx-auto'"
hover
:to="$listeners.selected ? undefined : `/recipe/${slug}`"
@click="$emit('selected')"
>
<v-img v-if="vertical">
<v-img v-if="vertical" class="rounded-sm">
<RecipeCardImage
:icon-size="100"
:height="75"
:height="150"
:slug="slug"
:recipe-id="recipeId"
small
:image-version="image"
/>
</v-img>
<v-list-item three-line>
<v-list-item three-line :class="vertical ? 'px-2' : 'px-0'">
<slot v-if="!vertical" name="avatar">
<v-list-item-avatar tile size="125" class="v-mobile-img rounded-sm my-0 ml-n4">
<v-list-item-avatar tile size="125" class="v-mobile-img rounded-sm my-0">
<RecipeCardImage
:icon-size="100"
:height="125"
Expand All @@ -30,8 +30,8 @@
/>
</v-list-item-avatar>
</slot>
<v-list-item-content>
<v-list-item-title class="mb-1">{{ name }} </v-list-item-title>
<v-list-item-content class="py-0">
<v-list-item-title class="mt-3 mb-1">{{ name }} </v-list-item-title>
<v-list-item-subtitle>
<SafeMarkdown :source="description" />
</v-list-item-subtitle>
Expand Down Expand Up @@ -120,7 +120,11 @@ export default defineComponent({
vertical: {
type: Boolean,
default: false,
}
},
isFlat: {
type: Boolean,
default: false,
},
},
setup() {
const { $auth } = useContext();
Expand Down Expand Up @@ -162,4 +166,9 @@ export default defineComponent({
.text-top {
align-self: start !important;
}
.flat {
box-shadow: none!important;
background-color: transparent;
}
</style>
16 changes: 10 additions & 6 deletions frontend/components/Domain/Recipe/RecipeContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@
color="secondary"
/>
<v-list-item-content :key="ingredientData.ingredient.quantity">
<SafeMarkdown class="ma-0 pa-0 text-subtitle-1 dense-markdown" :source="ingredientData.display" />
<RecipeIngredientListItem
:ingredient="ingredientData.ingredient"
:disable-amount="ingredientData.disableAmount"
:scale="recipeScale" />
</v-list-item-content>
</v-list-item>
</v-card>
Expand Down Expand Up @@ -146,7 +149,7 @@
:nudge-top="menuTop ? '5' : '0'"
allow-overflow
close-delay="125"
open-on-hover
:open-on-hover="$vuetify.breakpoint.mdAndUp"
content-class="d-print-none"
>
<template #activator="{ on, attrs }">
Expand All @@ -168,13 +171,13 @@

<script lang="ts">
import { defineComponent, reactive, toRefs, useContext, useRouter, ref } from "@nuxtjs/composition-api";
import RecipeIngredientListItem from "./RecipeIngredientListItem.vue";
import RecipeDialogPrintPreferences from "./RecipeDialogPrintPreferences.vue";
import RecipeDialogShare from "./RecipeDialogShare.vue";
import { useUserApi } from "~/composables/api";
import { alert } from "~/composables/use-toast";
import { usePlanTypeOptions } from "~/composables/use-group-mealplan";
import { Recipe, RecipeIngredient } from "~/lib/api/types/recipe";
import { parseIngredientText } from "~/composables/recipes";
import { ShoppingListSummary } from "~/lib/api/types/group";
import { PlanEntryType } from "~/lib/api/types/meal-plan";
import { useAxiosDownloader } from "~/composables/api/use-axios-download";
Expand Down Expand Up @@ -203,7 +206,8 @@ export default defineComponent({
components: {
RecipeDialogPrintPreferences,
RecipeDialogShare,
},
RecipeIngredientListItem
},
props: {
useItems: {
type: Object as () => ContextMenuIncludes,
Expand Down Expand Up @@ -384,7 +388,7 @@ export default defineComponent({
const shoppingLists = ref<ShoppingListSummary[]>();
const selectedShoppingList = ref<ShoppingListSummary>();
const recipeRef = ref<Recipe>(props.recipe);
const recipeIngredients = ref<{ checked: boolean; ingredient: RecipeIngredient; display: string }[]>([]);
const recipeIngredients = ref<{ checked: boolean; ingredient: RecipeIngredient, disableAmount: boolean }[]>([]);
async function getShoppingLists() {
const { data } = await api.shopping.lists.getAll();
Expand All @@ -411,7 +415,7 @@ export default defineComponent({
return {
checked: true,
ingredient,
display: parseIngredientText(ingredient, recipeRef.value?.settings?.disableAmount || false, props.recipeScale),
disableAmount: recipeRef.value.settings?.disableAmount || false
};
});
}
Expand Down
61 changes: 61 additions & 0 deletions frontend/components/Domain/Recipe/RecipeIngredientListItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<template>
<div class="ma-0 pa-0 text-subtitle-1 dense-markdown ingredient-item">
<SafeMarkdown v-if="parsedIng.quantity" class="d-inline" :source="parsedIng.quantity" />
<template v-if="parsedIng.unit">{{ parsedIng.unit }} </template>
<SafeMarkdown v-if="parsedIng.note && !parsedIng.name" class="text-bold d-inline" :source="parsedIng.note" />
<template v-else>
<SafeMarkdown v-if="parsedIng.name" class="text-bold d-inline" :source="parsedIng.name" />
<SafeMarkdown v-if="parsedIng.note" class="note" :source="parsedIng.note" />
</template>
</div>
</template>
<script lang="ts">
import { computed, defineComponent, toRefs } from "@nuxtjs/composition-api";
import { RecipeIngredient } from "~/lib/api/types/group";
import { useParsedIngredientText } from "~/composables/recipes";
export default defineComponent({
props: {
ingredient: {
type: Object as () => RecipeIngredient,
required: true,
},
disableAmount: {
type: Boolean,
default: false,
},
scale: {
type: Number,
default: 1,
},
},
setup(props) {
const parsedIng = computed(() => {
return useParsedIngredientText(props.ingredient, props.disableAmount, props.scale);
});
return {
parsedIng,
};
},
});
</script>
<style lang="scss">
.ingredient-item {
.d-inline {
& > p {
display: inline;
}
}
.text-bold {
font-weight: bold;
}
}
.note {
line-height: 0.8em;
font-size: 0.8em;
opacity: 0.7;
}
</style>
20 changes: 8 additions & 12 deletions frontend/components/Domain/Recipe/RecipeIngredients.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<v-list-item dense @click="toggleChecked(index)">
<v-checkbox hide-details :value="checked[index]" class="pt-0 my-auto py-auto" color="secondary" />
<v-list-item-content :key="ingredient.quantity">
<SafeMarkdown class="ma-0 pa-0 text-subtitle-1 dense-markdown" :source="ingredientDisplay[index]" />
<RecipeIngredientListItem :ingredient="ingredient" :disable-amount="disableAmount" :scale="scale" />
</v-list-item-content>
</v-list-item>
</div>
Expand All @@ -21,12 +21,12 @@

<script lang="ts">
import { computed, defineComponent, reactive, toRefs } from "@nuxtjs/composition-api";
// @ts-ignore vue-markdown has no types
import RecipeIngredientListItem from "./RecipeIngredientListItem.vue";
import { parseIngredientText } from "~/composables/recipes";
import { RecipeIngredient } from "~/lib/api/types/recipe";
export default defineComponent({
components: {},
components: { RecipeIngredientListItem },
props: {
value: {
type: Array as () => RecipeIngredient[],
Expand All @@ -52,7 +52,11 @@ export default defineComponent({
});
const ingredientCopyText = computed(() => {
return ingredientDisplay.value.join("\n");
return props.value
.map((ingredient) => {
return `${parseIngredientText(ingredient, props.disableAmount, props.scale, false)}`;
})
.join("\n");
});
function toggleChecked(index: number) {
Expand All @@ -61,16 +65,8 @@ export default defineComponent({
state.checked.splice(index, 1, !state.checked[index]);
}
const ingredientDisplay = computed(() => {
return props.value.map((ingredient) => {
return `${parseIngredientText(ingredient, props.disableAmount, props.scale)}`;
});
});
return {
ingredientDisplay,
...toRefs(state),
parseIngredientText,
ingredientCopyText,
toggleChecked,
};
Expand Down
Loading

0 comments on commit 498d947

Please sign in to comment.