feat: Add initial bulma version of adoption notice detail page
This commit is contained in:
parent
388cc327be
commit
e6a985ddfa
@ -12,12 +12,15 @@
|
||||
<!-- Add additional CSS in static file -->
|
||||
<link rel="stylesheet" href="{% static 'fellchensammlung/css/bulma-styles.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'fellchensammlung/css/bulma.min.css' %}">
|
||||
<link rel="stylesheet" href="https://unpkg.com/photoswipe@5.2.2/dist/photoswipe.css">
|
||||
<link href="{% static 'fontawesomefree/css/fontawesome.css' %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
|
||||
<link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
|
||||
|
||||
<script src="{% static 'fellchensammlung/js/custom.js' %}"></script>
|
||||
<script src="{% static 'fellchensammlung/js/toggles.js' %}"></script>
|
||||
<script type="module" src="{% static 'fellchensammlung/js/photoswipe.js' %}"></script>
|
||||
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'fellchensammlung/favicon/apple-touch-icon.png' %}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'fellchensammlung/favicon/favicon-32x32.png' %}">
|
||||
|
@ -7,15 +7,15 @@
|
||||
|
||||
{% block content %}
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">
|
||||
Hello World
|
||||
</h1>
|
||||
<p class="subtitle">
|
||||
Notfellchen bald mit <strong>Bulma</strong>?
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div class="container">
|
||||
<h1 class="title">
|
||||
Hello World
|
||||
</h1>
|
||||
<p class="subtitle">
|
||||
Notfellchen bald mit <strong>Bulma</strong>?
|
||||
</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-image">
|
||||
<figure class="image">
|
||||
|
@ -0,0 +1,125 @@
|
||||
{% extends "fellchensammlung/base_bulma.html" %}
|
||||
{% load custom_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}<title>{{ adoption_notice.name }}</title>{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h1 class="card-header-title is-1">{{ adoption_notice.name }}</h1>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="grid">
|
||||
<div class="cell">
|
||||
<!--- General Information --->
|
||||
<div class="grid">
|
||||
<div class="cell">
|
||||
<h2><strong>{% translate "Ort" %}</strong></h2>
|
||||
<p>{% if adoption_notice.location %}
|
||||
{{ adoption_notice.location }}
|
||||
{% else %}
|
||||
{{ adoption_notice.location_string }}
|
||||
{% endif %}</p>
|
||||
</div>
|
||||
{% if adoption_notice.organization %}
|
||||
<div class="cell">
|
||||
<h2 class="is-title-1">{% translate "Organisation" %}</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>{% translate "Suchen seit" %}</h2>
|
||||
<p>{{ adoption_notice.searching_since }}</p>
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
<h2>{% translate "Zuletzt aktualisiert" %}</h2>
|
||||
<p>{{ adoption_notice.last_checked_hr }}</p>
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
<h2>{% translate "Weitere Informationen" %}</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>
|
||||
<hr>
|
||||
|
||||
<div class="grid">
|
||||
<!--- Images --->
|
||||
<div class="cell">
|
||||
<h1>{% translate "Bilder" %}</h1>
|
||||
<div class="grid">
|
||||
{% for photo in adoption_notice.get_photos %}
|
||||
<div class="cell" id="#my-gallery">
|
||||
<img src="{{ MEDIA_URL }}/{{ photo.image }}" alt="{{ photo.alt_text }}">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<!--- Description --->
|
||||
<div class="cell">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h1>{% translate "Beschreibung" %}</h1>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<p>{% if adoption_notice.description %}
|
||||
{{ adoption_notice.description | render_markdown }}
|
||||
{% else %}
|
||||
{% translate "Keine Beschreibung angegeben" %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>r
|
||||
<div class="card-footer">
|
||||
{% if has_edit_permission %}
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<a class="button is-primary is-light"
|
||||
href="{% url 'adoption-notice-add-photo' adoption_notice_id=adoption_notice.pk %}">
|
||||
{% translate 'Foto hinzufügen' %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="column">
|
||||
<a class="button is-primary"
|
||||
href="{% url 'adoption-notice-edit' adoption_notice_id=adoption_notice.pk %}">
|
||||
{% translate 'Bearbeiten' %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid">
|
||||
{% for animal in adoption_notice.animals %}
|
||||
<div class="cell">
|
||||
{% include "fellchensammlung/partials/partial-animal-card.html" %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% include "fellchensammlung/partials/partial-comment-section.html" %}
|
||||
|
||||
{% endblock %}
|
@ -18,6 +18,7 @@ sitemaps = {
|
||||
|
||||
urlpatterns = [
|
||||
path("", views.index, name="index"),
|
||||
path("bulma/", views.index_bulma, name="index-bulma"),
|
||||
path("rss/", LatestAdoptionNoticesFeed(), name="rss"),
|
||||
path("metrics/", views.metrics, name="metrics"),
|
||||
# ex: /animal/5/
|
||||
@ -28,6 +29,7 @@ urlpatterns = [
|
||||
path("tier/<int:animal_id>/add-photo", views.add_photo_to_animal, name="animal-add-photo"),
|
||||
# ex: /adoption_notice/7/
|
||||
path("vermittlung/<int:adoption_notice_id>/", views.adoption_notice_detail, name="adoption-notice-detail"),
|
||||
path("bulma/vermittlung/<int:adoption_notice_id>/", views.adoption_notice_detail_bulma, name="adoption-notice-detail-bulma"),
|
||||
# ex: /adoption_notice/7/edit
|
||||
path("vermittlung/<int:adoption_notice_id>/edit", views.adoption_notice_edit, name="adoption-notice-edit"),
|
||||
# ex: /vermittlung/5/add-photo
|
||||
|
@ -63,6 +63,22 @@ def index(request):
|
||||
return render(request, 'fellchensammlung/index.html', context=context)
|
||||
|
||||
|
||||
def index_bulma(request):
|
||||
"""View function for home page of site."""
|
||||
latest_adoption_list = AdoptionNotice.objects.filter(
|
||||
adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")
|
||||
active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
|
||||
language_code = translation.get_language()
|
||||
lang = Language.objects.get(languagecode=language_code)
|
||||
active_announcements = Announcement.get_active_announcements(lang)
|
||||
|
||||
context = {"adoption_notices": active_adoptions[:5], "adoption_notices_map": active_adoptions,
|
||||
"announcements": active_announcements}
|
||||
Text.get_texts(["how_to", "introduction"], lang, context)
|
||||
|
||||
return render(request, 'fellchensammlung/bulma-index.html', context=context)
|
||||
|
||||
|
||||
def change_language(request):
|
||||
if request.method == 'POST':
|
||||
language_code = request.POST.get('language')
|
||||
@ -82,7 +98,7 @@ def change_language(request):
|
||||
return render(request, 'fellchensammlung/index.html')
|
||||
|
||||
|
||||
def adoption_notice_detail(request, adoption_notice_id):
|
||||
def adoption_notice_detail(request, adoption_notice_id, template=None):
|
||||
adoption_notice = AdoptionNotice.objects.get(id=adoption_notice_id)
|
||||
if request.user.is_authenticated:
|
||||
try:
|
||||
@ -139,7 +155,17 @@ def adoption_notice_detail(request, adoption_notice_id):
|
||||
comment_form = CommentForm(instance=adoption_notice)
|
||||
context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user,
|
||||
"has_edit_permission": has_edit_permission, "is_subscribed": is_subscribed}
|
||||
return render(request, 'fellchensammlung/details/detail_adoption_notice.html', context=context)
|
||||
print(f"{template=}")
|
||||
if template is not None:
|
||||
return render(request, template, context=context)
|
||||
else:
|
||||
print("dada")
|
||||
return render(request, 'fellchensammlung/details/detail_adoption_notice.html', context=context)
|
||||
|
||||
|
||||
def adoption_notice_detail_bulma(request, adoption_notice_id):
|
||||
return adoption_notice_detail(request, adoption_notice_id,
|
||||
template='fellchensammlung/details/bulma-detail-adoption-notice.html')
|
||||
|
||||
|
||||
@login_required()
|
||||
|
Loading…
x
Reference in New Issue
Block a user