summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorSébastien Mottet (oms) <oms@odoo.com>2020-03-31 09:47:27 +0000
committerSébastien Mottet (oms) <oms@odoo.com>2020-04-08 07:21:48 +0000
commite3b5b20b39ddd6faefb8edada3b0c42d769376c7 (patch)
tree111779bdcf607ad98e2b23fefd7d3f1d5c0bdde0 /addons
parentdbb0222d63401fe1ab4fef17f318a137114b4d3c (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/website_forum/controllers/main.py5
-rw-r--r--addons/website_forum/views/website_forum_profile.xml26
-rw-r--r--addons/website_profile/views/website_profile.xml2
3 files changed, 28 insertions, 5 deletions
diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py
index a07de8ae4e7..dfac6dc75a9 100644
--- a/addons/website_forum/controllers/main.py
+++ b/addons/website_forum/controllers/main.py
@@ -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([])
diff --git a/addons/website_forum/views/website_forum_profile.xml b/addons/website_forum/views/website_forum_profile.xml
index 541aadf4a29..5ac4de54d05 100644
--- a/addons/website_forum/views/website_forum_profile.xml
+++ b/addons/website_forum/views/website_forum_profile.xml
@@ -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">
diff --git a/addons/website_profile/views/website_profile.xml b/addons/website_profile/views/website_profile.xml
index 1849d3f6257..37b5359e032 100644
--- a/addons/website_profile/views/website_profile.xml
+++ b/addons/website_profile/views/website_profile.xml
@@ -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>