{# The viewer's rank on one restaurant. Each button posts and swaps this whole
widget; hx-select is explicit because <body>'s boosted "#content" would
otherwise be inherited and select nothing from this fragment. #}
{% from "_macros.html" import rank_icon, rank_btn %}
<div id="rank-{{ restaurant_id }}" class="join">
{% for r in ranks %}
<button type="button"
class="join-item btn btn-xs {% if my_rank == r %}{{ rank_btn(r) }}{% else %}btn-ghost border-base-300{% endif %}"
title="{{ r | capitalize }}"
aria-pressed="{{ 'true' if my_rank == r else 'false' }}"
hx-post="/restaurants/{{ restaurant_id }}/rank"
hx-vals='{"rank": "{{ r }}"}'
hx-target="#rank-{{ restaurant_id }}"
hx-select="#rank-{{ restaurant_id }}"
hx-swap="outerHTML">
<i class="fas {{ rank_icon(r) }}"></i><span class="hidden md:inline capitalize">{{ r }}</span>
</button>
{% endfor %}
</div>
neiam
/fieri-forever
the flavortown lunch engine
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
959 B · text
History
25c4237