feat: further redesign
This commit is contained in:
parent
99cde15966
commit
4c9c1e13a5
@ -316,6 +316,13 @@ class AdoptionNotice(models.Model):
|
|||||||
sexes.add(animal.sex)
|
sexes.add(animal.sex)
|
||||||
return sexes
|
return sexes
|
||||||
|
|
||||||
|
@property
|
||||||
|
def num_per_sex(self):
|
||||||
|
num_per_sex = dict()
|
||||||
|
for sex in SexChoices:
|
||||||
|
num_per_sex[sex] = self.animals.filter(sex=sex).count
|
||||||
|
return num_per_sex
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def last_checked_hr(self):
|
def last_checked_hr(self):
|
||||||
time_since_last_checked = timezone.now() - self.last_checked
|
time_since_last_checked = timezone.now() - self.last_checked
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{% extends "fellchensammlung/base_bulma.html" %}
|
{% extends "fellchensammlung/base_bulma.html" %}
|
||||||
{% load custom_tags %}
|
{% load custom_tags %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}<title>{{ adoption_notice.name }}</title>{% endblock %}
|
{% block title %}<title>{{ adoption_notice.name }}</title>{% endblock %}
|
||||||
|
|
||||||
@ -14,6 +15,34 @@
|
|||||||
<div class="cell">
|
<div class="cell">
|
||||||
<!--- General Information --->
|
<!--- General Information --->
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
|
<div class="cell">
|
||||||
|
{% if adoption_notice.num_per_sex.F > 0 %}
|
||||||
|
{{ adoption_notice.num_per_sex.F }}
|
||||||
|
<img class="icon" src="{% static 'fellchensammlung/img/sexes/F.png' %}"
|
||||||
|
alt="{% translate 'weibliche Tiere' %}">
|
||||||
|
{% endif %}
|
||||||
|
{% if adoption_notice.num_per_sex.F_N > 0 %}
|
||||||
|
{{ adoption_notice.num_per_sex.F_N }}
|
||||||
|
<img class="icon" src="{% static 'fellchensammlung/img/sexes/F_N.png' %}"
|
||||||
|
alt="{% translate 'weiblich, kastrierte Tiere' %}">
|
||||||
|
{% endif %}
|
||||||
|
{% if adoption_notice.num_per_sex.I > 0 %}
|
||||||
|
{{ adoption_notice.num_per_sex.I }}
|
||||||
|
<img class="icon" src="{% static 'fellchensammlung/img/sexes/I.png' %}"
|
||||||
|
alt="{% translate 'intersexuelle Tiere' %}">
|
||||||
|
{% endif %}
|
||||||
|
{% if adoption_notice.num_per_sex.M > 0 %}
|
||||||
|
{{ adoption_notice.num_per_sex.M }}
|
||||||
|
<img class="icon" src="{% static 'fellchensammlung/img/sexes/M.png' %}"
|
||||||
|
alt="{% translate 'männliche Tiere' %}">
|
||||||
|
{% endif %}
|
||||||
|
{% if adoption_notice.num_per_sex.M_N > 0 %}
|
||||||
|
{{ adoption_notice.num_per_sex.M_N }}
|
||||||
|
<img class="icon" src="{% static 'fellchensammlung/img/sexes/M_N.png' %}"
|
||||||
|
alt="{% translate 'männlich, kastrierte Tiere' %}">
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="cell">
|
<div class="cell">
|
||||||
<h2><strong>{% translate "Ort" %}</strong></h2>
|
<h2><strong>{% translate "Ort" %}</strong></h2>
|
||||||
<p>{% if adoption_notice.location %}
|
<p>{% if adoption_notice.location %}
|
||||||
@ -22,67 +51,32 @@
|
|||||||
{{ adoption_notice.location_string }}
|
{{ adoption_notice.location_string }}
|
||||||
{% endif %}</p>
|
{% endif %}</p>
|
||||||
</div>
|
</div>
|
||||||
{% if adoption_notice.organization %}
|
|
||||||
<div class="cell">
|
|
||||||
<h2><strong>{% translate "Organisation" %}</strong></h2>
|
|
||||||
<div>
|
|
||||||
<a href="{{ adoption_notice.organization.get_absolute_url }}">{{ adoption_notice.organization }}</a>
|
|
||||||
{% if adoption_notice.organization.trusted %}
|
|
||||||
<div class="tag"><i class="fa-solid fa-check"></i></div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="cell">
|
|
||||||
<h2><strong>{% translate "Suchen seit" %}</strong></h2>
|
|
||||||
<p>{{ adoption_notice.searching_since }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="cell">
|
|
||||||
<h2><strong>{% translate "Zuletzt aktualisiert" %}</strong></h2>
|
|
||||||
<p>{{ adoption_notice.last_checked_hr }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="cell">
|
|
||||||
<h2><strong>{% translate "Weitere Informationen" %}</strong></h2>
|
|
||||||
{% if adoption_notice.further_information %}
|
|
||||||
<form method="get" action="{% url 'external-site' %}">
|
|
||||||
<input type="hidden" name="url" value="{{ adoption_notice.further_information }}">
|
|
||||||
<button class="btn" type="submit" id="submit">
|
|
||||||
{{ adoption_notice.further_information | domain }} <i
|
|
||||||
class="fa-solid fa-arrow-up-right-from-square"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
{% else %}
|
|
||||||
-
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="coloumns">
|
<div class="columns">
|
||||||
<!--- Images --->
|
<!--- Images --->
|
||||||
<div class="coloumn block">
|
<div class="column block">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h1 class="card-header-title title is-2">{% translate "Bilder" %}</h1>
|
<h1 class="card-header-title title is-2">{% translate "Bilder" %}</h1>
|
||||||
<div class="grid card-content">
|
<div class="grid card-content">
|
||||||
<div class="cell" id="my-gallery">
|
<div class="cell" id="my-gallery">
|
||||||
{% for photo in adoption_notice.get_photos %}
|
{% for photo in adoption_notice.get_photos %}
|
||||||
<a href="{{ MEDIA_URL }}/{{ photo.image }}"
|
<a href="{{ MEDIA_URL }}/{{ photo.image }}"
|
||||||
data-pswp-width="{{ photo.image.width }}"
|
data-pswp-width="{{ photo.image.width }}"
|
||||||
data-pswp-height="{{ photo.image.height }}"
|
data-pswp-height="{{ photo.image.height }}"
|
||||||
target="_blank">
|
target="_blank">
|
||||||
<img style="height: 12rem" src="{{ MEDIA_URL }}/{{ photo.image }}" alt="{ photo.alt_text }}"/>
|
<img style="height: 12rem" src="{{ MEDIA_URL }}/{{ photo.image }}"
|
||||||
</a>
|
alt="{ photo.alt_text }}"/>
|
||||||
{% endfor %}
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<!--- Description --->
|
<!--- Description --->
|
||||||
<div class="coloumn block">
|
<div class="column block">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h1 class="card-header-title title is-2">{% translate "Beschreibung" %}</h1>
|
<h1 class="card-header-title title is-2">{% translate "Beschreibung" %}</h1>
|
||||||
@ -118,14 +112,26 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid">
|
<div class="columns">
|
||||||
{% for animal in adoption_notice.animals %}
|
{% for animal in adoption_notice.animals %}
|
||||||
<div class="cell">
|
<div class="column">
|
||||||
{% include "fellchensammlung/partials/bulma-partial-animal-card.html" %}
|
{% include "fellchensammlung/partials/bulma-partial-animal-card.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% if adoption_notice.further_information %}
|
||||||
|
<form method="get" action="{% url 'external-site' %}">
|
||||||
|
<input type="hidden" name="url" value="{{ adoption_notice.further_information }}">
|
||||||
|
<button class="button is-primary is-fullwidth" type="submit" id="submit">
|
||||||
|
{{ adoption_notice.further_information | domain }} <i
|
||||||
|
class="fa-solid fa-arrow-up-right-from-square"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% include "fellchensammlung/partials/bulma-partial-comment-section.html" %}
|
{% include "fellchensammlung/partials/bulma-partial-comment-section.html" %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user