From cf3024ef5b7faa5455ceeedb8cae0ce198afba0f Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 3 Nov 2017 14:26:38 +0100 Subject: [PATCH] Ability to display an error in the toolbar state --- customize.dist/translations/messages.fr.js | 1 + customize.dist/translations/messages.js | 3 ++- www/common/toolbar3.js | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 06fb7f13b..fc7a98fe5 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -44,6 +44,7 @@ define(function () { out.typing = "Édition"; out.initializing = "Initialisation..."; out.forgotten = 'Déplacé vers la corbeille'; + out.errorState = 'Erreur critique : {0}'; out.lag = 'Latence'; out.readonly = 'Lecture seule'; out.anonymous = "Anonyme"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 9e9531627..734d493cf 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -43,9 +43,10 @@ define(function () { out.disconnected = 'Disconnected'; out.synchronizing = 'Synchronizing'; out.reconnecting = 'Reconnecting...'; - out.typing = "Typing"; + out.typing = "Editing"; out.initializing = "Initializing..."; out.forgotten = 'Moved to the trash'; + out.errorState = 'Critical error: {0}'; out.lag = 'Lag'; out.readonly = 'Read only'; out.anonymous = "Anonymous"; diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index be8e6399f..bca41bd9b 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -691,6 +691,7 @@ define([ var typing = -1; var kickSpinner = function (toolbar, config/*, local*/) { if (!toolbar.spinner) { return; } + if (toolbar.isErrorState) { return; } var $spin = toolbar.spinner; if (typing === -1) { @@ -1050,6 +1051,17 @@ define([ } }; + toolbar.errorState = function (state, error) { + toolbar.isErrorState = state; + if (toolbar.spinner) { + if (!state) { + return void kickSpinner(toolbar, config); + } + var txt = Messages._getKey('errorState', [error]); + toolbar.spinner.text(txt); + } + }; + // When the pad is moved to the trash (forget button) toolbar.forgotten = function (/*userId*/) { toolbar.connected = false;