[IMP] website_[profile|forum]: show filtering forum on user profile page

- A tag has been added next to the title of each tab in the profile when the user come from a specific forum. The goal is to indicate to the user that the displayed content is specific to a given forum. The tag can be clicked by the user to remove the applied filter.
- Change label in edit profile page from "real name" to "name"
Task Id: 2214425

closes odoo/odoo#48665

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Sébastien Mottet (oms)
2020-04-08 07:21:48 +00:00
parent dbb0222d63
commit e3b5b20b39
3 changed files with 28 additions and 5 deletions
+4 -1
View File
@@ -555,7 +555,10 @@ class WebsiteForum(WebsiteProfile):
forums = post['forum']
elif post.get('forum_id'):
forums = request.env['forum.forum'].browse(int(post['forum_id']))
values.update({'edit_button_url_param': 'forum_id=' + str(post['forum_id'])})
values.update({
'edit_button_url_param': 'forum_id=%s' % str(post['forum_id']),
'forum_filtered': forums.name,
})
else:
forums = request.env['forum.forum'].search([])
@@ -56,7 +56,10 @@
<t t-if="forum">
<div role="tabpanel" class="o_wforum_profile_tab tab-pane" id="questions">
<div class="mb32">
<h5 class="border-bottom pb-1">Questions</h5>
<h5 class="border-bottom pb-1">
Questions
<t t-call="website_forum.forum_filter_tag"/>
</h5>
<t t-if="questions">
<div class="mb4" t-foreach="questions" t-as="question">
<t t-call="website_forum.display_post"/>
@@ -87,7 +90,11 @@
</div>
<div role="tabpanel" class="o_wforum_profile_tab tab-pane" id="answers">
<div class="mb32">
<h5 class="border-bottom pb-1">Answers</h5>
<h5 class="border-bottom pb-1">
Answers
<t t-call="website_forum.forum_filter_tag"/>
</h5>
<t t-if="answers">
<div t-foreach="answers" t-as="answer">
<t t-call="website_forum.display_post_answer"/>
@@ -106,7 +113,10 @@
</div>
<div role="tabpanel" class="o_wforum_profile_tab tab-pane" id="activity" t-if="uid == user.id">
<div class="mb32">
<h5 class="border-bottom pb-1">Activities</h5>
<h5 class="border-bottom pb-1">
Activities
<t t-call="website_forum.forum_filter_tag"/>
</h5>
<t t-call="website_forum.display_activities"/>
</div>
</div>
@@ -114,6 +124,16 @@
</xpath>
</template>
<template id="forum_filter_tag" name="Filtering Forum Tag">
<t t-if="forum_filtered">
<span class="align-items-baseline border d-inline-flex pl-2 rounded mb-1 ml-4">
<i class="fa fa-filter mr-2 text-muted"/>
<t t-esc="forum_filtered"/>
<a t-attf-href="/profile/user/#{uid}" class="btn border-0 py-1">&#215;</a>
</span>
</t>
</template>
<template id="display_activities" name="Forum Profile Activities">
<t t-if="activities">
<div t-foreach="activities" t-as="activity" class="card mb-2">
@@ -126,7 +126,7 @@
<div class="row">
<input name="user_id" t-att-value="user.id" type="hidden"/>
<div class="form-group col-12">
<label class="text-primary mb-1 d-block" for="user_name"><span class="font-weight-bold">Real name</span></label>
<label class="text-primary mb-1 d-block" for="user_name"><span class="font-weight-bold">Name</span></label>
<div>
<input type="text" class="form-control" name="name" id="user_name" required="True" t-attf-value="#{user.name}"/>
</div>