Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1056] Feature/add second logo field #433

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

<footer class='footer'>
{% firstof config.logo.default_alt_text config.name as logo_alt_text %}
{% logo src=config.logo.file|thumbnail_url:'logo' alt=logo_alt_text %}

<div class="footer__logo-text">
<p class="p">{{ config.footer_logo_title|linebreaksbr }}</p>
</div>

<div class="footer__logo">
{% logo src=config.footer_logo.file|thumbnail_url:'logo' alt=logo_alt_text href=config.footer_logo_url %}
</div>

<div class="footer__visitor">
<h2 class="h2">{{footer_texts.footer_visiting_title}}</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n link_tags %}

{% url 'root' as root_url %}
{% link extra_classes="logo" text=alt hide_text=True href=href|default:root_url src=src alt=alt %}
{% link extra_classes="logo" text=alt hide_text=True href=href|default:root_url src=src alt=alt hide_external_icon=True %}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
{% icon icon=icon outlined=icon_outlined %}
{% endif %}

{% if href|startswith:"http" %}{% icon icon="open_in_new" %}{% endif %}
{% if href|startswith:"http" and not hide_external_icon %}{% icon icon="open_in_new" %}{% endif %}
</a>
1 change: 1 addition & 0 deletions src/open_inwoner/components/templatetags/link_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def link(href, text, **kwargs):
- object_id: str | if href is an url name, object_id for reverse can be passed.
- uuid: str | if href is an url name, uuid for reverse can be passed.
- title: string | The HTML title attribute if different than the text.
- hide_external_icon: bool | If we want to hide the extra icon for an external link

Extra context:
- base_class: string | If it is a button or a string.
Expand Down
1 change: 1 addition & 0 deletions src/open_inwoner/components/templatetags/logo_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ def logo(src, alt, **kwargs):
Variables:
+ src: string | the location of the logo.
+ alt: string | the alt text of the logo
- title: string | the title of the logo
"""
return {**kwargs, "src": src, "alt": alt}
3 changes: 3 additions & 0 deletions src/open_inwoner/configurations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class SiteConfigurarionAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin):
{
"fields": (
"logo",
"footer_logo",
"footer_logo_title",
"footer_logo_url",
"hero_image_login",
)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Generated by Django 3.2.15 on 2023-01-20 12:31

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.image


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.FILER_IMAGE_MODEL),
("configurations", "0029_auto_20221221_1636"),
]

operations = [
migrations.AddField(
model_name="siteconfiguration",
name="footer_logo",
field=filer.fields.image.FilerImageField(
blank=True,
help_text="Footer logo",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="footer_logo",
to=settings.FILER_IMAGE_MODEL,
verbose_name="Footer logo",
),
),
migrations.AddField(
model_name="siteconfiguration",
name="footer_logo_title",
field=models.CharField(
blank=True,
default="",
help_text="The title - help text of the footer logo.",
max_length=255,
verbose_name="Footer logo title",
),
),
migrations.AddField(
model_name="siteconfiguration",
name="footer_logo_url",
field=models.URLField(
blank=True,
default="",
help_text="The external link for the footer logo.",
verbose_name="Footer logo link",
),
),
]
21 changes: 21 additions & 0 deletions src/open_inwoner/configurations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,27 @@ class SiteConfiguration(SingletonModel):
blank=True,
help_text=_("Mailing intro text on the footer section."),
)
footer_logo = FilerImageField(
verbose_name=_("Footer logo"),
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="footer_logo",
help_text=_("Footer logo"),
)
footer_logo_title = models.CharField(
max_length=255,
default="",
blank=True,
verbose_name=_("Footer logo title"),
help_text=_("The title - help text of the footer logo."),
)
footer_logo_url = models.URLField(
verbose_name=_("Footer logo link"),
blank=True,
default="",
help_text=_("The external link for the footer logo."),
)
flatpages = models.ManyToManyField(
FlatPage,
verbose_name=_("Flatpages"),
Expand Down
8 changes: 7 additions & 1 deletion src/open_inwoner/scss/components/Footer/Footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
display: grid;
gap: var(--gutter-width);
grid-template-areas:
'lg-tx lg-tx lg-tx lg-tx'
'lg lg lg lg'
'vstr vstr vstr vstr'
'ml ml ml ml'
Expand All @@ -21,6 +22,7 @@

@media (min-width: 768px) {
grid-template-areas:
'lg-tx lg-tx lg-tx lg-tx . . . . . . . . '
'lg lg lg lg lg lg lg lg lg lg lg lg'
'vstr vstr vstr vstr scl scl scl scl scl lnks lnks lnks'
'ml ml ml ml nws nws nws nws nws lnks lnks lnks';
Expand All @@ -29,10 +31,14 @@

/// Layout.

.logo {
&__logo {
grid-area: lg;
}

&__logo-text {
grid-area: lg-tx;
}

&__visitor {
grid-area: vstr;
}
Expand Down