Updates references to templates

This commit is contained in:
Mouse Reeve 2021-09-28 12:39:52 -07:00
parent 1c262a1a64
commit 9c9adfc6f0
10 changed files with 46 additions and 20 deletions

View file

@ -41,7 +41,9 @@ class Announcements(View):
"form": forms.AnnouncementForm(),
"sort": sort,
}
return TemplateResponse(request, "settings/announcements.html", data)
return TemplateResponse(
request, "settings/announcements/announcements.html", data
)
def post(self, request):
"""edit the site settings"""
@ -56,7 +58,9 @@ class Announcements(View):
).get_page(request.GET.get("page")),
"form": form,
}
return TemplateResponse(request, "settings/announcements.html", data)
return TemplateResponse(
request, "settings/announcements/announcements.html", data
)
@method_decorator(login_required, name="dispatch")
@ -74,7 +78,9 @@ class Announcement(View):
"announcement": announcement,
"form": forms.AnnouncementForm(instance=announcement),
}
return TemplateResponse(request, "settings/announcement.html", data)
return TemplateResponse(
request, "settings/announcements/announcement.html", data
)
def post(self, request, announcement_id):
"""edit announcement"""
@ -87,7 +93,9 @@ class Announcement(View):
"announcement": announcement,
"form": form,
}
return TemplateResponse(request, "settings/announcement.html", data)
return TemplateResponse(
request, "settings/announcements/announcement.html", data
)
@login_required

View file

@ -85,4 +85,4 @@ class Dashboard(View):
"user_stats": user_stats,
"status_stats": status_stats,
}
return TemplateResponse(request, "settings/dashboard.html", data)
return TemplateResponse(request, "settings/dashboard/dashboard.html", data)

View file

@ -22,7 +22,9 @@ class EmailBlocklist(View):
"domains": models.EmailBlocklist.objects.order_by("-created_date").all(),
"form": forms.EmailBlocklistForm(),
}
return TemplateResponse(request, "settings/email_blocklist.html", data)
return TemplateResponse(
request, "settings/email_blocklist/email_blocklist.html", data
)
def post(self, request, domain_id=None):
"""create a new domain block"""
@ -35,11 +37,15 @@ class EmailBlocklist(View):
"form": form,
}
if not form.is_valid():
return TemplateResponse(request, "settings/email_blocklist.html", data)
return TemplateResponse(
request, "settings/email_blocklist/email_blocklist.html", data
)
form.save()
data["form"] = forms.EmailBlocklistForm()
return TemplateResponse(request, "settings/email_blocklist.html", data)
return TemplateResponse(
request, "settings/email_blocklist/email_blocklist.html", data
)
# pylint: disable=unused-argument
def delete(self, request, domain_id):

View file

@ -44,7 +44,7 @@ class Federation(View):
"sort": sort,
"form": forms.ServerForm(),
}
return TemplateResponse(request, "settings/federation.html", data)
return TemplateResponse(request, "settings/federation/instance_list.html", data)
class AddFederatedServer(View):
@ -53,14 +53,16 @@ class AddFederatedServer(View):
def get(self, request):
"""add server form"""
data = {"form": forms.ServerForm()}
return TemplateResponse(request, "settings/edit_server.html", data)
return TemplateResponse(request, "settings/federation/edit_instance.html", data)
def post(self, request):
"""add a server from the admin panel"""
form = forms.ServerForm(request.POST)
if not form.is_valid():
data = {"form": form}
return TemplateResponse(request, "settings/edit_server.html", data)
return TemplateResponse(
request, "settings/federation/edit_instance.html", data
)
server = form.save()
return redirect("settings-federated-server", server.id)
@ -75,7 +77,7 @@ class ImportServerBlocklist(View):
def get(self, request):
"""add server form"""
return TemplateResponse(request, "settings/server_blocklist.html")
return TemplateResponse(request, "settings/federation/instance_blocklist.html")
def post(self, request):
"""add a server from the admin panel"""
@ -98,7 +100,9 @@ class ImportServerBlocklist(View):
server.block()
success_count += 1
data = {"failed": failed, "succeeded": success_count}
return TemplateResponse(request, "settings/server_blocklist.html", data)
return TemplateResponse(
request, "settings/federation/instance_blocklist.html", data
)
@method_decorator(login_required, name="dispatch")
@ -123,7 +127,7 @@ class FederatedServer(View):
user_subject__in=users.all()
),
}
return TemplateResponse(request, "settings/federated_server.html", data)
return TemplateResponse(request, "settings/federation/instance.html", data)
def post(self, request, server): # pylint: disable=unused-argument
"""update note"""

View file

@ -45,7 +45,7 @@ class ManageInvites(View):
),
"form": forms.CreateInviteForm(),
}
return TemplateResponse(request, "settings/manage_invites.html", data)
return TemplateResponse(request, "settings/invites/manage_invites.html", data)
def post(self, request):
"""creates an invite database entry"""
@ -64,7 +64,7 @@ class ManageInvites(View):
PAGE_LENGTH,
)
data = {"invites": paginated.page(1), "form": form}
return TemplateResponse(request, "settings/manage_invites.html", data)
return TemplateResponse(request, "settings/invites/manage_invites.html", data)
class Invite(View):
@ -135,7 +135,9 @@ class ManageInviteRequests(View):
),
"sort": sort,
}
return TemplateResponse(request, "settings/manage_invite_requests.html", data)
return TemplateResponse(
request, "settings/invites/manage_invite_requests.html", data
)
def post(self, request):
"""send out an invite"""

View file

@ -22,7 +22,9 @@ class IPBlocklist(View):
"addresses": models.IPBlocklist.objects.all(),
"form": forms.IPBlocklistForm(),
}
return TemplateResponse(request, "settings/ip_blocklist.html", data)
return TemplateResponse(
request, "settings/ip_blocklist/ip_blocklist.html", data
)
def post(self, request, block_id=None):
"""create a new ip address block"""
@ -35,11 +37,15 @@ class IPBlocklist(View):
"form": form,
}
if not form.is_valid():
return TemplateResponse(request, "settings/ip_blocklist.html", data)
return TemplateResponse(
request, "settings/ip_blocklist/ip_blocklist.html", data
)
form.save()
data["form"] = forms.IPBlocklistForm()
return TemplateResponse(request, "settings/ip_blocklist.html", data)
return TemplateResponse(
request, "settings/ip_blocklist/ip_blocklist.html", data
)
# pylint: disable=unused-argument
def delete(self, request, domain_id):