Refactors user pages

This commit is contained in:
Mouse Reeve 2021-01-29 09:05:53 -08:00
parent 6ccf7841e1
commit 24af288c52
5 changed files with 41 additions and 34 deletions

View file

@ -1,18 +1,17 @@
{% extends 'layout.html' %} {% extends 'user/user_layout.html' %}
{% load bookwyrm_tags %} {% load bookwyrm_tags %}
{% block content %}
<div class="block"> {% block header %}
<h1 class="title"> <h1 class="title">
{% if is_self %}Your {% if is_self %}Your
{% else %} {% else %}
{% include 'snippets/username.html' with user=user possessive=True %} {% include 'snippets/username.html' with user=user possessive=True %}
{% endif %} {% endif %}
followers followers
</h1> </h1>
</div> {% endblock %}
{% include 'snippets/user_header.html' with user=user %}
{% 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 %}

View file

@ -1,18 +1,17 @@
{% extends 'layout.html' %} {% extends 'user/user_layout.html' %}
{% load bookwyrm_tags %} {% load bookwyrm_tags %}
{% block content %}
<div class="block"> {% block header %}
<h1 class="title"> <h1 class="title">
Users following Users following
{% if is_self %}you {% if is_self %}you
{% else %} {% else %}
{% include 'snippets/username.html' with user=user %} {% include 'snippets/username.html' with user=user %}
{% endif %} {% endif %}
</h1> </h1>
</div> {% endblock %}
{% include 'snippets/user_header.html' with user=user %}
{% 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 %}

View file

@ -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>

View file

@ -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 %}

View file

@ -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)