mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-24 02:21:04 +00:00
Edit view for site settings
This commit is contained in:
parent
21aadf2920
commit
9db327a69e
3 changed files with 22 additions and 3 deletions
|
@ -90,6 +90,9 @@
|
||||||
Import books
|
Import books
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% if perms.bookwyrm.create_invites or perms.bookwyrm.edit_instance_settings%}
|
||||||
|
<hr class="navbar-divider">
|
||||||
|
{% endif %}
|
||||||
{% if perms.bookwyrm.create_invites %}
|
{% if perms.bookwyrm.create_invites %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'settings-invites' %}" class="navbar-item">
|
<a href="{% url 'settings-invites' %}" class="navbar-item">
|
||||||
|
@ -97,6 +100,13 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if perms.bookwyrm.edit_instance_settings %}
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'settings-site' %}" class="navbar-item">
|
||||||
|
Site Configuration
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
<hr class="navbar-divider">
|
<hr class="navbar-divider">
|
||||||
<li>
|
<li>
|
||||||
<a href="/logout" class="navbar-item">
|
<a href="/logout" class="navbar-item">
|
||||||
|
|
|
@ -51,11 +51,11 @@
|
||||||
<h2 class="title is-4">Footer Content</h2>
|
<h2 class="title is-4">Footer Content</h2>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<label class="label" for="id_support_link">Support link:</label>
|
<label class="label" for="id_support_link">Support link:</label>
|
||||||
<input type="text" name="support_link" maxlength="255" class="input" id="id_support_link" placeholder="https://www.patreon.com/bookwyrm" value="{{ site.support_link }}">
|
<input type="text" name="support_link" maxlength="255" class="input" id="id_support_link" placeholder="https://www.patreon.com/bookwyrm"{% if site.support_link %} value="{{ site.support_link }}"{% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<label class="label" for="id_support_title">Support title:</label>
|
<label class="label" for="id_support_title">Support title:</label>
|
||||||
<input type="text" name="support_title" maxlength="100" class="input" id="id_support_title" placeholder="Patreon" value="{{ site.support_title }}">
|
<input type="text" name="support_title" maxlength="100" class="input" id="id_support_title" placeholder="Patreon"{% if site.support_title %} value="{{ site.support_title }}"{% endif %}>
|
||||||
</div>
|
</div>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<label class="label" for="id_admin_email">Admin email:</label>
|
<label class="label" for="id_admin_email">Admin email:</label>
|
||||||
|
|
|
@ -27,5 +27,14 @@ class Site(View):
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
''' edit the site settings '''
|
''' edit the site settings '''
|
||||||
|
site = models.SiteSettings.objects.get()
|
||||||
|
form = forms.SiteForm(request.POST, instance=site)
|
||||||
|
if not form.is_valid():
|
||||||
|
data = {
|
||||||
|
'title': 'Site Settings',
|
||||||
|
'site_form': form
|
||||||
|
}
|
||||||
|
return TemplateResponse(request, 'settings/site.html', data)
|
||||||
|
form.save()
|
||||||
|
|
||||||
return redirect('/settings/site-settings')
|
return redirect('settings-site')
|
||||||
|
|
Loading…
Reference in a new issue