feat: Add expand option
This commit is contained in:
@@ -6,6 +6,11 @@ from fellchensammlung.models import RescueOrganization, AdoptionNotice, Species
|
||||
|
||||
@headers({"X-Robots-Tag": "noindex"})
|
||||
def list_ans_per_rescue_organization(request, rescue_organization_id, species_slug=None):
|
||||
expand = request.GET.get("expand")
|
||||
if expand is not None:
|
||||
expand = True
|
||||
else:
|
||||
expand = False
|
||||
org = get_object_or_404(RescueOrganization, pk=rescue_organization_id)
|
||||
if species_slug is None:
|
||||
adoption_notices = AdoptionNotice.objects.filter(organization=org)
|
||||
|
@@ -3,7 +3,11 @@
|
||||
<div class="grid is-col-min-10">
|
||||
{% for adoption_notice in adoption_notices %}
|
||||
<div class="cell">
|
||||
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
|
||||
{% if expand %}
|
||||
{% include "fellchensammlung/partials/partial-adoption-notice.html" %}
|
||||
{% else %}
|
||||
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@@ -1,40 +1,84 @@
|
||||
{% load custom_tags %}
|
||||
{% load i18n %}
|
||||
<div class="card an-card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-header-title">
|
||||
<a href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="grid">
|
||||
<div class="cell">
|
||||
<!--- General Information --->
|
||||
<div class="grid">
|
||||
|
||||
<div class="card">
|
||||
<div>
|
||||
<div class="header-card-adoption-notice">
|
||||
<h1><a class="heading-card-adoption-notice"
|
||||
href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a></h1>
|
||||
<a class="adoption-card-report-link" href="{{ adoption_notice.get_report_url }}"><i
|
||||
class="fa-solid fa-flag"></i></a>
|
||||
</div>
|
||||
<p><b>{% translate "Notfellchen" %}:</b> {{ adoption_notice.animals.all|join_link:", " | safe }}
|
||||
</p>
|
||||
<p>
|
||||
<b>Ort</b>
|
||||
{% if adoption_notice.location %}
|
||||
{{ adoption_notice.location.str }}
|
||||
{% else %}
|
||||
{{ adoption_notice.location_string }}
|
||||
{% endif %}
|
||||
</p>
|
||||
<div class="content">
|
||||
{% if adoption_notice.description %}
|
||||
{{ adoption_notice.description | render_markdown }}
|
||||
{% else %}
|
||||
<p>
|
||||
{% translate "Keine Beschreibung" %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if adoption_notice.get_photo %}
|
||||
<div class="adoption-notice-img">
|
||||
<img src="{{ MEDIA_URL }}/{{ adoption_notice.get_photo.image }}"
|
||||
alt="{{ adoption_notice.get_photo.alt_text }}">
|
||||
<div class="cell">
|
||||
|
||||
{% if adoption_notice.organization %}
|
||||
<div class="cell">
|
||||
<span>
|
||||
<i class="fa-solid fa-building fa-fw" aria-label="{% trans 'Tierschutzorganisation' %}"></i>
|
||||
<a href="{{ adoption_notice.organization.get_absolute_url }}"> {{ adoption_notice.organization }}</a>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
{% else %}
|
||||
<p>
|
||||
<i class="fa-solid fa-location-dot fa-fw"></i>
|
||||
{% if adoption_notice.location %}
|
||||
{{ adoption_notice.location }}
|
||||
{% else %}
|
||||
{{ adoption_notice.location_string }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="cell">
|
||||
{% include "fellchensammlung/partials/sex-overview.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if adoption_notice.get_photos %}
|
||||
<!--- Images -->
|
||||
<div class="gallery block">
|
||||
{% with photo=adoption_notice.get_photos.0 %}
|
||||
<div class="main-photo minimal">
|
||||
<a href="{{ MEDIA_URL }}{{ photo.image }}"
|
||||
data-pswp-width="{{ photo.image.width }}"
|
||||
data-pswp-height="{{ photo.image.height }}"
|
||||
target="_blank">
|
||||
<img src="{{ MEDIA_URL }}{{ photo.image }}"
|
||||
alt="{{ photo.alt_text }}">
|
||||
</a>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% if adoption_notice.get_photos|length > 1 %}
|
||||
<div class="thumbnail-row minimal">
|
||||
{% for photo in adoption_notice.get_photos|slice:"1:4" %}
|
||||
<div class="thumbnail">
|
||||
<a href="{{ MEDIA_URL }}{{ photo.image }}"
|
||||
data-pswp-width="{{ photo.image.width }}"
|
||||
data-pswp-height="{{ photo.image.height }}"
|
||||
target="_blank">
|
||||
<img src="{{ MEDIA_URL }}{{ photo.image }}"
|
||||
alt="{{ photo.alt_text }}">
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!--- Description -->
|
||||
{% if adoption_notice.description_short %}
|
||||
<div class="content block">
|
||||
{{ adoption_notice.description_short | render_markdown }}
|
||||
</div>
|
||||
{% else %}
|
||||
{% translate "Keine Foto" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user