diff --git a/tildes/scss/modules/_nav.scss b/tildes/scss/modules/_nav.scss index 2c552bd..415a09e 100644 --- a/tildes/scss/modules/_nav.scss +++ b/tildes/scss/modules/_nav.scss @@ -11,6 +11,11 @@ font-size: 0.8rem; font-weight: normal; border-bottom: 0; + + &.active a { + color: $blue; + text-decoration: underline; + } } } diff --git a/tildes/tildes/templates/base_user_menu.jinja2 b/tildes/tildes/templates/base_user_menu.jinja2 new file mode 100644 index 0000000..003be42 --- /dev/null +++ b/tildes/tildes/templates/base_user_menu.jinja2 @@ -0,0 +1,7 @@ +{% extends 'base.jinja2' %} + +{% from 'macros/user_menu.jinja2' import render_user_menu with context %} + +{% block sidebar %} + {{ render_user_menu() }} +{% endblock %} diff --git a/tildes/tildes/templates/invite.jinja2 b/tildes/tildes/templates/invite.jinja2 index 7ae3d49..4689995 100644 --- a/tildes/tildes/templates/invite.jinja2 +++ b/tildes/tildes/templates/invite.jinja2 @@ -1,4 +1,4 @@ -{% extends 'base_no_sidebar.jinja2' %} +{% extends 'base_user_menu.jinja2' %} {% block title %}Invite someone{% endblock %} diff --git a/tildes/tildes/templates/macros/user_menu.jinja2 b/tildes/tildes/templates/macros/user_menu.jinja2 new file mode 100644 index 0000000..761a85a --- /dev/null +++ b/tildes/tildes/templates/macros/user_menu.jinja2 @@ -0,0 +1,69 @@ +{% macro render_user_menu() %} + {% set route = request.matched_route.name %} + +

User menu

+ +{% endmacro %} diff --git a/tildes/tildes/templates/messages.jinja2 b/tildes/tildes/templates/messages.jinja2 index d9df80b..8877a6d 100644 --- a/tildes/tildes/templates/messages.jinja2 +++ b/tildes/tildes/templates/messages.jinja2 @@ -1,4 +1,4 @@ -{% extends 'base_no_sidebar.jinja2' %} +{% extends 'base_user_menu.jinja2' %} {% from 'macros/datetime.jinja2' import time_ago_responsive %} {% from 'macros/links.jinja2' import username_linked %} diff --git a/tildes/tildes/templates/notifications_unread.jinja2 b/tildes/tildes/templates/notifications_unread.jinja2 index 7ae6a63..b580f1f 100644 --- a/tildes/tildes/templates/notifications_unread.jinja2 +++ b/tildes/tildes/templates/notifications_unread.jinja2 @@ -1,4 +1,4 @@ -{% extends 'base_no_sidebar.jinja2' %} +{% extends 'base_user_menu.jinja2' %} {% from 'macros/comments.jinja2' import comment_tag_options_template, render_single_comment with context %} {% from 'macros/links.jinja2' import group_linked %} diff --git a/tildes/tildes/templates/settings.jinja2 b/tildes/tildes/templates/settings.jinja2 index 49175a8..e8264f6 100644 --- a/tildes/tildes/templates/settings.jinja2 +++ b/tildes/tildes/templates/settings.jinja2 @@ -1,4 +1,4 @@ -{% extends 'base_no_sidebar.jinja2' %} +{% extends 'base_user_menu.jinja2' %} {% block title %}User settings{% endblock %} diff --git a/tildes/tildes/templates/user.jinja2 b/tildes/tildes/templates/user.jinja2 index 1bb53d6..1e3a1f1 100644 --- a/tildes/tildes/templates/user.jinja2 +++ b/tildes/tildes/templates/user.jinja2 @@ -1,4 +1,4 @@ -{% extends 'base.jinja2' %} +{% extends 'base_user_menu.jinja2' %} {% from 'macros/comments.jinja2' import render_single_comment with context %} {% from 'macros/links.jinja2' import group_linked, username_linked %} @@ -37,40 +37,7 @@ {% block sidebar %} {% if user == request.user %} -

User menu

- + {{ super() }}
{% endif %} diff --git a/tildes/tildes/views/user.py b/tildes/tildes/views/user.py index 7627861..3b3da0b 100644 --- a/tildes/tildes/views/user.py +++ b/tildes/tildes/views/user.py @@ -54,22 +54,9 @@ def get_user(request: Request) -> dict: ) merged_posts = merged_posts[:page_size] - # if the user is on their own page, check if they have active invite codes - num_active_invite_codes = None - if user == request.user: - num_active_invite_codes = ( - request.query(UserInviteCode) - .filter( - UserInviteCode.user_id == request.user.user_id, - UserInviteCode.invitee_id == None, # noqa - ) - .count() - ) - return { 'user': user, 'merged_posts': merged_posts, - 'num_active_invite_codes': num_active_invite_codes, }