From 8b2fe75867fbce7f2eb6b9a88403b31538dfd7d0 Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 27 Mar 2020 20:29:24 +0000 Subject: [PATCH] toolbar: don't show the "saved revision" button in timeslider The saved revision "star" button appeared in the timeslider toolbar too. This change introduces a second flag "page" in toolbar.menu(), which controls whether the toolbar is being drawn for a pad or in the timeslider page. Fixes #3767. --- src/node/utils/toolbar.js | 14 ++++++++------ src/templates/pad.html | 4 ++-- src/templates/timeslider.html | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/node/utils/toolbar.js b/src/node/utils/toolbar.js index 320fd4e45..a2b8f5579 100644 --- a/src/node/utils/toolbar.js +++ b/src/node/utils/toolbar.js @@ -253,8 +253,9 @@ module.exports = { /* * Valid values for whichMenu: 'left' | 'right' | 'timeslider-right' + * Valid values for page: 'pad' | 'timeslider' */ - menu: function (buttons, isReadOnly, whichMenu) { + menu: function (buttons, isReadOnly, whichMenu, page) { if (isReadOnly) { // The best way to detect if it's the left editbar is to check for a bold button if (buttons[0].indexOf("bold") !== -1) { @@ -269,13 +270,14 @@ module.exports = { * This pad is not read only * * Add back the savedrevision button (the "star") if is not already there, - * but only on the right toolbar. + * but only on the right toolbar, and only if we are showing a pad (dont't + * do it in the timeslider). * - * This is a quick fix for #3702: it was sufficient to visit a single read - * only pad to cause the disappearence of the star button from all the - * pads. + * This is a quick fix for #3702 (and subsequent issue #3767): it was + * sufficient to visit a single read only pad to cause the disappearence + * of the star button from all the pads. */ - if ((buttons[0].indexOf("savedrevision") === -1) && (whichMenu === "right")) { + if ((buttons[0].indexOf("savedrevision") === -1) && (whichMenu === "right") && (page === "pad")) { buttons[0].push("savedrevision"); } } diff --git a/src/templates/pad.html b/src/templates/pad.html index 14719b689..ceda1d00e 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -64,12 +64,12 @@ diff --git a/src/templates/timeslider.html b/src/templates/timeslider.html index 2c1f465ce..6d3b6f2f4 100644 --- a/src/templates/timeslider.html +++ b/src/templates/timeslider.html @@ -82,7 +82,7 @@
<% e.begin_block("timesliderEditbarRight"); %> <% e.end_block(); %>