Fix bug where ingredients would not render if servings was an empty string

This commit is contained in:
maeligg 2021-06-16 12:01:55 +02:00
parent cd75ace26e
commit f224ac623b

View file

@ -11,13 +11,13 @@
<a class="c-tags__tag" href="/tags/{{ tag | noEmoji | slug }}">{{ tag }}</a> <a class="c-tags__tag" href="/tags/{{ tag | noEmoji | slug }}">{{ tag }}</a>
{% endfor %} {% endfor %}
</div> </div>
<div class="c-recipe__ingredients-wrapper" x-data='{currentServings: {{ servings }}, ingredients: "{{ ingredients | arrayToString }}".split("£") }'> <div class="c-recipe__ingredients-wrapper" x-data='{currentServings: {{ servings if not servings == "" else false }}, ingredients: "{{ ingredients | arrayToString }}".split("£") }'>
{% if time or servings %} {% if time or not servings == "" %}
<div class="c-recipe__additional-info"> <div class="c-recipe__additional-info">
{% if time %} {% if time %}
<p>{% include "icons/time.svg" %}{{ time }}</p> <p>{% include "icons/time.svg" %}{{ time }}</p>
{% endif %} {% endif %}
{% if servings %} {% if not servings == "" %}
<p> <p>
<template x-if="currentServings > 1"> <template x-if="currentServings > 1">
<button @click="currentServings -= 1" class="c-recipe__serving-button"> <button @click="currentServings -= 1" class="c-recipe__serving-button">