Skip to content

Commit

Permalink
Improve recipe ordering on event export (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
janpeterka committed Jun 21, 2023
1 parent 3d9384e commit 822dcc9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
27 changes: 14 additions & 13 deletions app/templates/daily_plans/_print_day_badge.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@
<span> {{ day.weekday }} </span>

<hr class="mt-1">

{% for meal, daily_recipes in day.daily_recipes | rejectattr("meal_type", "none") | groupby("meal_type") %}
<div> <strong>{{ meal }}:</strong> </div>
<span> {{ daily_recipes | map(attribute="recipe") | join(", ", attribute="name") }} </span>
{% endfor %}
# set recipes = day.daily_recipes | sort(attribute="order_index")

{% if day.daily_recipes_without_meal_type %}
<div> <strong>ostatní</strong> </div>
{{ day.daily_recipes_without_meal_type | map(attribute="recipe") | join(", ", attribute="name") }}
{% endif %}
{% for daily_recipe in recipes %}
# if not loop.previtem or daily_recipe.meal_type != loop.previtem.meal_type
<div> <strong>{{ daily_recipe.meal_type | default("ostatní", True) }}</strong> </div>
# endif

# if daily_recipe.meal_type != "nákup"
<div> {{ daily_recipe.recipe.name }} </div>
# endif
{% endfor %}

{% if day.all_tasks %}
<hr>
{% for task in day.all_tasks %}
<input type="checkbox"> {{ task }} <br>
{% endfor %}
{% for task in day.all_tasks %}
<input type="checkbox"> {{ task }} <br>
{% endfor %}
{% endif %}
</div>
</div>
</div>
19 changes: 0 additions & 19 deletions app/templates/event_exporter/recipe_list_visual.html.j2

This file was deleted.

4 changes: 2 additions & 2 deletions app/templates/events/_export.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<a data-turbo="false" class="btn bg-color-secondary-action color-white me-2 mt-1 mt-lg-0 w-100" href="{{ url_for('EventExporterView:show_ingredient_list_pdf', event_id=event.id) }}" target="_blank"> {{ icon("pdf") }} nákupní seznam s recepty </a>
</div>
<div class="col-12 col-sm-3">
<a data-turbo="false" class="btn bg-color-secondary-action color-white me-2 mt-1 mt-lg-0 w-100" href="{{ url_for('EventTimetableExporterView:pdf', event_id=event.id) }}" target="_blank"> {{ icon("pdf") }} jídelníček </a>
<a data-turbo="false" class="btn bg-color-secondary-action color-white me-2 mt-1 mt-lg-0 w-100" href="{{ url_for('EventTimetableExporterView:pdf', event_id=event.id) }}" target="_blank"> {{ icon("pdf") }} jídelníček </a>
</div>
<div class="col-12 col-sm-3">
<a data-turbo="false" class="btn bg-color-secondary-action color-white me-2 mt-1 mt-lg-0 w-100" href="{{ url_for('EventCookbookExporterView:pdf', event_id=event.id) }}" target="_blank"> {{ icon("pdf") }} kuchařka </a>
Expand All @@ -56,4 +56,4 @@
</div>
</div>
</div>
</details>
</details>

0 comments on commit 822dcc9

Please sign in to comment.