mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-13 20:31:00 +00:00
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:
|
||||
model = models.Report
|
||||
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 %}
|
||||
|
||||
<header class="block column is-offset-one-quarter pl-1">
|
||||
<h1 class="title">{% block header %}{% endblock %}</h1>
|
||||
<div class="columns is-mobile">
|
||||
<div class="column">
|
||||
<h1 class="title">{% block header %}{% endblock %}</h1>
|
||||
</div>
|
||||
<div class="column is-narrow">
|
||||
{% block edit-button %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="block columns">
|
||||
|
|
|
@ -4,8 +4,17 @@
|
|||
|
||||
{% 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 %}
|
||||
|
||||
<div class="block">
|
||||
{% include 'settings/add_server_form.html' with controls_text="add-server" %}
|
||||
</div>
|
||||
|
||||
<table class="table is-striped">
|
||||
<tr>
|
||||
{% url 'settings-federation' as url %}
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.template.response import TemplateResponse
|
|||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm.settings import PAGE_LENGTH
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ class Federation(View):
|
|||
servers = servers.order_by(sort)
|
||||
|
||||
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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue