diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index e4ffe02..1976732 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -156,6 +156,9 @@ class RescueOrganization(models.Model): def get_absolute_url(self): return reverse("rescue-organization-detail", args=[str(self.pk)]) + def get_absolute_url_bulma(self): + return reverse("bulma-rescue-organization-detail", args=[str(self.pk)]) + @property def adoption_notices(self): return AdoptionNotice.objects.filter(organization=self) @@ -173,6 +176,8 @@ class RescueOrganization(models.Model): return "" if len(self.description) > 200: return self.description[:200] + _(f" ... [weiterlesen]({self.get_absolute_url()})") + else: + return self.description def set_checked(self): self.last_checked = timezone.now() diff --git a/src/fellchensammlung/static/fellchensammlung/img/logo_transparent_small.png b/src/fellchensammlung/static/fellchensammlung/img/logo_transparent_small.png new file mode 100644 index 0000000..b57c9e3 Binary files /dev/null and b/src/fellchensammlung/static/fellchensammlung/img/logo_transparent_small.png differ diff --git a/src/fellchensammlung/templates/fellchensammlung/bulma-animal-shelters.html b/src/fellchensammlung/templates/fellchensammlung/bulma-animal-shelters.html new file mode 100644 index 0000000..47e6f75 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/bulma-animal-shelters.html @@ -0,0 +1,15 @@ +{% extends "fellchensammlung/base_bulma.html" %} +{% load i18n %} + +{% block title %}{% translate "Tierschutzorganisationen" %}{% endblock %} + +{% block content %} +
+
+ {% include "fellchensammlung/partials/bulma-partial-map.html" %} +
+
+
+ {% include "fellchensammlung/lists/bulma-list-animal-shelters.html" %} +
+{% endblock %} diff --git a/src/fellchensammlung/templates/fellchensammlung/details/bulma-detail-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/details/bulma-detail-rescue-organization.html new file mode 100644 index 0000000..0ce15eb --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/details/bulma-detail-rescue-organization.html @@ -0,0 +1,72 @@ +{% extends "fellchensammlung/base_bulma.html" %} +{% load custom_tags %} +{% load i18n %} + +{% block title %}{{ org.name }}{% endblock %} + +{% block content %} +
+
+
+
+

{{ org.name }}

+
+
+
+ + {% if org.location %} + {{ org.location }} + {% else %} + {{ org.location_string }} + {% endif %} + {% if org.description %} +

{{ org.description | render_markdown }}

+ {% endif %} +
+
+

{% trans "Kontaktdaten" %}

+ {% if org.website %} + + + + + {{ org.website }} + + {% endif %} + {% if org.phone_number %} + + + + + {{ org.phone_number }} + + {% endif %} + {% if org.email %} + + + + + {{ org.email }} + + {% endif %} +
+
+
+
+
+ {% include "fellchensammlung/partials/bulma-partial-map.html" %} +
+
+ + +

{% translate 'Vermittlungen der Organisation' %}

+
+ {% if org.adoption_notices %} + {% for adoption_notice in org.adoption_notices %} + {% include "fellchensammlung/partials/bulma-partial-adoption-notice-minimal.html" %} + {% endfor %} + {% else %} +

{% translate "Keine Vermittlungen gefunden." %}

+ {% endif %} +
+{% endblock %} diff --git a/src/fellchensammlung/templates/fellchensammlung/lists/bulma-list-animal-shelters.html b/src/fellchensammlung/templates/fellchensammlung/lists/bulma-list-animal-shelters.html new file mode 100644 index 0000000..3c5217b --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/lists/bulma-list-animal-shelters.html @@ -0,0 +1,12 @@ +{% load i18n %} +
+ {% if rescue_organizations %} + {% for rescue_organization in rescue_organizations %} +
+ {% include "fellchensammlung/partials/bulma-partial-rescue-organization.html" %} +
+ {% endfor %} + {% else %} +

{% translate "Keine Tierschutzorganisationen gefunden." %}

+ {% endif %} +
diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-map.html b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-map.html index a2eb0ad..cb94852 100644 --- a/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-map.html +++ b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-map.html @@ -59,7 +59,7 @@ {% for rescue_organization in rescue_organizations %} {% if rescue_organization.location %} // create the popup - const popup_{{ forloop.counter }} = new maplibregl.Popup({offset: 25}).setHTML(`{% include "fellchensammlung/partials/partial-rescue-organization.html" %}`); + const popup_{{ forloop.counter }} = new maplibregl.Popup({offset: 25}).setHTML(`{% include "fellchensammlung/partials/bulma-partial-rescue-organization-minimal-map.html" %}`); // create DOM element for the marker const el_{{ forloop.counter }} = document.createElement('div'); diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-rescue-organization-minimal-map.html b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-rescue-organization-minimal-map.html new file mode 100644 index 0000000..67dc8fe --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-rescue-organization-minimal-map.html @@ -0,0 +1,40 @@ +{% load custom_tags %} +{% load i18n %} + +{% load custom_tags %} +{% load i18n %} + + +

+ {{ rescue_organization.name }} +

+ +
+
+ +
+ +
+ +

+ + {% if rescue_organization.location %} + {{ rescue_organization.location }} + {% else %} + {{ rescue_organization.location_string }} + {% endif %}

+
+
+
+
+ +{% if rescue_organization.description_short %} +
+ {{ rescue_organization.description_short | render_markdown }} + +
+{% endif %} + + + + diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-rescue-organization.html new file mode 100644 index 0000000..d807286 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-rescue-organization.html @@ -0,0 +1,25 @@ +{% load custom_tags %} +{% load i18n %} + +
+
+

{{ rescue_organization.name }}

+ +
+
+

+ + {% if rescue_organization.location %} + {{ rescue_organization.location.str_hr }} + {% else %} + {{ rescue_organization.location_string }} + {% endif %} +

+

+ {% if rescue_organization.description_short %} + {{ rescue_organization.description_short | render_markdown }} + {% endif %} +

+
+
\ No newline at end of file diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py index 41b968b..c32f08d 100644 --- a/src/fellchensammlung/urls.py +++ b/src/fellchensammlung/urls.py @@ -30,7 +30,8 @@ urlpatterns = [ path("bulma/tier//add-photo", views.add_photo_to_animal_bulma, name="animal-add-photo-bulma"), # ex: /adoption_notice/7/ path("vermittlung//", views.adoption_notice_detail, name="adoption-notice-detail"), - path("bulma/vermittlung//", views.adoption_notice_detail_bulma, name="adoption-notice-detail-bulma"), + path("bulma/vermittlung//", views.adoption_notice_detail_bulma, + name="adoption-notice-detail-bulma"), # ex: /adoption_notice/7/edit path("vermittlung//edit", views.adoption_notice_edit, name="adoption-notice-edit"), # ex: /vermittlung/5/add-photo @@ -43,8 +44,11 @@ urlpatterns = [ name="adoption-notice-add-animal"), path("tierschutzorganisationen/", views.list_rescue_organizations, name="rescue-organizations"), + path("bulma/tierschutzorganisationen/", views.bulma_list_rescue_organizations, name="bulma-rescue-organizations"), path("organisation//", views.detail_view_rescue_organization, name="rescue-organization-detail"), + path("bulma/organisation//", views.bulma_detail_view_rescue_organization, + name="bulma-rescue-organization-detail"), # ex: /search/ path("suchen/", views.search, name="search"), diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index b447df7..319e139 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -408,6 +408,7 @@ def add_photo_to_animal(request, animal_id): form = ImageForm(in_flow=True) return render(request, 'fellchensammlung/forms/form-image.html', {'form': form}) + @login_required def add_photo_to_animal_bulma(request, animal_id): animal = Animal.objects.get(id=animal_id) @@ -440,7 +441,6 @@ def add_photo_to_animal_bulma(request, animal_id): return render(request, 'fellchensammlung/forms/bulma-form-image.html', {'form': form}) - @login_required def add_photo_to_adoption_notice(request, adoption_notice_id): adoption_notice = AdoptionNotice.objects.get(id=adoption_notice_id) @@ -468,6 +468,7 @@ def add_photo_to_adoption_notice(request, adoption_notice_id): form = ImageForm(in_flow=True) return render(request, 'fellchensammlung/forms/form-image.html', {'form': form}) + @login_required def add_photo_to_adoption_notice_bulma(request, adoption_notice_id): adoption_notice = AdoptionNotice.objects.get(id=adoption_notice_id) @@ -808,18 +809,29 @@ def external_site_warning(request): return render(request, 'fellchensammlung/external_site_warning.html', context=context) -def list_rescue_organizations(request): +def list_rescue_organizations(request, template='fellchensammlung/animal-shelters.html'): rescue_organizations = RescueOrganization.objects.all() context = {"rescue_organizations": rescue_organizations} - return render(request, 'fellchensammlung/animal-shelters.html', context=context) + return render(request, template, context=context) -def detail_view_rescue_organization(request, rescue_organization_id): +def bulma_list_rescue_organizations(request): + return list_rescue_organizations(request, template='fellchensammlung/bulma-animal-shelters.html') + + +def detail_view_rescue_organization(request, rescue_organization_id, + template='fellchensammlung/details/detail-rescue-organization.html'): org = RescueOrganization.objects.get(pk=rescue_organization_id) - return render(request, 'fellchensammlung/details/detail-rescue-organization.html', + return render(request, template, context={"org": org, "map_center": org.position, "zoom_level": 6, "rescue_organizations": [org]}) +def bulma_detail_view_rescue_organization(request, rescue_organization_id): + return detail_view_rescue_organization(request, + rescue_organization_id, + template='fellchensammlung/details/bulma-detail-rescue-organization.html') + + def export_own_profile(request): user = request.user ANs = AdoptionNotice.objects.filter(owner=user)