diff --git a/boot.sh b/boot.sh index 1a6cdb521..313fbd42d 100644 --- a/boot.sh +++ b/boot.sh @@ -1,8 +1,30 @@ #!/bin/sh source venv/bin/activate - TANDOOR_PORT="${TANDOOR_PORT:-8080}" +NGINX_CONF_FILE=/opt/recipes/nginx/conf.d/Recipes.conf + +display_warning() { + echo "[WARNING]" + echo -e "$1" +} + +echo "Checking configuration..." + +# Nginx config file must exist if gunicorn is not active +if [ ! -f "$NGINX_CONF_FILE" ] && [ $GUNICORN_MEDIA -eq 0 ]; then + display_warning "Nginx configuration file could not be found at the default location!\nPath: ${NGINX_CONF_FILE}" +fi + +# SECRET_KEY must be set in .env file +if [ -z "${SECRET_KEY}" ]; then + display_warning "The environment variable 'SECRET_KEY' is not set but REQUIRED for running Tandoor!" +fi + +# POSTGRES_PASSWORD must be set in .env file +if [ -z "${POSTGRES_PASSWORD}" ]; then + display_warning "The environment variable 'POSTGRES_PASSWORD' is not set but REQUIRED for running Tandoor!" +fi echo "Waiting for database to be ready..." @@ -36,4 +58,4 @@ echo "Done" chmod -R 755 /opt/recipes/mediafiles -exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi +exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi \ No newline at end of file diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 8a1462a25..6fefc11ab 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -12,6 +12,7 @@ from django.contrib.auth.models import Group from django.contrib.auth.password_validation import validate_password from django.core.exceptions import ValidationError from django.db.models import Avg, Q, Sum +from django.db.models.functions import Lower from django.http import HttpResponseRedirect, JsonResponse from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse, reverse_lazy diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 0bd118fa6..14ccd0c3f 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -210,6 +210,18 @@ {{ $t("File") }} + + {{ $t("paste_ingredients") }} + @@ -516,6 +528,17 @@ + + + + + @@ -574,7 +597,8 @@ export default { recipes_loading: false, message: "", options_limit: 25, - + paste_ingredients: undefined, + paste_step: undefined, show_file_create: false, step_for_file_create: undefined, } @@ -942,6 +966,29 @@ export default { energy: function () { return energyHeading() }, + appendIngredients: function () { + let ing_list = this.paste_ingredients.split(/\r?\n/) + let step = this.recipe.steps.findIndex((x) => x.id == this.paste_step) + let order = Math.max(...this.recipe.steps[step].ingredients.map((x) => x.order), -1) + 1 + this.recipe.steps[step].ingredients_visible = true + ing_list.forEach((ing) => { + if (ing.trim() !== "") { + this.genericPostAPI("api_ingredient_from_string", { text: ing }).then((result) => { + let unit = null + if (result.data.unit !== "") { + unit = { name: result.data.unit } + } + this.recipe.steps[step].ingredients.splice(order, 0, { + amount: result.data.amount, + unit: unit, + food: { name: result.data.food }, + note: result.data.note, + }) + }) + order++ + } + }) + }, }, } diff --git a/vue/src/components/MealPlanEditModal.vue b/vue/src/components/MealPlanEditModal.vue index cb1d72434..0dc944225 100644 --- a/vue/src/components/MealPlanEditModal.vue +++ b/vue/src/components/MealPlanEditModal.vue @@ -207,8 +207,7 @@ export default { if (!cancel) { console.log("saving", { ...this.mealplan_settings, ...this.entryEditing }) this.$bvModal.hide(`edit-modal`) - this.$emit("save-entry", { ...this.mealplan_settings, ...this.entryEditing }) - console.log("after emit", { ...this.mealplan_settings, ...this.entryEditing }.addshopping) + this.$emit("save-entry", { ...this.mealplan_settings, ...this.entryEditing, ...{ addshopping: this.entryEditing.addshopping && !this.autoMealPlan } }) } }, deleteEntry() { diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index d941bfef3..722b7fc0f 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -298,5 +298,8 @@ "review_shopping": "Review shopping entries before saving", "view_recipe": "View Recipe", "copy_to_new": "Copy To New Recipe", - "recipe_name": "Recipe Name" + "recipe_name": "Recipe Name", + "paste_ingredients_placeholder": "Paste ingredient list here...", + "paste_ingredients": "Paste Ingredients", + "ingredient_list": "Ingredient List" } diff --git a/vue/yarn.lock b/vue/yarn.lock index a3ed32e1f..f34632674 100644 --- a/vue/yarn.lock +++ b/vue/yarn.lock @@ -5369,9 +5369,9 @@ flush-write-stream@^1.0.0: readable-stream "^2.3.6" follow-redirects@^1.0.0, follow-redirects@^1.14.4: - version "1.14.7" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685" - integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ== + version "1.14.8" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc" + integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA== for-in@^1.0.2: version "1.0.2"