Merge pull request #209 from odoo-dev/master-forum-users-row-mat

[FIX] website_forum: display the users as a table in block of 3 cols
This commit is contained in:
Martin Trigaux 2014-05-26 14:26:18 +02:00
commit ba4ce723fd
2 changed files with 7 additions and 7 deletions

View File

@ -449,7 +449,10 @@ class WebsiteForum(http.Controller):
pager = request.website.pager(url="/forum/%s/users" % slug(forum), total=tag_count, page=page, step=step, scope=30)
obj_ids = User.search(cr, SUPERUSER_ID, [('karma', '>', 1)], limit=step, offset=pager['offset'], order='karma DESC', context=context)
users = User.browse(cr, SUPERUSER_ID, obj_ids, context=context)
# put the users in block of 3 to display them as a table
users = [[] for i in range(len(obj_ids)/3+1)]
for index, user in enumerate(User.browse(cr, SUPERUSER_ID, obj_ids, context=context)):
users[index/3].append(user)
searches['users'] = 'True'
values = self._prepare_forum_values(forum=forum, searches=searches)

View File

@ -725,11 +725,8 @@
<template id="users">
<t t-call="website_forum.header">
<t t-foreach="users" t-as="user">
<t t-if="user_index % 3 == 0">
<div class="row"></div>
</t>
<div class="col-sm-4">
<div t-foreach="users" t-as="row_users" class="row mt16">
<div t-foreach="row_users" t-as="user" class="col-sm-4">
<img class="pull-left img img-circle img-avatar" t-attf-src="/forum/user/#{user.id}/avatar"/>
<div>
<a t-attf-href="/forum/#{slug(forum)}/user/#{user.id}" t-field="user.name"/>
@ -750,7 +747,7 @@
<t t-raw="0"/>
</div>
</div>
</t>
</div>
<div class="pull-left">
<t t-call="website.pager"/>
</div>