1
0
mirror of https://gitlab.com/brutaldon/brutaldon.git synced 2024-12-04 14:46:24 -05:00

Add a template for accounts list

This commit is contained in:
Jason McBrayer 2019-04-23 21:53:21 -04:00
parent c1b5eb6359
commit 3289adde09
4 changed files with 46 additions and 2 deletions

View File

@ -0,0 +1,18 @@
<article class="media box">
<figure class="media-left">
<p class="image is-64x64">
<img src="{{ account.avatar_static }}"
alt="{{ account.acct }}">
</p>
</figure>
<div class="media-content">
<strong>{{ account.display_name }}</strong> ({{ account.username }})
</div>
<div class="media-right">
<form method="POST" action="{% url "accounts" account.id %}">
{% csrf_token %}
<button class="button" name="activate">Activate</button>
<button class="button" name="forget">Forget</button>
</form>
</div>
</article>

View File

@ -0,0 +1,24 @@
{% extends "base.html" %}
{% load widget_tweaks %}
{% block content %}
<div class="container">
<h1 class="title">Signed-in accounts</h1>
{% if not accounts %}
<p>No accounts.</p>
{% endif %}
{% for account in accounts %}
{% include "accounts/account_partial.html" %}
{% endfor %}
<p>
Or <a href="{% url "login" %}">log in</a> to another account to
add it to the list.
</p>
</div>
{% endblock %}

View File

@ -67,5 +67,6 @@ urlpatterns = [
path('requests/', views.follow_requests, name='follow_requests'),
path('requests/<id>', views.follow_requests, name='follow_requests'),
path('accounts/', views.accounts, name='accounts'),
path('accounts/<id>', views.accounts, name='accounts'),
path('', views.home, name=''),
]

View File

@ -1065,7 +1065,7 @@ def delete_filter(request, id):
else:
return render(request, "filters/delete.html",
{"filter": filter,
"own_acct": request.session["user"],
"own_acct": request.session["active_user"],
"confirm_page": True,
"preferences": account.preferences})
@ -1133,11 +1133,12 @@ def follow_requests(request, id=None):
return redirect(follow_requests)
@br_login_required
def accounts(request):
def accounts(request, id=None):
active_account, mastodon = get_usercontext(request)
if request.method == 'GET':
accounts = [x['user'] for x in request.session.get('accounts_dict').values()]
return render(request, 'accounts/list.html',
{'active_account': active_account,
"own_acct": request.session["active_user"],
'accounts': accounts,
'preferences': active_account.preferences})