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"})
|
@headers({"X-Robots-Tag": "noindex"})
|
||||||
def list_ans_per_rescue_organization(request, rescue_organization_id, species_slug=None):
|
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)
|
org = get_object_or_404(RescueOrganization, pk=rescue_organization_id)
|
||||||
if species_slug is None:
|
if species_slug is None:
|
||||||
adoption_notices = AdoptionNotice.objects.filter(organization=org)
|
adoption_notices = AdoptionNotice.objects.filter(organization=org)
|
||||||
|
@@ -3,7 +3,11 @@
|
|||||||
<div class="grid is-col-min-10">
|
<div class="grid is-col-min-10">
|
||||||
{% for adoption_notice in adoption_notices %}
|
{% for adoption_notice in adoption_notices %}
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
|
{% if expand %}
|
||||||
|
{% include "fellchensammlung/partials/partial-adoption-notice.html" %}
|
||||||
|
{% else %}
|
||||||
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
|
{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,40 +1,84 @@
|
|||||||
{% load custom_tags %}
|
{% load custom_tags %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
<div class="card an-card">
|
||||||
<div class="card">
|
<div class="card-header">
|
||||||
<div>
|
<h2 class="card-header-title">
|
||||||
<div class="header-card-adoption-notice">
|
<a href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a>
|
||||||
<h1><a class="heading-card-adoption-notice"
|
</h2>
|
||||||
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>
|
</div>
|
||||||
<p><b>{% translate "Notfellchen" %}:</b> {{ adoption_notice.animals.all|join_link:", " | safe }}
|
<div class="card-content">
|
||||||
</p>
|
<div class="grid">
|
||||||
|
<div class="cell">
|
||||||
|
<!--- General Information --->
|
||||||
|
<div class="grid">
|
||||||
|
|
||||||
|
<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>
|
<p>
|
||||||
<b>Ort</b>
|
<i class="fa-solid fa-location-dot fa-fw"></i>
|
||||||
{% if adoption_notice.location %}
|
{% if adoption_notice.location %}
|
||||||
{{ adoption_notice.location.str }}
|
{{ adoption_notice.location }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ adoption_notice.location_string }}
|
{{ adoption_notice.location_string }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
<div class="content">
|
|
||||||
{% if adoption_notice.description %}
|
|
||||||
{{ adoption_notice.description | render_markdown }}
|
|
||||||
{% else %}
|
|
||||||
<p>
|
|
||||||
{% translate "Keine Beschreibung" %}
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% if adoption_notice.get_photo %}
|
<div class="cell">
|
||||||
<div class="adoption-notice-img">
|
{% include "fellchensammlung/partials/sex-overview.html" %}
|
||||||
<img src="{{ MEDIA_URL }}/{{ adoption_notice.get_photo.image }}"
|
</div>
|
||||||
alt="{{ adoption_notice.get_photo.alt_text }}">
|
</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>
|
</div>
|
||||||
{% else %}
|
|
||||||
{% translate "Keine Foto" %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user