From 12fa83bb444069e43b23b0f4b8a84b8333d5949b Mon Sep 17 00:00:00 2001 From: jvm-odoo Date: Mon, 17 Feb 2020 10:14:43 +0000 Subject: [PATCH] [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) --- addons/website_forum/controllers/main.py | 2 ++ addons/website_forum/i18n/website_forum.pot | 10 ++++++++++ addons/website_forum/views/website_forum.xml | 10 +++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index f8b268d902b..6ad0af1f2f1 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -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//question//toggle_favourite', type='json', auth="user", methods=['POST'], website=True) diff --git a/addons/website_forum/i18n/website_forum.pot b/addons/website_forum/i18n/website_forum.pot index 7c57e7a64df..864e420e463 100644 --- a/addons/website_forum/i18n/website_forum.pot +++ b/addons/website_forum/i18n/website_forum.pot @@ -393,6 +393,11 @@ msgstr "" msgid "All Forums" 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.new_question msgid "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 diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index ebc265471f2..bf4800285a0 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -128,12 +128,16 @@