mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-01 04:48:44 +00:00
commit
e2bc751ee4
12 changed files with 75 additions and 18 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(
|
code_of_conduct = models.TextField(
|
||||||
default="Add a code of conduct here.")
|
default="Add a code of conduct here.")
|
||||||
allow_registration = models.BooleanField(default=True)
|
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
|
@classmethod
|
||||||
def get(cls):
|
def get(cls):
|
||||||
|
|
|
@ -75,6 +75,7 @@ TEMPLATES = [
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
|
'bookwyrm.context_processors.site_settings',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column block">
|
<div class="column block">
|
||||||
{% include 'snippets/about.html' with site_settings=site_settings %}
|
{% include 'snippets/about.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column block">
|
<div class="column block">
|
||||||
<h2 class="title">Code of Conduct</h2>
|
<h2 class="title">Code of Conduct</h2>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ site_settings.code_of_conduct | safe }}
|
{{ site.code_of_conduct | safe }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
{% include 'snippets/about.html' with site_settings=site_settings %}
|
{% include 'snippets/about.html' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{% if title %}{{ title }} | {% endif %}BookWyrm</title>
|
<title>{% if title %}{{ title }} | {% endif %}{{ site.name }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link type="text/css" rel="stylesheet" href="/static/css/bulma.min.css">
|
<link type="text/css" rel="stylesheet" href="/static/css/bulma.min.css">
|
||||||
<link type="text/css" rel="stylesheet" href="/static/css/format.css">
|
<link type="text/css" rel="stylesheet" href="/static/css/format.css">
|
||||||
|
@ -11,12 +11,10 @@
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/static/images/favicon.ico">
|
<link rel="shortcut icon" type="image/x-icon" href="/static/images/favicon.ico">
|
||||||
|
|
||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
<meta name="twitter:title" content="BookWyrm">
|
<meta name="twitter:title" content="{{ site.name }}">
|
||||||
<meta name="og:title" content="BookWyrm">
|
<meta name="og:title" content="{{ site.name }}">
|
||||||
<meta name="twitter:description" content="Federated Social Reading">
|
<meta name="twitter:description" content="Federated Social Reading">
|
||||||
<meta name="og:description" content="Federated Social Reading">
|
<meta name="og:description" content="Federated Social Reading">
|
||||||
<meta name="twitter:creator" content="@tripofmice">
|
|
||||||
<meta name="twitter:site" content="@tripofmice">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -123,6 +121,30 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<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>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var csrf_token = '{{ csrf_token }}';
|
var csrf_token = '{{ csrf_token }}';
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="box has-background-primary-light">
|
<div class="box has-background-primary-light">
|
||||||
{% if site_settings.allow_registration %}
|
{% if site.allow_registration %}
|
||||||
<h2 class="title">Create an Account</h2>
|
<h2 class="title">Create an Account</h2>
|
||||||
<form name="register" method="post" action="/user-register">
|
<form name="register" method="post" action="/user-register">
|
||||||
{% include 'snippets/register_form.html' %}
|
{% include 'snippets/register_form.html' %}
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
{% include 'snippets/about.html' with site_settings=site_settings %}
|
{% include 'snippets/about.html' %}
|
||||||
|
|
||||||
<p class="block">
|
<p class="block">
|
||||||
<a href="/about/">More about this site</a>
|
<a href="/about/">More about this site</a>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
{% include 'snippets/about.html' with site_settings=site_settings %}
|
{% include 'snippets/about.html' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<h1 class="title">About {{ site_settings.name }}</h1>
|
<h1 class="title">About {{ site.name }}</h1>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<img src="/static/images/logo.png" alt="BookWyrm">
|
<img src="/static/images/logo.png" alt="BookWyrm">
|
||||||
</div>
|
</div>
|
||||||
<p class="block">
|
<p class="block">
|
||||||
{{ site_settings.instance_description }}
|
{{ site.instance_description }}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -42,7 +42,6 @@ def user_login(request):
|
||||||
login_form.non_field_errors = 'Username or password are incorrect'
|
login_form.non_field_errors = 'Username or password are incorrect'
|
||||||
register_form = forms.RegisterForm()
|
register_form = forms.RegisterForm()
|
||||||
data = {
|
data = {
|
||||||
'site_settings': models.SiteSettings.get(),
|
|
||||||
'login_form': login_form,
|
'login_form': login_form,
|
||||||
'register_form': register_form
|
'register_form': register_form
|
||||||
}
|
}
|
||||||
|
@ -78,7 +77,6 @@ def register(request):
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
data = {
|
data = {
|
||||||
'site_settings': models.SiteSettings.get(),
|
|
||||||
'login_form': forms.LoginForm(),
|
'login_form': forms.LoginForm(),
|
||||||
'register_form': form
|
'register_form': form
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,6 @@ def login_page(request):
|
||||||
# send user to the login page
|
# send user to the login page
|
||||||
data = {
|
data = {
|
||||||
'title': 'Login',
|
'title': 'Login',
|
||||||
'site_settings': models.SiteSettings.get(),
|
|
||||||
'login_form': forms.LoginForm(),
|
'login_form': forms.LoginForm(),
|
||||||
'register_form': forms.RegisterForm(),
|
'register_form': forms.RegisterForm(),
|
||||||
}
|
}
|
||||||
|
@ -247,7 +246,6 @@ def about_page(request):
|
||||||
''' more information about the instance '''
|
''' more information about the instance '''
|
||||||
data = {
|
data = {
|
||||||
'title': 'About',
|
'title': 'About',
|
||||||
'site_settings': models.SiteSettings.get(),
|
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'about.html', data)
|
return TemplateResponse(request, 'about.html', data)
|
||||||
|
|
||||||
|
@ -295,7 +293,6 @@ def invite_page(request, code):
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'title': 'Join',
|
'title': 'Join',
|
||||||
'site_settings': models.SiteSettings.get(),
|
|
||||||
'register_form': forms.RegisterForm(),
|
'register_form': forms.RegisterForm(),
|
||||||
'invite': invite,
|
'invite': invite,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue