forked from mirrors/bookwyrm
Adds edit server form
This commit is contained in:
parent
8261fbf86a
commit
74549956c2
5 changed files with 40 additions and 3 deletions
|
@ -281,3 +281,9 @@ class ReportForm(CustomForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Report
|
model = models.Report
|
||||||
fields = ["user", "reporter", "statuses", "note"]
|
fields = ["user", "reporter", "statuses", "note"]
|
||||||
|
|
||||||
|
|
||||||
|
class ServerForm(CustomForm):
|
||||||
|
class Meta:
|
||||||
|
model = models.FederatedServer
|
||||||
|
exclude = []
|
||||||
|
|
15
bookwyrm/templates/settings/add_server_form.html
Normal file
15
bookwyrm/templates/settings/add_server_form.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{% extends 'components/inline_form.html' %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
|
{% trans "Add server" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block form %}
|
||||||
|
<form>
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit" class="button is-primary">{% trans "Save" %}</button>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -6,7 +6,14 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<header class="block column is-offset-one-quarter pl-1">
|
<header class="block column is-offset-one-quarter pl-1">
|
||||||
|
<div class="columns is-mobile">
|
||||||
|
<div class="column">
|
||||||
<h1 class="title">{% block header %}{% endblock %}</h1>
|
<h1 class="title">{% block header %}{% endblock %}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="column is-narrow">
|
||||||
|
{% block edit-button %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="block columns">
|
<div class="block columns">
|
||||||
|
|
|
@ -4,8 +4,17 @@
|
||||||
|
|
||||||
{% block header %}{% trans "Federated Servers" %}{% endblock %}
|
{% block header %}{% trans "Federated Servers" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block edit-button %}
|
||||||
|
{% trans "Add server" as button_text %}
|
||||||
|
{% include 'snippets/toggle/open_button.html' with controls_text="add-server" icon="plus" text=button_text focus="add-server-header" %}
|
||||||
|
{% endblock%}
|
||||||
|
|
||||||
{% block panel %}
|
{% block panel %}
|
||||||
|
|
||||||
|
<div class="block">
|
||||||
|
{% include 'settings/add_server_form.html' with controls_text="add-server" %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table is-striped">
|
<table class="table is-striped">
|
||||||
<tr>
|
<tr>
|
||||||
{% url 'settings-federation' as url %}
|
{% url 'settings-federation' as url %}
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.template.response import TemplateResponse
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
|
||||||
from bookwyrm import models
|
from bookwyrm import forms, models
|
||||||
from bookwyrm.settings import PAGE_LENGTH
|
from bookwyrm.settings import PAGE_LENGTH
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class Federation(View):
|
||||||
servers = servers.order_by(sort)
|
servers = servers.order_by(sort)
|
||||||
|
|
||||||
paginated = Paginator(servers, PAGE_LENGTH)
|
paginated = Paginator(servers, PAGE_LENGTH)
|
||||||
data = {"servers": paginated.page(page), "sort": sort}
|
data = {"servers": paginated.page(page), "sort": sort, "form": forms.ServerForm}
|
||||||
return TemplateResponse(request, "settings/federation.html", data)
|
return TemplateResponse(request, "settings/federation.html", data)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue