Merge pull request #477 from mouse-reeve/logo-default

Lets instances customize logos
This commit is contained in:
Mouse Reeve 2021-01-04 12:59:11 -08:00 committed by GitHub
commit e7553ee0c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 6 deletions

View file

@ -0,0 +1,28 @@
# Generated by Django 3.0.7 on 2021-01-04 20:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0030_auto_20201224_1939'),
]
operations = [
migrations.AddField(
model_name='sitesettings',
name='favicon',
field=models.ImageField(blank=True, null=True, upload_to='logos/'),
),
migrations.AddField(
model_name='sitesettings',
name='logo',
field=models.ImageField(blank=True, null=True, upload_to='logos/'),
),
migrations.AddField(
model_name='sitesettings',
name='logo_small',
field=models.ImageField(blank=True, null=True, upload_to='logos/'),
),
]

View file

@ -17,6 +17,15 @@ class SiteSettings(models.Model):
code_of_conduct = models.TextField(
default="Add a code of conduct here.")
allow_registration = models.BooleanField(default=True)
logo = models.ImageField(
upload_to='logos/', null=True, blank=True
)
logo_small = models.ImageField(
upload_to='logos/', null=True, blank=True
)
favicon = models.ImageField(
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)
admin_email = models.EmailField(max_length=255, 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">