[DE mobile] Fixed display blocked preloader.

This commit is contained in:
Alexander Yuzhin 2016-11-18 11:52:46 +03:00
parent e2058ff642
commit a7cf60048e
4 changed files with 76 additions and 62 deletions

View file

@ -333,7 +333,7 @@ define([
} else { } else {
_.delay(function () { _.delay(function () {
$(me.loadMask).hasClass('modal-in') && uiApp.closeModal(me.loadMask); $(me.loadMask).hasClass('modal-in') && uiApp.closeModal(me.loadMask);
}, 200); }, 300);
} }
if (id==Asc.c_oAscAsyncAction['Save'] && (!me._state.fastCoauth || me._state.usersCount<2)) { if (id==Asc.c_oAscAsyncAction['Save'] && (!me._state.fastCoauth || me._state.usersCount<2)) {
@ -342,93 +342,99 @@ define([
}, },
setLongActionView: function(action) { setLongActionView: function(action) {
var title = '', text = ''; var me = this,
title = '',
text = '';
switch (action.id) { switch (action.id) {
case Asc.c_oAscAsyncAction['Open']: case Asc.c_oAscAsyncAction['Open']:
title = this.openTitleText; title = me.openTitleText;
text = this.openTextText; text = me.openTextText;
break; break;
case Asc.c_oAscAsyncAction['Save']: case Asc.c_oAscAsyncAction['Save']:
this._state.isSaving = new Date(); me._state.isSaving = new Date();
title = this.saveTitleText; title = me.saveTitleText;
text = this.saveTextText; text = me.saveTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadDocumentFonts']: case Asc.c_oAscAsyncAction['LoadDocumentFonts']:
title = this.loadFontsTitleText; title = me.loadFontsTitleText;
text = this.loadFontsTextText; text = me.loadFontsTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadDocumentImages']: case Asc.c_oAscAsyncAction['LoadDocumentImages']:
title = this.loadImagesTitleText; title = me.loadImagesTitleText;
text = this.loadImagesTextText; text = me.loadImagesTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadFont']: case Asc.c_oAscAsyncAction['LoadFont']:
title = this.loadFontTitleText; title = me.loadFontTitleText;
text = this.loadFontTextText; text = me.loadFontTextText;
break; break;
case Asc.c_oAscAsyncAction['LoadImage']: case Asc.c_oAscAsyncAction['LoadImage']:
title = this.loadImageTitleText; title = me.loadImageTitleText;
text = this.loadImageTextText; text = me.loadImageTextText;
break; break;
case Asc.c_oAscAsyncAction['DownloadAs']: case Asc.c_oAscAsyncAction['DownloadAs']:
title = this.downloadTitleText; title = me.downloadTitleText;
text = this.downloadTextText; text = me.downloadTextText;
break; break;
case Asc.c_oAscAsyncAction['Print']: case Asc.c_oAscAsyncAction['Print']:
title = this.printTitleText; title = me.printTitleText;
text = this.printTextText; text = me.printTextText;
break; break;
case Asc.c_oAscAsyncAction['UploadImage']: case Asc.c_oAscAsyncAction['UploadImage']:
title = this.uploadImageTitleText; title = me.uploadImageTitleText;
text = this.uploadImageTextText; text = me.uploadImageTextText;
break; break;
case Asc.c_oAscAsyncAction['ApplyChanges']: case Asc.c_oAscAsyncAction['ApplyChanges']:
title = this.applyChangesTitleText; title = me.applyChangesTitleText;
text = this.applyChangesTextText; text = me.applyChangesTextText;
break; break;
case Asc.c_oAscAsyncAction['PrepareToSave']: case Asc.c_oAscAsyncAction['PrepareToSave']:
title = this.savePreparingText; title = me.savePreparingText;
text = this.savePreparingTitle; text = me.savePreparingTitle;
break; break;
case Asc.c_oAscAsyncAction['MailMergeLoadFile']: case Asc.c_oAscAsyncAction['MailMergeLoadFile']:
title = this.mailMergeLoadFileText; title = me.mailMergeLoadFileText;
text = this.mailMergeLoadFileTitle; text = me.mailMergeLoadFileTitle;
break; break;
case Asc.c_oAscAsyncAction['DownloadMerge']: case Asc.c_oAscAsyncAction['DownloadMerge']:
title = this.downloadMergeTitle; title = me.downloadMergeTitle;
text = this.downloadMergeText; text = me.downloadMergeText;
break; break;
case Asc.c_oAscAsyncAction['SendMailMerge']: case Asc.c_oAscAsyncAction['SendMailMerge']:
title = this.sendMergeTitle; title = me.sendMergeTitle;
text = this.sendMergeText; text = me.sendMergeText;
break; break;
case ApplyEditRights: case ApplyEditRights:
title = this.txtEditingMode; title = me.txtEditingMode;
text = this.txtEditingMode; text = me.txtEditingMode;
break; break;
case LoadingDocument: case LoadingDocument:
title = this.loadingDocumentTitleText; title = me.loadingDocumentTitleText;
text = this.loadingDocumentTextText; text = me.loadingDocumentTextText;
break; break;
} }
if (action.type == Asc.c_oAscAsyncActionType['BlockInteraction']) { if (action.type == Asc.c_oAscAsyncActionType['BlockInteraction']) {
this.loadMask = uiApp.showPreloader(title); if (me.loadMask && $(me.loadMask).hasClass('modal-in')) {
$$(me.loadMask).find('.modal-title').text(title);
} else {
me.loadMask = uiApp.showPreloader(title);
}
} }
else { else {
// this.getApplication().getController('Statusbar').setStatusCaption(text); // this.getApplication().getController('Statusbar').setStatusCaption(text);

View file

@ -45,7 +45,7 @@ define([
], function (core) { ], function (core) {
'use strict'; 'use strict';
DE.Controllers.AddContainer = Backbone.Controller.extend((function() { DE.Controllers.AddContainer = Backbone.Controller.extend(_.extend((function() {
// private // private
return { return {
@ -66,9 +66,7 @@ define([
}, },
showModal: function() { showModal: function() {
var me = this, var me = this;
mainView = DE.getController('Editor').getView('Editor').f7View,
isAndroid = Framework7.prototype.device.android === true;
if ($$('.container-add.modal-in').length > 0) { if ($$('.container-add.modal-in').length > 0) {
return; return;
@ -88,10 +86,11 @@ define([
}, },
_layoutEditorsByStack: function () { _layoutEditorsByStack: function () {
var addViews = []; var me = this,
addViews = [];
addViews.push({ addViews.push({
caption: 'Table', caption: me.textTable,
id: 'add-table', id: 'add-table',
layout: DE.getController('AddTable') layout: DE.getController('AddTable')
.getView('AddTable') .getView('AddTable')
@ -99,7 +98,7 @@ define([
}); });
addViews.push({ addViews.push({
caption: 'Shape', caption: me.textShape,
id: 'add-shape', id: 'add-shape',
layout: DE.getController('AddShape') layout: DE.getController('AddShape')
.getView('AddShape') .getView('AddShape')
@ -107,7 +106,7 @@ define([
}); });
addViews.push({ addViews.push({
caption: 'Image', caption: me.textImage,
id: 'add-image', id: 'add-image',
layout: DE.getController('AddImage') layout: DE.getController('AddImage')
.getView('AddImage') .getView('AddImage')
@ -115,7 +114,7 @@ define([
}); });
addViews.push({ addViews.push({
caption: 'Other', caption: me.textOther,
id: 'add-other', id: 'add-other',
layout: DE.getController('AddOther') layout: DE.getController('AddOther')
.getView('AddOther') .getView('AddOther')
@ -127,7 +126,6 @@ define([
_showByStack: function(isPhone) { _showByStack: function(isPhone) {
var me = this, var me = this,
mainView = DE.getController('Editor').getView('Editor').f7View,
isAndroid = Framework7.prototype.device.android === true, isAndroid = Framework7.prototype.device.android === true,
layoutAdds = me._layoutEditorsByStack(); layoutAdds = me._layoutEditorsByStack();
@ -253,7 +251,12 @@ define([
}); });
Common.NotificationCenter.trigger('addcontainer:show'); Common.NotificationCenter.trigger('addcontainer:show');
},
textTable: 'Table',
textShape: 'Shape',
textImage: 'Image',
textOther: 'Other'
} }
} })(), DE.Controllers.AddContainer || {}))
})());
}); });

View file

@ -47,7 +47,7 @@ define([
], function (core) { ], function (core) {
'use strict'; 'use strict';
DE.Controllers.AddImage = Backbone.Controller.extend((function() { DE.Controllers.AddImage = Backbone.Controller.extend(_.extend((function() {
// //
return { return {
@ -103,33 +103,33 @@ define([
}, },
onUrlChange: function (e) { onUrlChange: function (e) {
$('#addimage-insert')[_.isEmpty($(e.currentTarget).val()) ? 'addClass' : 'removeClass']('disabled'); $('#addimage-insert').toggleClass('disabled', _.isEmpty($(e.currentTarget).val()));
}, },
onInsertByUrl: function (e) { onInsertByUrl: function (e) {
var me = this, var me = this,
$input = $('#addimage-link-url input[type="url"]'); $input = $('#addimage-link-url input[type=url]');
if ($input) { if ($input) {
var value = ($input.val()).replace(/ /g, ''); var value = ($input.val()).replace(/ /g, '');
_.delay(function () {
if (!_.isEmpty(value)) { if (!_.isEmpty(value)) {
if ((/((^https?)|(^ftp)):\/\/.+/i.test(value))) { if ((/((^https?)|(^ftp)):\/\/.+/i.test(value))) {
me.api.AddImageUrl(value);
DE.getController('AddContainer').hideModal(); DE.getController('AddContainer').hideModal();
_.defer(function () {
me.api.AddImageUrl(value);
});
} else { } else {
uiApp.alert(me.txtNotUrl); uiApp.alert(me.txtNotUrl);
} }
} else { } else {
uiApp.alert(me.textEmptyImgUrl); uiApp.alert(me.textEmptyImgUrl);
} }
}, 300);
} }
}, },
textEmptyImgUrl : 'You need to specify image URL.', textEmptyImgUrl : 'You need to specify image URL.',
txtNotUrl : 'This field should be a URL in the format \"http://www.example.com\"' txtNotUrl : 'This field should be a URL in the format \"http://www.example.com\"'
} }
})()); })(), DE.Controllers.AddImage || {}))
}); });

View file

@ -135,5 +135,10 @@
"DE.Controllers.Toolbar.dlgLeaveMsgText": "You have unsaved changes in this document. Click 'Stay on this Page' to await the autosave of the document. Click 'Leave this Page' to discard all the unsaved changes.", "DE.Controllers.Toolbar.dlgLeaveMsgText": "You have unsaved changes in this document. Click 'Stay on this Page' to await the autosave of the document. Click 'Leave this Page' to discard all the unsaved changes.",
"DE.Controllers.Toolbar.leaveButtonText": "Leave this Page", "DE.Controllers.Toolbar.leaveButtonText": "Leave this Page",
"DE.Controllers.Toolbar.stayButtonText": "Stay on this Page", "DE.Controllers.Toolbar.stayButtonText": "Stay on this Page",
"DE.Views.Toolbar.textBack": "Back" "DE.Views.Toolbar.textBack": "Back",
"DE.Controllers.AddContainer.textTable": "Table",
"DE.Controllers.AddContainer.textShape": "Shape",
"DE.Controllers.AddContainer.textImage": "Image",
"DE.Controllers.AddContainer.textOther": "Other"
} }