Merge branch 'develop' into feature/kilojoules

This commit is contained in:
vabene1111
2021-11-01 09:46:04 +01:00
committed by GitHub
44 changed files with 1284 additions and 1655 deletions

View File

@ -41,10 +41,17 @@ SHOPPING_MIN_AUTOSYNC_INTERVAL=5
# Default for user setting sticky navbar
# STICKY_NAV_PREF_DEFAULT=1
# If staticfiles are stored at a different location uncomment and change accordingly
# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# SCRIPT_NAME=/recipes
# If staticfiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# STATIC_URL=/static/
# If mediafiles are stored at a different location uncomment and change accordingly
# If mediafiles are stored at a different location uncomment and change accordingly, MUST END IN /
# this is not required if you are just using a subfolder
# This can either be a relative path from the applications base path or the url of an external host
# MEDIA_URL=/media/
# Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. Please use any of the examples
@ -79,8 +86,6 @@ GUNICORN_MEDIA=0
# when unset: 0 (false)
REVERSE_PROXY_AUTH=0
# If base URL is something other than just / (you are serving a subfolder in your proxy for instance http://recipe_app/recipes/)
# SCRIPT_NAME=/recipes
# Default settings for spaces, apply per space and can be changed in the admin view
# SPACE_DEFAULT_MAX_RECIPES=0 # 0=unlimited recipes
# SPACE_DEFAULT_MAX_USERS=0 # 0=unlimited users per space

View File

@ -50,4 +50,4 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: '🚀 A new Version of tandoor has been released 🥳 \n https://github.com/vabene1111/recipes/releases/tag/{{ steps.get_version.outputs.VERSION }}'
args: '🚀 A new Version of tandoor has been released 🥳 \n https://github.com/vabene1111/recipes/releases/tag/{{GITHUB_REF/refs\/tags\//}}'

View File

@ -1,7 +1,7 @@
FROM python:3.9-alpine3.12
#Install all dependencies.
RUN apk add --no-cache postgresql-libs gettext zlib libjpeg libxml2-dev libxslt-dev py-cryptography
RUN apk add --no-cache postgresql-libs gettext zlib libjpeg libwebp libxml2-dev libxslt-dev py-cryptography
#Print all logs without buffering it.
ENV PYTHONUNBUFFERED 1
@ -15,7 +15,7 @@ WORKDIR /opt/recipes
COPY requirements.txt ./
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libressl-dev libffi-dev cargo openssl-dev openldap-dev && \
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev libffi-dev cargo openssl-dev openldap-dev && \
python -m venv venv && \
/opt/recipes/venv/bin/python -m pip install --upgrade pip && \
venv/bin/pip install wheel==0.36.2 && \

View File

@ -1,6 +1,6 @@
<h1 align="center">
<br>
<a href="https://app.tandoor.dev"><img src="https://github.com/vabene1111/recipes/raw/develop/docs/logo_color.svg" height="256px" width="256px"></a>
<a href="https://tandoor.dev"><img src="https://github.com/vabene1111/recipes/raw/develop/docs/logo_color.svg" height="256px" width="256px"></a>
<br>
Tandoor Recipes
<br>
@ -15,49 +15,77 @@
<a href="https://discord.gg/RhzBrfWgtp" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/badge/icon/discord?icon=discord&label" ></a>
<a href="https://hub.docker.com/r/vabene1111/recipes" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/docker/pulls/vabene1111/recipes" ></a>
<a href="https://github.com/vabene1111/recipes/releases/latest" rel="noopener noreferrer"><img src="https://img.shields.io/github/v/release/vabene1111/recipes" ></a>
<a href="https://app.tandoor.dev/accounts/login/?demo" rel="noopener noreferrer"><img src="https://img.shields.io/badge/demo-available-success" ></a>
</p>
<p align="center">
<a href="https://tandoor.dev" target="_blank" rel="noopener noreferrer">Website</a>
<a href="https://docs.tandoor.dev/install/docker/" target="_blank" rel="noopener noreferrer">Installation</a>
<a href="https://docs.tandoor.dev/" target="_blank" rel="noopener noreferrer">Documentation</a>
<a href="https://docs.tandoor.dev/" target="_blank" rel="noopener noreferrer">Docs</a>
<a href="https://app.tandoor.dev/accounts/login/?demo" target="_blank" rel="noopener noreferrer">Demo</a>
<a href="https://discord.gg/RhzBrfWgtp" target="_blank" rel="noopener noreferrer">Discord server</a>
<a href="https://discord.gg/RhzBrfWgtp" target="_blank" rel="noopener noreferrer">Discord</a>
</p>
![Preview](docs/preview.png)
# Your Feedback
## Core Features
- 🥗 **Manage your recipes** - Manage your ever growing recipe collection
- 📆 **Plan** - multiple meals for each day
- 🛒 **Shopping lists** - via the meal plan or straight from recipes
- 📚 **Cookbooks** - collect recipes into books
- 👪 **Share and collaborate** on recipes with friends and family
Share some information on how you use Tandoor to help me improve the application [Google Survey](https://forms.gle/qNfLK2tWTeWHe9Qd7)
## Made by and for power users
## Features
- 📦 **Sync** files with Dropbox and Nextcloud (more can easily be added)
- 🔍 Powerful **search** with Djangos [TrigramSimilarity](https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/search/#trigram-similarity)
- 🔍 Powerful & customizable **search** with fulltext support and [TrigramSimilarity](https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/search/#trigram-similarity)
- 🏷️ Create and search for **tags**, assign them in batch to all files matching certain filters
- 📄 **Create recipes** locally within a nice, standardized web interface
- **Import recipes** from thousands of websites supporting [ld+json or microdata](https://schema.org/Recipe)
- 📱 Optimized for use on **mobile** devices like phones and tablets
- 🛒 Generate **shopping** lists from recipes
- 📆 Create a **Plan** on what to eat when
- 👪 **Share** recipes with friends and comment on them to suggest or remember changes you made
- ➗ automatically convert decimal units to **fractions** for those who like this
- 🐳 Easy setup with **Docker** and included examples for Kubernetes, Unraid and Synology
- ↔️ Quickly merge and rename ingredients, tags and units
- 📥 **Import recipes** from thousands of websites supporting [ld+json or microdata](https://schema.org/Recipe)
- ➗ Support for **fractions** or decimals
- 🐳 Easy setup with **Docker** and included examples for **Kubernetes**, **Unraid** and **Synology**
- 🎨 Customize your interface with **themes**
- ✉️ Export and import recipes from other users
- 📦 **Sync** files with Dropbox and Nextcloud
## All the must haves
- 📱Optimized for use on **mobile** devices
- 🌍 localized in many languages thanks to the awesome community
- Many more like recipe scaling, image compression, cookbooks, printing views, ...
- 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/)
- Many more like recipe scaling, image compression, printing views and supermarkets
This application is meant for people with a collection of recipes they want to share with family and friends or simply
store them in a nicely organized way. A basic permission system exists but this application is not meant to be run as
a public page.
## Docs
Documentation can be found [here](https://docs.tandoor.dev/).
While this application has been around for a while and is actively used by many (including myself), it is still considered
**beta** software that has a lot of rough edges and unpolished parts.
## Contributing
You can help out with the ongoing development by looking for potential bugs in our code base, or by contributing new features. We are always welcoming new pull requests containing bug fixes, refactors and new features. We have a list of tasks and bugs on our issue tracker on Github. Please comment on issues if you want to contribute with, to avoid duplicating effort.
## Your Feedback
Share some information on how you use Tandoor to help me improve the application [Google Survey](https://forms.gle/qNfLK2tWTeWHe9Qd7)
## Get in touch
<table>
<tr>
<td><a href="https://discord.gg/RhzBrfWgtp">Discord</a></td>
<td>We have a public Discord server that anyone can join. This is where all our developers and contributors hang out and where we make announcements</td>
</tr>
<tr>
<td><a href="https://twitter.com/TandoorRecipes">Twitter</a></td>
<td>You can follow our Twitter account to get updates on new features or releases</td>
</tr>
</table>
## License
Beginning with version 0.10.0 the code in this repository is licensed under the [GNU AGPL v3](https://www.gnu.org/licenses/agpl-3.0.de.html) license with an
Beginning with version 0.10.0 the code in this repository is licensed under the [GNU AGPL v3](https://www.gnu.org/licenses/agpl-3.0.de.html) license with a
[common clause](https://commonsclause.com/) selling exception. See [LICENSE.md](https://github.com/vabene1111/recipes/blob/develop/LICENSE.md) for details.
> NOTE: There appears to be a whole range of legal issues with licensing anything else then the standard completely open licenses.
@ -68,8 +96,8 @@ Beginning with version 0.10.0 the code in this repository is licensed under the
**This software and *all* its features are and will always be free for everyone to use and enjoy.**
The reason for the selling exception is that a significant amount of time was spend over multiple years to develop this software.
A payed hosted version which will be identical in features and code base to the software offered in this repository will
A paid hosted version which will be identical in features and code base to the software offered in this repository will
likely be released in the future (including all features needed to sell a hosted version as they might also be useful for personal use).
This will not only benefit me personally but also everyone who self-hosts this software as any profits made trough selling the hosted option
This will not only benefit me personally but also everyone who self-hosts this software as any profits made through selling the hosted option
allow me to spend more time developing and improving the software for everyone. Selling exceptions are [approved by Richard Stallman](http://www.gnu.org/philosophy/selling-exceptions.en.html) and the
common clause license is very permissive (see the [FAQ](https://commonsclause.com/)).

View File

@ -14,10 +14,10 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: 2021-09-07 16:06+0000\n"
"Last-Translator: Afaren <Afaren@outlook.com>\n"
"Language-Team: French <http://translate.tandoor.dev/projects/tandoor/recipes-"
"backend/fr/>\n"
"PO-Revision-Date: 2021-10-26 10:06+0000\n"
"Last-Translator: tarek EL SOL <tarek.elsol@gmail.com>\n"
"Language-Team: French <http://translate.tandoor.dev/projects/tandoor/"
"recipes-backend/fr/>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -305,7 +305,7 @@ msgstr ""
#: .\cookbook\forms.py:500
msgid "Partial Match"
msgstr ""
msgstr "correspondance partielle"
#: .\cookbook\forms.py:501
msgid "Starts Wtih"

View File

@ -13,7 +13,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-09-13 22:40+0200\n"
"PO-Revision-Date: 2021-10-02 12:25+0000\n"
"PO-Revision-Date: 2021-10-26 10:06+0000\n"
"Last-Translator: Jesse <jesse.kamps@pm.me>\n"
"Language-Team: Dutch <http://translate.tandoor.dev/projects/tandoor/"
"recipes-backend/nl/>\n"
@ -58,7 +58,7 @@ msgid ""
"Users with whom newly created meal plan/shopping list entries should be "
"shared by default."
msgstr ""
"Gebruikers waarmee nieuwe maaltijdplannen/boodschappenlijstjes standaard "
"Gebruikers waarmee een nieuw maaltijdplan/boodschappenlijst standaard "
"gedeeld moeten worden."
#: .\cookbook\forms.py:59
@ -71,7 +71,7 @@ msgstr "Aantal decimalen om ingrediënten op af te ronden."
#: .\cookbook\forms.py:61
msgid "If you want to be able to create and see comments underneath recipes."
msgstr "Als je opmerkingen bij recepten wil kunnen maken en zien."
msgstr "Als je opmerkingen onder recepten wil kunnen maken en zien."
#: .\cookbook\forms.py:63
msgid ""
@ -842,7 +842,7 @@ msgstr "Winkelen"
#: .\cookbook\templates\base.html:113
msgid "Keyword"
msgstr "Etiket"
msgstr "Etiketten"
#: .\cookbook\templates\base.html:137
#: .\cookbook\templates\forms\ingredients.html:24
@ -874,7 +874,7 @@ msgstr "Recept importeren"
#: .\cookbook\templates\shopping_list.html:188
#: .\cookbook\templates\shopping_list.html:210
msgid "Create"
msgstr "Maak"
msgstr "Nieuw recept"
#: .\cookbook\templates\base.html:207 .\cookbook\templates\space.html:7
#: .\cookbook\templates\space.html:19
@ -1028,11 +1028,11 @@ msgid ""
" "
msgstr ""
"\n"
" Het volgende formulier kan worden gebruikt wanneer per ongeluk twee "
"(of meer) eenheden of ingrediënten zijn gemaakt die eigenlijk hetzelfde "
"zijn.\n"
" Het voegt de twee eenheden of ingrediënten samen en past alle bijbehorende "
"recepten aan.\n"
" Het volgende formulier kan worden gebruikt wanneer per ongeluk twee ("
"of meer) eenheden of ingrediënten zijn gemaakt die eigenlijk\n"
" hetzelfde zijn\n"
" Het voegt de twee eenheden of ingrediënten samen en past alle "
"bijbehorende recepten aan.\n"
" "
#: .\cookbook\templates\forms\ingredients.html:26
@ -1068,7 +1068,7 @@ msgstr "Origineel bestand verwijderen"
#: .\cookbook\templates\generic\list_template.html:6
#: .\cookbook\templates\generic\list_template.html:21
msgid "List"
msgstr "Lijst"
msgstr " "
#: .\cookbook\templates\generic\list_template.html:34
msgid "Filter"
@ -1201,13 +1201,14 @@ msgstr ""
"\n"
" Markdown is een lichtgewicht opmaak taal die gebruikt kan worden om "
"tekst eenvoudig op te maken.\n"
" Deze site gebruikt de <a href=\"https://python-markdown.github.io/\" target="
"\"_blank\">Python Markdown</a> bibliotheek\n"
" om je tekst in mooi uitziende HTML om te zetten. De volledige documentatie "
"kan \n"
" <a href=\"https://daringfireball.net/projects/markdown/syntax\" target="
"\"_blank\">hier</a>gevonden worden.\n"
" Onvolledige, maar waarschijnlijk voldoende, informatie staat hieronder.\n"
" Deze site gebruikt de <a href=\"https://python-markdown.github.io/\" "
"target=\"_blank\">Python Markdown</a> bibliotheek\n"
" om je tekst in mooi uitziende HTML om te zetten. De volledige "
"documentatie kan \n"
" <a href=\"https://daringfireball.net/projects/markdown/syntax\" "
"target=\"_blank\">hier</a>gevonden worden.\n"
" Onvolledige, maar waarschijnlijk voldoende, informatie staat "
"hieronder.\n"
" "
#: .\cookbook\templates\markdown_info.html:25
@ -1216,7 +1217,7 @@ msgstr "Koppen"
#: .\cookbook\templates\markdown_info.html:54
msgid "Formatting"
msgstr "Formattering"
msgstr "Opmaak"
#: .\cookbook\templates\markdown_info.html:56
#: .\cookbook\templates\markdown_info.html:72
@ -1299,7 +1300,7 @@ msgstr ""
#: .\cookbook\templates\markdown_info.html:132
#: .\cookbook\templates\markdown_info.html:145
msgid "This will become an image"
msgstr "Dit wordt een plaatje"
msgstr "Dit wordt een afbeelding"
#: .\cookbook\templates\markdown_info.html:152
msgid "Tables"
@ -1372,7 +1373,7 @@ msgstr "Maak alleen een notitie"
#: .\cookbook\templates\shopping_list.html:29
#: .\cookbook\templates\shopping_list.html:714
msgid "Shopping List"
msgstr "Boodschappenlijstje"
msgstr "Boodschappenlijst"
#: .\cookbook\templates\meal_plan.html:172
msgid "Shopping list currently empty"
@ -1380,7 +1381,7 @@ msgstr "Boodschappenlijst is momenteel leeg"
#: .\cookbook\templates\meal_plan.html:175
msgid "Open Shopping List"
msgstr "Open boodschappenlijstje"
msgstr "Open boodschappenlijst"
#: .\cookbook\templates\meal_plan.html:189
msgid "Plan"
@ -1405,15 +1406,15 @@ msgstr ""
#: .\cookbook\templates\meal_plan.html:217
#: .\cookbook\templates\meal_plan.html:294
msgid "Edit plan types"
msgstr "Bewerk plan soorten"
msgstr "Bewerk maaltijdplan types"
#: .\cookbook\templates\meal_plan.html:219
msgid "Show help"
msgstr "Toon help"
msgstr "Help"
#: .\cookbook\templates\meal_plan.html:220
msgid "Week iCal export"
msgstr "Week iCal export"
msgstr "Exporteer week als iCal"
#: .\cookbook\templates\meal_plan.html:256
#: .\cookbook\templates\url_import.html:542
@ -1433,7 +1434,7 @@ msgstr "Gedeeld met"
#: .\cookbook\templates\meal_plan.html:280
msgid "Add to Shopping"
msgstr "Voeg toe aan Boodschappen"
msgstr "Voeg toe aan boodschappenlijst"
#: .\cookbook\templates\meal_plan.html:323
msgid "New meal type"
@ -1556,7 +1557,7 @@ msgid ""
"Recipes, foods, shopping lists and more are organized in spaces of one or "
"more people."
msgstr ""
"Recepten, ingrediënten, boodschappenlijstjes en meer zijn georganiseerd in "
"Recepten, ingrediënten, boodschappenlijsten en meer zijn georganiseerd in "
"ruimtes van één of meer personen."
#: .\cookbook\templates\no_space_info.html:18
@ -1995,7 +1996,7 @@ msgstr "Maak Superuser acount"
#: .\cookbook\templates\shopping_list.html:79
msgid "Shopping Recipes"
msgstr "Boodschappen recepten"
msgstr "Recepten op boodschappenlijst"
#: .\cookbook\templates\shopping_list.html:83
msgid "No recipes selected"
@ -2007,7 +2008,7 @@ msgstr "Invoermodus"
#: .\cookbook\templates\shopping_list.html:158
msgid "Add Entry"
msgstr "Zet op lijst"
msgstr "Voeg toe aan boodschappenlijst"
#: .\cookbook\templates\shopping_list.html:174
msgid "Amount"
@ -2044,7 +2045,7 @@ msgstr "Afgerond"
#: .\cookbook\templates\shopping_list.html:296
msgid "You are offline, shopping list might not syncronize."
msgstr "Je bent offline, boodschappenlijst synchroniseert mogelijk niet."
msgstr "Je bent offline, de boodschappenlijst synchroniseert mogelijk niet."
#: .\cookbook\templates\shopping_list.html:361
msgid "Copy/Export"
@ -2721,7 +2722,7 @@ msgstr "Supermarkten"
#: .\cookbook\views\lists.py:179
msgid "Shopping Categories"
msgstr "Boodschappen categorieën"
msgstr "Boodschappencategorieën"
#: .\cookbook\views\new.py:122
msgid "Imported new recipe!"

Binary file not shown.

View File

@ -2,22 +2,21 @@ import random
from datetime import timedelta
from decimal import Decimal
from gettext import gettext as _
from django.contrib.auth.models import User
from django.db.models import Avg, QuerySet, Sum
from django.urls import reverse
from django.utils import timezone
from drf_writable_nested import (UniqueFieldsMixin,
WritableNestedModelSerializer)
from drf_writable_nested import UniqueFieldsMixin, WritableNestedModelSerializer
from rest_framework import serializers
from rest_framework.exceptions import ValidationError, NotFound
from rest_framework.exceptions import NotFound, ValidationError
from cookbook.models import (Comment, CookLog, Food, Ingredient, Keyword,
MealPlan, MealType, NutritionInformation, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport,
ShareLink, ShoppingList, ShoppingListEntry,
ShoppingListRecipe, Step, Storage, Sync, SyncLog,
Unit, UserPreference, ViewLog, SupermarketCategory, Supermarket,
SupermarketCategoryRelation, ImportLog, BookmarkletImport, UserFile, Automation)
from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, Food, ImportLog,
Ingredient, Keyword, MealPlan, MealType, NutritionInformation, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport, ShareLink, ShoppingList,
ShoppingListEntry, ShoppingListRecipe, Step, Storage, Supermarket,
SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, Unit,
UserFile, UserPreference, ViewLog)
from cookbook.templatetags.custom_tags import markdown
@ -34,12 +33,19 @@ class ExtendedRecipeMixin(serializers.ModelSerializer):
except KeyError:
api_serializer = None
# extended values are computationally expensive and not needed in normal circumstances
if self.context.get('request', False) and bool(int(self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
return fields
else:
try:
if bool(int(self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
return fields
except AttributeError:
pass
except KeyError:
pass
try:
del fields['image']
del fields['numrecipe']
return fields
except KeyError:
pass
return fields
def get_image(self, obj):
# TODO add caching
@ -158,7 +164,7 @@ class UserFileSerializer(serializers.ModelSerializer):
current_file_size_mb = 0
if ((validated_data['file'].size / 1000 / 1000 + current_file_size_mb - 5)
> self.context['request'].space.max_file_storage_mb != 0):
> self.context['request'].space.max_file_storage_mb != 0):
raise ValidationError(_('You have reached your file upload limit.'))
def create(self, validated_data):

View File

@ -344,6 +344,7 @@
<script type="application/javascript">
localStorage.setItem('SCRIPT_NAME', "{% base_path request 'script' %}")
localStorage.setItem('BASE_PATH', "{% base_path request 'base' %}")
localStorage.setItem('STATIC_URL', "{% base_path request 'static_base' %}")
window.addEventListener("load", () => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("{% url 'service_worker' %}", {scope: "{% base_path request 'base' %}" + '/'}).then(function (reg) {

View File

@ -1,742 +1,36 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load render_bundle from webpack_loader %}
{% load static %}
{% load i18n %}
{% load l10n %}
{% block title %}{% trans 'Meal-Plan' %}{% endblock %}
{% block extra_head %}
{% include 'include/vue_base.html' %}
<script src="{% static 'js/moment-with-locales.min.js' %}"></script>
<script src="{% static 'js/Sortable.min.js' %}"></script>
<script src="{% static 'js/vuedraggable.umd.min.js' %}"></script>
<script src="{% static 'js/vue-cookies.js' %}"></script>
<script src="{% static 'js/js.cookie.min.js' %}"></script>
{% endblock %}
{% block content %}
{% block content_fluid %}
<div id="app">
<div class="row mt-2 mb-1">
<div class="col-md-4 offset-md-4">
<div class="input-group">
<div class="input-group-prepend">
<button class="btn btn-outline-secondary shadow-none"
@click="changeStartDate(number_of_days * -1)">
<i class="fas fa-arrow-left"></i>
</button>
</div>
<input name="date" id="id_date" class="form-control" type="date" v-model="start_date"
@change="updatePlan()">
<div class="input-group-append">
<button class="btn btn-outline-secondary shadow-none" @click="changeStartDate(number_of_days)">
<i class="fas fa-arrow-right"></i>
</button>
</div>
</div>
</div>
<div class="col-md-4">
<a href="{% url 'view_plan_new' %}" class="float-right">
<button class="btn btn-outline-secondary shadow-none">
<i class="fas fa-star"></i> {% trans 'Try the new meal planner' %}
</button>
</a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-sm table-striped table-responsive-sm" style=" table-layout:fixed;">
<thead class="thead-dark" style="background-image: url({% static 'assets/header.svg' %});">
<tr>
<th class="thead-blank" v-for="d in dates" style="width: 14.2%; text-align: center;">
[[formatDateDayname(d)]]<br/>[[formatDateDay(d)]].
<button class="btn btn-sm btn-outline-secondary shadow-none" @click="addDayToShopping(d)"><i
class="fas fa-cart-plus fa-sm"></i></button>
</th>
</tr>
</thead>
<tbody v-for="t in meal_types">
<tr v-if="meal_plan[t.name] !== undefined">
<td :colspan="number_of_days" style="text-align: center">
[[ meal_plan[t.name].name]]
<template
v-if="t.created_by !== {{ request.user.pk }} && user_names[t.created_by] !== undefined">
([[ user_names[t.created_by] ]])
</template>
</td>
</tr>
<tr v-if="meal_plan[t.name] !== undefined">
<td v-for="d in meal_plan[t.name].days">
<draggable class="list-group" :list="d.items" group="plan" style="min-height: 40px"
@change="dragChanged(d.date, t, $event)"
:empty-insert-threshold="10" handle=".handle">
<div class="" v-for="(element, index) in d.items" :key="element.id">
<!-- small layout with handle -->
<div class="d-block d-md-none">
<div class="col-">
<i class="fas fa-arrows-alt handle input-group-text"
style="width: 100%"></i>
</div>
<div class="list-group-item" style="word-wrap: break-word;">
<a href="#" @click="plan_detail = element" data-toggle="modal"
data-target="#id_plan_detail_modal">[[ planElementName(element)]]</a>
</div>
</div>
<!-- big layout -->
<div class="list-group-item handle d-md-block d-none"
style="word-wrap: break-word; padding: 2;margin-bottom: 4">
<div class="col-md-12" style="padding: 0">
<a href="#" @click="plan_detail = element" data-toggle="modal"
data-target="#id_plan_detail_modal">[[ planElementName(element)]]</a>
</div>
</div>
</div>
</draggable>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="card">
<div class="card-header">
<i class="fas fa-calendar-plus"></i> {% trans 'New Entry' %} <a href="#" data-toggle="modal"
data-target="#id_plan_help_modal"><i
class="far fa-question-circle"></i></a>
</div>
<div class="row">
<div class="col-md-6">
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="input-group mb-3">
<input type="text" class="form-control" v-model="recipe_query" @keyup="getRecipes"
placeholder="{% trans 'Search Recipe' %}">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button"
@click="getRandomRecipes">
<i class="fas fa-dice"></i>
</button>
</div>
</div>
</div>
</div>
<draggable class="list-group" :list="recipes"
:group="{ name: 'plan', pull: 'clone', put: false }" :clone="cloneRecipe">
<div class="list-group-item d-flex align-items-center justify-content-between"
v-for="(element, index) in recipes" :key="element.id">
<span>
<i class="fas fa-arrows-alt"></i> [[element.name]]
</span>
<span class="badge badge-light badge-pill">[[element.servings]]</span>
</div>
</draggable>
</div>
</div>
<div class="col-md-6">
<div>
<div class="card-body">
<input type="text" class="form-control" v-model="new_note_title"
placeholder="{% trans 'Title' %}" style="margin-bottom: 8px">
<textarea class="form-control" v-model="new_note_text"
placeholder="{% trans 'Note (optional)' %}"></textarea>
<small><span
class="text-muted">{% trans 'You can use markdown to format this field. See the <a href="/docs/markdown/" target="_blank" rel="noopener noreferrer">docs here</a>' %}</span></small>
<br/>
<br/>
<input type="number" class="form-control" v-model="new_note_servings"
placeholder="{% trans 'Serving Count' %}" style="margin-bottom: 8px">
<br/>
<draggable :list="pseudo_note_list"
:group="{ name: 'plan', pull: 'clone', put: false }" :clone="cloneNote">
<div class="list-group-item" v-for="(element, index) in pseudo_note_list"
:key="element.id">
<i class="fas fa-arrows-alt"></i> {% trans 'Create only note' %}
</div>
</draggable>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<i class="fas fa-shopping-cart"></i> {% trans 'Shopping List' %}
</div>
<div class="card-body">
<template v-if="shopping_list.length < 1">{% trans 'Shopping list currently empty' %}</template>
<template v-else>
<a v-bind:href="getShoppingUrl()" class="btn btn-success"
target="_blank">{% trans 'Open Shopping List' %}</a>
<br/>
<br/>
{% trans 'Recipes' %}
<ul class="list-group" style="margin-top: 8px">
<li class="list-group-item" v-for="item in shopping_list"> [[ item.recipe_name ]]</li>
</ul>
</template>
</div>
</div>
</div>
<div class="col-md-6" style="margin-top: 8px">
<div class="card">
<div class="card-header">
<i class="fas fa-shopping-cart"></i> {% trans 'Plan' %}
</div>
<div class="card-body">
<div class="row">
<div class="col">
<label>
{% trans 'Number of Days' %}
<input class="form-control" type="number" v-model="number_of_days"
@change="updatePlan(); $cookies.set('number_of_days',number_of_days, -1)">
</label>
</div>
</div>
<div class="row">
<div class="col">
<label>
{% trans 'Weekday offset' %}
<input class="form-control" type="number" v-model="start_offset"
@change="updatePlan(); $cookies.set('start_offset',start_offset, -1)">
<small class="text-muted">{% trans 'Number of days starting from the first day of the week to offset the default view.' %}</small>
</label>
</div>
</div>
<a href="#" data-toggle="modal"
data-target="#id_plan_types_modal">{% trans 'Edit plan types' %}</a> <br/>
<a href="#" data-toggle="modal"
data-target="#id_plan_help_modal">{% trans 'Show help' %}</a><br/>
<a v-bind:href="getIcalUrl()">{% trans 'Week iCal export' %}</a>
</div>
</div>
</div>
</div>
<br/>
<br/>
<div class="modal fade" id="id_plan_detail_modal" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
<template v-if="plan_detail.title !==''">[[ plan_detail.title ]]</template>
<template v-else>[[ plan_detail.recipe_name ]]</template>
<small
class="text-muted"><br/>[[ plan_detail.meal_type_name ]] [[
formatLocalDate(plan_detail.date) ]]</small>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<template v-if="plan_detail.recipe_name !== undefined ">
<small class="text-muted">{% trans 'Recipe' %}</small><br/>
<a v-bind:href="planDetailRecipeUrl()" target="_blank">[[ plan_detail.recipe_name ]]</a>
<br/>
<br/>
<small class="text-muted">{% trans 'Serving Count' %}</small><br/>
<span>[[ plan_detail.servings ]]</span>
</template>
<template v-if="plan_detail.note !== ''">
<small class="text-muted">{% trans 'Note' %}</small><br/>
<span v-html="plan_detail.note_markdown"></span>
<br/>
</template>
<br/>
<br/>
<template v-if="plan_detail.created_by !== undefined ">
<small class="text-muted">{% trans 'Created by' %}</small><br/>
[[ user_names[plan_detail.created_by] ]]
<br/>
</template>
<template v-if="plan_detail.shared.length > 0">
<small class="text-muted">{% trans 'Shared with' %}</small><br/>
<span>[[ planDetailUserList() ]]</span>
<br/>
</template>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger"
@click="deleteEntry(plan_detail)">{% trans 'Delete' %}</button>
<button type="button" class="btn btn-success"
v-if="!shopping_list.includes(plan_detail) && plan_detail.recipe_name !== undefined"
@click="shopping_list.push(plan_detail)">{% trans 'Add to Shopping' %}</button>
<a class="btn btn-primary" v-bind:href="planDetailEditUrl()">{% trans 'Edit' %}</a>
<button type="button" class="btn btn-secondary"
data-dismiss="modal">{% trans 'Close' %}</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="id_plan_types_modal" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans 'Edit plan types' %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<draggable :list="meal_types_edit" handle=".handle"
:group="{ name: 'types'}">
<div v-for="(element, index) in meal_types_edit"
:key="element.id">
<template v-if="!element.delete">
<div class="input-group mb-3">
<div class="input-group-prepend handle">
<button tabindex="-1" class="btn btn-outline-secondary"><i
class="fas fa-arrows-alt-v"></i></button>
</div>
<input class="form-control" v-model="element.name">
<div class="input-group-append">
<button tabindex="-1" class="btn btn-outline-danger" type="button"
@click="markTypeDelete(element)"><i class="fas fa-trash-alt"></i>
</button>
</div>
</div>
</template>
</div>
</draggable>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
@click="meal_types_edit.push({name:'{% trans 'New meal type' %}', delete:false})">{% trans 'New' %}</button>
<button type="button" class="btn btn-success"
@click="updatePlanTypes()">{% trans 'Save' %}</button>
<button type="button" class="btn btn-secondary"
data-dismiss="modal">{% trans 'Close' %}</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="id_plan_help_modal" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans 'Meal Plan Help' %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{% blocktrans %}
<p>The meal plan module allows planning of meals both with recipes and notes.</p>
<p>Simply select a recipe from the list of recently viewed recipes or search the one you
want and drag it to the desired plan position. You can also add a note and a title and
then drag the recipe to create a plan entry with a custom title and note. Creating only
Notes is possible by dragging the create note box into the plan.</p>
<p>Click on a recipe in order to open the detailed view. There you can also add it to the
shopping list. You can also add all recipes of a day to the shopping list by
clicking the shopping cart at the top of the table.</p>
<p>Since a common use case is to plan meals together you can define
users you want to share your plan with in the settings.
</p>
<p>You can also edit the types of meals you want to plan. If you share your plan with
someone with
different meals, their meal types will appear in your list as well. To prevent
duplicates (e.g. Other and Misc.)
name your meal types the same as the users you share your meals with and they will be
merged.</p>
{% endblocktrans %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
data-dismiss="modal">{% trans 'Close' %}</button>
</div>
</div>
</div>
</div>
<meal-plan-view></meal-plan-view>
</div>
<script src="{% url 'javascript-catalog' %}"></script>
{% endblock %}
{% block script %}
{% if debug %}
<script src="{% url 'js_reverse' %}"></script>
{% else %}
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
<script type="application/javascript">
moment.locale('{{request.LANGUAGE_CODE}}');
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
let csrftoken = Cookies.get('csrftoken');
Vue.http.headers.common['X-CSRFToken'] = csrftoken;
window.CUSTOM_LOCALE = '{{ request.LANGUAGE_CODE }}'
let app = new Vue({
delimiters: ['[[', ']]'],
el: '#app',
data: {
start_date: undefined,
start_offset: 0,
dates: [],
number_of_days: $cookies.isKey('number_of_days') ? $cookies.get('number_of_days') : 7,
plan_entries: [],
meal_types: [],
meal_types_edit: [],
meal_plan: {},
plan_detail: {shared: []},
recipes: [],
recipe_query: '',
pseudo_note_list: [
{id: 0, title: '', text: ''}
],
new_note_title: '',
new_note_text: '',
new_note_servings: '',
default_shared_users: [],
user_id_update: [],
user_names: {},
shopping: false,
shopping_list: [],
},
mounted: function () {
this.default_shared_users = [{% for u in request.user.userpreference.plan_share.all %}
{{ u.pk }},
{% endfor %}]
this.$set(this.user_names, {{ request.user.pk }}, '{{ request.user.get_user_name }}')
this.user_id_update = Array.from(this.default_shared_users)
this.start_offset = $cookies.isKey('start_offset') ? $cookies.get('start_offset') : 0;
this.start_date = moment().weekday(0).add(this.start_offset, 'days').format('YYYY-MM-DD')
this.updatePlan();
this.getRecipes();
//this.makeToast('success', 'this actually works', 'success')
},
methods: {
makeToast: function (title, message, variant = null) {
this.$bvToast.toast(message, {
title: title,
variant: variant,
toaster: 'b-toaster-top-center',
solid: true
})
},
updatePlan: function () {
this.dates = [];
for (var i = 0; i <= (this.number_of_days - 1); i++) {
this.dates.push(moment(this.start_date).add(i, 'days'));
}
let planEntryPromise = this.getPlanEntries();
let planTypePromise = this.getPlanTypes();
Promise.allSettled([planEntryPromise, planTypePromise]).then(() => {
this.buildGrid()
})
},
getPlanEntries: function () {
return this.$http.get("{% url 'api:mealplan-list' %}?from_date=" + this.dates[0].format('YYYY-MM-DD') + "&to_date=" + this.dates[this.dates.length - 1].format('YYYY-MM-DD')).then((response) => {
this.plan_entries = response.data;
}).catch((err) => {
console.log("getPlanEntries error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
})
},
getPlanTypes: function () {
return this.$http.get("{% url 'api:mealtype-list' %}").then((response) => {
this.meal_types = response.data;
this.meal_types_edit = jQuery.extend(true, [], response.data);
for (let mte of this.meal_types_edit) {
this.$set(mte, 'delete', false)
}
if (this.meal_types.length === 0) {
this.makeToast(gettext('Information'), gettext('To use the meal plan please first create at least one meal plan type.'), 'warning')
}
}).catch((err) => {
console.log("getPlanTypes error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
})
},
buildGrid: function () {
this.meal_plan = {}
for (let e of this.plan_entries) {
let new_type = {id: e.meal_type, name: e.meal_type_name, created_by: e.created_by}
if (this.meal_types.filter(el => el.name === new_type.name).length === 0) {
this.meal_types.push(new_type)
}
}
for (let t of this.meal_types) {
this.$set(this.meal_plan, t.name, {
name: t.name,
meal_type: t.id,
days: {}
})
for (let d of this.dates) {
this.$set(this.meal_plan[t.name].days, d.format('YYYY-MM-DD'), {
name: this.formatDateDayname(d),
date: d.format('YYYY-MM-DD'),
items: []
})
}
}
for (let e of this.plan_entries) {
this.meal_plan[e.meal_type_name].days[e.date].items.push(e)
for (let u of e.shared) {
if (!this.user_id_update.includes(parseInt(u))) {
this.user_id_update.push(parseInt(u))
}
}
}
this.updateUserNames()
},
getRandomRecipes: function () {
this.$set(this, 'recipe_query', '');
this.getRecipes();
},
getRecipes: function () {
let url = "{% url 'api:recipe-list' %}?page_size=5"
if (this.recipe_query !== '') {
url += '&query=' + this.recipe_query;
} else {
url += '&random=true'
}
this.$http.get(url).then((response) => {
this.recipes = this.removeDuplicates(response.data.results, recipe => recipe.id);
}).catch((err) => {
console.log("getRecipes error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
})
},
getMdNote: function () {
let url = "{% url 'api:recipe-list' %}?page_size=5"
if (this.recipe_query !== '') {
url += '&query=' + this.recipe_query;
}
this.$http.get(url).then((response) => {
this.recipes = response.data.results;
}).catch((err) => {
console.log("getRecipes error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
})
},
updateUserNames: function () {
return this.$http.get("{% url 'api:username-list' %}?filter_list=[" + this.user_id_update + ']').then((response) => {
for (let u of response.data) {
this.$set(this.user_names, u.id, u.username);
}
}).catch((err) => {
console.log("updateUserNames error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
})
},
dragChanged: function (date, meal_type, evt) {
if (evt.added !== undefined) {
let plan_entry = evt.added.element
plan_entry.date = date
plan_entry.meal_type = meal_type
plan_entry.meal_type_name = meal_type.name
if (plan_entry.is_new) { // its not a meal plan object
plan_entry.created_by = {{ request.user.id }};
plan_entry.shared = this.default_shared_users
this.$http.post(`{% url 'api:mealplan-list' %}`, plan_entry).then((response) => {
let entry = response.data
this.meal_plan[entry.meal_type_name].days[entry.date].items = this.meal_plan[entry.meal_type_name].days[entry.date].items.filter(item => !item.is_new)
this.meal_plan[entry.meal_type_name].days[entry.date].items.push(entry)
}).catch((err) => {
console.log("dragChanged create error", err);
})
} else {
this.$http.put(`{% url 'api:mealplan-list' %}${plan_entry.id}/`, plan_entry).then((response) => {
}).catch((err) => {
console.log("dragChanged update error", err);
this.makeToast(gettext('Error'), gettext('There was an error updating a resource!') + err.bodyText, 'danger')
})
}
}
},
deleteEntry: function (entry) {
$('#id_plan_detail_modal').modal('hide')
this.$http.delete(`{% url 'api:mealplan-list' %}${entry.id}/`, entry).then((response) => {
this.meal_plan[entry.meal_type_name].days[entry.date].items = this.meal_plan[entry.meal_type_name].days[entry.date].items.filter(item => item !== entry)
}).catch((err) => {
console.log("deleteEntry error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
})
},
removeDuplicates: function (data, key) {
return [
...new Map(data.map(item => [key(item), item])).values()
]
},
updatePlanTypes: function () {
let promise_list = []
let i = 0
for (let x of this.meal_types_edit) {
x.order = i
i++
if (x.id === undefined && !x.delete) {
x.created_by = {{ request.user.id }}
promise_list.push(this.$http.post("{% url 'api:mealtype-list' %}", x).then((response) => {
}).catch((err) => {
console.log("updatePlanTypes create error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
}))
} else if (x.delete) {
if (x.id !== undefined) {
promise_list.push(this.$http.delete(`{% url 'api:mealtype-list' %}${x.id}/`, x).then((response) => {
}).catch((err) => {
console.log("updatePlanTypes delete error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
}))
}
} else {
promise_list.push(this.$http.put(`{% url 'api:mealtype-list' %}${x.id}/`, x).then((response) => {
}).catch((err) => {
console.log("updatePlanTypes update error: ", err);
this.makeToast(gettext('Error'), gettext('There was an error loading a resource!') + err.bodyText, 'danger')
}))
}
}
Promise.allSettled(promise_list).then(() => {
this.updatePlan()
$('#id_plan_types_modal').modal('hide')
})
},
markTypeDelete: function (element) {
if (confirm(gettext('When deleting a meal type all entries using that type will be deleted as well. Deletion will apply when configuration is saved. Do you want to proceed?'))) {
element.delete = true
}
},
cloneRecipe: function (recipe) {
let r = {
id: Math.round(Math.random() * 1000) + 10000,
recipe: recipe,
recipe_name: recipe.name,
servings: (this.new_note_servings > 1) ? this.new_note_servings : recipe.servings,
title: this.new_note_title,
note: this.new_note_text,
is_new: true
}
console.log(recipe)
this.new_note_title = ''
this.new_note_text = ''
this.new_note_servings = ''
return r
},
cloneNote: function () {
let new_entry = {
id: Math.round(Math.random() * 1000) + 10000,
title: this.new_note_title,
note: this.new_note_text,
servings: 1,
is_new: true,
}
if (new_entry.title === '') {
new_entry.title = gettext('Title')
}
this.new_note_title = ''
this.new_note_text = ''
this.new_note_servings = ''
return new_entry
},
planElementName: function (element) {
if (element.title) {
return element.title
} else if (element.recipe_name) {
return element.recipe_name
} else {
return element.name
}
},
planDetailRecipeUrl: function () {
return "{% url 'view_recipe' 12345 %}".replace(/12345/, this.plan_detail.recipe.id);
},
planDetailEditUrl: function () {
return "{% url 'edit_meal_plan' 12345 %}".replace(/12345/, this.plan_detail.id);
},
planDetailUserList: function () {
let users = []
for (let u of this.plan_detail.shared) {
users.push(this.user_names[u])
}
return users.join(', ')
},
formatLocalDate: function (date) {
return moment(date).format('LL')
},
formatDateDay: function (date) {
return moment(date).format('D')
},
formatDateDayname: function (date) {
return moment(date).format('dddd')
},
changeStartDate: function (change) {
this.start_date = moment(this.start_date).add(change, 'days').format('YYYY-MM-DD')
this.updatePlan();
},
getShoppingUrl: function () {
let url = "{% url 'view_shopping' %}"
let first = true
for (let se of this.shopping_list) {
if (first) {
url += `?r=[${se.recipe.id},${se.servings}]`
first = false
} else {
url += `&r=[${se.recipe.id},${se.servings}]`
}
}
return url
},
getIcalUrl: function () {
if (this.dates.length === 0) {
return ""
}
return "{% url 'api_get_plan_ical' 12345 6789 %}".replace(/12345/, this.dates[0].format('YYYY-MM-DD')).replace(/6789/, this.dates[this.dates.length - 1].format('YYYY-MM-DD'));
},
addDayToShopping: function (date) {
for (let t of this.meal_types) {
for (let i of this.meal_plan[t.name].days[date.format('YYYY-MM-DD')].items) {
if (!this.shopping_list.includes(i)) {
this.shopping_list.push(i)
}
}
}
}
}
});
window.ICAL_URL = '{% url 'api_get_plan_ical' 12345 6789 %}'
window.SHOPPING_URL = '{% url 'view_shopping' %}'
</script>
{% render_bundle 'meal_plan_view' %}
{% endblock %}

View File

@ -178,7 +178,7 @@
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">{% trans 'Percise' %}</h5>
<h5 class="card-title">{% trans 'Precise' %}</h5>
<p class="card-text">{% trans 'Allows fine control over search results but might not return results if too many spelling mistakes are made.' %}</p>
<p class="card-text"><small class="text-muted">{% trans 'Perfect for large Databases' %}</small></p>
<button class="btn btn-primary card-link" onclick="applyPreset('precise')">{% trans 'Apply' %}</button>

View File

@ -142,7 +142,7 @@ def bookmarklet(request):
localStorage.setItem('redirectURL', '" + server + reverse('data_import_url') + "'); \
localStorage.setItem('token', '" + api_token.__str__() + "'); \
document.body.appendChild(document.createElement(\'script\')).src=\'" \
+ server + prefix + static('js/bookmarklet.js') + "? \
+ server + prefix + static('js/bookmarklet.js') + "? \
r=\'+Math.floor(Math.random()*999999999);}})();"
return re.sub(r"[\n\t\s]*", "", bookmark)
@ -153,3 +153,5 @@ def base_path(request, path_type):
return request._current_scheme_host + request.META.get('HTTP_X_SCRIPT_NAME', '')
elif path_type == 'script':
return request.META.get('HTTP_X_SCRIPT_NAME', '')
elif path_type == 'static_base':
return static('vue/manifest.json').replace('vue/manifest.json', '')

View File

@ -58,7 +58,6 @@ urlpatterns = [
path('search/v2/', views.search_v2, name='view_search_v2'),
path('books/', views.books, name='view_books'),
path('plan/', views.meal_plan, name='view_plan'),
path('plan_new/', views.meal_plan_new, name='view_plan_new'),
path('plan/entry/<int:pk>', views.meal_plan_entry, name='view_plan_entry'),
path('shopping/', views.shopping_list, name='view_shopping'),
path('shopping/<int:pk>', views.shopping_list, name='view_shopping'),

View File

@ -5,6 +5,7 @@ from io import BytesIO
import requests
from django.contrib import messages
from django.core.exceptions import ObjectDoesNotExist
from django.core.files import File
from django.db.transaction import atomic
from django.http import HttpResponse, HttpResponseRedirect
@ -150,8 +151,15 @@ def import_url(request):
recipe.steps.add(step)
for kw in data['keywords']:
k, created = Keyword.objects.get_or_create(name=kw['text'], space=request.space)
recipe.keywords.add(k)
if data['all_keywords']: # do not remove this check :) https://github.com/vabene1111/recipes/issues/645
k, created = Keyword.objects.get_or_create(name=kw['text'], space=request.space)
recipe.keywords.add(k)
else:
try:
k = Keyword.objects.get(name=kw['text'], space=request.space)
recipe.keywords.add(k)
except ObjectDoesNotExist:
pass
ingredient_parser = IngredientParser(request, True)
for ing in data['recipeIngredient']:

View File

@ -220,11 +220,6 @@ def meal_plan(request):
return render(request, 'meal_plan.html', {})
@group_required('user')
def meal_plan_new(request):
return render(request, 'meal_plan_new.html', {})
@group_required('user')
def supermarket(request):
return render(request, 'supermarket.html', {})
@ -344,10 +339,13 @@ def user_settings(request):
if fields_searched == 0:
search_form.add_error(None, _('You must select at least one field to search!'))
search_error = True
elif search_form.cleaned_data['search'] in ['websearch', 'raw'] and len(search_form.cleaned_data['fulltext']) == 0:
search_form.add_error('search', _('To use this search method you must select at least one full text search field!'))
elif search_form.cleaned_data['search'] in ['websearch', 'raw'] and len(
search_form.cleaned_data['fulltext']) == 0:
search_form.add_error('search',
_('To use this search method you must select at least one full text search field!'))
search_error = True
elif search_form.cleaned_data['search'] in ['websearch', 'raw'] and len(search_form.cleaned_data['trigram']) > 0:
elif search_form.cleaned_data['search'] in ['websearch', 'raw'] and len(
search_form.cleaned_data['trigram']) > 0:
search_form.add_error(None, _('Fuzzy search is not compatible with this search method!'))
search_error = True
else:
@ -386,7 +384,8 @@ def user_settings(request):
else:
preference_form = UserPreferenceForm()
fields_searched = len(sp.icontains.all()) + len(sp.istartswith.all()) + len(sp.trigram.all()) + len(sp.fulltext.all())
fields_searched = len(sp.icontains.all()) + len(sp.istartswith.all()) + len(sp.trigram.all()) + len(
sp.fulltext.all())
if sp and not search_error and fields_searched > 0:
search_form = SearchPreferenceForm(instance=sp)
elif not search_error:
@ -396,7 +395,8 @@ def user_settings(request):
api_token = Token.objects.create(user=request.user)
# these fields require postgress - just disable them if postgress isn't available
if not settings.DATABASES['default']['ENGINE'] in ['django.db.backends.postgresql_psycopg2', 'django.db.backends.postgresql']:
if not settings.DATABASES['default']['ENGINE'] in ['django.db.backends.postgresql_psycopg2',
'django.db.backends.postgresql']:
search_form.fields['search'].disabled = True
search_form.fields['lookup'].disabled = True
search_form.fields['trigram'].disabled = True

View File

@ -60,6 +60,25 @@ Use the superuser account to grant permissions to the newly created users.
To link an account to an already existing normal user go to the settings page of the user and link it.
Here you can also unlink your account if you no longer want to use a social login method.
## LDAP
LDAP authentication can be enabled in the `.env` file by setting `LDAP_AUTH=1`.
If set, users listed in the LDAP instance will be able to sign in without signing up.
These variables must be set to configure the connection to the LDAP instance:
```
AUTH_LDAP_SERVER_URI=ldap://ldap.example.org:389
AUTH_LDAP_BIND_DN=uid=admin,ou=users,dc=example,dc=org
AUTH_LDAP_BIND_PASSWORD=adminpassword
AUTH_LDAP_USER_SEARCH_BASE_DN=ou=users,dc=example,dc=org
```
Additional optional variables:
```
AUTH_LDAP_USER_SEARCH_FILTER_STR=(uid=%(user)s)
AUTH_LDAP_USER_ATTR_MAP={'first_name': 'givenName', 'last_name': 'sn', 'email': 'mail'}
AUTH_LDAP_ALWAYS_UPDATE_USER=1
AUTH_LDAP_CACHE_TIMEOUT=3600
```
## Reverse Proxy Authentication
!!! Info "Community Contributed Tutorial"

View File

@ -1,72 +1,79 @@
<h1 align="center">
<br>
<a href="https://app.tandoor.dev"><img src="https://github.com/vabene1111/recipes/raw/develop/docs/logo_color.svg" height="256px" width="256px"></a>
<a href="https://tandoor.dev"><img src="https://github.com/vabene1111/recipes/raw/develop/docs/logo_color.svg" height="256px" width="256px"></a>
<br>
Tandoor Recipes
<br>
</h1>
<h4 align="center">This is my personal beta of vabene's excellent recipe app. It includes many of the new features I've developed and should be considered experimental.</h4>
## Experimental Features
- Manual import recipes from URL & Source (HTML/JSON)
- Bookmarklet to import recipes from any website
- Full Text Search
- Hierarchical Keywords
## Coming Next
- Heirarchical Ingredients
- Faceted Search
- Search filter by rating
- What Can I Make Now?
- Better ingredient/unit matching on import
- Custom word replacement on import (e.g. 'grams' automatically imported as 'g')
- improved ingredient parser (items in parens moved to notes)
- quick view ingredients
- quick view associated recipe
- favorite recipes
<h4 align="center">The recipe manager that allows you to manage your ever growing collection of digital recipes.</h4>
<p align="center">
<img src="https://github.com/vabene1111/recipes/workflows/Continous%20Integration/badge.svg?branch=develop" >
<img src="https://img.shields.io/github/stars/vabene1111/recipes" >
<img src="https://img.shields.io/github/forks/vabene1111/recipes" >
<img src="https://img.shields.io/docker/pulls/vabene1111/recipes" >
<a href="https://github.com/vabene1111/recipes/actions" target="_blank" rel="noopener noreferrer"><img src="https://github.com/vabene1111/recipes/workflows/Continous%20Integration/badge.svg?branch=master" ></a>
<a href="https://github.com/vabene1111/recipes/stargazers" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/github/stars/vabene1111/recipes" ></a>
<a href="https://github.com/vabene1111/recipes/network/members" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/github/forks/vabene1111/recipes" ></a>
<a href="https://discord.gg/RhzBrfWgtp" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/badge/icon/discord?icon=discord&label" ></a>
<a href="https://hub.docker.com/r/vabene1111/recipes" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/docker/pulls/vabene1111/recipes" ></a>
<a href="https://github.com/vabene1111/recipes/releases/latest" rel="noopener noreferrer"><img src="https://img.shields.io/github/v/release/vabene1111/recipes" ></a>
<a href="https://app.tandoor.dev/accounts/login/?demo" rel="noopener noreferrer"><img src="https://img.shields.io/badge/demo-available-success" ></a>
</p>
<p align="center">
<a href="https://docs.tandoor.dev/install/docker.html" rel="noopener noreferrer">Installation</a>
<a href="https://docs.tandoor.dev/" target="_blank" rel="noopener noreferrer">Documentation</a>
<a href="https://app.tandoor.dev/" target="_blank" rel="noopener noreferrer">Demo</a>
<a href="https://tandoor.dev" target="_blank" rel="noopener noreferrer">Website</a>
<a href="https://docs.tandoor.dev/install/docker/" target="_blank" rel="noopener noreferrer">Installation</a>
<a href="https://docs.tandoor.dev/" target="_blank" rel="noopener noreferrer">Docs</a>
<a href="https://app.tandoor.dev/accounts/login/?demo" target="_blank" rel="noopener noreferrer">Demo</a>
<a href="https://discord.gg/RhzBrfWgtp" target="_blank" rel="noopener noreferrer">Discord</a>
</p>
![Preview](preview.png)
!!! info "WIP"
The documentation is work in progress. New information will be added over time.
Feel free to open pull requests to enhance the documentation.
## Core Features
- 🥗 **Manage your recipes** with a fast and intuitive editor
- 📆 **Plan** multiple meals for each day
- 🛒 **Shopping lists** via the meal plan or straight from recipes
- 📚 **Cookbooks** collect recipes into books
- 👪 **Share and collaborate** on recipes with friends and family
## Features
## Made by and for power users
- 📦 **Sync** files with Dropbox and Nextcloud (more can easily be added)
- 🔍 Powerful **search** with Djangos [TrigramSimilarity](https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/search/#trigram-similarity)
- 🔍 Powerful & customizable **search** with fulltext support and [TrigramSimilarity](https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/search/#trigram-similarity)
- 🏷️ Create and search for **tags**, assign them in batch to all files matching certain filters
- 📄 **Create recipes** locally within a nice, standardized web interface
- **Import recipes** from thousands of websites supporting [ld+json or microdata](https://schema.org/Recipe)
- 📱 Optimized for use on **mobile** devices like phones and tablets
- 🛒 Generate **shopping** lists from recipes
- 📆 Create a **Plan** on what to eat when
- 👪 **Share** recipes with friends and comment on them to suggest or remember changes you made
- ➗ automatically convert decimal units to **fractions** for those who like this
- 🐳 Easy setup with **Docker** and included examples for Kubernetes, Unraid and Synology
- ↔️ Quickly merge and rename ingredients, tags and units
- 📥 **Import recipes** from thousands of websites supporting [ld+json or microdata](https://schema.org/Recipe)
- ➗ Support for **fractions** or decimals
- 🐳 Easy setup with **Docker** and included examples for **Kubernetes**, **Unraid** and **Synology**
- 🎨 Customize your interface with **themes**
- ✉️ Export and import recipes from other users
- 📦 **Sync** files with Dropbox and Nextcloud
## All the must haves
- 📱Optimized for use on **mobile** devices
- 🌍 localized in many languages thanks to the awesome community
- Many more like recipe scaling, image compression, cookbooks, printing views, ...
- 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/)
- Many more like recipe scaling, image compression, printing views and supermarkets
This application is meant for people with a collection of recipes they want to share with family and friends or simply
store them in a nicely organized way. A basic permission system exists but this application is not meant to be run as
a public page.
## Your Feedback
Share some information on how you use Tandoor to help me improve the application [Google Survey](https://forms.gle/qNfLK2tWTeWHe9Qd7)
## Get in touch
<table>
<tr>
<td><a href="https://discord.gg/RhzBrfWgtp">Discord</a></td>
<td>We have a public Discord server that anyone can join. This is where all our developers and contributors hang out and where we make announcements</td>
</tr>
<tr>
<td><a href="https://twitter.com/TandoorRecipes">Twitter</a></td>
<td>You can follow our Twitter account to get updates on new features or releases</td>
</tr>
</table>
## Roadmap
This application has been under rapid development over the last year.

View File

@ -360,6 +360,7 @@ LANGUAGES = [
('it', _('Italian')),
('lv', _('Latvian')),
('pl', _('Polish')),
('ru', _('Russian')),
('es', _('Spanish')),
]

View File

@ -1,11 +1,11 @@
Django==3.2.7
Django==3.2.8
cryptography==35.0.0
django-annoying==0.10.6
django-autocomplete-light==3.8.2
django-cleanup==5.2.0
django-crispy-forms==1.13.0
django-filter==21.1
django-tables2==2.4.0
django-tables2==2.4.1
djangorestframework==3.12.4
drf-writable-nested==0.6.3
bleach==4.1.0
@ -13,31 +13,31 @@ bleach-allowlist==1.0.3
gunicorn==20.1.0
lxml==4.6.3
Markdown==3.3.4
Pillow==8.3.2
Pillow==8.4.0
psycopg2-binary==2.9.1
python-dotenv==0.19.0
python-dotenv==0.19.1
requests==2.26.0
simplejson==3.17.5
six==1.16.0
webdavclient3==3.14.6
whitenoise==5.3.0
icalendar==4.0.7
pyyaml==5.4.1
uritemplate==3.0.1
icalendar==4.0.9
pyyaml==6.0
uritemplate==4.1.1
beautifulsoup4==4.10.0
microdata==0.7.1
Jinja2==3.0.1
Jinja2==3.0.2
django-webpack-loader==1.4.1
django-js-reverse==0.9.1
django-allauth==0.45.0
recipe-scrapers==13.4.0
recipe-scrapers==13.5.0
django-scopes==1.2.0
pytest==6.2.5
pytest-django==4.4.0
django-treebeard==4.5.1
django-cors-headers==3.9.0
django-storages==1.11.1
boto3==1.18.52
django-cors-headers==3.10.0
django-storages==1.12.3
boto3==1.19.7
django-prometheus==2.1.0
django-hCaptcha==0.1.0
python-ldap==3.3.1

1602
vue/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
"vue-click-outside": "^1.1.0",
"vue-clickaway": "^2.2.2",
"vue-cookies": "^1.7.4",
"vue-i18n": "^8.24.4",
"vue-i18n": "^8.26.5",
"vue-infinite-loading": "^2.4.5",
"vue-multiselect": "^2.1.6",
"vue-property-decorator": "^9.1.2",
@ -33,7 +33,7 @@
"vue2-touch-events": "^3.2.2",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.0",
"workbox-webpack-plugin": "^6.1.5"
"workbox-webpack-plugin": "^6.3.0"
},
"devDependencies": {
"@kazupon/vue-i18n-loader": "^0.5.0",
@ -44,12 +44,12 @@
"@vue/cli-plugin-pwa": "~4.5.13",
"@vue/cli-plugin-typescript": "^4.5.13",
"@vue/cli-service": "~4.5.13",
"@vue/compiler-sfc": "^3.1.1",
"@vue/compiler-sfc": "^3.2.20",
"@vue/eslint-config-typescript": "^7.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.28.0",
"eslint-plugin-vue": "^7.10.0",
"typescript": "~4.4.3",
"eslint-plugin-vue": "^8.0.3",
"typescript": "~4.4.4",
"vue-cli-plugin-i18n": "^2.1.1",
"webpack-bundle-tracker": "1.4.0",
"workbox-expiration": "^6.3.0",

View File

@ -4,6 +4,14 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -61,10 +61,10 @@ import Vue from 'vue'
import {BootstrapVue} from 'bootstrap-vue'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import {ApiApiFactory} from "../../utils/openapi/api";
import CookbookSlider from "../../components/CookbookSlider";
import LoadingSpinner from "../../components/LoadingSpinner";
import {StandardToasts} from "../../utils/utils";
import {ApiApiFactory} from "@/utils/openapi/api";
import CookbookSlider from "@/components/CookbookSlider";
import LoadingSpinner from "@/components/LoadingSpinner";
import {StandardToasts} from "@/utils/utils";
Vue.use(BootstrapVue)

View File

@ -4,6 +4,14 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,14 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -231,22 +231,24 @@
<script>
import Vue from "vue";
import {BootstrapVue} from 'bootstrap-vue'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import ContextMenu from "@/components/ContextMenu/ContextMenu";
import ContextMenuItem from "@/components/ContextMenu/ContextMenuItem";
import {CalendarView, CalendarMathMixin} from "vue-simple-calendar/src/components/bundle";
import Vue from "vue";
import {ApiApiFactory} from "@/utils/openapi/api";
import MealPlanCard from "../../components/MealPlanCard";
import moment from 'moment'
import {ApiMixin, StandardToasts} from "@/utils/utils";
import MealPlanEditModal from "../../components/MealPlanEditModal";
import VueCookies from "vue-cookies";
import MealPlanCard from "@/components/MealPlanCard";
import MealPlanEditModal from "@/components/MealPlanEditModal";
import MealPlanCalenderHeader from "@/components/MealPlanCalenderHeader";
import EmojiInput from "../../components/Modals/EmojiInput";
import draggable from 'vuedraggable'
import EmojiInput from "@/components/Modals/EmojiInput";
import moment from "moment"
import draggable from "vuedraggable"
import VueCookies from "vue-cookies";
import {ApiMixin, StandardToasts} from "@/utils/utils";
import {CalendarView, CalendarMathMixin} from "vue-simple-calendar/src/components/bundle";
import {ApiApiFactory} from "@/utils/openapi/api";
const {makeToast} = require("@/utils/utils");

View File

@ -4,6 +4,13 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,14 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,14 @@ import i18n from "@/i18n";
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -93,22 +93,28 @@
<h5 class="d-table-cell align-middle">{{ $t('Nutrition') }}</h5>
</div>
<div class="col-md-3">
<button type="button" @click="addNutrition()"
class="btn btn-sm btn-light shadow-none float-right" v-b-toggle.id_nutrition_collapse
v-if="recipe.nutrition === null"><i class="fas fa-plus-circle"></i>
<button type="button" @click="addNutrition()" v-if="recipe.nutrition === null"
v-b-tooltip.hover v-bind:title="$t('Add_nutrition_recipe')"
class="btn btn-sm btn-success shadow-none float-right" ><i class="fas fa-plus-circle"></i>
</button>
<button type="button" @click="removeNutrition()" v-if="recipe.nutrition !== null"
v-b-toggle.id_nutrition_collapse
class="btn btn-sm btn-light shadow-none float-right"><i class="fas fa-minus-circle"></i>
v-b-tooltip.hover v-bind:title="$t('Remove_nutrition_recipe')"
class="btn btn-sm btn-danger shadow-none float-right"><i class="fas fa-trash-alt"></i>
</button>
</div>
</div>
</div>
<b-collapse id="id_nutrition_collapse" class="mt-2">
<div class="card-body " v-if="recipe.nutrition">
<b-collapse id="id_nutrition_collapse" class="mt-2" v-model="nutrition_visible">
<div class="card-body " v-if="recipe.nutrition !== null">
<b-alert show>
There is currently only very basic support for tracking nutritional information.
A <a href="https://github.com/vabene1111/recipes/issues/896" target="_blank" rel="noreferrer nofollow">big update</a> is planned to improve on this in many different areas.
</b-alert>
<label for="id_name"> {{ $t(energy()) }}</label>
<input class="form-control" id="id_calories" v-model="recipe.nutrition.calories">
<label for="id_name"> {{ $t('Carbohydrates') }}</label>
@ -461,7 +467,8 @@
</button>
</div>
<div class="col-md-3 col-6">
<button type="button" @click="updateRecipe(true)" v-b-tooltip.hover :title="`${$t('Key_Ctrl')} + ${$t('Key_Shift')} + S`"
<button type="button" @click="updateRecipe(true)" v-b-tooltip.hover
:title="`${$t('Key_Ctrl')} + ${$t('Key_Shift')} + S`"
class="btn btn-sm btn-block btn-success shadow-none">{{ $t('Save_and_View') }}
</button>
</div>
@ -505,7 +512,7 @@ Vue.use(VueMarkdownEditor);
Vue.use(BootstrapVue)
export default {
name: 'RecipeSearchView',
name: 'RecipeEditView',
mixins: [ResolveUrlMixin, ApiMixin],
components: {Multiselect, LoadingSpinner, draggable},
data() {
@ -527,7 +534,11 @@ export default {
}
},
computed: {},
computed: {
nutrition_visible: function () {
return this.recipe.nutrition !== null
}
},
mounted() {
this.loadRecipe()

View File

@ -4,6 +4,14 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,14 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,14 @@ import i18n from "@/i18n";
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -4,6 +4,14 @@ import i18n from '@/i18n'
Vue.config.productionTip = false
// TODO move this and other default stuff to centralized JS file (verify nothing breaks)
let publicPath = localStorage.STATIC_URL + 'vue/'
if (process.env.NODE_ENV === 'development') {
publicPath = 'http://localhost:8080/'
}
export default __webpack_public_path__ = publicPath // eslint-disable-line
new Vue({
i18n,
render: h => h(App),

View File

@ -108,7 +108,7 @@ export default {
mixins: [ApiMixin],
components: {
GenericMultiselect,
RecipeCard: () => import('./RecipeCard.vue')
RecipeCard: () => import('@/components/RecipeCard.vue')
},
data() {
return {

View File

@ -26,6 +26,8 @@
"Recipes_per_page": "Recipes per Page",
"Show_as_header": "Show as header",
"Hide_as_header": "Hide as header",
"Add_nutrition_recipe": "Add nutrition to recipe",
"Remove_nutrition_recipe": "Delete nutrition from recipe",
"Copy_template_reference": "Copy template reference",
"Save_and_View": "Save & View",
"Manage_Books": "Manage Books",

View File

@ -120,5 +120,17 @@
"move_title": "Déplacer {type}",
"del_confirmation_tree": "Êtes-vous sûr de vouloir supprimer {source} et tous ses enfants ?",
"warning_feature_beta": "Cette fonctionnalité est actuellement en phase BETA (test). Veuillez vous attendre à des bugs et éventuellement à des changements avenir (éventuellement la perte de données liées aux fonctionnalités) lorsque vous utilisez cette fonctionnalité.",
"confirm_delete": "Voulez-vous vraiment supprimer {objet} ?"
"confirm_delete": "Voulez-vous vraiment supprimer {objet} ?",
"Note": "Noter",
"Add_Step": "Ajouter une étape",
"Step_Name": "Nom de l'étape",
"Parameter": "Paramètre",
"Automation": "Automatisation",
"Text": "Texte",
"Color": "Couleur",
"New_Meal_Type": "Nouveau type de repas",
"Select_File": "Choisir le fichier",
"Shopping_list": "Liste de courses",
"Save_and_View": "Sauvegarder et visualiser",
"step_time_minutes": "Temps passé en minute"
}

View File

@ -2,13 +2,13 @@
"import_running": "Er wordt geïmporteerd, even geduld!",
"all_fields_optional": "Alle velden zijn optioneel en kunnen leeg gelaten worden.",
"convert_internal": "Zet om naar intern recept",
"Log_Recipe_Cooking": "Log Bereiding",
"Log_Recipe_Cooking": "Bereiding loggen",
"External_Recipe_Image": "Externe Afbeelding Recept",
"Add_to_Book": "Voeg toe aan Boek",
"Add_to_Shopping": "Voeg toe aan Boodschappenlijst",
"Add_to_Shopping": "Voeg toe aan winkelen",
"Add_to_Plan": "Voeg toe aan Plan",
"Step_start_time": "Starttijd stap",
"Select_Book": "Selecteer Boek",
"Select_Book": "Selecteer boek",
"Recipe_Image": "Afbeelding Recept",
"Import_finished": "Importeren gereed",
"View_Recipes": "Bekijk Recepten",
@ -76,8 +76,8 @@
"Delete": "Verwijder",
"Ok": "Open",
"Load_More": "Laad meer",
"Manage_Books": "Beheer Boeken",
"Create": "Maak",
"Manage_Books": "Beheer boeken",
"Create": "Voeg toe",
"Failure": "Storing",
"View": "Bekijk",
"Recipes": "Recepten",
@ -117,8 +117,8 @@
"Add_Step": "Voeg Stap toe",
"Note": "Notitie",
"delete_confirmation": "Weet je zeker dat je {source} wil verwijderen?",
"Ignore_Shopping": "Negeer Boodschappen",
"Shopping_Category": "Boodschappen Categorie",
"Ignore_Shopping": "Negeer winkelen",
"Shopping_Category": "Boodschappencategorie",
"Edit_Food": "Bewerk Eten",
"Move_Food": "Verplaats Eten",
"New_Food": "Nieuw Eten",
@ -138,7 +138,7 @@
"Keyword_Alias": "Etiket Alias",
"Recipe_Book": "Kookboek",
"New_Unit": "Nieuwe Eenheid",
"Create_New_Shopping Category": "Maak nieuwe Boodschappen Categorie",
"Create_New_Shopping Category": "Maak nieuwe boodschappencategorie",
"delete_title": "Verwijder {type}",
"create_title": "Nieuw {type}",
"edit_title": "Bewerk {type}",
@ -166,8 +166,8 @@
"Table_of_Contents": "Inhoudsopgave",
"Create_New_Meal_Type": "Voeg Nieuw Maaltijdtype toe",
"Empty": "Leeg",
"Create_Meal_Plan_Entry": "Maak maaltijdplan regel",
"Edit_Meal_Plan_Entry": "Bewerk maaltijdplan regel",
"Create_Meal_Plan_Entry": "Maak maaltijdplan",
"Edit_Meal_Plan_Entry": "Bewerk maaltijdplan",
"Title": "Titel",
"Week": "Week",
"Month": "Maand",
@ -190,5 +190,17 @@
"Select_File": "Selecteer Bestand",
"Year": "Jaar",
"Planner": "Planner",
"file_upload_disabled": "Het uploaden van bestanden is niet ingeschakeld voor uw ruimte."
"file_upload_disabled": "Het uploaden van bestanden is niet ingeschakeld voor uw ruimte.",
"Export_As_ICal": "Exporteer huidige periode naar iCal formaat",
"Week_Numbers": "Weeknummers",
"Show_Week_Numbers": "Toon weeknummers?",
"Export_To_ICal": "Exporteer .ics",
"Added_To_Shopping_List": "Toegevoegd aan boodschappenlijst",
"Shopping_List_Empty": "Je boodschappenlijst is op dit moment leeg, je kan artikelen via het context menu of een maaltijdplan (rechtermuisknop op de kaart of linkermuisknop op het menu icoon) toevoegen",
"Next_Period": "Volgende periode",
"Previous_Period": "Vorige periode",
"Current_Period": "Huidige periode",
"Next_Day": "Volgende dag",
"Previous_Day": "Vorige dag",
"Cannot_Add_Notes_To_Shopping": "Notities kunnen niet aan de boodschappenlijst toegevoegd worden"
}

View File

@ -48,7 +48,7 @@ module.exports = {
filenameHashing: false,
productionSourceMap: false,
publicPath: process.env.NODE_ENV === 'production'
? '/static/vue'
? ''
: 'http://localhost:8080/',
outputDir: '../cookbook/static/vue/',
runtimeCompiler: true,