forked from mirrors/bookwyrm
Ignore request flow
This commit is contained in:
parent
81ab73f309
commit
5297b9d796
4 changed files with 36 additions and 11 deletions
|
@ -16,7 +16,8 @@
|
|||
<ul class="menu-list">
|
||||
<li>
|
||||
{% url 'settings-invites' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Invites" %}</a>
|
||||
{% url 'settings-invite-requests' as alt_url %}
|
||||
<a href="{{ url }}"{% if url in request.path or request.path in alt_url %} class="is-active" aria-selected="true"{% endif %}>{% trans "Invites" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
{% url 'settings-reports' as url %}
|
||||
|
|
|
@ -6,19 +6,25 @@
|
|||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
{% url 'settings-invites' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invites" %}</a>
|
||||
</li>
|
||||
{% url 'settings-invite-requests' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invite Requests" %}</a>
|
||||
</li>
|
||||
{% url 'settings-invites' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invites" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section class="block">
|
||||
<h2 class="title is-4">{% trans "Invite Requests" %}</h2>
|
||||
<h2 class="title is-4">
|
||||
{% if ignored %}
|
||||
{% trans "Ignored Invite Requests" %}
|
||||
{% else %}
|
||||
{% trans "Invite Requests" %}
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
||||
<table class="table is-striped">
|
||||
<tr>
|
||||
|
@ -55,8 +61,13 @@
|
|||
</form>
|
||||
|
||||
<form name="ignore-request" method="post" action="{% url 'settings-invite-requests-ignore' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="invite-request" value="{{ req.id }}">
|
||||
{% if not req.ignored %}
|
||||
<button type="submit" class="button is-danger is-light is-small">{% trans "Ignore" %}</button>
|
||||
{% else %}
|
||||
<button type="submit" class="button is-danger is-light is-small">{% trans "Un-gnore" %}</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -65,5 +76,11 @@
|
|||
{% endfor %}
|
||||
</table>
|
||||
{% include 'snippets/pagination.html' with page=requests path=request.path %}
|
||||
|
||||
{% if ignored %}
|
||||
<p><a href="{% url 'settings-invite-requests' %}">{% trans "Back to pending requests" %}</a></p>
|
||||
{% else %}
|
||||
<p><a href="{% url 'settings-invite-requests' %}?ignored=True">{% trans "View ignored requests" %}</a></p>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
{% url 'settings-invites' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invites" %}</a>
|
||||
</li>
|
||||
{% url 'settings-invite-requests' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invite Requests" %}</a>
|
||||
</li>
|
||||
{% url 'settings-invites' as url %}
|
||||
<li {% if url in request.path %}class="is-active" aria-current="page"{% endif %}>
|
||||
<a href="{{ url }}">{% trans "Invites" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -130,4 +130,11 @@ class InviteRequest(View):
|
|||
|
||||
@require_POST
|
||||
def ignore_invite_request(request):
|
||||
""" ok """
|
||||
""" hide an invite request """
|
||||
invite_request = get_object_or_404(
|
||||
models.InviteRequest, id=request.POST.get("invite-request")
|
||||
)
|
||||
|
||||
invite_request.ignored = not invite_request.ignored
|
||||
invite_request.save()
|
||||
return redirect("settings-invite-requests")
|
||||
|
|
Loading…
Reference in a new issue