Use uploaded logos in templates

This commit is contained in:
Mouse Reeve 2021-01-04 12:47:10 -08:00
parent 7cc2dfe517
commit 0c0e9bebdf
4 changed files with 17 additions and 17 deletions

View file

@ -1,4 +1,4 @@
# Generated by Django 3.0.7 on 2020-12-13 00:14
# Generated by Django 3.0.7 on 2021-01-04 20:40
from django.db import migrations, models
@ -6,23 +6,23 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0022_auto_20201212_1744'),
('bookwyrm', '0030_auto_20201224_1939'),
]
operations = [
migrations.AddField(
model_name='sitesettings',
name='favicon',
field=models.ImageField(default='/static/images/favicon.ico', upload_to='static/images/'),
field=models.ImageField(blank=True, null=True, upload_to='logos/'),
),
migrations.AddField(
model_name='sitesettings',
name='logo',
field=models.ImageField(default='/static/images/logo.png', upload_to='static/images/'),
field=models.ImageField(blank=True, null=True, upload_to='logos/'),
),
migrations.AddField(
model_name='sitesettings',
name='logo_small',
field=models.ImageField(default='/static/images/logo-small.png', upload_to='static/images/'),
field=models.ImageField(blank=True, null=True, upload_to='logos/'),
),
]

View file

@ -18,16 +18,13 @@ class SiteSettings(models.Model):
default="Add a code of conduct here.")
allow_registration = models.BooleanField(default=True)
logo = models.ImageField(
upload_to='static/images/',
default='/static/images/logo.png'
upload_to='logos/', null=True, blank=True
)
logo_small = models.ImageField(
upload_to='static/images/',
default='/static/images/logo-small.png'
upload_to='logos/', null=True, blank=True
)
favicon = models.ImageField(
upload_to='static/images/',
default='/static/images/favicon.ico'
upload_to='logos/', null=True, blank=True
)
support_link = models.CharField(max_length=255, null=True, blank=True)
support_title = models.CharField(max_length=100, null=True, blank=True)

View file

@ -8,20 +8,23 @@
<link type="text/css" rel="stylesheet" href="/static/css/format.css">
<link type="text/css" rel="stylesheet" href="/static/css/icons.css">
<link rel="shortcut icon" type="image/x-icon" href="/static/images/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="{% if site.favicon %}/images/{{ site.favicon }}{% else %}/static/images/favicon.ico{% endif %}">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="{{ site.name }}">
<meta name="og:title" content="{{ site.name }}">
<meta name="twitter:title" content="{% if title %}{{ title }} | {% endif %}{{ site.name }}">
<meta name="og:title" content="{% if title %}{{ title }} | {% endif %}{{ site.name }}">
<meta name="twitter:description" content="Federated Social Reading">
<meta name="og:description" content="Federated Social Reading">
<meta name="twitter:image" content="{% if site.logo %}/images/{{ site.logo }}{% else %}/static/images/logo.png{% endif %}">
<meta name="og:image" content="{% if site.logo %}/images/{{ site.logo }}{% else %}/static/images/logo.png{% endif %}">
<meta name="twitter:image:alt" content="BookWyrm Logo">
</head>
<body>
<nav class="navbar container" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="/">
<img class="image logo" src="/static/images/logo-small.png" alt="Home page">
<img class="image logo" src="{% if site.logo_small %}/images/{{ site.logo_small }}{% else %}/static/images/logo-small.png{% endif %}" alt="Home page">
</a>
<form class="navbar-item column" action="/search/">
<div class="field has-addons">

View file

@ -1,7 +1,7 @@
<div class="columns">
<div class="column is-narrow is-hidden-mobile">
<figure class="block">
<img src="/static/images/logo.png" alt="BookWyrm">
<img src="{% if site.logo_small %}/images/{{ site.logo }}{% else %}/static/images/logo.png{% endif %}" alt="BookWyrm logo">
</figure>
</div>
<div class="content">