feat: Allow setting a background color for embedding

This commit is contained in:
2025-09-10 22:54:24 +02:00
parent b708e9ecaf
commit bb3136bfc7
2 changed files with 16 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ from fellchensammlung.models import RescueOrganization, AdoptionNotice, Species
@headers({"X-Robots-Tag": "noindex"})
def list_ans_per_rescue_organization(request, rescue_organization_id, species_slug=None, active=True):
expand = request.GET.get("expand")
background_color = request.GET.get("background_color")
if expand is not None:
expand = True
else:
@@ -26,7 +27,11 @@ def list_ans_per_rescue_organization(request, rescue_organization_id, species_sl
adoption_notices = adoption_notices_of_org
else:
species = get_object_or_404(Species, slug=species_slug)
adoption_notices = [adoption_notice for adoption_notice in adoption_notices_of_org if species in adoption_notice.species]
adoption_notices = [adoption_notice for adoption_notice in adoption_notices_of_org if
species in adoption_notice.species]
template = 'fellchensammlung/embeddables/list-adoption-notices.html'
return render(request, template, context={"adoption_notices": adoption_notices, "expand": expand})
return render(request, template,
context={"adoption_notices": adoption_notices,
"expand": expand,
"background_color": background_color})

View File

@@ -21,6 +21,14 @@
<link href="{% static 'fontawesomefree/css/brands.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'fontawesomefree/css/solid.css' %}" rel="stylesheet" type="text/css">
{% if background_color %}
<style>
body {
background: #{{ background_color }};
}
</style>
{% endif %}
<script src="{% static 'fellchensammlung/js/custom.js' %}"></script>
<script src="{% static 'fellchensammlung/js/toggles.js' %}"></script>
<script src="{% static 'fellchensammlung/js/jquery.min.js' %}"></script>
@@ -32,6 +40,7 @@
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'fellchensammlung/favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'fellchensammlung/favicon/favicon-16x16.png' %}">
{% get_oxitraffic_script_if_enabled %}
<base target="_parent"/>
</head>
<body>