Browse Source

Add sidebar to all user pages

merge-requests/8/head
Ivan Fonseca 8 years ago
parent
commit
2486d6f31a
No known key found for this signature in database GPG Key ID: 95A9C856EC788689
  1. 8
      tildes/tildes/templates/invite.jinja2
  2. 67
      tildes/tildes/templates/macros/user_menu.jinja2
  3. 7
      tildes/tildes/templates/messages.jinja2
  4. 4
      tildes/tildes/templates/messages_sent.jinja2
  5. 4
      tildes/tildes/templates/messages_unread.jinja2
  6. 4
      tildes/tildes/templates/notifications.jinja2
  7. 7
      tildes/tildes/templates/notifications_unread.jinja2
  8. 8
      tildes/tildes/templates/settings.jinja2
  9. 36
      tildes/tildes/templates/user.jinja2

8
tildes/tildes/templates/invite.jinja2

@ -1,4 +1,6 @@
{% extends 'base_no_sidebar.jinja2' %}
{% extends 'base.jinja2' %}
{% from 'macros/user_menu.jinja2' import render_user_menu with context %}
{% block title %}Invite someone{% endblock %}
@ -37,3 +39,7 @@
<p>You don't currently have any invite codes available.</p>
{% endif %}
{% endblock %}
{% block sidebar %}
{{ render_user_menu('misc_invite') }}
{% endblock %}

67
tildes/tildes/templates/macros/user_menu.jinja2

@ -0,0 +1,67 @@
{% macro render_user_menu(current_page) %}
<h2>User menu</h2>
<ul class="nav">
<li>Profile</li>
<ul class="nav">
<li class="nav-item"><a href="/user/{{ request.user }}">
{% if(current_page == 'profile_activity') %}<u>{% endif %}
Recent activity
{% if(current_page == 'profile_activity') %}</u>{% endif %}
</a></li>
</ul>
<li>Notifications</li>
<ul class="nav">
{% if request.user.num_unread_notifications > 0 %}
<li class="nav-item"><strong><a href="/notifications/unread">
{% if(current_page == 'notifications_unread') %}<u>{% endif %}
Unread ({{ request.user.num_unread_notifications }})
{% if(current_page == 'notifications_unread') %}</u>{% endif %}
</a></strong></li>
{% endif %}
<li class="nav-item"><a href="/notifications">
{% if(current_page == 'notifications_prev') %}<u>{% endif %}
Previously read
{% if(current_page == 'notifications_prev') %}</u>{% endif %}
</a></li>
</ul>
<li>Messages</li>
<ul class="nav">
{% if request.user.num_unread_messages > 0 %}
<li class="nav-item"><strong><a href="/messages/unread">
{% if(current_page == 'messages_unread') %}<u>{% endif %}
Unread ({{ request.user.num_unread_messages }})
{% if(current_page == 'messages_unread') %}</u>{% endif %}
</a></strong></li>
{% endif %}
<li class="nav-item"><a href="/messages">
{% if(current_page == 'messages_inbox') %}<u>{% endif %}
Inbox
{% if(current_page == 'messages_inbox') %}</u>{% endif %}
</a></li>
<li class="nav-item"><a href="/messages/sent">
{% if(current_page == 'messages_sent') %}<u>{% endif %}
Sent messages
{% if(current_page == 'messages_sent') %}</u>{% endif %}
</a></li>
</ul>
<li>Misc</li>
<ul class="nav">
{% if request.user.invite_codes_remaining or num_active_invite_codes|default(0) %}
<li class="nav-item"><strong><a href="/invite">
{% if(current_page == 'misc_invite') %}<u>{% endif %}
Invite someone ({{ request.user.invite_codes_remaining + num_active_invite_codes|default(0) }})
{% if(current_page == 'misc_invite') %}</u>{% endif %}
</a></strong></li>
{% endif %}
<li class="nav-item"><a href="/settings">
{% if(current_page == 'misc_settings') %}<u>{% endif %}
Settings
{% if(current_page == 'misc_settings') %}</u>{% endif %}
</a></li>
<li class="nav-item"><a href="/logout">Log out</a></li>
</ul>
</ul>
{% endmacro %}

7
tildes/tildes/templates/messages.jinja2

@ -1,7 +1,8 @@
{% extends 'base_no_sidebar.jinja2' %}
{% extends 'base.jinja2' %}
{% from 'macros/datetime.jinja2' import time_ago_responsive %}
{% from 'macros/links.jinja2' import username_linked %}
{% from 'macros/user_menu.jinja2' import render_user_menu with context %}
{% block title %}Message Inbox{% endblock %}
@ -34,3 +35,7 @@
{% endfor %}
</table>
{% endblock %}
{% block sidebar %}
{{ render_user_menu('messages_inbox') }}
{% endblock %}

4
tildes/tildes/templates/messages_sent.jinja2

@ -3,3 +3,7 @@
{% block title %}Sent Messages{% endblock %}
{% block main_heading %}Sent Messages{% endblock %}
{% block sidebar %}
{{ render_user_menu('messages_sent') }}
{% endblock %}

4
tildes/tildes/templates/messages_unread.jinja2

@ -3,3 +3,7 @@
{% block title %}Unread Messages{% endblock %}
{% block main_heading %}Unread Messages{% endblock %}
{% block sidebar %}
{{ render_user_menu('messages_unread') }}
{% endblock %}

4
tildes/tildes/templates/notifications.jinja2

@ -8,3 +8,7 @@
<p class="text-italic text-small text-secondary">This page shows your most recent, previously read notifications (up to a max of 100, pagination coming soon)</p>
{{ super() }}
{% endblock %}
{% block sidebar %}
{{ render_user_menu('notifications_prev') }}
{% endblock %}

7
tildes/tildes/templates/notifications_unread.jinja2

@ -1,7 +1,8 @@
{% extends 'base_no_sidebar.jinja2' %}
{% extends 'base.jinja2' %}
{% from 'macros/comments.jinja2' import comment_tag_options_template, render_single_comment with context %}
{% from 'macros/links.jinja2' import group_linked %}
{% from 'macros/user_menu.jinja2' import render_user_menu with context %}
{% block title %}Unread notifications{% endblock %}
@ -39,3 +40,7 @@
{{ comment_tag_options_template(comment_tag_options) }}
{% endblock %}
{% block sidebar %}
{{ render_user_menu('notifications_unread') }}
{% endblock %}

8
tildes/tildes/templates/settings.jinja2

@ -1,4 +1,6 @@
{% extends 'base_no_sidebar.jinja2' %}
{% extends 'base.jinja2' %}
{% from 'macros/user_menu.jinja2' import render_user_menu with context %}
{% block title %}User settings{% endblock %}
@ -51,3 +53,7 @@
<div class="text-small text-secondary">Define a list of topic tags to filter out of listings by default</div>
</ul>
{% endblock %}
{% block sidebar %}
{{ render_user_menu('misc_settings') }}
{% endblock %}

36
tildes/tildes/templates/user.jinja2

@ -3,6 +3,7 @@
{% from 'macros/comments.jinja2' import render_single_comment with context %}
{% from 'macros/links.jinja2' import group_linked, username_linked %}
{% from 'macros/topics.jinja2' import render_topic_for_listing with context %}
{% from 'macros/user_menu.jinja2' import render_user_menu with context %}
{% block title %}User: {{ user.username }}{% endblock %}
@ -37,40 +38,7 @@
{% block sidebar %}
{% if user == request.user %}
<h2>User menu</h2>
<ul class="nav">
<li>Notifications</li>
<ul class="nav">
{% if request.user.num_unread_notifications > 0 %}
<li class="nav-item"><strong><a href="/notifications/unread">
Unread ({{ request.user.num_unread_notifications }})
</a></strong></li>
{% endif %}
<li class="nav-item"><a href="/notifications">Previously read</a></li>
</ul>
<li>Messages</li>
<ul class="nav">
{% if request.user.num_unread_messages > 0 %}
<li class="nav-item"><strong><a href="/messages/unread">
Unread ({{ request.user.num_unread_messages }})
</a></strong></li>
{% endif %}
<li class="nav-item"><a href="/messages">Inbox</a></li>
<li class="nav-item"><a href="/messages/sent">Sent messages</a></li>
</ul>
<li>Misc</li>
<ul class="nav">
{% if request.user.invite_codes_remaining or num_active_invite_codes %}
<li class="nav-item"><strong><a href="/invite">
Invite someone ({{ request.user.invite_codes_remaining + num_active_invite_codes }})
</a></strong></li>
{% endif %}
<li class="nav-item"><a href="/settings">Settings</a></li>
<li class="nav-item"><a href="/logout">Log out</a></li>
</ul>
</ul>
{{ render_user_menu('profile_activity') }}
<hr>
{% endif %}

Loading…
Cancel
Save