Fix placement of disconnection tip

This commit is contained in:
Julia Radzhabova 2021-12-14 00:07:24 +03:00
parent 6e28d2778f
commit e5c0eef2a8
7 changed files with 35 additions and 14 deletions

View file

@ -956,6 +956,7 @@ define([
setLongActionView: function(action) {
var title = '', text = '', force = false;
var statusCallback = null; // call after showing status
switch (action.id) {
case Asc.c_oAscAsyncAction['Open']:
@ -1044,7 +1045,10 @@ define([
case Asc.c_oAscAsyncAction['Disconnect']:
text = this.textDisconnect;
this.disableEditing(true, true);
this.getApplication().getController('Statusbar').showDisconnectTip();
var me = this;
statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip();
};
break;
default:
@ -1064,7 +1068,7 @@ define([
if (!this.isShowOpenDialog)
this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']);
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
this.getApplication().getController('Statusbar').setStatusCaption(text, force, 0, statusCallback);
}
},

View file

@ -251,13 +251,14 @@ define([
this.statusbar.reloadLanguages(langs);
},
setStatusCaption: function(text, force, delay) {
setStatusCaption: function(text, force, delay, callback) {
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
return;
this.timerCaption = undefined;
if (text.length) {
this.statusbar.showStatusMessage(text);
callback && callback();
if (delay>0)
this.timerCaption = (new Date()).getTime() + delay;
} else
@ -309,8 +310,10 @@ define([
showDisconnectTip: function () {
var me = this;
if (!this.disconnectTip) {
var target = this.statusbar.getStatusLabel();
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
this.disconnectTip = new Common.UI.SynchronizeTip({
target : this.statusbar.isVisible() ? this.statusbar.getStatusLabel().parent() : $(document.body),
target : target,
text : this.textDisconnect,
placement: 'top',
position: this.statusbar.isVisible() ? undefined : {bottom: 0},

View file

@ -632,6 +632,7 @@ define([
setLongActionView: function(action) {
var title = '', text = '', force = false;
var statusCallback = null; // call after showing status
switch (action.id) {
case Asc.c_oAscAsyncAction['Open']:
@ -713,7 +714,10 @@ define([
case Asc.c_oAscAsyncAction['Disconnect']:
text = this.textDisconnect;
this.disableEditing(true, true);
this.getApplication().getController('Statusbar').showDisconnectTip();
var me = this;
statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip();
};
break;
default:
@ -733,7 +737,7 @@ define([
if (!this.isShowOpenDialog)
this.loadMask.show(action.id===Asc.c_oAscAsyncAction['Open']);
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
this.getApplication().getController('Statusbar').setStatusCaption(text, force, 0, statusCallback);
}
},

View file

@ -205,13 +205,14 @@ define([
this.statusbar.reloadLanguages(langs);
},
setStatusCaption: function(text, force, delay) {
setStatusCaption: function(text, force, delay, callback) {
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
return;
this.timerCaption = undefined;
if (text.length) {
this.statusbar.showStatusMessage(text);
callback && callback();
if (delay>0)
this.timerCaption = (new Date()).getTime() + delay;
} else
@ -229,8 +230,10 @@ define([
showDisconnectTip: function () {
var me = this;
if (!this.disconnectTip) {
var target = this.statusbar.getStatusLabel();
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
this.disconnectTip = new Common.UI.SynchronizeTip({
target : this.statusbar.isVisible() ? this.statusbar.getStatusLabel().parent() : $(document.body),
target : target,
text : this.textDisconnect,
placement: 'top',
position: this.statusbar.isVisible() ? undefined : {bottom: 0},

View file

@ -713,6 +713,7 @@ define([
setLongActionView: function(action) {
var title = '', text = '', force = false;
var statusCallback = null; // call after showing status
switch (action.id) {
case Asc.c_oAscAsyncAction.Open:
@ -788,7 +789,10 @@ define([
title = this.textDisconnect;
text = this.textDisconnect;
this.disableEditing(true, true);
this.getApplication().getController('Statusbar').showDisconnectTip();
var me = this;
statusCallback = function() {
me.getApplication().getController('Statusbar').showDisconnectTip();
};
break;
default:
@ -808,7 +812,7 @@ define([
this.loadMask.show();
}
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
this.getApplication().getController('Statusbar').setStatusCaption(text, force, 0, statusCallback);
}
},

View file

@ -788,13 +788,13 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
},
setStatusCaption: function(text, force, delay) {
setStatusCaption: function(text, force, delay, callback) {
if (this.timerCaption && ( ((new Date()) < this.timerCaption) || text.length==0 ) && !force )
return;
this.timerCaption = undefined;
if (text.length) {
this.statusbar.showStatusMessage(text);
this.statusbar.showStatusMessage(text, callback);
if (delay>0)
this.timerCaption = (new Date()).getTime() + delay;
} else
@ -814,8 +814,10 @@ define([
showDisconnectTip: function () {
var me = this;
if (!this.disconnectTip) {
var target = this.statusbar.getStatusLabel();
target = target.is(':visible') ? target.parent() : this.statusbar.isVisible() ? this.statusbar.$el : $(document.body);
this.disconnectTip = new Common.UI.SynchronizeTip({
target : this.statusbar.isVisible() ? this.statusbar.getStatusLabel().parent() : $(document.body),
target : target,
text : this.textDisconnect,
placement: 'top',
position: this.statusbar.isVisible() ? undefined : {bottom: 0},

View file

@ -987,7 +987,7 @@ define([
return _message;
},
showStatusMessage: function(message) {
showStatusMessage: function(message, callback) {
this.statusMessage = message;
if (!this.actionWidth) {
this.actionWidth = message.length > 22 ? 166 : 140;
@ -1006,6 +1006,7 @@ define([
_.delay(function(){
me.updateTabbarBorders();
me.onTabInvisible(undefined, me.tabbar.checkInvisible(true));
callback && callback();
},30);
},