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

Merge branch 'mealie-next' into fix/warn-on-edit-nav

This commit is contained in:
boc-the-git 2024-02-21 20:51:50 +11:00 committed by GitHub
commit 618c567392
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
232 changed files with 3870 additions and 2042 deletions

View file

@ -133,7 +133,7 @@ export default defineComponent({
const domMadeThisForm = ref<VForm>();
const newTimelineEvent = ref<RecipeTimelineEventIn>({
// @ts-expect-error - TS doesn't like the $auth global user attribute
subject: i18n.t("recipe.user-made-this", { user: $auth.user.fullName } as string),
subject: i18n.tc("recipe.user-made-this", { user: $auth.user.fullName }),
eventType: "comment",
eventMessage: "",
timestamp: undefined,

View file

@ -19,11 +19,11 @@
</div>
</v-card-text>
<v-list v-if="showViewer" dense class="mt-0 pt-0">
<v-list-item v-for="(item, key, index) in labels" :key="index" style="min-height: 25px" dense>
<v-list-item v-for="(item, key, index) in renderedList" :key="index" style="min-height: 25px" dense>
<v-list-item-content>
<v-list-item-title class="pl-4 caption flex row">
<div>{{ item.label }}</div>
<div class="ml-auto mr-1">{{ value[key] }}</div>
<div class="ml-auto mr-1">{{ item.value }}</div>
<div>{{ item.suffix }}</div>
</v-list-item-title>
</v-list-item-content>
@ -37,6 +37,14 @@
import { computed, defineComponent, useContext } from "@nuxtjs/composition-api";
import { Nutrition } from "~/lib/api/types/recipe";
type NutritionLabelType = {
[key: string]: {
label: string;
suffix: string;
value?: string;
};
};
export default defineComponent({
props: {
value: {
@ -50,34 +58,34 @@ export default defineComponent({
},
setup(props, context) {
const { i18n } = useContext();
const labels = {
const labels = <NutritionLabelType>{
calories: {
label: i18n.t("recipe.calories"),
suffix: i18n.t("recipe.calories-suffix"),
label: i18n.tc("recipe.calories"),
suffix: i18n.tc("recipe.calories-suffix"),
},
fatContent: {
label: i18n.t("recipe.fat-content"),
suffix: i18n.t("recipe.grams"),
label: i18n.tc("recipe.fat-content"),
suffix: i18n.tc("recipe.grams"),
},
fiberContent: {
label: i18n.t("recipe.fiber-content"),
suffix: i18n.t("recipe.grams"),
label: i18n.tc("recipe.fiber-content"),
suffix: i18n.tc("recipe.grams"),
},
proteinContent: {
label: i18n.t("recipe.protein-content"),
suffix: i18n.t("recipe.grams"),
label: i18n.tc("recipe.protein-content"),
suffix: i18n.tc("recipe.grams"),
},
sodiumContent: {
label: i18n.t("recipe.sodium-content"),
suffix: i18n.t("recipe.milligrams"),
label: i18n.tc("recipe.sodium-content"),
suffix: i18n.tc("recipe.milligrams"),
},
sugarContent: {
label: i18n.t("recipe.sugar-content"),
suffix: i18n.t("recipe.grams"),
label: i18n.tc("recipe.sugar-content"),
suffix: i18n.tc("recipe.grams"),
},
carbohydrateContent: {
label: i18n.t("recipe.carbohydrate-content"),
suffix: i18n.t("recipe.grams"),
label: i18n.tc("recipe.carbohydrate-content"),
suffix: i18n.tc("recipe.grams"),
},
};
const valueNotNull = computed(() => {
@ -96,11 +104,25 @@ export default defineComponent({
context.emit("input", { ...props.value, [key]: event });
}
// Build a new list that only contains nutritional information that has a value
const renderedList = computed(() => {
return Object.entries(labels).reduce((item: NutritionLabelType, [key, label]) => {
if (props.value[key]?.trim()) {
item[key] = {
...label,
value: props.value[key],
};
}
return item;
}, {});
});
return {
labels,
valueNotNull,
showViewer,
updateValue,
renderedList,
};
},
});

View file

@ -25,6 +25,7 @@
:label="$t('shopping-list.note')"
rows="1"
auto-grow
@keypress="handleNoteKeyPress"
></v-textarea>
</div>
<div class="d-flex align-end" style="gap: 20px">
@ -95,7 +96,7 @@
</template>
<script lang="ts">
import { defineComponent, computed } from "@nuxtjs/composition-api";
import { defineComponent, computed, watch } from "@nuxtjs/composition-api";
import { ShoppingListItemCreate, ShoppingListItemOut } from "~/lib/api/types/group";
import { MultiPurposeLabelOut } from "~/lib/api/types/labels";
import { IngredientFood, IngredientUnit } from "~/lib/api/types/recipe";
@ -128,9 +129,28 @@ export default defineComponent({
context.emit("input", val);
},
});
watch(
() => props.value.food,
(newFood) => {
// @ts-ignore our logic already assumes there's a label attribute, even if TS doesn't think there is
listItem.value.label = newFood?.label || null;
listItem.value.labelId = listItem.value.label?.id || null;
}
);
return {
listItem,
};
},
methods: {
handleNoteKeyPress(event) {
// Save on Enter
if (!event.shiftKey && event.key === "Enter") {
event.preventDefault();
this.$emit("save");
}
},
}
});
</script>

View file

@ -200,7 +200,7 @@
"created-on-date": "Създадено на {0}",
"unsaved-changes": "Имате незапазени промени. Желаете ли да ги запазите преди да излезете? Натиснете Ок за запазване и Отказ за отхвърляне на промените.",
"clipboard-copy-failure": "Линкът към рецептата е копиран в клипборда.",
"confirm-delete-generic-items": "Are you sure you want to delete the following items?"
"confirm-delete-generic-items": "Сигурни ли сте, че желаете да изтриете следните елементи?"
},
"group": {
"are-you-sure-you-want-to-delete-the-group": "Сигурни ли сте, че искате да изтриете <b>{groupName}<b/>?",
@ -259,7 +259,7 @@
},
"meal-plan": {
"create-a-new-meal-plan": "Създаване на нов хранителен план",
"update-this-meal-plan": "Update this Meal Plan",
"update-this-meal-plan": "Обнови този План за хранене",
"dinner-this-week": "Вечеря тази седмица",
"dinner-today": "Вечеря Днес",
"dinner-tonight": "Вечеря ТАЗИ ВЕЧЕР",
@ -474,11 +474,11 @@
"add-to-timeline": "Добави към времевата линия",
"recipe-added-to-list": "Рецептата е добавена към списъка",
"recipes-added-to-list": "Рецептите са добавени към списъка",
"successfully-added-to-list": "Successfully added to list",
"successfully-added-to-list": "Успешно добавено в списъка",
"recipe-added-to-mealplan": "Рецептата е добавена към хранителния план",
"failed-to-add-recipes-to-list": "Неуспешно добавяне на рецепта към списъка",
"failed-to-add-recipe-to-mealplan": "Рецептата не беше добавена към хранителния план",
"failed-to-add-to-list": "Failed to add to list",
"failed-to-add-to-list": "Неуспешно добавяне към списъка",
"yield": "Добив",
"quantity": "Количество",
"choose-unit": "Избери единица",
@ -537,8 +537,8 @@
"new-recipe-names-must-be-unique": "Името на рецептата трябва да бъде уникално",
"scrape-recipe": "Обхождане на рецепта",
"scrape-recipe-description": "Обходи рецепта по линк. Предоставете линк за сайт, който искате да бъде обходен. Mealie ще опита да обходи рецептата от този сайт и да я добави във Вашата колекция.",
"scrape-recipe-have-a-lot-of-recipes": "Have a lot of recipes you want to scrape at once?",
"scrape-recipe-suggest-bulk-importer": "Try out the bulk importer",
"scrape-recipe-have-a-lot-of-recipes": "Имате много рецепти, които искате да обходите наведнъж?",
"scrape-recipe-suggest-bulk-importer": "Пробвайте масовото импорторане",
"import-original-keywords-as-tags": "Импортирай оригиналните ключови думи като тагове",
"stay-in-edit-mode": "Остани в режим на редакция",
"import-from-zip": "Импортирай от Zip",
@ -562,7 +562,7 @@
"upload-image": "Качване на изображение",
"screen-awake": "Запази екрана активен",
"remove-image": "Премахване на изображение",
"nextStep": "Next step"
"nextStep": "Следваща стъпка"
},
"search": {
"advanced-search": "Разширено търсене",
@ -1187,7 +1187,7 @@
"require-all-tools": "Изискване на всички инструменти",
"cookbook-name": "Име на книгата с рецепти",
"cookbook-with-name": "Книга с рецепти {0}",
"create-a-cookbook": "Create a Cookbook",
"cookbook": "Cookbook"
"create-a-cookbook": "Създай Готварска книга",
"cookbook": "Готварска книга"
}
}

View file

@ -9,11 +9,11 @@
"database-url": "URL de base de datos",
"default-group": "Grupo Predeterminado",
"demo": "Versión Demo",
"demo-status": "Estado Demo",
"demo-status": "Modo Demo",
"development": "Desarrollo",
"docs": "Documentación",
"download-log": "Descargar Log",
"download-recipe-json": "Último JSON recuperado",
"download-recipe-json": "Último JSON extraído",
"github": "Github",
"log-lines": "Líneas de registro",
"not-demo": "No Demo",
@ -33,7 +33,7 @@
"pdf": "PDF",
"recipe": "Receta",
"show-assets": "Mostrar recursos",
"error-submitting-form": "Se ha producido un error al enviar el formulario"
"error-submitting-form": "Error al enviar el formulario"
},
"category": {
"categories": "Categorías",
@ -200,7 +200,7 @@
"created-on-date": "Creado el {0}",
"unsaved-changes": "Tienes cambios sin guardar. ¿Quieres guardar antes de salir? Aceptar para guardar, Cancelar para descartar cambios.",
"clipboard-copy-failure": "No se pudo copiar al portapapeles.",
"confirm-delete-generic-items": "Are you sure you want to delete the following items?"
"confirm-delete-generic-items": "¿Estás seguro que quieres eliminar los siguientes elementos?"
},
"group": {
"are-you-sure-you-want-to-delete-the-group": "Por favor, confirma que deseas eliminar <b>{groupName}<b/>",
@ -599,9 +599,9 @@
"import-summary": "Importar resumen",
"partial-backup": "Copia de seguridad parcial",
"unable-to-delete-backup": "No se puede eliminar la copia de seguridad.",
"experimental-description": "Backups a total snapshots of the database and data directory of the site. This includes all data and cannot be set to exclude subsets of data. You can think off this as a snapshot of Mealie at a specific time. Currently, {not-crossed-version} (data migrations are not done automatically). These serve as a database agnostic way to export and import data or backup the site to an external location.",
"experimental-description": "Las copias de seguridad son instantáneas completas de la base de datos y del directorio de datos del sitio. Esto incluye todos los datos y no se pueden configurar para excluir subconjuntos de datos. Puedes pensar en esto como una instantánea de Mealie en un momento específico. Estas sirven como una forma agnóstica de la base de datos para exportar e importar datos, o respaldar el sitio en una ubicación externa.",
"backup-restore": "Restaurar Copia de Seguridad",
"back-restore-description": "Restoring this backup will overwrite all the current data in your database and in the data directory and replace them with the contents of this backup. {cannot-be-undone} If the restoration is successful, you will be logged out.",
"back-restore-description": "Restaurar esta copia de seguridad sobrescribirá todos los datos actuales de su base de datos y del directorio de datos y los sustituirá por el contenido de esta copia. {cannot-be-undone} Si la restauración se realiza correctamente, se cerrará su sesión.",
"cannot-be-undone": "Esta acción no se puede deshacer, use con precaución.",
"postgresql-note": "Si estás usando PostGreSQL, por favor revisa el {backup-restore-process} antes de restaurar.",
"backup-restore-process-in-the-documentation": "copia de seguridad/proceso de restauración en la documentación",
@ -723,7 +723,7 @@
"ldap-ready": "LDAP Listo",
"ldap-ready-error-text": "No todos los valores LDAP están configurados. Esto puede ignorarse si no está usando autenticación LDAP.",
"ldap-ready-success-text": "Las variables LDAP requeridas están todas definidas.",
"build": "Compilar",
"build": "Compilación",
"recipe-scraper-version": "Versión de Analizador de Recetas"
},
"shopping-list": {
@ -962,9 +962,9 @@
"settings-chosen-explanation": "Los ajustes seleccionados aquí, excluyendo la opción bloqueada, se aplicarán a todas las recetas seleccionadas.",
"selected-length-recipe-s-settings-will-be-updated": "Se actualizarán los ajustes de {count} receta(s).",
"recipe-data": "Datos de la receta",
"recipe-data-description": "Use this section to manage the data associated with your recipes. You can perform several bulk actions on your recipes including exporting, deleting, tagging, and assigning categories.",
"recipe-columns": "Recipe Columns",
"data-exports-description": "This section provides links to available exports that are ready to download. These exports do expire, so be sure to grab them while they're still available.",
"recipe-data-description": "Utiliza esta sección para gestionar los datos asociados a tus recetas. Puedes realizar varias acciones de forma masiva en tus recetas, como exportar, eliminar, etiquetar y asignar categorías.",
"recipe-columns": "Columnas de Recetas",
"data-exports-description": "Esta sección proporciona enlaces a las exportaciones disponibles listas para descargar. Estas exportaciones caducan, así que asegúrate de descargarlas mientras estén disponibles.",
"data-exports": "Exportación de datos",
"tag": "Etiqueta",
"categorize": "Clasificar",
@ -973,14 +973,14 @@
"categorize-recipes": "Categorizar recetas",
"export-recipes": "Exportar recetas",
"delete-recipes": "Borrar Recetas",
"source-unit-will-be-deleted": "Source Unit will be deleted"
"source-unit-will-be-deleted": "Se eliminará la unidad de origen"
},
"create-alias": "Crear un Alias",
"manage-aliases": "Administrar Alias",
"seed-data": "Datos de ejemplo",
"seed": "Semilla",
"data-management": "Data Management",
"data-management-description": "Select which data set you want to make changes to.",
"data-management": "Gestión de Datos",
"data-management-description": "Selecciona el conjunto de datos al que deseas hacer cambios.",
"select-data": "Seleccionar datos",
"select-language": "Seleccionar idioma",
"columns": "Columnas",
@ -1003,7 +1003,7 @@
},
"user-registration": {
"user-registration": "Registro de usuario",
"registration-success": "Registration Success",
"registration-success": "Registrado con éxito",
"join-a-group": "Unirse a un grupo",
"create-a-new-group": "Crear un grupo nuevo",
"provide-registration-token-description": "Por favor, proporcione el token de registro asociado con el grupo al que desea unirse. Necesitará obtenerlo de un miembro del grupo.",
@ -1050,57 +1050,57 @@
},
"ocr-editor": {
"ocr-editor": "Editor de OCR",
"toolbar": "Toolbar",
"toolbar": "Barra de Herramientas",
"selection-mode": "Modo de selección",
"pan-and-zoom-picture": "Desplazar y hacer zoom en la imagen",
"split-text": "Split text",
"preserve-line-breaks": "Preserve original line breaks",
"split-by-block": "Split by text block",
"flatten": "Flatten regardless of original formating",
"split-text": "Dividir texto",
"preserve-line-breaks": "Mantener los saltos de línea originales",
"split-by-block": "División por bloques de texto",
"flatten": "Acoplar independientemente del formato original",
"help": {
"help": "Help",
"mouse-modes": "Mouse modes",
"selection-mode": "Selection Mode (default)",
"selection-mode-desc": "The selection mode is the main mode that can be used to enter data:",
"help": "Ayuda",
"mouse-modes": "Modos de ratón",
"selection-mode": "Modo selección (por defecto)",
"selection-mode-desc": "El modo de selección es el modo principal que puede utilizarse para introducir datos:",
"selection-mode-steps": {
"draw": "Draw a rectangle on the text you want to select.",
"draw": "Dibuja un rectángulo sobre el texto que deseas seleccionar.",
"click": "Click on any field on the right and then click back on the rectangle above the image.",
"result": "The selected text will appear inside the previously selected field."
},
"pan-and-zoom-mode": "Pan and Zoom Mode",
"pan-and-zoom-mode": "Modo Panorámico y Zoom",
"pan-and-zoom-desc": "Select pan and zoom by clicking the icon. This mode allows to zoom inside the image and move around to make using big images easier.",
"split-text-mode": "Split Text modes",
"split-text-mode": "Modos de división de texto",
"split-modes": {
"line-mode": "Line mode (default)",
"line-mode": "Modo de línea (por defecto)",
"line-mode-desc": "In line mode, the text will be propagated by keeping the original line breaks. This mode is useful when using bulk add on a list of ingredients where one ingredient is one line.",
"block-mode": "Block mode",
"block-mode-desc": "In block mode, the text will be split in blocks. This mode is useful when bulk adding instructions that are usually written in paragraphs.",
"flat-mode": "Flat mode",
"flat-mode-desc": "In flat mode, the text will be added to the selected recipe field with no line breaks."
"block-mode": "Modo en bloque",
"block-mode-desc": "En el modo de bloque, el texto se dividirá en bloques. Este modo es útil cuando se agregan instrucciones que están escritas en párrafos.",
"flat-mode": "Modo texto sin formato",
"flat-mode-desc": "En modo texto sin formato, el texto se añadirá al campo de la receta seleccionado sin saltos de línea."
}
}
},
"admin": {
"maintenance": {
"storage-details": "Storage Details",
"page-title": "Site Maintenance",
"summary-title": "Summary",
"button-label-get-summary": "Get Summary",
"storage-details": "Detalle del almacenamiento",
"page-title": "Mantenimiento del sitio",
"summary-title": "Índice",
"button-label-get-summary": "Obtener Resumen",
"button-label-open-details": "Detalles",
"info-description-data-dir-size": "Data Directory Size",
"info-description-log-file-size": "Log File Size",
"info-description-cleanable-directories": "Cleanable Directories",
"info-description-cleanable-images": "Cleanable Images",
"info-description-data-dir-size": "Tamaño del directorio de datos",
"info-description-log-file-size": "Tamaño del archivo de registro",
"info-description-cleanable-directories": "Directorios eliminables",
"info-description-cleanable-images": "Imágenes eliminables",
"storage": {
"title-temporary-directory": "Directorio temporal (.temp)",
"title-backups-directory": "Backups Directory (backups)",
"title-groups-directory": "Groups Directory (groups)",
"title-recipes-directory": "Recipes Directory (recipes)",
"title-user-directory": "User Directory (user)"
"title-backups-directory": "Directorio de Copias de Seguridad (respaldos)",
"title-groups-directory": "Directorio de Grupos (grupos)",
"title-recipes-directory": "Directorio de Recetas (recetas)",
"title-user-directory": "Directorio de usuario (usuario)"
},
"action-delete-log-files-name": "Delete Log Files",
"action-delete-log-files-description": "Deletes all the log files",
"action-clean-directories-name": "Clean Directories",
"action-delete-log-files-name": "Borrar archivos de registro",
"action-delete-log-files-description": "Elimina todos los archivos de registro",
"action-clean-directories-name": "Limpiar directorios",
"action-clean-directories-description": "Removes all the recipe folders that are not valid UUIDs",
"action-clean-temporary-files-name": "Eliminar archivos temporales",
"action-clean-temporary-files-description": "Eliminar todos los archivos y carpetas del directorio .temp",
@ -1119,8 +1119,8 @@
"ingredients-natural-language-processor": "Ingredients Natural Language Processor",
"ingredients-natural-language-processor-explanation": "Mealie uses Conditional Random Fields (CRFs) for parsing and processing ingredients. The model used for ingredients is based off a data set of over 100,000 ingredients from a dataset compiled by the New York Times. Note that as the model is trained in English only, you may have varied results when using the model in other languages. This page is a playground for testing the model.",
"ingredients-natural-language-processor-explanation-2": "It's not perfect, but it yields great results in general and is a good starting point for manually parsing ingredients into individual fields. Alternatively, you can also use the \"Brute\" processor that uses a pattern matching technique to identify ingredients.",
"nlp": "NLP",
"brute": "Brute",
"nlp": "PLN",
"brute": "En bruto",
"show-individual-confidence": "Mostrar confianza individual",
"ingredient-text": "Texto del ingrediente",
"average-confident": "{0} Confianza",
@ -1148,31 +1148,31 @@
"user-settings-description": "Administrar preferencias, cambiar contraseña y actualizar correo electrónico",
"api-tokens-description": "Administra tus API Tokens para acceder desde aplicaciones externas",
"group-description": "These items are shared within your group. Editing one of them will change it for the whole group!",
"group-settings": "Group Settings",
"group-settings": "Ajustes de grupo",
"group-settings-description": "Manage your common group settings like mealplan and privacy settings.",
"cookbooks-description": "Manage a collection of recipe categories and generate pages for them.",
"members": "Members",
"members-description": "See who's in your group and manage their permissions.",
"members": "Miembros",
"members-description": "Ver quién está en tu grupo y administrar sus permisos.",
"webhooks-description": "Setup webhooks that trigger on days that you have have mealplan scheduled.",
"notifiers": "Notifiers",
"notifiers": "Notificaciones",
"notifiers-description": "Setup email and push notifications that trigger on specific events.",
"manage-data": "Manage Data",
"manage-data-description": "Manage your Food and Units (more options coming soon)",
"data-migrations": "Data Migrations",
"data-migrations-description": "Migrate your existing data from other applications like Nextcloud Recipes and Chowdown",
"email-sent": "Email Sent",
"error-sending-email": "Error Sending Email",
"personal-information": "Personal Information",
"preferences": "Preferences",
"show-advanced-description": "Show advanced features (API Keys, Webhooks, and Data Management)",
"back-to-profile": "Back to Profile",
"looking-for-privacy-settings": "Looking for Privacy Settings?",
"manage-your-api-tokens": "Manage Your API Tokens",
"manage-user-profile": "Manage User Profile",
"manage-cookbooks": "Manage Cookbooks",
"manage-data": "Administrar datos",
"manage-data-description": "Administra tu Comida y Unidades (próximamente más opciones)",
"data-migrations": "Migración de datos",
"data-migrations-description": "Migrar tus datos existentes de otras aplicaciones como Nextcloud Recipes y Chowdown",
"email-sent": "Email enviado",
"error-sending-email": "Error enviando email",
"personal-information": "Datos Personales",
"preferences": "Preferencias",
"show-advanced-description": "Mostrar características avanzadas (API Keys, Webhooks y Gestión de Datos)",
"back-to-profile": "Volver al perfil",
"looking-for-privacy-settings": "¿Buscas los ajustes de privacidad?",
"manage-your-api-tokens": "Gestiona tus API tokens",
"manage-user-profile": "Administrar Perfil de Usuario",
"manage-cookbooks": "Administrar Recetario",
"manage-members": "Gestionar miembros",
"manage-webhooks": "Manage Webhooks",
"manage-notifiers": "Manage Notifiers",
"manage-webhooks": "Gestionar Webhooks",
"manage-notifiers": "Administrar Notificadores",
"manage-data-migrations": "Administrar Migraciones de Datos"
},
"cookbook": {
@ -1187,7 +1187,7 @@
"require-all-tools": "Requiere todos los utensilios",
"cookbook-name": "Nombre del recetario",
"cookbook-with-name": "Recetario {0}",
"create-a-cookbook": "Create a Cookbook",
"cookbook": "Cookbook"
"create-a-cookbook": "Crear Recetario",
"cookbook": "Recetario"
}
}

View file

@ -200,7 +200,7 @@
"created-on-date": "Gemaakt op {0}",
"unsaved-changes": "Er zijn niet-opgeslagen wijzigingen. Wil je eerst opslaan voordat je vertrekt? Okay om op te slaan, Annuleren om wijzigingen ongedaan te maken.",
"clipboard-copy-failure": "Kopiëren naar klembord mislukt.",
"confirm-delete-generic-items": "Are you sure you want to delete the following items?"
"confirm-delete-generic-items": "Weet u zeker dat u de volgende items wilt verwijderen?"
},
"group": {
"are-you-sure-you-want-to-delete-the-group": "Weet je zeker dat je <b>{groupName}<b/> wil verwijderen?",

View file

@ -707,7 +707,7 @@
"email-configured": "Email настроен",
"email-test-results": "Результаты теста Email",
"ready": "Готово",
"not-ready": "Не готово - Проверьте переменные окружающей среды",
"not-ready": "Не готово - Проверьте переменные окружения",
"succeeded": "Выполнено успешно",
"failed": "Ошибка",
"general-about": "Общая информация",

View file

@ -1,8 +1,8 @@
interface AuthRedirectParams {
interface AdminRedirectParams {
$auth: any
redirect: (path: string) => void
}
export default function ({ $auth, redirect }: AuthRedirectParams) {
export default function ({ $auth, redirect }: AdminRedirectParams) {
// If the user is not an admin redirect to the home page
if (!$auth.user.admin) {
return redirect("/")

View file

@ -0,0 +1,11 @@
interface AdvancedOnlyRedirectParams {
$auth: any
redirect: (path: string) => void
}
export default function ({ $auth, redirect }: AdvancedOnlyRedirectParams) {
// If the user is not allowed to access advanced features redirect to the home page
if (!$auth.user.advanced) {
console.warn("User is not allowed to access advanced features");
return redirect("/")
}
}

View file

@ -0,0 +1,12 @@
interface CanManageRedirectParams {
$auth: any
redirect: (path: string) => void
}
export default function ({ $auth, redirect }: CanManageRedirectParams) {
// If the user is not allowed to manage group settings redirect to the home page
console.log($auth.user)
if (!$auth.user.canManage) {
console.warn("User is not allowed to manage group settings");
return redirect("/")
}
}

View file

@ -0,0 +1,11 @@
interface CanOrganizeRedirectParams {
$auth: any
redirect: (path: string) => void
}
export default function ({ $auth, redirect }: CanOrganizeRedirectParams) {
// If the user is not allowed to organize redirect to the home page
if (!$auth.user.canOrganize) {
console.warn("User is not allowed to organize data");
return redirect("/")
}
}

View file

@ -0,0 +1,12 @@
interface GroupOnlyRedirectParams {
$auth: any
route: any
redirect: (path: string) => void
}
export default function ({ $auth, route, redirect }: GroupOnlyRedirectParams) {
// this can only be used for routes that have a groupSlug parameter (e.g. /g/:groupSlug/...)
if (route.params.groupSlug !== $auth.user.groupSlug) {
redirect("/")
}
}

View file

@ -28,7 +28,7 @@
"date-fns": "^2.29.3",
"fuse.js": "^6.6.2",
"isomorphic-dompurify": "^1.0.0",
"nuxt": "^2.16.0",
"nuxt": "^2.17.3",
"v-jsoneditor": "^1.4.5",
"vue-advanced-cropper": "^1.11.6",
"vuedraggable": "^2.24.3",
@ -56,8 +56,8 @@
},
"resolutions": {
"@nuxtjs/i18n/**/ufo": "0.7.9",
"vue-template-compiler": "2.7.14",
"vue-demi": "^0.13.11",
"vue-template-compiler": "2.7.16",
"postcss-preset-env": "^7.0.0",
"typescript": "^4.9.5"
}

View file

@ -31,7 +31,24 @@
<BaseButton type="button" :loading="generatingToken" create @click.prevent="handlePasswordReset">
{{ $t("user.generate-password-reset-link") }}
</BaseButton>
<AppButtonCopy v-if="resetUrl" :copy-text="resetUrl"></AppButtonCopy>
</div>
<div v-if="resetUrl" class="mb-2">
<v-card-text>
<p class="text-center pb-0">
{{ resetUrl }}
</p>
</v-card-text>
<v-card-actions class="align-center pt-0" style="gap: 4px">
<BaseButton cancel @click="resetUrl = ''"> {{ $t("general.close") }} </BaseButton>
<v-spacer></v-spacer>
<BaseButton v-if="user.email" color="info" class="mr-1" @click="sendResetEmail">
<template #icon>
{{ $globals.icons.email }}
</template>
{{ $t("user.email") }}
</BaseButton>
<AppButtonCopy :icon="false" color="info" :copy-text="resetUrl" />
</v-card-actions>
</div>
<AutoForm v-model="user" :items="userForm" update-mode :disabled-fields="disabledFields" />
@ -46,7 +63,7 @@
<script lang="ts">
import { computed, defineComponent, useRoute, onMounted, ref, useContext } from "@nuxtjs/composition-api";
import { useAdminApi } from "~/composables/api";
import { useAdminApi, useUserApi } from "~/composables/api";
import { useGroups } from "~/composables/use-groups";
import { alert } from "~/composables/use-toast";
import { useUserForm } from "~/composables/use-users";
@ -118,6 +135,17 @@ export default defineComponent({
generatingToken.value = false;
}
const userApi = useUserApi();
async function sendResetEmail() {
if (!user.value?.email) return;
const { response } = await userApi.email.sendForgotPassword({ email: user.value.email });
if (response && response.status === 200) {
alert.success(i18n.tc("profile.email-sent"));
} else {
alert.error(i18n.tc("profile.error-sending-email"));
}
}
return {
user,
disabledFields,
@ -130,6 +158,7 @@ export default defineComponent({
handlePasswordReset,
resetUrl,
generatingToken,
sendResetEmail,
};
},
});

View file

@ -98,31 +98,23 @@
</template>
<script lang="ts">
import { defineComponent, reactive, ref, useRouter } from "@nuxtjs/composition-api";
import { defineComponent, reactive, ref } from "@nuxtjs/composition-api";
import draggable from "vuedraggable";
import { useCookbooks } from "@/composables/use-group-cookbooks";
import { useLoggedInState } from "~/composables/use-logged-in-state";
import CookbookEditor from "~/components/Domain/Cookbook/CookbookEditor.vue";
import { ReadCookBook } from "~/lib/api/types/cookbook";
export default defineComponent({
components: { CookbookEditor, draggable },
middleware: ["auth", "group-only"],
setup() {
const { isOwnGroup, loggedIn } = useLoggedInState();
const router = useRouter();
if (!(loggedIn.value && isOwnGroup.value)) {
router.back();
}
const dialogStates = reactive({
create: false,
delete: false,
});
const { cookbooks, actions } = useCookbooks();
// create
const createTarget = ref<ReadCookBook | null>(null);
async function createCookbook() {
@ -146,7 +138,6 @@ export default defineComponent({
dialogStates.delete = false;
deleteTarget.value = null;
}
return {
cookbooks,
actions,

View file

@ -48,46 +48,54 @@
</div>
<v-expansion-panels v-model="panels" multiple>
<v-expansion-panel v-for="(ing, index) in parsedIng" :key="index">
<v-expansion-panel-header class="my-0 py-0" disable-icon-rotate>
<template #default="{ open }">
<v-fade-transition>
<span v-if="!open" key="0"> {{ ing.input }} </span>
</v-fade-transition>
</template>
<template #actions>
<v-icon left :color="isError(ing) ? 'error' : 'success'">
{{ isError(ing) ? $globals.icons.alert : $globals.icons.check }}
</v-icon>
<div class="my-auto" :color="isError(ing) ? 'error-text' : 'success-text'">
{{ ing.confidence ? asPercentage(ing.confidence.average) : "" }}
</div>
</template>
</v-expansion-panel-header>
<v-expansion-panel-content class="pb-0 mb-0">
<RecipeIngredientEditor v-model="parsedIng[index].ingredient" allow-insert-ingredient @insert-ingredient="insertIngredient(index)" @delete="deleteIngredient(index)" />
{{ ing.input }}
<v-card-actions>
<v-spacer />
<BaseButton
v-if="errors[index].unitError && errors[index].unitErrorMessage !== ''"
color="warning"
small
@click="createUnit(ing.ingredient.unit, index)"
>
{{ errors[index].unitErrorMessage }}
</BaseButton>
<BaseButton
v-if="errors[index].foodError && errors[index].foodErrorMessage !== ''"
color="warning"
small
@click="createFood(ing.ingredient.food, index)"
>
{{ errors[index].foodErrorMessage }}
</BaseButton>
</v-card-actions>
</v-expansion-panel-content>
</v-expansion-panel>
<draggable
v-if="parsedIng.length > 0"
v-model="parsedIng"
handle=".handle"
:style="{ width: '100%' }"
ghost-class="ghost"
>
<v-expansion-panel v-for="(ing, index) in parsedIng" :key="index">
<v-expansion-panel-header class="my-0 py-0" disable-icon-rotate>
<template #default="{ open }">
<v-fade-transition>
<span v-if="!open" key="0"> {{ ing.input }} </span>
</v-fade-transition>
</template>
<template #actions>
<v-icon left :color="isError(ing) ? 'error' : 'success'">
{{ isError(ing) ? $globals.icons.alert : $globals.icons.check }}
</v-icon>
<div class="my-auto" :color="isError(ing) ? 'error-text' : 'success-text'">
{{ ing.confidence ? asPercentage(ing.confidence.average) : "" }}
</div>
</template>
</v-expansion-panel-header>
<v-expansion-panel-content class="pb-0 mb-0">
<RecipeIngredientEditor v-model="parsedIng[index].ingredient" allow-insert-ingredient @insert-ingredient="insertIngredient(index)" @delete="deleteIngredient(index)" />
{{ ing.input }}
<v-card-actions>
<v-spacer />
<BaseButton
v-if="errors[index].unitError && errors[index].unitErrorMessage !== ''"
color="warning"
small
@click="createUnit(ing.ingredient.unit, index)"
>
{{ errors[index].unitErrorMessage }}
</BaseButton>
<BaseButton
v-if="errors[index].foodError && errors[index].foodErrorMessage !== ''"
color="warning"
small
@click="createFood(ing.ingredient.food, index)"
>
{{ errors[index].foodErrorMessage }}
</BaseButton>
</v-card-actions>
</v-expansion-panel-content>
</v-expansion-panel>
</draggable>
</v-expansion-panels>
</v-container>
</v-container>
@ -96,6 +104,7 @@
<script lang="ts">
import { computed, defineComponent, ref, useContext, useRoute, useRouter } from "@nuxtjs/composition-api";
import { invoke, until } from "@vueuse/core";
import draggable from "vuedraggable";
import {
CreateIngredientFood,
CreateIngredientUnit,
@ -122,7 +131,9 @@ interface Error {
export default defineComponent({
components: {
RecipeIngredientEditor,
draggable
},
middleware: ["auth", "group-only"],
setup() {
const { $auth } = useContext();
const panels = ref<number[]>([]);

View file

@ -33,6 +33,7 @@ import AdvancedOnly from "~/components/global/AdvancedOnly.vue";
export default defineComponent({
components: { AdvancedOnly },
middleware: ["auth", "group-only"],
setup() {
const { $auth, $globals, i18n } = useContext();

View file

@ -22,6 +22,7 @@ export default defineComponent({
components: {
RecipeOrganizerPage,
},
middleware: ["auth", "group-only"],
setup() {
const { items, actions } = useCategoryStore();

View file

@ -22,6 +22,7 @@ export default defineComponent({
components: {
RecipeOrganizerPage,
},
middleware: ["auth", "group-only"],
setup() {
const { items, actions } = useTagStore();

View file

@ -17,6 +17,7 @@ import RecipeTimeline from "~/components/Domain/Recipe/RecipeTimeline.vue";
export default defineComponent({
components: { RecipeTimeline },
middleware: ["auth", "group-only"],
setup() {
const api = useUserApi();
const ready = ref<boolean>(false);

View file

@ -22,6 +22,7 @@ export default defineComponent({
components: {
RecipeOrganizerPage,
},
middleware: ["auth", "group-only"],
setup() {
const toolStore = useToolStore();
const dialog = ref(false);

View file

@ -30,6 +30,7 @@
import { computed, defineComponent, useContext, useRoute } from "@nuxtjs/composition-api";
export default defineComponent({
middleware: ["auth", "can-organize-only"],
props: {
value: {
type: Boolean,

View file

@ -227,7 +227,6 @@ import { useFoodStore, useLabelStore } from "~/composables/store";
import { VForm } from "~/types/vuetify";
export default defineComponent({
components: { MultiPurposeLabel, RecipeDataAliasManagerDialog },
setup() {
const userApi = useUserApi();

View file

@ -65,6 +65,7 @@ import { useGroupSelf } from "~/composables/use-groups";
import { ReadGroupPreferences } from "~/lib/api/types/group";
export default defineComponent({
middleware: ["auth", "can-manage-only"],
setup() {
const { group, actions: groupActions } = useGroupSelf();

View file

@ -46,6 +46,7 @@ import { isSameDay, addDays, parseISO } from "date-fns";
import { useMealplans } from "~/composables/use-group-mealplan";
export default defineComponent({
middleware: ["auth"],
setup() {
const route = useRoute();
const router = useRouter();

View file

@ -39,6 +39,7 @@
:recipe-id="mealplan.recipe ? mealplan.recipe.id : ''"
class="mb-2"
:route="mealplan.recipe ? true : false"
:rating="mealplan.recipe ? mealplan.recipe.rating : 0"
:slug="mealplan.recipe ? mealplan.recipe.slug : mealplan.title"
:description="mealplan.recipe ? mealplan.recipe.description : mealplan.text"
:name="mealplan.recipe ? mealplan.recipe.name : mealplan.title"

View file

@ -98,6 +98,7 @@ export default defineComponent({
GroupMealPlanRuleForm,
RecipeChips,
},
middleware: ["auth"],
props: {
value: {
type: Boolean,

View file

@ -78,6 +78,7 @@ export default defineComponent({
components: {
UserAvatar,
},
middleware: ["auth"],
setup() {
const api = useUserApi();

View file

@ -85,6 +85,7 @@ const MIGRATIONS = {
};
export default defineComponent({
middleware: ["auth", "advanced-only"],
setup() {
const { $globals, i18n } = useContext();

View file

@ -124,6 +124,7 @@ interface OptionSection {
}
export default defineComponent({
middleware: ["auth", "advanced-only"],
setup() {
const api = useUserApi();

View file

@ -34,6 +34,7 @@ import { useUserApi } from "~/composables/api";
import { ReportOut } from "~/lib/api/types/reports";
export default defineComponent({
middleware: "auth",
setup() {
const route = useRoute();
const id = route.value.params.id;

View file

@ -50,6 +50,7 @@ import GroupWebhookEditor from "~/components/Domain/Group/GroupWebhookEditor.vue
export default defineComponent({
components: { GroupWebhookEditor },
middleware: ["auth", "advanced-only"],
setup() {
const { actions, webhooks } = useGroupWebhooks();

View file

@ -235,6 +235,7 @@ export default defineComponent({
RecipeList,
ShoppingListItemEditor,
},
middleware: "auth",
setup() {
const { $auth, i18n } = useContext();
const preferences = useShoppingListPreferences();
@ -643,15 +644,15 @@ export default defineComponent({
// Create New Item
const createEditorOpen = ref(false);
const createListItemData = ref<ShoppingListItemCreate>(ingredientResetFactory());
const createListItemData = ref<ShoppingListItemCreate>(listItemFactory());
function ingredientResetFactory(): ShoppingListItemCreate {
function listItemFactory(isFood = false): ShoppingListItemCreate {
return {
shoppingListId: id,
checked: false,
position: shoppingList.value?.listItems?.length || 1,
isFood: false,
quantity: 1,
isFood,
quantity: 0,
note: "",
labelId: undefined,
unitId: undefined,
@ -664,6 +665,11 @@ export default defineComponent({
return;
}
if (!createListItemData.value.foodId && !createListItemData.value.note) {
// don't create an empty item
return;
}
loadingCounter.value += 1;
// make sure it's inserted into the end of the list, which may have been updated
@ -674,8 +680,7 @@ export default defineComponent({
loadingCounter.value -= 1;
if (data) {
createListItemData.value = ingredientResetFactory();
createEditorOpen.value = false;
createListItemData.value = listItemFactory(createListItemData.value.isFood || false);
refresh();
}
}

View file

@ -44,6 +44,7 @@ import { useUserApi } from "~/composables/api";
import { useAsyncKey } from "~/composables/use-utils";
export default defineComponent({
middleware: "auth",
setup() {
const { $auth } = useContext();
const userApi = useUserApi();

View file

@ -14,6 +14,7 @@ import { useAsyncKey } from "~/composables/use-utils";
export default defineComponent({
components: { RecipeCardSection },
middleware: "auth",
setup() {
const api = useUserApi();
const route = useRoute();

View file

@ -69,6 +69,7 @@ import { useUserApi } from "~/composables/api";
import { VForm } from "~/types/vuetify";
export default defineComponent({
middleware: ["auth", "advanced-only"],
setup() {
const nuxtContext = useContext();

View file

@ -135,6 +135,7 @@ export default defineComponent({
UserAvatar,
UserPasswordStrength,
},
middleware: "auth",
setup() {
const { $auth } = useContext();
const user = computed(() => $auth.user as unknown as UserOut);

View file

@ -113,7 +113,7 @@
<p>{{ $t('profile.group-description') }}</p>
</div>
<v-row tag="section">
<v-col cols="12" sm="12" md="6">
<v-col v-if="$auth.user.canManage" cols="12" sm="12" md="6">
<UserProfileLinkCard
:link="{ text: $tc('profile.group-settings'), to: `/group` }"
:image="require('~/static/svgs/manage-group-settings.svg')"
@ -162,17 +162,16 @@
</UserProfileLinkCard>
</v-col>
</AdvancedOnly>
<AdvancedOnly>
<v-col cols="12" sm="12" md="6">
<UserProfileLinkCard
:link="{ text: $tc('profile.manage-data'), to: `/group/data/foods` }"
:image="require('~/static/svgs/manage-recipes.svg')"
>
<template #title> {{ $t('profile.manage-data') }} </template>
{{ $t('profile.manage-data-description') }}
</UserProfileLinkCard>
</v-col>
</AdvancedOnly>
<!-- $auth.user.canOrganize should not be null because of the auth middleware -->
<v-col v-if="$auth.user.canOrganize" cols="12" sm="12" md="6">
<UserProfileLinkCard
:link="{ text: $tc('profile.manage-data'), to: `/group/data/foods` }"
:image="require('~/static/svgs/manage-recipes.svg')"
>
<template #title> {{ $t('profile.manage-data') }} </template>
{{ $t('profile.manage-data-description') }}
</UserProfileLinkCard>
</v-col>
<AdvancedOnly>
<v-col cols="12" sm="12" md="6">
<UserProfileLinkCard
@ -208,6 +207,7 @@ export default defineComponent({
UserAvatar,
StatsCards,
},
middleware: "auth",
scrollToTop: true,
setup() {
const { $auth, i18n } = useContext();

File diff suppressed because it is too large Load diff