Skip to content
Snippets Groups Projects
Commit a29d1d00 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch 'master' into '254-favicon-should-contain-only-school-bag'

# Conflicts:
#   CHANGELOG.rst
parents 6510c6f8 662f796e
No related branches found
No related tags found
1 merge request!772Resolve "Favicon should contain only school bag"
Pipeline #46312 passed with warnings
......@@ -24,6 +24,8 @@ Removed
~~~~~~~
* Remove old generated AlekSIS icons
* Imprint is now called "Imprint" and not "Impress".
* Logo files weren't uploaded to public namespace.
`2.3.1`_ – 2021-12-17
---------------------
......
# flake8: noqa: DJ12
import os
from datetime import datetime
from typing import Any, Callable, List, Optional, Union
......@@ -21,6 +22,8 @@ from django.views.generic import CreateView, UpdateView
from django.views.generic.edit import DeleteView, ModelFormMixin
import reversion
from dynamic_preferences.settings import preferences_settings
from dynamic_preferences.types import FilePreference
from guardian.admin import GuardedModelAdmin
from guardian.core import ObjectPermissionChecker
from jsonstore.fields import IntegerField, JSONFieldMixin
......@@ -529,3 +532,14 @@ class SchoolTermRelatedExtensibleForm(ExtensibleForm):
kwargs["initial"] = {"school_term": SchoolTerm.current}
super().__init__(*args, **kwargs)
class PublicFilePreferenceMixin(FilePreference):
"""Uploads a file to the public namespace."""
upload_path = "public"
def get_upload_path(self):
return os.path.join(
self.upload_path, preferences_settings.FILE_PREFERENCE_UPLOAD_DIR, self.identifier()
)
......@@ -16,6 +16,7 @@ from dynamic_preferences.types import (
)
from oauth2_provider.models import AbstractApplication
from .mixins import PublicFilePreferenceMixin
from .models import Group, Person
from .registries import person_preferences_registry, site_preferences_registry
from .util.notifications import get_notification_choices_lazy
......@@ -78,7 +79,7 @@ class ColourSecondary(StringPreference):
@site_preferences_registry.register
class Logo(FilePreference):
class Logo(PublicFilePreferenceMixin, FilePreference):
"""Logo of your AlekSIS instance."""
section = theme
......@@ -88,7 +89,7 @@ class Logo(FilePreference):
@site_preferences_registry.register
class Favicon(FilePreference):
class Favicon(PublicFilePreferenceMixin, FilePreference):
"""Favicon of your AlekSIS instance."""
section = theme
......@@ -98,7 +99,7 @@ class Favicon(FilePreference):
@site_preferences_registry.register
class PWAIcon(FilePreference):
class PWAIcon(PublicFilePreferenceMixin, FilePreference):
"""PWA-Icon of your AlekSIS instance."""
section = theme
......
......@@ -180,7 +180,7 @@
<span id="doit"></span>
{% if request.site.preferences.footer__imprint_url %}
<a class="blue-text text-lighten-4" href="{{ request.site.preferences.footer__imprint_url }}">
{% trans "Impress" %}
{% trans "Imprint" %}
</a>
{% endif %}
{% if request.site.preferences.footer__privacy_url and request.site.preferences.footer__imprint_url %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment