mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-28 04:33:14 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6b505c361 | ||
|
|
97cef449c9 | ||
|
|
fef6f695ce | ||
|
|
73a24a8ef0 | ||
|
|
e727cae020 | ||
|
|
894d2d2e6b | ||
|
|
543e52d596 |
@@ -12,7 +12,7 @@ class Chowdown(Integration):
|
||||
|
||||
def import_file_name_filter(self, zip_info_object):
|
||||
print("testing", zip_info_object.filename)
|
||||
return re.match(r'^_recipes/([A-Za-z\d\s-])+.md$', zip_info_object.filename)
|
||||
return re.match(r'^(_)*recipes/([A-Za-z\d\s-])+.md$', zip_info_object.filename)
|
||||
|
||||
def get_recipe_from_file(self, file):
|
||||
ingredient_mode = False
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ from annoying.functions import get_object_or_None
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.models import User
|
||||
from django.core import management
|
||||
from django.core.exceptions import FieldError
|
||||
from django.core.exceptions import FieldError, ValidationError
|
||||
from django.core.files import File
|
||||
from django.db.models import Q
|
||||
from django.http import FileResponse, HttpResponse, JsonResponse
|
||||
@@ -70,6 +70,8 @@ class StandardFilterMixin(ViewSetMixin):
|
||||
queryset = queryset.filter(updated_at__gte=updated_at)
|
||||
except FieldError:
|
||||
pass
|
||||
except ValidationError:
|
||||
raise APIException(_('Parameter updated_at incorrectly formatted'))
|
||||
|
||||
limit = self.request.query_params.get('limit', None)
|
||||
random = self.request.query_params.get('random', False)
|
||||
|
||||
@@ -63,6 +63,11 @@ Images are saved in a directory called `images`.
|
||||
|
||||
In order to import your Chowdown recipes simply create a `.zip` file from those two folders and import them.
|
||||
The folder structure should look as follows
|
||||
|
||||
!!! info "_recipes"
|
||||
For some reason chowdown uses `_` before the `recipes` folder. To avoid confusion the import supports both
|
||||
`_recipes` and `recipes`
|
||||
|
||||
```
|
||||
Recipes.zip/
|
||||
├── _recipes/
|
||||
|
||||
BIN
docs/preview.png
BIN
docs/preview.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.3 MiB |
BIN
docs/preview.xcf
BIN
docs/preview.xcf
Binary file not shown.
@@ -12,7 +12,7 @@
|
||||
<i class="far fa-check-circle text-primary" v-if="!ingredient.checked"></i>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="ingredient.amount !== 0">{{ calculateAmount(ingredient.amount) }}</span>
|
||||
<span v-if="ingredient.amount !== 0" v-html="calculateAmount(ingredient.amount)"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span v-if="ingredient.unit !== null && !ingredient.no_amount">{{ ingredient.unit.name }}</span>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<i class="fas fa-fire fa-fw text-primary"></i> {{ _('Calories') }}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ calculateAmount(recipe.nutrition.calories) }} kcal
|
||||
<span v-html="calculateAmount(recipe.nutrition.calories)"></span> kcal
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
<i class="fas fa-bread-slice fa-fw text-primary"></i> {{ _('Carbohydrates') }}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
{{ calculateAmount(recipe.nutrition.carbohydrates) }} g
|
||||
<span v-html="calculateAmount(recipe.nutrition.carbohydrates)"></span> g
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -34,7 +33,7 @@
|
||||
<i class="fas fa-cheese fa-fw text-primary"></i> {{ _('Fats') }}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ calculateAmount(recipe.nutrition.fats) }} g
|
||||
<span v-html="calculateAmount(recipe.nutrition.fats)"></span> g
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,7 +42,7 @@
|
||||
<i class="fas fa-drumstick-bite fa-fw text-primary"></i> {{ _('Proteins') }}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ calculateAmount(recipe.nutrition.proteins) }} g
|
||||
<span v-html="calculateAmount(recipe.nutrition.proteins)"></span> g
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<span>{{ calculateAmount(number) }}</span>
|
||||
<span v-html="calculateAmount(number)"></span>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ export function getUserPreference(pref) {
|
||||
import {frac} from "@/utils/fractions";
|
||||
|
||||
export function calculateAmount(amount, factor) {
|
||||
if (getUserPreference('user_fractions')) {
|
||||
if (getUserPreference('use_fractions')) {
|
||||
let return_string = ''
|
||||
let fraction = frac.cont((amount * factor), 9, true)
|
||||
let fraction = frac((amount * factor), 9, true)
|
||||
|
||||
if (fraction[0] > 0) {
|
||||
return_string += fraction[0]
|
||||
|
||||
Reference in New Issue
Block a user