[MERGE] website_slides: apply various fixes
This merge applies various fixes to website_slides (eLearning). Linked to task 1978530 closes odoo/odoo#33559 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -1,27 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import hashlib
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from werkzeug import urls
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class Users(models.Model):
|
||||
_inherit = 'res.users'
|
||||
|
||||
def __init__(self, pool, cr):
|
||||
init_res = super(Users, self).__init__(pool, cr)
|
||||
type(self).SELF_WRITEABLE_FIELDS = list(
|
||||
set(
|
||||
self.SELF_WRITEABLE_FIELDS +
|
||||
['country_id', 'city', 'website', 'website_description', 'website_published']))
|
||||
type(self).SELF_READABLE_FIELDS = type(self).SELF_READABLE_FIELDS + ['karma']
|
||||
return init_res
|
||||
|
||||
create_date = fields.Datetime('Create Date', readonly=True, index=True)
|
||||
forum_waiting_posts_count = fields.Integer('Waiting post', compute="_get_user_waiting_post")
|
||||
|
||||
|
||||
@@ -204,6 +204,7 @@ class WebsiteProfile(http.Controller):
|
||||
'rank': user.rank_id.name,
|
||||
'karma': user.karma,
|
||||
'badge_count': len(user.badge_ids),
|
||||
'website_published': user.website_published
|
||||
}
|
||||
|
||||
@http.route(['/profile/users',
|
||||
|
||||
@@ -14,6 +14,15 @@ VALIDATION_KARMA_GAIN = 3
|
||||
class Users(models.Model):
|
||||
_inherit = 'res.users'
|
||||
|
||||
def __init__(self, pool, cr):
|
||||
init_res = super(Users, self).__init__(pool, cr)
|
||||
type(self).SELF_WRITEABLE_FIELDS = list(
|
||||
set(
|
||||
self.SELF_WRITEABLE_FIELDS +
|
||||
['country_id', 'city', 'website', 'website_description', 'website_published']))
|
||||
type(self).SELF_READABLE_FIELDS = type(self).SELF_READABLE_FIELDS + ['karma']
|
||||
return init_res
|
||||
|
||||
@api.model
|
||||
def _generate_profile_token(self, user_id, email):
|
||||
"""Return a token for email validation. This token is valid for the day
|
||||
|
||||
@@ -497,6 +497,7 @@
|
||||
<img class="position-absolute" t-attf-src="/website_profile/static/src/img/rank_#{user['position']}.svg" alt="User rank" style="bottom: 0; right: -10px"/>
|
||||
</div>
|
||||
<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>
|
||||
<div class="row mx-0 o_wprofile_top3_card_footer text-nowrap">
|
||||
@@ -516,6 +517,9 @@
|
||||
<td class="align-middle w-md-75">
|
||||
<span class="font-weight-bold" t-esc="user['name']"/><br/>
|
||||
<span class="text-muted font-weight-bold" t-esc="user['rank']"></span>
|
||||
</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>
|
||||
<td class="align-middle font-weight-bold text-right text-nowrap">
|
||||
<b t-esc="user['karma']"/> <span class="text-muted small font-weight-bold">XP</span>
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
<i class="fa fa-home"/> Course
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li t-if="channel.allow_comment" class="nav-item">
|
||||
<a class="nav-link" id="review-tab" data-toggle="pill" href="#review" role="tab" aria-controls="review" aria-selected="false">Review</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -176,7 +176,7 @@
|
||||
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
|
||||
<t t-if="channel.channel_type == 'training'" t-call="website_slides.course_slides_list"/>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="review" role="tabpanel" aria-labelledby="review-tab">
|
||||
<div t-if="channel.allow_comment" class="tab-pane fade" id="review" role="tabpanel" aria-labelledby="review-tab">
|
||||
<t t-call="portal.message_thread">
|
||||
<t t-set="object" t-value="channel"/>
|
||||
<t t-set="hash" t-value="message_post_hash"/>
|
||||
@@ -336,8 +336,7 @@
|
||||
<i class="fa fa-bars"/>
|
||||
</div>
|
||||
<span t-if="category_id" t-att-class="'text-muted' if not channel.can_upload else ''" t-esc="category['name']"/>
|
||||
<em t-elif="channel.can_publish" class="text-muted mb-1">Uncategorized</em>
|
||||
<small t-if="not category['total_slides']" class="ml-1 text-muted"><b>(empty)</b></small>
|
||||
<small t-if="not category['total_slides'] and category_id" class="ml-1 text-muted"><b>(empty)</b></small>
|
||||
</div>
|
||||
<div t-if="category_id" class="o_text_link d-flex border-left">
|
||||
<a t-if="channel.can_upload"
|
||||
|
||||
Reference in New Issue
Block a user