diff --git a/gittip/models/participant.py b/gittip/models/participant.py index 625dd3145f..66ace60ab5 100644 --- a/gittip/models/participant.py +++ b/gittip/models/participant.py @@ -304,6 +304,21 @@ def get_age_in_seconds(self): out = (now - self.claimed_time).total_seconds() return out + def get_teams(self): + """Return a list of teams this user is a member of. + """ + return list(gittip.db.fetchall(""" + + SELECT team AS name + , ( SELECT count(*) + FROM current_memberships + WHERE team=team + ) AS nmembers + FROM current_memberships + WHERE member=%s; + + """, (self.username,))) + # Participant as Team # =================== diff --git a/scss/modules.scss b/scss/modules.scss index 9f9603ffc1..8a29cc4745 100644 --- a/scss/modules.scss +++ b/scss/modules.scss @@ -149,8 +149,8 @@ a.mini-user:hover { } } -UL.community-memberships { - margin: 1em 0; +UL.memberships { + margin: 0 0 2em; padding: 0; float: left; width: 100%; diff --git a/templates/profile-edit.html b/templates/profile-edit.html index ef0db7497e..e184bd18fa 100644 --- a/templates/profile-edit.html +++ b/templates/profile-edit.html @@ -55,10 +55,12 @@

Statement - + + {% include "team-listing.html" %} +

Communities

- + Join Communities
diff --git a/templates/team-listing.html b/templates/team-listing.html new file mode 100644 index 0000000000..00855867f3 --- /dev/null +++ b/templates/team-listing.html @@ -0,0 +1,13 @@ +{% set teams = participant.get_teams() %} +{% if teams %} +

Teams

+ +{% end %} diff --git a/www/%username/index.html b/www/%username/index.html index 3f67cd0b0d..54512e3403 100644 --- a/www/%username/index.html +++ b/www/%username/index.html @@ -74,9 +74,11 @@

Statement

{% else %}
{% end %} + {% include "templates/team-listing.html" %} + {% if communities %}

Communities

-