Files
classifieds/app/templates/listings/detail.html
T
2026-06-16 13:29:32 -04:00

85 lines
3.7 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ listing.title }}{% endblock %}
{% block content %}
<article class="detail">
<div class="detail-main card">
<h1>{{ listing.title }}</h1>
<div class="detail-meta">
{% if listing.price_display %}<span class="price big">{{ listing.price_display }}</span>{% endif %}
<span class="badge cat">{{ listing.category.name }}</span>
{% if not listing.is_live %}<span class="badge warn">{{ listing.status.value }}</span>{% endif %}
</div>
<p class="muted small">
{% if listing.city %}{{ listing.city }}, {{ listing.state }} {{ listing.zip }}{% endif %}
· {{ _('%(n)s views', n=listing.view_count) }}
</p>
{% if listing.images %}
<div class="gallery">
{% for img in listing.images %}
<img src="{{ url_for('listings.media', rel=img.path) }}" alt="">
{% endfor %}
</div>
{% endif %}
<div class="body">{{ listing.body | replace('\n','<br>') | safe }}</div>
{% if listing.attributes %}
<table class="attrs">
{% for f in listing.category.fields() %}
{% if listing.attributes.get(f.name) is not none %}
<tr><th>{{ f.label }}</th><td>{{ listing.attributes.get(f.name) }}</td></tr>
{% endif %}
{% endfor %}
</table>
{% endif %}
</div>
<aside class="detail-side card">
<div class="seller">
<strong>{{ listing.user.display_name }}</strong>
{% if listing.user.verified %}<span class="badge ok">{{ _('Verified') }}</span>{% endif %}
</div>
{% if is_owner %}
<a class="btn" href="{{ url_for('listings.edit', listing_id=listing.id) }}">{{ _('Edit') }}</a>
<a class="btn ghost" href="{{ url_for('payments.boost_listing', listing_id=listing.id) }}">{{ _('⚡ Boost') }}</a>
{% if listing.status.value == 'active' %}
<form method="post" action="{{ url_for('listings.mark_sold', listing_id=listing.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><button class="btn ghost" type="submit">{{ _('Mark sold') }}</button>
</form>
{% endif %}
<form method="post" action="{{ url_for('listings.delete', listing_id=listing.id) }}"
onsubmit="return confirm('{{ _('Delete this listing?') }}')">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><button class="btn danger" type="submit">{{ _('Delete') }}</button>
</form>
{% else %}
{% if current_user.is_authenticated %}
<a class="btn" href="{{ url_for('messaging.start_conversation', listing_id=listing.id) }}">
{{ _('Contact seller') }}
</a>
<form method="post"
action="{{ url_for('messaging.toggle_favorite', listing_id=listing.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="btn ghost" type="submit">{{ _('♥ Save listing') }}</button>
</form>
<form method="post" class="report-form"
action="{{ url_for('listings.report', listing_id=listing.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<select class="input" name="reason">
{% for r in ['spam', 'scam', 'offensive', 'duplicate', 'miscategorized', 'other'] %}
<option value="{{ r }}">{{ r }}</option>
{% endfor %}
</select>
<input class="input" name="note" placeholder="{{ _('Optional note') }}">
<button class="btn ghost tiny" type="submit">{{ _('Report listing') }}</button>
</form>
{% else %}
<a class="btn" href="{{ url_for('auth.login') }}?next={{ request.path }}">
{{ _('Sign in to contact') }}
</a>
{% endif %}
{% endif %}
</aside>
</article>
{% endblock %}