From d92f76592c1929e4cf876c615e3be03621b17abd Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Mon, 27 Jan 2020 15:25:56 +0000 Subject: [PATCH] [IMP] website(_blog/_slides): show a toaster when a record is published This commit shows a toaster when publishing a record through the toggle in the topbar. The `_description` field is used to do that, as it is supposed to contains a 'business oriented' descriptive name, see task-37311. Indeed, this field is used in studio and in mail templates. task-2144335 --- addons/website/static/src/js/content/website_root.js | 7 +++++++ addons/website/views/website_navbar_templates.xml | 2 +- addons/website_blog/models/website_blog.py | 2 +- addons/website_slides/models/slide_channel_tag.py | 4 ++-- addons/website_slides/models/slide_question.py | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/addons/website/static/src/js/content/website_root.js b/addons/website/static/src/js/content/website_root.js index a851ea3d2a9..6f7f8f21bea 100644 --- a/addons/website/static/src/js/content/website_root.js +++ b/addons/website/static/src/js/content/website_root.js @@ -161,6 +161,13 @@ var WebsiteRoot = publicRootData.PublicRoot.extend({ $data.toggleClass("css_unpublished css_published"); $data.find('input').prop("checked", result); $data.parents("[data-publish]").attr("data-publish", +result ? 'on' : 'off'); + if (result) { + self.displayNotification({ + type: 'success', + title: _t("Congratulation"), + message: _t("You've published your ") + $data.data('description'), + }); + } }) .guardedCatch(function (err, data) { data = data || {statusText: err.message.message}; diff --git a/addons/website/views/website_navbar_templates.xml b/addons/website/views/website_navbar_templates.xml index 56a4d6c264b..891e8312e85 100644 --- a/addons/website/views/website_navbar_templates.xml +++ b/addons/website/views/website_navbar_templates.xml @@ -63,7 +63,7 @@