From 123dc1a74dada7b66a9658166d55171333301380 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Fri, 8 May 2020 00:10:23 +0200 Subject: [PATCH] meal plan entry view --- cookbook/forms.py | 7 +- cookbook/models.py | 4 + .../static/custom/css/markdown_blockquote.css | 21 +++++ cookbook/templates/base.html | 2 +- cookbook/templates/meal_plan.html | 14 ++-- cookbook/templates/meal_plan_entry.html | 83 +++++++++++++++++++ cookbook/templates/recipe_view.html | 26 +----- cookbook/urls.py | 1 + cookbook/views/edit.py | 2 +- cookbook/views/views.py | 13 +++ 10 files changed, 140 insertions(+), 33 deletions(-) create mode 100644 cookbook/static/custom/css/markdown_blockquote.css create mode 100644 cookbook/templates/meal_plan_entry.html diff --git a/cookbook/forms.py b/cookbook/forms.py index b3a925a02..51d59ed3e 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -92,7 +92,7 @@ class InternalRecipeForm(forms.ModelForm): } widgets = {'keywords': MultiSelectWidget} help_texts = { - 'instructions': _('You can use markdown to format the instructions. See the docs here') + 'instructions': _('You can use markdown to format this field. See the docs here') } @@ -264,4 +264,9 @@ class MealPlanForm(forms.ModelForm): model = MealPlan fields = ('recipe', 'title', 'meal', 'note', 'date', 'shared') + help_texts = { + 'shared': _('You can list default users to share recipes with in the settings.'), + 'note': _('You can use markdown to format this field. See the docs here') + } + widgets = {'recipe': SelectWidget, 'date': DateWidget, 'shared': MultiSelectWidget} diff --git a/cookbook/models.py b/cookbook/models.py index e6b3b1c49..b6d04b44e 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -234,6 +234,10 @@ class MealPlan(models.Model): return self.title return str(self.recipe) + def get_meal_name(self): + meals = dict(self.MEAL_TYPES) + return meals.get(self.meal) + class CookLog(models.Model): recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE) diff --git a/cookbook/static/custom/css/markdown_blockquote.css b/cookbook/static/custom/css/markdown_blockquote.css new file mode 100644 index 000000000..17f2645f3 --- /dev/null +++ b/cookbook/static/custom/css/markdown_blockquote.css @@ -0,0 +1,21 @@ +/* css classes needed to render markdown blockquotes */ +blockquote { + background: #f9f9f9; + border-left: 4px solid #ccc; + margin: 1.5em 10px; + padding: .5em 10px; + quotes: none; +} + +blockquote:before { + color: #ccc; + content: open-quote; + font-size: 4em; + line-height: .1em; + margin-right: .25em; + vertical-align: -.4em; +} + +blockquote p { + display: inline; +} \ No newline at end of file diff --git a/cookbook/templates/base.html b/cookbook/templates/base.html index dbd849281..945d50fc1 100644 --- a/cookbook/templates/base.html +++ b/cookbook/templates/base.html @@ -70,7 +70,7 @@ class="sr-only">(current) -