From: Radek Czajka Date: Tue, 13 Oct 2026 09:19:29 +0000 (+0200) Subject: Reference onepagers X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/f5a171520d0105e9316afdd42dfee295f09e57ed?ds=inline Reference onepagers --- diff --git a/src/catalogue/templates/catalogue/book_text.html b/src/catalogue/templates/catalogue/book_text.html index e06f0f2a3..a35738fc7 100644 --- a/src/catalogue/templates/catalogue/book_text.html +++ b/src/catalogue/templates/catalogue/book_text.html @@ -230,7 +230,10 @@ x
- +
+ + 🖨️ +
+ +{% load l10n %} + + + + +Karta obiektu — {{ entity.label }} + + + + + + + + + + + + +
+
+
+
Mapa Wolnych Lektur
+

{{ entity.label }}

+
+
+
+
+
Wikipedia →
+
+
+ +
+ + {% if entity.lon %} +
+
Lokalizacja
+ {% localize off %} +
+ {% endlocalize %} +
{{ coords_label }}
+
+ {% endif %} + +
+
Ilustracje
+ {% for illu in entity.get_images|slice:":4" %} +
+
+ +
{{ illu.caption }}
+
+ {% endfor %} +
+
+ +
fragmenty tekstu
+ +
+ {% for ref in entity.reference_set.all|slice:":3" %} +
+
+ Okładka: {{ ref.book.pretty_title }} +
+
+
+ {% for author in ref.book.authors %} + {{ author.name }}{% if not forloop.last %}, {% endif %} + {% endfor %} + — {{ ref.book.title }}
+ {% for occ in ref.occurence_set.all|slice:":3" %} +
{{ occ.html|safe }}
+ {% endfor %} +
+ {% with occ=ref.occurence_set.all.first %} +
+
+
+
zobacz w treści
+
+ {% endwith %} +
+ {% endfor %} +
+
+ + + + + diff --git a/src/references/templates/references/popup.html b/src/references/templates/references/popup.html index f8977e6d8..6ee12ce6f 100644 --- a/src/references/templates/references/popup.html +++ b/src/references/templates/references/popup.html @@ -1,7 +1,15 @@ {% load thumbnail %}

+ {% if entity.wikipedia_link %} + {% endif %} {{ entity.label }} + {% if entity.wikipedia_link %} + + {% endif %} + + + 🖨️

@@ -32,6 +40,5 @@ {{ occ.html|safe }} {% endfor %} -
{% endfor %} diff --git a/src/references/urls.py b/src/references/urls.py index e83b46334..74cd79eeb 100644 --- a/src/references/urls.py +++ b/src/references/urls.py @@ -6,4 +6,6 @@ urlpatterns = [ path('', views.pin_map), path('popup/', views.popup), re_path(r'^(?P[a-zA-Z0-9-/]*)/$', views.pin_map_tagged), + + path('ulotka/', views.onepager, name='references_onepager'), ] diff --git a/src/references/views.py b/src/references/views.py index 7e0e3574b..3a02f6524 100644 --- a/src/references/views.py +++ b/src/references/views.py @@ -33,3 +33,11 @@ def popup(request, pk): 'entity': e, }) + +def onepager(request, pk): + e = get_object_or_404(models.Entity, pk=pk) + return render(request, 'references/onepager.html', { + 'entity': e, + 'coords_label': e.get_pretty_coords(), + }) + diff --git a/src/wolnelektury/static/js/book_text/references.js b/src/wolnelektury/static/js/book_text/references.js index 394ec3ffd..cd782c894 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -49,8 +49,12 @@ $this.addClass('interesting'); ref = interestingReferences[uri]; - $this.attr('href', ref.wikipedia_link); - $this.attr('target', '_blank'); + if (ref.wikipedia_link) { + $this.attr('href', ref.wikipedia_link); + $this.attr('target', '_blank'); + } else { + $this.removeAttr('href') + } } }); @@ -104,8 +108,14 @@ } $("#reference-link").text(ref.label); - $("#reference-link").attr('href', ref.wikipedia_link); + if (ref.wikipedia_link) { + $("#reference-link").attr('href', ref.wikipedia_link); + } else { + $('#reference-link').removeAttr('href'); + } + $("#reference-print").attr('href', '/mapa/ulotka/' + ref.id); + _paq.push(['trackEvent', 'html', 'reference']); });