forked from mirrors/bookwyrm
Refactors user pages
This commit is contained in:
parent
6ccf7841e1
commit
24af288c52
5 changed files with 41 additions and 34 deletions
|
@ -1,18 +1,17 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'user/user_layout.html' %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
{% block content %}
|
|
||||||
<div class="block">
|
|
||||||
<h1 class="title">
|
|
||||||
{% if is_self %}Your
|
|
||||||
{% else %}
|
|
||||||
{% include 'snippets/username.html' with user=user possessive=True %}
|
|
||||||
{% endif %}
|
|
||||||
followers
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% include 'snippets/user_header.html' with user=user %}
|
{% block header %}
|
||||||
|
<h1 class="title">
|
||||||
|
{% if is_self %}Your
|
||||||
|
{% else %}
|
||||||
|
{% include 'snippets/username.html' with user=user possessive=True %}
|
||||||
|
{% endif %}
|
||||||
|
followers
|
||||||
|
</h1>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block panel %}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h2 class="title">Followers</h2>
|
<h2 class="title">Followers</h2>
|
||||||
{% for followers in followers %}
|
{% for followers in followers %}
|
||||||
|
@ -34,5 +33,4 @@
|
||||||
<div>{{ user|username }} has no followers</div>
|
<div>{{ user|username }} has no followers</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,18 +1,17 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'user/user_layout.html' %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
{% block content %}
|
|
||||||
<div class="block">
|
|
||||||
<h1 class="title">
|
|
||||||
Users following
|
|
||||||
{% if is_self %}you
|
|
||||||
{% else %}
|
|
||||||
{% include 'snippets/username.html' with user=user %}
|
|
||||||
{% endif %}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% include 'snippets/user_header.html' with user=user %}
|
{% block header %}
|
||||||
|
<h1 class="title">
|
||||||
|
Users following
|
||||||
|
{% if is_self %}you
|
||||||
|
{% else %}
|
||||||
|
{% include 'snippets/username.html' with user=user %}
|
||||||
|
{% endif %}
|
||||||
|
</h1>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block panel %}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h2 class="title">Following</h2>
|
<h2 class="title">Following</h2>
|
||||||
{% for follower in user.following.all %}
|
{% for follower in user.following.all %}
|
||||||
|
@ -34,5 +33,4 @@
|
||||||
<div>{{ user|username }} isn't following any users</div>
|
<div>{{ user|username }} isn't following any users</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'user/user_layout.html' %}
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h1 class="title">User profile</h1>
|
<h1 class="title">User profile</h1>
|
||||||
|
@ -15,8 +15,9 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% include 'snippets/user_header.html' with user=user %}
|
{% block panel %}
|
||||||
{% if user.bookwyrm_user %}
|
{% if user.bookwyrm_user %}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h2 class="title">Shelves</h2>
|
<h2 class="title">Shelves</h2>
|
|
@ -1,5 +1,12 @@
|
||||||
|
{% extends 'layout.html' %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% load bookwyrm_tags %}
|
{% load bookwyrm_tags %}
|
||||||
|
<header class="block">
|
||||||
|
{% block header %}{% endblock %}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{# user bio #}
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
|
@ -60,3 +67,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% block panel %}{% endblock %}
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -90,7 +90,7 @@ class User(View):
|
||||||
'goal': goal,
|
'goal': goal,
|
||||||
}
|
}
|
||||||
|
|
||||||
return TemplateResponse(request, 'user.html', data)
|
return TemplateResponse(request, 'user/user.html', data)
|
||||||
|
|
||||||
class Followers(View):
|
class Followers(View):
|
||||||
''' list of followers view '''
|
''' list of followers view '''
|
||||||
|
@ -115,7 +115,7 @@ class Followers(View):
|
||||||
'is_self': request.user.id == user.id,
|
'is_self': request.user.id == user.id,
|
||||||
'followers': user.followers.all(),
|
'followers': user.followers.all(),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'followers.html', data)
|
return TemplateResponse(request, 'user/followers.html', data)
|
||||||
|
|
||||||
class Following(View):
|
class Following(View):
|
||||||
''' list of following view '''
|
''' list of following view '''
|
||||||
|
@ -140,7 +140,7 @@ class Following(View):
|
||||||
'is_self': request.user.id == user.id,
|
'is_self': request.user.id == user.id,
|
||||||
'following': user.following.all(),
|
'following': user.following.all(),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'following.html', data)
|
return TemplateResponse(request, 'user/following.html', data)
|
||||||
|
|
||||||
|
|
||||||
@method_decorator(login_required, name='dispatch')
|
@method_decorator(login_required, name='dispatch')
|
||||||
|
@ -153,7 +153,7 @@ class EditUser(View):
|
||||||
'form': forms.EditUserForm(instance=request.user),
|
'form': forms.EditUserForm(instance=request.user),
|
||||||
'user': request.user,
|
'user': request.user,
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'edit_user.html', data)
|
return TemplateResponse(request, 'settings/edit_user.html', data)
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
''' les get fancy with images '''
|
''' les get fancy with images '''
|
||||||
|
@ -161,7 +161,7 @@ class EditUser(View):
|
||||||
request.POST, request.FILES, instance=request.user)
|
request.POST, request.FILES, instance=request.user)
|
||||||
if not form.is_valid():
|
if not form.is_valid():
|
||||||
data = {'form': form, 'user': request.user}
|
data = {'form': form, 'user': request.user}
|
||||||
return TemplateResponse(request, 'edit_user.html', data)
|
return TemplateResponse(request, 'settings/edit_user.html', data)
|
||||||
|
|
||||||
user = form.save(commit=False)
|
user = form.save(commit=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue