{% extends "root.html" %}
{% from "_macros.html" import map_legend, cuisine_links %}
{% block content %}
{% set can_edit = role == "editor" or role == "admin" %}
<div class="space-y-4">
<div class="flex items-center justify-between gap-3 flex-wrap">
<div>
<a href="/areas" class="text-xs link link-hover opacity-70">Areas</a>
<h2 class="text-2xl font-bold text-accent">{{ area.name }}</h2>
</div>
<div class="flex gap-2 flex-wrap">
<a href="/areas/{{ area.id }}/plan" class="btn btn-primary btn-sm"><i class="fas fa-utensils"></i> Where to?</a>
{% if can_edit %}<a href="/areas/{{ area.id }}/restaurants/new" class="btn btn-sm"><i class="fas fa-plus"></i> Add restaurant</a>{% endif %}
<a href="/areas/{{ area.id }}/members" class="btn btn-ghost btn-sm"><i class="fas fa-users"></i> Members <span class="badge badge-sm">{{ member_count }}</span></a>
<a href="/cuisines?area={{ area.id }}" class="btn btn-ghost btn-sm"><i class="fas fa-bowl-food"></i> Cuisines</a>
<a href="/areas/{{ area.id }}/history" class="btn btn-ghost btn-sm"><i class="fas fa-clock-rotate-left"></i> History</a>
</div>
</div>
{% if error == "taken" %}
<div class="alert alert-warning text-sm"><i class="fas fa-triangle-exclamation"></i> You already have an area with that name.</div>
{% endif %}
{% if refreshed is not none %}
<div class="alert alert-success text-sm">
<i class="fas fa-rotate"></i>
{% if refreshed == 0 %}Checked OSM: everything was already up to date.{% else %}Updated {{ refreshed }} restaurant{{ "" if refreshed == 1 else "s" }} from OSM.{% endif %}
</div>
{% endif %}
{% if open_outings %}
<div class="space-y-2">
{% for o in open_outings %}
<a href="/outings/{{ o.id }}" class="alert alert-info flex justify-between gap-3 hover:brightness-95">
<span><i class="fas fa-utensils"></i> Lunch being decided · <span class="font-mono">{{ o.on_date }}</span></span>
<span class="text-sm">{{ o.going | length }} going{% if o.going %}: {{ o.going | join(", ") }}{% endif %} · vote →</span>
</a>
{% endfor %}
</div>
{% endif %}
<div class="h-96 rounded-box border border-base-300"
data-map data-fit
data-tiles="{{ map_config.tiles }}" data-lat="{{ area.lat }}" data-lon="{{ area.lon }}" data-zoom="{{ area.zoom }}"
data-markers='{{ markers | tojson }}'></div>
{{ map_legend() }}
{% if restaurants | length == 0 %}
<div class="border border-dashed border-base-300 rounded-box p-8 text-center space-y-3">
<p class="opacity-70">No restaurants in {{ area.name }} yet.</p>
{% if can_edit %}
<a href="/areas/{{ area.id }}/restaurants/new" class="btn btn-primary btn-sm"><i class="fas fa-plus"></i> Add the first one</a>
{% else %}
<p class="text-xs opacity-70">An editor or admin can add them.</p>
{% endif %}
</div>
{% else %}
<div class="overflow-x-auto border border-base-300 rounded-box">
<table class="table table-sm">
<thead>
<tr><th>Restaurant</th><th>Your rank</th><th class="text-right">Visits</th><th>Last</th></tr>
</thead>
<tbody>
{% for r in restaurants %}
<tr class="{{ 'opacity-50' if r.archived else '' }}">
<td>
<a href="/restaurants/{{ r.id }}" class="font-semibold link link-hover">{{ r.name }}</a>
{% if r.archived %}<span class="badge badge-ghost badge-sm">archived</span>{% endif %}
{% if r.cuisines or r.added_by_name %}
<span class="block text-xs opacity-70">
{{ cuisine_links(r.cuisines, area.id) }}{% if r.cuisines and r.added_by_name %} · {% endif %}{% if r.added_by_name %}added by {{ r.added_by_name }}{% endif %}
</span>
{% endif %}
</td>
<td>{% with restaurant_id = r.id, my_rank = r.my_rank, my_since = r.my_since, tried = r.tried %}{% include "restaurants/_rank.html" %}{% endwith %}</td>
<td class="text-right font-mono">{{ r.visits }}</td>
<td class="text-xs whitespace-nowrap">
{%- if r.last_visit -%}
{%- set ago = r.last_visit | timesince -%}
<span title="{{ r.last_visit }}">{{ "today" if ago == "0 days" else ago ~ " ago" }}</span>
{%- else -%}—{%- endif -%}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% if can_edit %}
<details class="collapse collapse-arrow bg-base-200 border border-base-300">
<summary class="collapse-title text-sm font-semibold">Manage {{ area.name }}</summary>
<div class="collapse-content space-y-4">
{% if role == "admin" %}
<form method="post" action="/areas/{{ area.id }}/rename" class="join">
<input class="input input-bordered input-sm join-item" type="text" name="name" value="{{ area.name }}" maxlength="100" required aria-label="Area name"/>
<button class="btn btn-sm join-item" type="submit"><i class="fas fa-pen"></i> Rename</button>
</form>
{% endif %}
<form method="post" action="/areas/{{ area.id }}/refresh" class="space-y-1">
<button class="btn btn-sm" type="submit" {% if not osm_linked %}disabled{% endif %}>
<i class="fas fa-rotate"></i> Refresh {{ osm_linked }} OSM-linked restaurant{{ "" if osm_linked == 1 else "s" }}
</button>
<p class="text-xs opacity-70">
Pulls current opening hours from OSM, and fills any blank cuisine, website or address.
Anything you've typed in is kept.
</p>
</form>
</div>
</details>
{% endif %}
</div>
{% endblock %}
neiam
/fieri-forever
the flavortown lunch engine
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
5.5 KiB · text
History
73e11cd