refactor(bulma): move contact details to partial

This commit is contained in:
2025-05-25 11:04:18 +02:00
parent 736f645bf0
commit 3c60782ae7
3 changed files with 69 additions and 27 deletions

View File

@@ -198,6 +198,14 @@ class RescueOrganization(models.Model):
def species_urls(self):
return SpeciesSpecificURL.objects.filter(organization=self)
@property
def has_contact_data(self):
"""
Returns true if at least one type of contact data is available.
"""
return self.instagram or self.facebook or self.website or self.phone_number or self.email or self.fediverse_profile
# Admins can perform all actions and have the highest trust associated with them
# Moderators can make moderation decisions regarding the deletion of content

View File

@@ -23,34 +23,8 @@
<p>{{ org.description | render_markdown }}</p>
{% endif %}
</div>
<div class="panel block">
<p class="panel-heading">{% trans "Kontaktdaten" %}</p>
{% if org.website %}
<a class="panel-block is-active">
<span class="panel-icon">
<i class="fas fa-globe" aria-label="{% translate "Website" %}"></i>
</span>
{{ org.website }}
</a>
{% endif %}
{% if org.phone_number %}
<a class="panel-block is-active">
<span class="panel-icon">
<i class="fas fa-phone" aria-label="{% translate "Telefonnummer" %}"></i>
</span>
{{ org.phone_number }}
</a>
{% endif %}
{% if org.email %}
<a class="panel-block is-active">
<span class="panel-icon">
<i class="fas fa-envelope" aria-label="{% translate "E-Mail" %}"></i>
</span>
{{ org.email }}
</a>
{% endif %}
</div>
</div>
{% include "fellchensammlung/partials/bulma-partial-rescue-organization-contact.html" %}
</div>
</div>
<div class="column">

View File

@@ -0,0 +1,60 @@
{% load custom_tags %}
{% load i18n %}
<div class="panel block">
<p class="panel-heading">{% trans "Kontaktdaten" %}</p>
{% if org.hast_contact_data %}
{% if org.website %}
<a class="panel-block is-active" href="{{ org.website }}" target="_blank">
<span class="panel-icon">
<i class="fas fa-globe" aria-label="{% translate "Website" %}"></i>
</span>
{{ org.website }}
</a>
{% endif %}
{% if org.phone_number %}
<a class="panel-block is-active" href="tel:{{ org.phone_number }}">
<span class="panel-icon">
<i class="fas fa-phone" aria-label="{% translate "Telefonnummer" %}"></i>
</span>
{{ org.phone_number }}
</a>
{% endif %}
{% if org.email %}
<a class="panel-block is-active" href="mailto:{{ org.email }}">
<span class="panel-icon">
<i class="fas fa-envelope" aria-label="{% translate "E-Mail" %}"></i>
</span>
{{ org.email }}
</a>
{% endif %}
{% if org.fediverse_profile %}
<a class="panel-block is-active" href="{{ org.fediverse_profile }}" target="_blank">
<span class="panel-icon">
<i class="fas fa-hashtag" aria-label="{% translate "Fediverse Profil" %}"></i>
</span>
{{ org.fediverse_profile }}
</a>
{% endif %}
{% if org.instagram %}
<a class="panel-block is-active" href="{{ org.instagram }}" target="_blank">
<span class="panel-icon">
<i class="fa-brands fa-instagram" aria-label="{% translate "Instagram Profil" %}"></i>
</span>
{{ org.instagram }}
</a>
{% endif %}
{% if org.facebook %}
<a class="panel-block is-active" href="{{ org.facebook }}" target="_blank">
<span class="panel-icon">
<i class="fa-brands fa-facebook" aria-label="{% translate "Facebook Profil" %}"></i>
</span>
{{ org.facebook }}
</a>
{% endif %}
{% else %}
<p>{% translate 'Keine Kontaktdaten hinterlegt' %}</p>
{% endif %}
</div>