Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Clean up ~user nav/subnav
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Aug 22, 2015
1 parent 846d85e commit c81a15d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 4 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ <h1><a href="/"><img src="{{ website.asset('gratipay.svg') }}"
{% else %}
<ul class="nav you-are">
<li>
<a href="/"{% if request.path.raw == '/' or request.path.raw.split('/')[1] == user.participant.username %} class="selected"{% endif %}>
{% set parts = request.path.raw.split('/') %}
{% set on_profile = parts[1] == '~' %}
{% set on_own_profile = on_profile and parts[2] == user.participant.username %}
<a href="/~{{user.participant.username}}/"{% if on_own_profile %} class="selected"{% endif %}>
{{ user.participant.username }}
<div class="quick-stats">
<span class="my-total-giving">{{ format_currency(user.participant.get_giving_for_profile()[1], "USD") }}</span>/{{ _("wk") }}
Expand Down
12 changes: 5 additions & 7 deletions templates/profile-subnav.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% set current_page = '/' if request.path.raw == '/' else '/~' + request.path.raw[3:] %}
{% set show_members = participant.show_as_team(user) %}
{% set show_dashboard = (user.participant == participant) %}
{% set show_receiving = (user.participant == participant or not participant.anonymous_receiving) %}
{% set show_profile = show_members or show_receiving %}
{% set u = participant.username %}
{% set pages = [ ('/', _('Dashboard'), True, False)
, ('/~'+u+'/', _('Profile'), True, show_profile)
, ('/~'+u+'/giving/', _('Giving'), True, False)
, ('/~'+u+'/history/', _('History'), True, False)
, ('/~'+u+'/settings/', _('Settings'), True, False)
, ('/~'+u+'/events/', _('Events'), False, False)
{% set pages = [ ('/~'+u+'/', _('Profile'), True, show_profile)
, ('/~'+u+'/giving/', _('Giving'), True, False)
, ('/~'+u+'/history/', _('History'), True, False)
, ('/~'+u+'/settings/', _('Settings'), True, False)
, ('/~'+u+'/events/', _('Events'), False, False)
] %}
{% set pages = filter_profile_subnav(user, participant, pages) %}
{% if pages %}
Expand Down

0 comments on commit c81a15d

Please sign in to comment.