summaryrefslogtreecommitdiff
path: root/addons/website_profile/views/website_profile.xml
diff options
context:
space:
mode:
authorPatrick Hoste <pko@odoo.com>2019-06-27 07:54:04 +0000
committerThibault Delavallée <tde@odoo.com>2019-11-05 15:08:34 +0000
commitbfbc7c6a184b2b507b1bf4ad778430bc2f3a0e7f (patch)
tree76cc91bd7b3b2011c7930e084ed77cc12dcac980 /addons/website_profile/views/website_profile.xml
parentc27ba2af1c640d91c6d7605412228687cc99cbd0 (diff)
[IMP] gamification: track karma change on users
PURPOSE Allow karma gain tracking enabling notably display of top users based on weekly / monthly gain in website profile. SPECIFCIATIONS Each time a user gains karma a record is created in the gamification karma tracking model. Scheduled activity runs to consolidate the records into monthly gain records to avoid having crowdy table and unnecessary noise in karma gain. This model is made private and only accessible through some dedicated compute methods / controllers used in website profile. In website profile module buttons are added to see users ranking based on their total karma (like before) but also by last week and last month gains (using the newly introduced tracking model). LINKS Task ID 2003505 PR #34594
Diffstat (limited to 'addons/website_profile/views/website_profile.xml')
-rw-r--r--addons/website_profile/views/website_profile.xml24
1 files changed, 23 insertions, 1 deletions
diff --git a/addons/website_profile/views/website_profile.xml b/addons/website_profile/views/website_profile.xml
index 629119b98d0..9a8dacb8e2a 100644
--- a/addons/website_profile/views/website_profile.xml
+++ b/addons/website_profile/views/website_profile.xml
@@ -481,7 +481,15 @@
<div class="o_wprofile_all_users_header o_wprofile_gradient mb-n5 pb-5">
<t t-call="website_profile.user_profile_sub_nav"/>
<div class="container">
- <h1 class="py-4 text-white">All Users</h1>
+ <h1 class="py-4 text-white d-inline-block">All Users</h1>
+ <div class="form-inline py-4 float-right">
+ <strong class="form-group text-white mr-2">Rank by :</strong>
+ <div class="form-group btn-group">
+ <button type="button" t-attf-class="btn btn-secondary #{ 'active' if group_by == 'week' else ''}" onclick="location.href='/profile/users?group_by=week'">This week</button>
+ <button type="button" t-attf-class="btn btn-secondary #{ 'active' if group_by == 'month' else ''}" onclick="location.href='/profile/users?group_by=month'">This month</button>
+ <button type="button" t-attf-class="btn btn-secondary #{ 'active' if group_by == 'all' else ''}" onclick="location.href='/profile/users'">All time</button>
+ </div>
+ </div>
</div>
</div>
</template>
@@ -519,6 +527,9 @@
<h3 class="mt-2 mb-0" t-esc="user['name']"></h3>
<span class="badge badge-danger font-weight-normal px-2" t-if="not user['website_published']">Unpublished</span>
<strong class="text-muted" t-esc="user['rank']"/>
+ <div class="h3 my-2" t-if="user['karma_gain']">
+ <span class="badge badge-pill badge-success px-3 py-2" >+ <t t-esc="user['karma_gain']"/> XP</span>
+ </div>
</div>
<div class="row mx-0 o_wprofile_top3_card_footer text-nowrap">
<div class="col py-3"><b t-esc="user['karma']"/> <span class="text-muted">XP</span></div>
@@ -538,6 +549,17 @@
<span class="font-weight-bold" t-esc="user['name']"/><br/>
<span class="text-muted font-weight-bold" t-esc="user['rank']"></span>
</td>
+ <td class="align-middle text-nowrap">
+ <t t-if="user['karma_gain']">
+ <span class="badge badge-pill badge-success d-inline">+ <t t-esc="user['karma_gain']"/> XP</span>
+ <span class="text-muted pl-2 pr-3">
+ <t t-if="group_by == 'week'">Weekly </t>
+ <t t-elif="group_by == 'month'">Monthly </t>
+ <t t-else="">All time </t>
+ gain
+ </span>
+ </t>
+ </td>
<td t-if="not user['website_published']" class="align-middle font-weight-bold text-right text-nowrap">
<span class="badge badge-danger font-weight-normal px-2 py-1 m-1">Unpublished</span>
</td>