feat: add bulma about
This commit is contained in:
		@@ -0,0 +1,27 @@
 | 
			
		||||
{% extends "fellchensammlung/base_bulma.html" %}
 | 
			
		||||
{% load i18n %}
 | 
			
		||||
{% load custom_tags %}
 | 
			
		||||
 | 
			
		||||
{% block title %}<title>{% translate "Über uns" %}</title>{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    {% if about_us %}
 | 
			
		||||
        <div class="card">
 | 
			
		||||
            <div class="card-header">
 | 
			
		||||
                <h1 class="card-header-title">{{ about_us.title }}</h1>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="card-content content">
 | 
			
		||||
                {{ about_us.content | render_markdown }}
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    {% if faq %}
 | 
			
		||||
        <div class="card">
 | 
			
		||||
            <h2>{{ faq.title }}</h2>
 | 
			
		||||
            <p>
 | 
			
		||||
                {{ faq.content | render_markdown }}
 | 
			
		||||
            </p>
 | 
			
		||||
        </div>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
							
								
								
									
										16
									
								
								src/fellchensammlung/tools/i18n.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/fellchensammlung/tools/i18n.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
from django.utils import translation
 | 
			
		||||
 | 
			
		||||
from fellchensammlung.models import Language, Text
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_texts_by_language(text_codes):
 | 
			
		||||
    language_code = translation.get_language()
 | 
			
		||||
    lang = Language.objects.get(languagecode=language_code)
 | 
			
		||||
 | 
			
		||||
    texts = {}
 | 
			
		||||
    for text_code in text_codes:
 | 
			
		||||
        try:
 | 
			
		||||
            texts[text_code] = Text.objects.get(text_code=text_code, language=lang, )
 | 
			
		||||
        except Text.DoesNotExist:
 | 
			
		||||
            texts[text_code] = None
 | 
			
		||||
    return texts
 | 
			
		||||
@@ -55,6 +55,7 @@ urlpatterns = [
 | 
			
		||||
    path("vermitteln/", views.add_adoption_notice, name="add-adoption"),
 | 
			
		||||
 | 
			
		||||
    path("ueber-uns/", views.about, name="about"),
 | 
			
		||||
    path("bulma/ueber-uns/", views.about_bulma, name="about-bulma"),
 | 
			
		||||
 | 
			
		||||
    ################
 | 
			
		||||
    ## Moderation ##
 | 
			
		||||
 
 | 
			
		||||
@@ -24,6 +24,7 @@ from .forms import AdoptionNoticeForm, AdoptionNoticeFormWithDateWidget, ImageFo
 | 
			
		||||
    CommentForm, ReportCommentForm, AnimalForm, \
 | 
			
		||||
    AdoptionNoticeSearchForm, AnimalFormWithDateWidget, AdoptionNoticeFormWithDateWidgetAutoAnimal
 | 
			
		||||
from .models import Language, Announcement
 | 
			
		||||
from .tools import i18n
 | 
			
		||||
from .tools.geo import GeoAPI, zoom_level_for_radius
 | 
			
		||||
from .tools.metrics import gather_metrics_data
 | 
			
		||||
from .tools.admin import clean_locations, get_unchecked_adoption_notices, deactivate_unchecked_adoption_notices, \
 | 
			
		||||
@@ -97,6 +98,8 @@ def change_language(request):
 | 
			
		||||
            return response
 | 
			
		||||
        else:
 | 
			
		||||
            return render(request, 'fellchensammlung/index.html')
 | 
			
		||||
    else:
 | 
			
		||||
        return render(request, 'fellchensammlung/index.html')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def adoption_notice_detail(request, adoption_notice_id, template=None):
 | 
			
		||||
@@ -415,15 +418,7 @@ def animal_edit(request, animal_id):
 | 
			
		||||
def about(request):
 | 
			
		||||
    rules = Rule.objects.all()
 | 
			
		||||
 | 
			
		||||
    language_code = translation.get_language()
 | 
			
		||||
    lang = Language.objects.get(languagecode=language_code)
 | 
			
		||||
 | 
			
		||||
    legal = {}
 | 
			
		||||
    for text_code in ["terms_of_service", "privacy_statement", "imprint", "about_us", "faq"]:
 | 
			
		||||
        try:
 | 
			
		||||
            legal[text_code] = Text.objects.get(text_code=text_code, language=lang, )
 | 
			
		||||
        except Text.DoesNotExist:
 | 
			
		||||
            legal[text_code] = None
 | 
			
		||||
    legal = i18n.get_texts_by_language(["terms_of_service", "privacy_statement", "imprint", "about_us", "faq"])
 | 
			
		||||
 | 
			
		||||
    context = {"rules": rules, }
 | 
			
		||||
    context.update(legal)
 | 
			
		||||
@@ -434,6 +429,16 @@ def about(request):
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def about_bulma(request):
 | 
			
		||||
    context = i18n.get_texts_by_language(["about_us", "faq"])
 | 
			
		||||
 | 
			
		||||
    return render(
 | 
			
		||||
        request,
 | 
			
		||||
        "fellchensammlung/bulma-about.html",
 | 
			
		||||
        context=context
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def report_adoption(request, adoption_notice_id):
 | 
			
		||||
    """
 | 
			
		||||
    Form to report adoption notices
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user