diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index eedd361..2e62827 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -186,6 +186,11 @@ class AdoptionNotice(models.Model): else: return self.location.latitude, self.location.longitude + @property + def description_short(self): + if len(self.description) > 200: + return self.description[:200] + f" ... [weiterlesen]({self.get_absolute_url()})" + def get_absolute_url(self): """Returns the url to access a detailed page for the animal.""" return reverse('adoption-notice-detail', args=[str(self.id)]) diff --git a/src/fellchensammlung/static/fellchensammlung/css/styles.css b/src/fellchensammlung/static/fellchensammlung/css/styles.css index ab5a8a9..c27d48f 100644 --- a/src/fellchensammlung/static/fellchensammlung/css/styles.css +++ b/src/fellchensammlung/static/fellchensammlung/css/styles.css @@ -427,6 +427,10 @@ select, .button { max-height: 250px; } +.img-small img { + height: 100px; +} + .btn-notification { display: inline-block; position: relative; diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-adoption-notice-minimal.html b/src/fellchensammlung/templates/fellchensammlung/partials/partial-adoption-notice-minimal.html new file mode 100644 index 0000000..1765fd2 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partials/partial-adoption-notice-minimal.html @@ -0,0 +1,33 @@ +{% load custom_tags %} +{% load i18n %} + +
+
+ +

+ Ort + {% if adoption_notice.location %} + {{ adoption_notice.location }} + {% else %} + {{ adoption_notice.location_string }} + {% endif %} +

+

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

+ {% if adoption_notice.get_photo %} +
+ {{ adoption_notice.get_photo.alt_text }} +
+ {% endif %} +
+
\ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html b/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html index ab23df2..05de0ce 100644 --- a/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html +++ b/src/fellchensammlung/templates/fellchensammlung/partials/partial-map.html @@ -20,7 +20,7 @@ {% for adoption_notice in adoption_notices %} // create the popup - const popup_{{ forloop.counter }} = new maplibregl.Popup({offset: 25}).setHTML(`{% include "fellchensammlung/partials/partial-adoption-notice.html" %}`); + const popup_{{ forloop.counter }} = new maplibregl.Popup({offset: 25}).setHTML(`{% include "fellchensammlung/partials/partial-adoption-notice-minimal.html" %}`); // create DOM element for the marker const el_{{ forloop.counter }} = document.createElement('div');