[IMP] design forum

bzr revid: fp@tinyerp.com-20140308162524-1jc03priitz3p1mm
This commit is contained in:
Fabien Pinckaers 2014-03-08 17:25:24 +01:00
parent 277e62dfc5
commit f3616cb63a
2 changed files with 20 additions and 15 deletions

View File

@ -188,9 +188,6 @@ class Users(osv.Model):
}
return result
_columns = {
# Field to remove
'tags': fields.many2many('website.forum.tag', 'forum_tag_rel', 'forum_id', 'forum_tag_id', 'Tag'),
'create_date': fields.datetime('Create Date', select=True, readonly=True),
'karma': fields.integer('Karma'), # Use Gamification for this
'forum': fields.boolean('Is Forum Member'),
@ -201,7 +198,8 @@ class Users(osv.Model):
'bronze_badge':fields.function(_get_user_badge_level, string="Number of bronze badges", type='integer', multi='badge_level'),
}
_defaults = {
'forum': False
'forum': False,
'karma': 0
}
class PostHistory(osv.Model):
@ -243,11 +241,14 @@ class Badge(osv.Model):
'level': 'bronze'
}
# TODO:
# remove this object and replace by mail.message of type notes on related post
# type = message types
class ForumActivity(osv.Model):
_name = "website.forum.activity"
_description = "Activity"
_order = "id desc"
_columns = {
'name': fields.char('Name', size=64),
'post_id': fields.many2one('website.forum.post', 'Post'),
@ -263,6 +264,7 @@ class ForumActivity(osv.Model):
('voted_question', 'voted question'), ('voted_answer', 'voted answer'),
('received_badge', 'received badge'),
], 'Activity Type'),
# merge these 2 fields into one: karma: fields.integer (that can be positive or negative)
'karma_add': fields.integer('Added Karma'),
'karma_sub': fields.integer('Karma Removed')
}

View File

@ -690,7 +690,7 @@
<div t-foreach="users" t-as="user" class="col-sm-4">
<t t-set="separator"><br/></t>
<t t-call="website_forum.user_detail"/>
<span class="text-muted">Joined on <span t-field="user.create_date"/></span>
<span class="text-muted">Joined on <span t-field="user.create_date" t-field-options='{"format":"short"}'/></span>
</div>
</div>
<div class="pull-left">
@ -715,10 +715,10 @@
<tr>
<td rowspan="2" valign="top"><span class="text-muted">contributions</span></td>
<td>member since</td>
<td><span t-field="user.create_date" t-field-options='{"format": "MMMM d, YYYY"}'/></td>
<td><span t-field="user.create_date" t-field-options='{"format": "short"}'/></td>
</tr><tr>
<td>last connection</td>
<td><span t-field="user.login_date" t-field-options='{"format": "long"}'/></td>
<td><span t-field="user.login_date" t-field-options='{"format": "short"}'/></td>
</tr>
</table>
</div><div class="col-sm-5">
@ -812,14 +812,17 @@
</template>
<template id="user_badges">
<div class="col-sm-3 mt16" t-foreach="user.badges" t-as="badge">
<a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge.badge_id) }" class="badge">
<span t-field="badge.badge_id.name" />
</a>
<span>
X <t t-esc="len(badge.badge_id.owner_ids)"/>
</span>
<div class="row mb32">
<div class="col-sm-3 mt16" t-foreach="user.badges" t-as="badge">
<a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge.badge_id) }" class="badge">
<span t-field="badge.badge_id.name" />
</a>
<span>
X <t t-esc="len(badge.badge_id.owner_ids)"/>
</span>
</div>
</div>
<b t-if="not user.badges" class="mb32">No badge yet!</b>
</template>
</data>