forked from mirrors/bookwyrm
Groups profile settings templates
This commit is contained in:
parent
24af288c52
commit
9fa8ee3940
12 changed files with 41 additions and 32 deletions
|
@ -81,7 +81,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/edit-profile" class="navbar-item">
|
||||
<a href="/preferences/profile" class="navbar-item">
|
||||
Settings
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'preferences_layout.html' %}
|
||||
{% extends 'preferences/preferences_layout.html' %}
|
||||
|
||||
{% block header %}
|
||||
Blocked Users
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'preferences_layout.html' %}
|
||||
{% extends 'preferences/preferences_layout.html' %}
|
||||
{% block header %}
|
||||
Change Password
|
||||
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'preferences_layout.html' %}
|
||||
{% extends 'preferences/preferences_layout.html' %}
|
||||
{% block header %}
|
||||
Edit Profile
|
||||
{% endblock %}
|
|
@ -10,16 +10,16 @@
|
|||
<h2 class="menu-label">Account</h2>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<a href="/edit-profile"{% if '/edit-profile' in request.path %} class="is-active" aria-selected="true"{% endif %}>Profile</a>
|
||||
<a href="/preferences/profile"{% if '/preferences/profile' in request.path %} class="is-active" aria-selected="true"{% endif %}>Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/change-password"{% if '/change-password' in request.path %} class="is-active" aria-selected="true"{% endif %}>Change password</a>
|
||||
<a href="/preferences/password"{% if '/preferences/password' in request.path %} class="is-active" aria-selected="true"{% endif %}>Change password</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h2 class="menu-label">Relationships</h2>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
<a href="/block"{% if '/block' in request.path %} class="is-active" aria-selected="true"{% endif %}>Blocked users</a>
|
||||
<a href="/preferences/block"{% if '/preferences/block' in request.path %} class="is-active" aria-selected="true"{% endif %}>Blocked users</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
{% if is_self %}
|
||||
<div class="column is-narrow">
|
||||
<a href="/edit-profile">
|
||||
<a href="/preferences/profile">
|
||||
<span class="icon icon-pencil" title="Edit profile">
|
||||
<span class="is-sr-only">Edit profile</span>
|
||||
</span>
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.urls import path, re_path
|
|||
|
||||
|
||||
from bookwyrm import incoming, settings, views, wellknown
|
||||
from bookwyrm.views.rss_feed import RssFeed
|
||||
from bookwyrm.utils import regex
|
||||
|
||||
user_path = r'^user/(?P<username>%s)' % regex.username
|
||||
|
@ -49,7 +48,6 @@ urlpatterns = [
|
|||
re_path(r'^password-reset/?$', views.PasswordResetRequest.as_view()),
|
||||
re_path(r'^password-reset/(?P<code>[A-Za-z0-9]+)/?$',
|
||||
views.PasswordReset.as_view()),
|
||||
re_path(r'^change-password/?$', views.ChangePassword.as_view()),
|
||||
|
||||
# invites
|
||||
re_path(r'^invite/?$', views.ManageInvites.as_view()),
|
||||
|
@ -76,9 +74,15 @@ urlpatterns = [
|
|||
re_path(r'%s/shelves/?$' % user_path, views.user_shelves_page),
|
||||
re_path(r'%s/followers(.json)?/?$' % user_path, views.Followers.as_view()),
|
||||
re_path(r'%s/following(.json)?/?$' % user_path, views.Following.as_view()),
|
||||
re_path(r'^edit-profile/?$', views.EditUser.as_view()),
|
||||
re_path(r'%s/rss' % user_path, views.rss_feed.RssFeed()),
|
||||
|
||||
# preferences
|
||||
re_path(r'^preferences/profile/?$', views.EditUser.as_view()),
|
||||
re_path(r'^preferences/password/?$', views.ChangePassword.as_view()),
|
||||
re_path(r'^preferences/block/?$', views.Block.as_view()),
|
||||
re_path(r'^block/(?P<user_id>\d+)/?$', views.Block.as_view()),
|
||||
re_path(r'^unblock/(?P<user_id>\d+)/?$', views.unblock),
|
||||
|
||||
# reading goals
|
||||
re_path(r'%s/goal/(?P<year>\d{4})/?$' % user_path, views.Goal.as_view()),
|
||||
|
||||
|
@ -140,7 +144,4 @@ urlpatterns = [
|
|||
re_path(r'^accept-follow-request/?$', views.accept_follow_request),
|
||||
re_path(r'^delete-follow-request/?$', views.delete_follow_request),
|
||||
|
||||
re_path(r'^block/?$', views.Block.as_view()),
|
||||
re_path(r'^block/(?P<user_id>\d+)/?$', views.Block.as_view()),
|
||||
re_path(r'^unblock/(?P<user_id>\d+)/?$', views.unblock),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
|
|
@ -17,6 +17,7 @@ from .notifications import Notifications
|
|||
from .outbox import Outbox
|
||||
from .reading import edit_readthrough, create_readthrough, delete_readthrough
|
||||
from .reading import start_reading, finish_reading, delete_progressupdate
|
||||
from .rss_feed import RssFeed
|
||||
from .password import PasswordResetRequest, PasswordReset, ChangePassword
|
||||
from .tag import Tag, AddTag, RemoveTag
|
||||
from .search import Search
|
||||
|
|
|
@ -17,7 +17,7 @@ class Block(View):
|
|||
def get(self, request):
|
||||
''' list of blocked users? '''
|
||||
return TemplateResponse(
|
||||
request, 'blocks.html', {'title': 'Blocked Users'})
|
||||
request, 'preferences/blocks.html', {'title': 'Blocked Users'})
|
||||
|
||||
def post(self, request, user_id):
|
||||
''' block a user '''
|
||||
|
@ -31,7 +31,7 @@ class Block(View):
|
|||
privacy='direct',
|
||||
direct_recipients=[to_block]
|
||||
)
|
||||
return redirect('/block')
|
||||
return redirect('/preferences/block')
|
||||
|
||||
|
||||
@require_POST
|
||||
|
@ -55,4 +55,4 @@ def unblock(request, user_id):
|
|||
direct_recipients=[to_unblock]
|
||||
)
|
||||
block.delete()
|
||||
return redirect('/block')
|
||||
return redirect('/preferences/block')
|
||||
|
|
|
@ -94,7 +94,8 @@ class ChangePassword(View):
|
|||
'title': 'Change Password',
|
||||
'user': request.user,
|
||||
}
|
||||
return TemplateResponse(request, 'change_password.html', data)
|
||||
return TemplateResponse(
|
||||
request, 'preferences/change_password.html', data)
|
||||
|
||||
def post(self, request):
|
||||
''' allow a user to change their password '''
|
||||
|
@ -102,9 +103,9 @@ class ChangePassword(View):
|
|||
confirm_password = request.POST.get('confirm-password')
|
||||
|
||||
if new_password != confirm_password:
|
||||
return redirect('/edit-profile')
|
||||
return redirect('preferences/password')
|
||||
|
||||
request.user.set_password(new_password)
|
||||
request.user.save()
|
||||
login(request, request.user)
|
||||
return redirect('/user/%s' % request.user.localname)
|
||||
return redirect(request.user.local_path)
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
''' '''
|
||||
''' serialize user's posts in rss feed '''
|
||||
|
||||
from django.contrib.syndication.views import Feed
|
||||
from django.urls import reverse
|
||||
from bookwyrm.models.user import User
|
||||
from .helpers import get_activity_feed, get_user_from_username
|
||||
|
||||
# pylint: disable=no-self-use, unused-argument
|
||||
class RssFeed(Feed):
|
||||
|
||||
description_template = "snippets/rss_content.html"
|
||||
title_template = "snippets/rss_title.html"
|
||||
''' serialize user's posts in rss feed '''
|
||||
description_template = 'snippets/rss_content.html'
|
||||
title_template = 'snippets/rss_title.html'
|
||||
|
||||
def get_object(self, request, username):
|
||||
''' the user who's posts get serialized '''
|
||||
return get_user_from_username(username)
|
||||
|
||||
|
||||
def link(self, obj):
|
||||
''' link to the user's profile '''
|
||||
return obj.local_path
|
||||
|
||||
|
||||
def title(self, obj):
|
||||
return f"Status updates from {obj.display_name}"
|
||||
''' title of the rss feed entry '''
|
||||
return f'Status updates from {obj.display_name}'
|
||||
|
||||
|
||||
def items(self, obj):
|
||||
return get_activity_feed(obj, ['public', 'unlisted'], queryset=obj.status_set)
|
||||
''' the user's activity feed '''
|
||||
return get_activity_feed(
|
||||
obj, ['public', 'unlisted'], queryset=obj.status_set)
|
||||
|
||||
|
||||
|
||||
def item_link(self, item):
|
||||
''' link to the status '''
|
||||
return item.local_path
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ class EditUser(View):
|
|||
'form': forms.EditUserForm(instance=request.user),
|
||||
'user': request.user,
|
||||
}
|
||||
return TemplateResponse(request, 'settings/edit_user.html', data)
|
||||
return TemplateResponse(request, 'preferences/edit_user.html', data)
|
||||
|
||||
def post(self, request):
|
||||
''' les get fancy with images '''
|
||||
|
@ -161,7 +161,7 @@ class EditUser(View):
|
|||
request.POST, request.FILES, instance=request.user)
|
||||
if not form.is_valid():
|
||||
data = {'form': form, 'user': request.user}
|
||||
return TemplateResponse(request, 'settings/edit_user.html', data)
|
||||
return TemplateResponse(request, 'preferences/edit_user.html', data)
|
||||
|
||||
user = form.save(commit=False)
|
||||
|
||||
|
|
Loading…
Reference in a new issue