Ability to display an error in the toolbar state

pull/1/head
yflory 7 years ago
parent 8de9a596f1
commit cf3024ef5b

@ -44,6 +44,7 @@ define(function () {
out.typing = "Édition"; out.typing = "Édition";
out.initializing = "Initialisation..."; out.initializing = "Initialisation...";
out.forgotten = 'Déplacé vers la corbeille'; out.forgotten = 'Déplacé vers la corbeille';
out.errorState = 'Erreur critique : {0}';
out.lag = 'Latence'; out.lag = 'Latence';
out.readonly = 'Lecture seule'; out.readonly = 'Lecture seule';
out.anonymous = "Anonyme"; out.anonymous = "Anonyme";

@ -43,9 +43,10 @@ define(function () {
out.disconnected = 'Disconnected'; out.disconnected = 'Disconnected';
out.synchronizing = 'Synchronizing'; out.synchronizing = 'Synchronizing';
out.reconnecting = 'Reconnecting...'; out.reconnecting = 'Reconnecting...';
out.typing = "Typing"; out.typing = "Editing";
out.initializing = "Initializing..."; out.initializing = "Initializing...";
out.forgotten = 'Moved to the trash'; out.forgotten = 'Moved to the trash';
out.errorState = 'Critical error: {0}';
out.lag = 'Lag'; out.lag = 'Lag';
out.readonly = 'Read only'; out.readonly = 'Read only';
out.anonymous = "Anonymous"; out.anonymous = "Anonymous";

@ -691,6 +691,7 @@ define([
var typing = -1; var typing = -1;
var kickSpinner = function (toolbar, config/*, local*/) { var kickSpinner = function (toolbar, config/*, local*/) {
if (!toolbar.spinner) { return; } if (!toolbar.spinner) { return; }
if (toolbar.isErrorState) { return; }
var $spin = toolbar.spinner; var $spin = toolbar.spinner;
if (typing === -1) { 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) // When the pad is moved to the trash (forget button)
toolbar.forgotten = function (/*userId*/) { toolbar.forgotten = function (/*userId*/) {
toolbar.connected = false; toolbar.connected = false;

Loading…
Cancel
Save