Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Feb 2, 2024
2 parents 0c94cf1 + e530396 commit 2a15d19
Show file tree
Hide file tree
Showing 47 changed files with 655 additions and 383 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-docker-open-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
suffix: ""
continue-on-error: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get version number
id: get_version
Expand All @@ -43,7 +43,7 @@ jobs:
path: ./recipes/plugins/open_data_plugin

# Build Vue frontend
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
suffix: ""
continue-on-error: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get version number
id: get_version
Expand All @@ -35,7 +35,7 @@ jobs:
fi
# Build Vue frontend
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
# Build Vue frontend
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install Vue dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand All @@ -25,7 +25,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
# Override language selection by uncommenting this and choosing your languages
with:
languages: python, javascript
Expand All @@ -47,6 +47,6 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
languages: javascript, python
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
if: github.repository_owner == 'TandoorRecipes'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install mkdocs-material mkdocs-include-markdown-plugin
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Share some information on how you use Tandoor to help me improve the application
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.
> NOTE: There appears to be a whole range of legal issues with licensing anything other than the standard completely open licenses.
> I am in the process of getting some professional legal advice to sort out these issues.
> Please also see [Issue 238](https://github.com/vabene1111/recipes/issues/238) for some discussion and **reasoning** regarding the topic.
Expand Down
2 changes: 1 addition & 1 deletion boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ echo "Done"

chmod -R 755 /opt/recipes/mediafiles

exec gunicorn -b :$TANDOOR_PORT --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi
exec gunicorn -b "[::]:$TANDOOR_PORT" --workers $GUNICORN_WORKERS --threads $GUNICORN_THREADS --access-logfile - --error-logfile - --log-level $GUNICORN_LOG_LEVEL recipes.wsgi
2 changes: 1 addition & 1 deletion cookbook/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def __init__(self, *args, **kwargs):
class Meta:
model = Space

fields = ('food_inherit', 'reset_food_inherit', 'use_plural')
fields = ('food_inherit', 'reset_food_inherit',)

help_texts = {
'food_inherit': _('Fields on food that should be inherited by default.'),
Expand Down
7 changes: 6 additions & 1 deletion cookbook/helper/template_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ class IngredientObject(object):
unit = ""
food = ""
note = ""
numeric_amount = 0

def __init__(self, ingredient):
if ingredient.no_amount:
self.amount = ""
else:
self.amount = f"<scalable-number v-bind:number='{bleach.clean(str(ingredient.amount))}' v-bind:factor='ingredient_factor'></scalable-number>"
self.numeric_amount = float(ingredient.amount)
if ingredient.unit:
if ingredient.unit.plural_name in (None, ""):
self.unit = bleach.clean(str(ingredient.unit))
Expand Down Expand Up @@ -83,9 +85,12 @@ def render_instructions(step): # TODO deduplicate markdown cleanup code
for i in step.ingredients.all():
ingredients.append(IngredientObject(i))

def scale(number):
return f"<scalable-number v-bind:number='{bleach.clean(str(number))}' v-bind:factor='ingredient_factor'></scalable-number>"

try:
template = Template(instructions)
instructions = template.render(ingredients=ingredients)
instructions = template.render(ingredients=ingredients, scale=scale)
except TemplateSyntaxError:
return _('Could not parse template code.') + ' Error: Template Syntax broken'
except UndefinedError:
Expand Down
30 changes: 22 additions & 8 deletions cookbook/locale/it/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-18 14:28+0200\n"
"PO-Revision-Date: 2023-04-29 07:55+0000\n"
"Last-Translator: Oliver Cervera <[email protected]>\n"
"PO-Revision-Date: 2024-02-01 17:22+0000\n"
"Last-Translator: Lorenzo <[email protected]>\n"
"Language-Team: Italian <http://translate.tandoor.dev/projects/tandoor/"
"recipes-backend/it/>\n"
"Language: it\n"
Expand Down Expand Up @@ -536,27 +536,27 @@ msgstr "rotazione inversa"

#: .\cookbook\helper\recipe_url_import.py:267
msgid "careful rotation"
msgstr ""
msgstr "rotazione con cura"

#: .\cookbook\helper\recipe_url_import.py:268
msgid "knead"
msgstr ""
msgstr "impastare"

#: .\cookbook\helper\recipe_url_import.py:269
msgid "thicken"
msgstr ""
msgstr "addensare"

#: .\cookbook\helper\recipe_url_import.py:270
msgid "warm up"
msgstr ""
msgstr "riscaldare"

#: .\cookbook\helper\recipe_url_import.py:271
msgid "ferment"
msgstr ""
msgstr "fermentare"

#: .\cookbook\helper\recipe_url_import.py:272
msgid "sous-vide"
msgstr ""
msgstr "sottovuoto"

#: .\cookbook\helper\shopping_helper.py:157
msgid "You must supply a servings size"
Expand Down Expand Up @@ -1760,6 +1760,13 @@ msgid ""
"selected for a full text search.\n"
" "
msgstr ""
" \n"
" Ricerche semplici ignorano la puteggiatura e parole comuni come "
"\"il\", \"un\", \"e\". E tratterà separatamente le parole come necessario.\n"
" Cercare \"mela o farina\" restituisce ogni ricetta che contiene "
"sia \"mele\" che \"farina\" ovunque nei campi che sono stati selezionati per "
"una ricerca completa di testo.\n"
" "

#: .\cookbook\templates\search_info.html:34
msgid ""
Expand All @@ -1771,6 +1778,13 @@ msgid ""
"been selected for a full text search.\n"
" "
msgstr ""
" \n"
" Ricerche di frase ignorano la punteggiatura, ma cercano tutte "
"parole nell'esatto ordine indicato.\n"
" Cercare \"mele o farina\" restituisce una ricetta che contiene "
"l'esatta frase \"mele o farina\" in qualsiasi campo selezionato per una "
"ricerca completa di testo.\n"
" "

#: .\cookbook\templates\search_info.html:39
msgid ""
Expand Down
6 changes: 0 additions & 6 deletions cookbook/migrations/0204_propertytype_fdc_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
from django_scopes import scopes_disabled


def fix_fdc_ids(apps, schema_editor):
with scopes_disabled():
# in case any food had a non digit fdc ID before this migration, remove it
Food = apps.get_model('cookbook', 'Food')
Food.objects.exclude(fdc_id__regex=r'^\d+$').exclude(fdc_id=None).update(fdc_id=None)


class Migration(migrations.Migration):
Expand All @@ -17,7 +12,6 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RunPython(fix_fdc_ids),
migrations.AddField(
model_name='propertytype',
name='fdc_id',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
# Generated by Django 4.2.7 on 2023-11-29 19:44

from django.db import migrations, models
from django_scopes import scopes_disabled


class Migration(migrations.Migration):
def fix_fdc_ids(apps, schema_editor):
with scopes_disabled():
# in case any food had a non digit fdc ID before this migration, remove it
Food = apps.get_model('cookbook', 'Food')
Food.objects.exclude(fdc_id__regex=r'^\d+$').exclude(fdc_id=None).update(fdc_id=None)


class Migration(migrations.Migration):
dependencies = [
('cookbook', '0204_propertytype_fdc_id'),
]

operations = [
migrations.RunPython(fix_fdc_ids),
migrations.AlterField(
model_name='food',
name='fdc_id',
Expand Down
17 changes: 17 additions & 0 deletions cookbook/migrations/0209_remove_space_use_plural.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.7 on 2024-01-28 07:42

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('cookbook', '0208_space_app_name_userpreference_max_owned_spaces'),
]

operations = [
migrations.RemoveField(
model_name='space',
name='use_plural',
),
]
1 change: 0 additions & 1 deletion cookbook/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ class Space(ExportModelOperationsMixin('space'), models.Model):
max_recipes = models.IntegerField(default=0)
max_file_storage_mb = models.IntegerField(default=0, help_text=_('Maximum file storage for space in MB. 0 for unlimited, -1 to disable file upload.'))
max_users = models.IntegerField(default=0)
use_plural = models.BooleanField(default=True)
allow_sharing = models.BooleanField(default=True)
no_sharing_limit = models.BooleanField(default=False)
demo = models.BooleanField(default=False)
Expand Down
2 changes: 1 addition & 1 deletion cookbook/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class Meta:
fields = (
'id', 'name', 'created_by', 'created_at', 'message', 'max_recipes', 'max_file_storage_mb', 'max_users',
'allow_sharing', 'demo', 'food_inherit', 'user_count', 'recipe_count', 'file_size_mb',
'image', 'nav_logo', 'space_theme', 'custom_space_theme', 'nav_bg_color', 'nav_text_color', 'use_plural',
'image', 'nav_logo', 'space_theme', 'custom_space_theme', 'nav_bg_color', 'nav_text_color',
'logo_color_32', 'logo_color_128', 'logo_color_144', 'logo_color_180', 'logo_color_192', 'logo_color_512', 'logo_color_svg',)
read_only_fields = (
'id', 'created_by', 'created_at', 'max_recipes', 'max_file_storage_mb', 'max_users', 'allow_sharing',
Expand Down
10 changes: 9 additions & 1 deletion cookbook/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<title>{% block title %}
{% endblock %}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
<meta name="robots" content="noindex,nofollow"/>

<link rel="icon" href="{{ theme_values.logo_color_svg }}">
Expand Down Expand Up @@ -481,6 +481,14 @@ <h6 class="dropdown-header">{% trans 'Your Spaces' %}</h6>
overflow-x: hidden;
}
}

#id_base_container {
padding-bottom: env(safe-area-inset-bottom);
}

.fixed-bottom {
padding-bottom: max(0.5rem, calc(env(safe-area-inset-bottom) - 0.5rem)) !important;
}
</style>

</body>
Expand Down
9 changes: 6 additions & 3 deletions cookbook/templatetags/theming_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django_scopes import scopes_disabled

from cookbook.models import UserPreference, UserFile, Space
from recipes.settings import STICKY_NAV_PREF_DEFAULT, UNAUTHENTICATED_THEME_FROM_SPACE
from recipes.settings import STICKY_NAV_PREF_DEFAULT, UNAUTHENTICATED_THEME_FROM_SPACE, FORCE_THEME_FROM_SPACE

register = template.Library()

Expand All @@ -15,11 +15,14 @@ def theme_values(request):

def get_theming_values(request):
space = None
if getattr(request,'space',None):
if getattr(request, 'space', None):
space = request.space
if not request.user.is_authenticated and UNAUTHENTICATED_THEME_FROM_SPACE > 0:
if not request.user.is_authenticated and UNAUTHENTICATED_THEME_FROM_SPACE > 0 and FORCE_THEME_FROM_SPACE == 0:
with scopes_disabled():
space = Space.objects.filter(id=UNAUTHENTICATED_THEME_FROM_SPACE).first()
if FORCE_THEME_FROM_SPACE:
with scopes_disabled():
space = Space.objects.filter(id=FORCE_THEME_FROM_SPACE).first()

themes = {
UserPreference.BOOTSTRAP: 'themes/bootstrap.min.css',
Expand Down
4 changes: 2 additions & 2 deletions cookbook/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1686,10 +1686,10 @@ def get_plan_ical(request, from_date, to_date):
).filter(space=request.user.userspace_set.filter(active=1).first().space).distinct().all()

if from_date is not None:
queryset = queryset.filter(date__gte=from_date)
queryset = queryset.filter(from_date__gte=from_date)

if to_date is not None:
queryset = queryset.filter(date__lte=to_date)
queryset = queryset.filter(to_date__lte=to_date)

cal = Calendar()

Expand Down
5 changes: 4 additions & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ Tandoor can be installed as a progressive web app (PWA) on mobile and desktop de
#### Safari (iPhone/iPad)
Open Tandoor, click Safari's share button, select `Add to Home Screen`

### Chrome/Chromium
#### Chrome/Chromium
Open Tandoor, click the `add Tandoor to the home screen` message that pops up at the bottom of the screen

#### Firefox for Android
Open Tandoor, click on the `` menu icon, then on `Install`

### Desktop browsers

#### Google Chrome
Expand Down
2 changes: 1 addition & 1 deletion docs/features/automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ In order to prevent denial of service attacks on the RegEx engine the number of
and the length of the inputs that are processed are limited. Those limits should never be reached
during normal usage.

## Instructtion Replace, Title Replace, Food Replace & Unit Replace
## Instruction Replace, Title Replace, Food Replace & Unit Replace

These work just like the Description Replace automation.
Instruction, Food and Unit Replace will run against every iteration of the object in a recipe during import.
Expand Down
4 changes: 2 additions & 2 deletions docs/features/shopping.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!!! info "WIP"
While being around for a while there are still a lot of features that i plan on adding to the shopping list.
While being around for a while there are still a lot of features that I plan on adding to the shopping list.
You can see an overview of what is still planned on [this](https://github.com/vabene1111/recipes/issues/114) issue.


Expand Down Expand Up @@ -41,4 +41,4 @@ There are a few more features worth pointing out

1. You can export recipes for use in other applications (Google Keep, etc.) by using the export button
2. In the export popup you can define a prefix to be put before each row in case an external app requires that
3. Marking a shopping list as finished will hide it from the shopping list page
3. Marking a shopping list as finished will hide it from the shopping list page
Loading

0 comments on commit 2a15d19

Please sign in to comment.