[IMP] website_forum: improving forum header UX

Issue

	- Install Forums
	- Have at least 2 forums
	- Go in one of them
	- Go in a topic
	- Click the button "All Forums" to go back
	- You go back to the forum's app homepage

	This is bad for UX, I should have been redirected
	to the forum's topic list.

Cause

	This behavior is not handled by Odoo.

Solution

	Move All Forums in the navbar
	Creating a smart "back" button based on browser history.

OPW-2198011

closes odoo/odoo#46454

X-original-commit: 307e6cd5b44b8f619a35056557f72aae241943b3
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
This commit is contained in:
jvm-odoo
2020-02-27 13:51:53 +00:00
parent 4df7594d58
commit 12fa83bb44
3 changed files with 19 additions and 3 deletions
+2
View File
@@ -235,6 +235,8 @@ class WebsiteForum(WebsiteProfile):
'filters': filters,
'reversed': reversed,
})
if (request.httprequest.referrer or "").startswith(request.httprequest.url_root):
values['back_button_url'] = request.httprequest.referrer
return request.render("website_forum.post_description_full", values)
@http.route('/forum/<model("forum.forum"):forum>/question/<model("forum.post"):question>/toggle_favourite', type='json', auth="user", methods=['POST'], website=True)
@@ -393,6 +393,11 @@ msgstr ""
msgid "<i class=\"fa fa-chevron-left mr-1\"/>All Forums"
msgstr ""
#. module: website_forum
#: model_terms:ir.ui.view,arch_db:website_forum.forum_nav_header
msgid "<i class=\"fa fa-chevron-left mr-1\"/>Back"
msgstr ""
#. module: website_forum
#: model_terms:ir.ui.view,arch_db:website_forum.new_question
msgid "<i class=\"fa fa-chevron-left mr-2\"/>Back to All Topics"
@@ -890,6 +895,11 @@ msgstr ""
msgid "Avatar"
msgstr ""
#. module: website_forum
#: model_terms:ir.ui.view,arch_db:website_forum.forum_nav_header
msgid "Back"
msgstr ""
#. module: website_forum
#: model_terms:ir.ui.view,arch_db:website_forum.edit_post
#: model_terms:ir.ui.view,arch_db:website_forum.header
+7 -3
View File
@@ -128,12 +128,16 @@
<template id="forum_nav_header">
<div class="navbar navbar-expand-sm navbar-light">
<div class="container flex-wrap flex-md-nowrap">
<a t-if="request.website.forums_count > 1" class="btn btn-light border mr-2" href="/forum/" title="All forums">
<i class="fa fa-chevron-left mr-1"/>All Forums
<a t-if="back_button_url" class="btn btn-light border mr-2" t-attf-href="#{back_button_url}" title="Back">
<i class="fa fa-chevron-left mr-1"/>Back
</a>
<!-- Desktop -->
<ul class="navbar-nav mr-auto d-none d-lg-flex">
<li class="nav-item">
<a t-if="request.website.forums_count > 1" class="nav-link" href="/forum/" title="All forums">
All Forums
</a>
</li>
<li class="nav-item">
<a t-attf-href="/forum/#{ slug(forum) }" t-attf-class="nav-link #{question_count and 'active'}">Topics</a>
</li>