summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaakov M. Nemoy <loupgaroublond@gmail.com>2008-07-23 13:51:02 (GMT)
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2008-07-23 13:51:02 (GMT)
commitdc5ec07b95bac71bbcd72e143149a41ae64f2642 (patch)
tree8e9aab0c47dea81bf17f43923cac7d24b5ac2646
parentdb241eb520c5b06d7fd83b7ed1f13f7e2a1c4e81 (diff)
downloadfas-dc5ec07b95bac71bbcd72e143149a41ae64f2642.zip
fas-dc5ec07b95bac71bbcd72e143149a41ae64f2642.tar.gz
fas-dc5ec07b95bac71bbcd72e143149a41ae64f2642.tar.xz
Adds filtering of group member lists on type of member.
This patch is probably not the 100% cleanest implementation or interface, but the core is there.
-rw-r--r--fas/group.py9
-rw-r--r--fas/templates/group/members.html1
-rw-r--r--fas/templates/search-box.html7
3 files changed, 15 insertions, 2 deletions
diff --git a/fas/group.py b/fas/group.py
index 04e5c50..b82f894 100644
--- a/fas/group.py
+++ b/fas/group.py
@@ -154,7 +154,8 @@ class Group(controllers.Controller):
@validate(validators=GroupMembers())
@error_handler(error) # pylint: disable-msg=E0602
@expose(template="fas.templates.group.members", allow_json=True)
- def members(self, groupname, search=u'a*', order_by='username'):
+ def members(self, groupname, search=u'a*', role_type=None,
+ order_by='username'):
'''View group'''
sort_map = { 'username': 'people_1.username',
'creation': 'person_roles_creation',
@@ -183,6 +184,8 @@ class Group(controllers.Controller):
).join('sponsor', aliased=True).filter(
Groups.name==groupname,
).order_by(sort_map[order_by])
+ if role_type:
+ members = members.filter(PersonRoles.role_type==role_type)
group.json_props = {'PersonRoles': ['member']}
return dict(group=group, members=members, search=search)
@@ -582,7 +585,7 @@ into the e-mail aliases within an hour.
@expose(template="genshi-text:fas.templates.group.dump", format="text",
content_type='text/plain; charset=utf-8')
@expose(allow_json=True)
- def dump(self, groupname=None):
+ def dump(self, groupname=None, role_type=None):
sponsorTables = PeopleTable.join(PersonRolesTable,
People.id==PersonRoles.sponsor_id)
if not groupname:
@@ -604,6 +607,8 @@ into the e-mail aliases within an hour.
PersonRoles.group).add_column(
PersonRoles.role_type).filter(
Groups.name==groupname).order_by('username')
+ if role_type:
+ people = people.filter(PersonRoles.c.role_type==role_type)
# retrieve sponsorship info:
sponsorCount = select(
diff --git a/fas/templates/group/members.html b/fas/templates/group/members.html
index 8b2906d..417b367 100644
--- a/fas/templates/group/members.html
+++ b/fas/templates/group/members.html
@@ -39,6 +39,7 @@
<span py:if='me.fedoraRoleStatus == "approved"'>${form(action='modifyGroup', value=value, method='get')}</span>
-->
<h3><a href="${tg.url('/group/view/%s' % group.name)}">${_('Group Details')}</a></h3>
+ ${types('/group/members/%s/%s' % (group.name, search), ['administrator', 'sponsor', 'user'])}
${search_box('/group/members/%s' % group.name)}
<h3>${_('Members')}</h3>
${member_table(members, group, person)}
diff --git a/fas/templates/search-box.html b/fas/templates/search-box.html
index 6e09ef5..71e8dd8 100644
--- a/fas/templates/search-box.html
+++ b/fas/templates/search-box.html
@@ -17,4 +17,11 @@
<li><a href="${tg.url('%s/*' % url_fragment)}">${_('All')}</a></li>
</ul>
</div>
+ <div py:def="types(url_fragment, types)">
+ <h3>${_('Types')}</h3>
+ <ul class="letters">
+ <li py:for="type in types"><a href="${tg.url('%s/%s' % (url_fragment, type))}">${type}</a></li>
+ <li><a href="${tg.url('%s' % url_fragment)}">${_('All')}</a></li>
+ </ul>
+ </div>
</html>