Bugfix admin redirect fixes (#587)

This commit is contained in:
mj2p 2023-06-14 18:15:29 +01:00 committed by GitHub
parent f88ad38294
commit bb8f589da7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 32 additions and 22 deletions

View file

@ -16,7 +16,7 @@
{% include "forms/_field.html" with field=form.end %}
</fieldset>
<div class="buttons">
<a href="{{ announcement.urls.admin_root }}" class="button secondary left">Back</a>
<a href="{{ announcement.urls.admin_root }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ announcement.urls.admin_delete }}" class="button delete">Delete</a>
<button>Save</button>
</div>

View file

@ -10,11 +10,11 @@
{% for announcement in page_obj %}
<tr>
<td class="icon">
<a href="{{ announcement.urls.admin_edit }}" class="overlay"></a>
<a href="{{ announcement.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-bullhorn"></i>
</td>
<td class="name">
<a href="{{ announcement.urls.admin_edit }}" class="overlay"></a>
<a href="{{ announcement.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ announcement.html|truncatewords_html:"10" }}
<small>
{% if announcement.service_announcement %}{{ domain.service_domain }}{% endif %}

View file

@ -12,11 +12,11 @@
{% for domain in page_obj %}
<tr>
<td class="icon">
<a href="{{ domain.urls.edit_federation }}" class="overlay"></a>
<a href="{{ domain.urls.edit_federation }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-globe"></i>
</td>
<td class="name">
<a href="{{ domain.urls.edit_federation }}" class="overlay"></a>
<a href="{{ domain.urls.edit_federation }}?page={{ page_obj.number }}" class="overlay"></a>
{{ domain.domain }}
<small>{{ domain.software }}</small>
</td>

View file

@ -15,7 +15,7 @@
{% include "forms/_field.html" with field=form.notes %}
</fieldset>
<div class="buttons">
<a href="{{ domain.urls.root_federation }}" class="button secondary left">Back</a>
<a href="{{ domain.urls.root_federation }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ domain.urls.delete }}" class="button delete">Delete</a>
<button>Save</button>
</div>

View file

@ -38,7 +38,7 @@
</div>
</fieldset>
<div class="buttons">
<a href="{{ hashtag.urls.admin }}" class="button secondary left">Back</a>
<a href="{{ hashtag.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ hashtag.urls.timeline }}" class="button secondary">View Posts</a>
<button>Save</button>
</div>

View file

@ -7,11 +7,11 @@
{% for hashtag in page_obj %}
<tr>
<td class="icon">
<a href="{{ hashtag.urls.admin_edit }}" class="overlay"></a>
<a href="{{ hashtag.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-hashtag"></i>
</td>
<td class="name">
<a href="{{ hashtag.urls.admin_edit }}" class="overlay"></a>
<a href="{{ hashtag.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ hashtag.display_name }}
<small>{% if hashtag.public %}Public{% elif hashtag.public is None %}Unreviewed{% else %}Private{% endif %}</small>
</td>

View file

@ -22,7 +22,7 @@
{% for identity in page_obj %}
<tr>
<td class="icon">
<a href="{{ identity.urls.admin_edit }}" class="overlay"></a>
<a href="{{ identity.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<img
src="{{ identity.local_icon_url.relative }}"
class="icon"
@ -33,7 +33,7 @@
>
</td>
<td class="name">
<a href="{{ identity.urls.admin_edit }}" class="overlay"></a>
<a href="{{ identity.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ identity.html_name_or_handle }}
<small>@{{ identity.handle }}</small>
</td>

View file

@ -115,7 +115,7 @@
{% endif %}
</div>
<div class="buttons">
<a href="{{ identity.urls.admin }}" class="button secondary left">Back</a>
<a href="{{ identity.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ identity.urls.view }}" class="button secondary">View Profile</a>
<button>Save Notes</button>
</div>

View file

@ -13,7 +13,7 @@
{% include "forms/_field.html" with field=form.notes %}
</fieldset>
<div class="buttons">
<a href="{% url "admin_invites" %}" class="button secondary left">Back</a>
<a href="{% url 'admin_invites' %}?page={{ page }}" class="button secondary left">Back</a>
<button class="delete" name="delete">Delete</button>
<button>Save</button>
</div>

View file

@ -12,11 +12,11 @@
{% for invite in page_obj %}
<tr>
<td class="icon">
<a href="{{ invite.urls.admin_view }}" class="overlay"></a>
<a href="{{ invite.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-envelope"></i>
</td>
<td class="name">
<a href="{{ invite.urls.admin_view }}" class="overlay"></a>
<a href="{{ invite.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
{{ invite.token }}
<small>
{% if invite.note %}

View file

@ -77,7 +77,7 @@
</table>
</fieldset>
<div class="buttons">
<a href="{{ report.urls.admin }}" class="button secondary left">Back</a>
<a href="{{ report.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<a href="{{ report.subject_identity.urls.view }}" class="button secondary">View Profile</a>
<a href="{{ report.subject_identity.urls.admin_edit }}" class="button secondary">Identity Admin</a>
<button>Save Notes</button>

View file

@ -15,11 +15,11 @@
{% for report in page_obj %}
<tr>
<td class="icon">
<a href="{{ report.urls.admin_view }}" class="overlay"></a>
<a href="{{ report.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
<img src="{{ report.subject_identity.local_icon_url.relative }}" class="icon" alt="Avatar for {{ report.subject_identity.name_or_handle }}">
</td>
<td class="name">
<a href="{{ report.urls.admin_view }}" class="overlay"></a>
<a href="{{ report.urls.admin_view }}?page={{ page_obj.number }}" class="overlay"></a>
{{ report.subject_identity.html_name_or_handle }}
{% if report.subject_post %}
<small>

View file

@ -29,7 +29,7 @@
<p>Created: <time title="{{ editing_user.created }} UTC">{{ editing_user.created | timesince }} ago</time></p>
</fieldset>
<div class="buttons">
<a href="{{ editing_user.urls.admin }}" class="button secondary left">Back</a>
<a href="{{ editing_user.urls.admin }}?page={{ page }}" class="button secondary left">Back</a>
<button>Save</button>
</div>
</form>

View file

@ -12,11 +12,11 @@
{% for user in page_obj %}
<tr>
<td class="icon">
<a href="{{ user.urls.admin_edit }}" class="overlay"></a>
<a href="{{ user.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
<i class="fa-solid fa-user"></i>
</td>
<td class="name">
<a href="{{ user.urls.admin_edit }}" class="overlay"></a>
<a href="{{ user.urls.admin_edit }}?page={{ page_obj.number }}" class="overlay"></a>
{{ user.email }}
<small>{% if user.admin %}Admin{% elif user.moderator %}Moderator{% endif %}</small>
</td>

View file

@ -49,7 +49,11 @@ class AnnouncementEdit(UpdateView):
model = Announcement
template_name = "admin/announcement_edit.html"
extra_context = {"section": "announcements"}
success_url = Announcement.urls.admin_root
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["page"] = self.request.GET.get("page")
return context
class form_class(AnnouncementCreate.form_class):
pass

View file

@ -64,6 +64,7 @@ class FederationEdit(FormView):
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context["domain"] = self.domain
context["page"] = self.request.GET.get("page")
return context
def form_valid(self, form):

View file

@ -64,6 +64,7 @@ class HashtagEdit(FormView):
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context["hashtag"] = self.hashtag
context["page"] = self.request.GET.get("page")
return context
def form_valid(self, form):

View file

@ -90,4 +90,5 @@ class IdentityEdit(FormView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["identity"] = self.identity
context["page"] = self.request.GET.get("page")
return context

View file

@ -106,4 +106,5 @@ class InviteView(FormView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["invite"] = self.invite
context["page"] = self.request.GET.get("page")
return context

View file

@ -77,4 +77,5 @@ class ReportView(FormView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["report"] = self.report
context["page"] = self.request.GET.get("page")
return context

View file

@ -81,4 +81,5 @@ class UserEdit(FormView):
context = super().get_context_data(**kwargs)
context["editing_user"] = self.user
context["same_user"] = self.user == self.request.user
context["page"] = self.request.GET.get("page")
return context