kaarten/templates/partials.html

27 lines
1.2 KiB
HTML
Raw Permalink Normal View History

2020-03-20 13:41:26 +01:00
{% macro render_card(card, game, playerid, play=False, undo=False, pickup=False, shuffle_deck=False) -%}
{% if play %}
<a href={{ url_for("play", card=card, gameid=game.game_id, playerid=playerid) }}>{{_render_card(card)}} </a>
{% elif undo %}
<a href={{ url_for("undo", gameid=game.game_id, playerid=playerid) }}>{{_render_card(card)}} </a>
{% elif pickup %}
<a href={{ url_for("pickup", gameid=game.game_id, playerid=playerid) }}>{{_render_card(card)}} </a>
{% elif shuffle_deck %}
<a href={{ url_for("shuffle_deck", gameid=game.game_id, playerid=playerid) }}>{{_render_card(card)}} </a>
{% else %}
{{_render_card(card)}}
{% endif %}
{%- endmacro %}
{% macro _render_card(card) -%}
2020-03-20 15:16:22 +01:00
<img src={{ url_for('static', filename='images/cards/' + card + '.png') }} alt={{ card }} width=100 />
2020-03-20 13:41:26 +01:00
{%- endmacro %}
{% macro deck(game, playerid="") -%}
{% if game.cards["pickup_pile"] == [] %}
{{ render_card("XX", game, playerid, shuffle_deck=(playerid != "")) }}
{% else %}
{{ render_card("back", game, playerid, pickup=(playerid != "")) }}
{% endif %}
{{ render_card(game.last_card, game, playerid, undo=(playerid != "" and game.cards["played_cards"] != [])) }}
2020-03-20 15:16:22 +01:00
{%- endmacro %}