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