forked from mirrors/bookwyrm
Expand site settings and add footer
This commit is contained in:
parent
b33ea40da2
commit
117d243577
4 changed files with 56 additions and 2 deletions
8
bookwyrm/context_processors.py
Normal file
8
bookwyrm/context_processors.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
''' customize the info available in context for rendering templates '''
|
||||
from bookwyrm import models
|
||||
|
||||
def site_settings(request):
|
||||
''' include the custom info about the site '''
|
||||
return {
|
||||
'site': models.SiteSettings.objects.get()
|
||||
}
|
28
bookwyrm/migrations/0016_auto_20201211_2026.py
Normal file
28
bookwyrm/migrations/0016_auto_20201211_2026.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 3.0.7 on 2020-12-11 20:26
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bookwyrm', '0015_auto_20201128_0349'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='sitesettings',
|
||||
name='admin_email',
|
||||
field=models.EmailField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='sitesettings',
|
||||
name='support_link',
|
||||
field=models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='sitesettings',
|
||||
name='support_title',
|
||||
field=models.CharField(blank=True, max_length=100, null=True),
|
||||
),
|
||||
]
|
|
@ -17,6 +17,9 @@ class SiteSettings(models.Model):
|
|||
code_of_conduct = models.TextField(
|
||||
default="Add a code of conduct here.")
|
||||
allow_registration = models.BooleanField(default=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)
|
||||
|
||||
@classmethod
|
||||
def get(cls):
|
||||
|
|
|
@ -124,8 +124,23 @@
|
|||
<div class="footer">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
About this server
|
||||
|
||||
<p>
|
||||
<a href="/about">About this server</a>
|
||||
</p>
|
||||
{% if site.admin_email %}
|
||||
<p>
|
||||
<a href="mailto:{{ site.admin_email }}">Contact site admin</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if site.support_link %}
|
||||
<div class="column">
|
||||
<span class="icon icon-heart"></span>
|
||||
Support {{ site.name }} on <a href="{{ site.support_link }}" target="_blank">{{ site.support_title }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="column">
|
||||
BookWyrm is open source software. You can contribute or report issues on <a href="https://github.com/mouse-reeve/bookwyrm">GitHub</a>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue