mirror of https://github.com/xwiki-labs/cryptpad
Add new state messages in the toolbar
This commit is contained in:
parent
6d080bcb45
commit
3e4faf1be1
|
@ -42,6 +42,8 @@ define(function () {
|
|||
out.synchronizing = 'Synchronisation';
|
||||
out.reconnecting = 'Reconnexion...';
|
||||
out.typing = "Édition";
|
||||
out.initializing = "Initialisation...";
|
||||
out.forgotten = 'Déplacé vers la corbeille';
|
||||
out.lag = 'Latence';
|
||||
out.readonly = 'Lecture seule';
|
||||
out.anonymous = "Anonyme";
|
||||
|
|
|
@ -44,6 +44,8 @@ define(function () {
|
|||
out.synchronizing = 'Synchronizing';
|
||||
out.reconnecting = 'Reconnecting...';
|
||||
out.typing = "Typing";
|
||||
out.initializing = "Initializing...";
|
||||
out.forgotten = 'Moved to the trash';
|
||||
out.lag = 'Lag';
|
||||
out.readonly = 'Read only';
|
||||
out.anonymous = "Anonymous";
|
||||
|
|
|
@ -67,6 +67,7 @@ define([
|
|||
var title;
|
||||
var toolbar;
|
||||
var state = STATE.DISCONNECTED;
|
||||
var firstConnection = true;
|
||||
|
||||
var toolbarContainer = options.toolbarContainer ||
|
||||
(function () { throw new Error("toolbarContainer must be specified"); }());
|
||||
|
@ -119,13 +120,23 @@ define([
|
|||
switch (state) {
|
||||
case STATE.DISCONNECTED:
|
||||
case STATE.INITIALIZING: {
|
||||
evStart.reg(function () { toolbar.reconnecting(); });
|
||||
evStart.reg(function () {
|
||||
if (firstConnection) {
|
||||
toolbar.initializing();
|
||||
return;
|
||||
}
|
||||
toolbar.reconnecting();
|
||||
});
|
||||
break;
|
||||
}
|
||||
case STATE.INFINITE_SPINNER: {
|
||||
evStart.reg(function () { toolbar.failed(); });
|
||||
break;
|
||||
}
|
||||
case STATE.FORGOTTEN: {
|
||||
evStart.reg(function () { toolbar.forgotten(); });
|
||||
break;
|
||||
}
|
||||
default:
|
||||
}
|
||||
if (wasEditable !== (state === STATE.READY)) {
|
||||
|
@ -247,6 +258,7 @@ define([
|
|||
evOnDefaultContentNeeded.fire();
|
||||
}
|
||||
stateChange(STATE.READY);
|
||||
firstConnection = false;
|
||||
if (!readOnly) { onLocal(); }
|
||||
evOnReady.fire(newPad);
|
||||
|
||||
|
@ -479,7 +491,7 @@ define([
|
|||
/* add a forget button */
|
||||
toolbar.$rightside.append(common.createButton('forget', true, {}, function (err) {
|
||||
if (err) { return; }
|
||||
stateChange(STATE.HISTORY_MODE);
|
||||
stateChange(STATE.FORGOTTEN);
|
||||
}));
|
||||
|
||||
var $tags = common.createButton('hashtag', true);
|
||||
|
|
|
@ -1034,13 +1034,25 @@ define([
|
|||
}
|
||||
//checkLag(toolbar, config);
|
||||
};
|
||||
toolbar.initializing = function (/*userId*/) {
|
||||
toolbar.connected = false;
|
||||
if (toolbar.spinner) {
|
||||
toolbar.spinner.text(Messages.initializing);
|
||||
}
|
||||
};
|
||||
toolbar.reconnecting = function (/*userId*/) {
|
||||
//if (config.metadataMgr) { config.userList.userNetfluxId = userId; } TODO
|
||||
toolbar.connected = false;
|
||||
if (toolbar.spinner) {
|
||||
toolbar.spinner.text(Messages.reconnecting);
|
||||
}
|
||||
//checkLag(toolbar, config);
|
||||
};
|
||||
|
||||
// When the pad is moved to the trash (forget button)
|
||||
toolbar.forgotten = function (/*userId*/) {
|
||||
toolbar.connected = false;
|
||||
if (toolbar.spinner) {
|
||||
toolbar.spinner.text(Messages.forgotten);
|
||||
}
|
||||
};
|
||||
|
||||
// On log out, remove permanently the realtime elements of the toolbar
|
||||
|
|
Loading…
Reference in New Issue