[DE] refactoring

This commit is contained in:
Maxim Kadushkin 2017-03-29 12:01:34 +03:00
parent 181bdc7fa2
commit 5ed32d082c
6 changed files with 21 additions and 10 deletions

View file

@ -292,7 +292,7 @@ define([
})
});
storeUsers = DE.getCollection('Common.Collections.Users')
storeUsers = this.options.storeUsers;
storeUsers.bind({
add : onAddUser,
change : onUsersChanged,

View file

@ -154,7 +154,6 @@ define([
var _icon_url = model.get('baseUrl') + modes[model.get('currentVariation')].get('icons')[(window.devicePixelRatio > 1) ? 1 : 0];
var btn = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'img-commonctrl review-prev',
iconImg: _icon_url,
caption: model.get('name'),
menu: modes && modes.length > 1,

View file

@ -104,9 +104,9 @@
}
.button-otherstates-icon2(@icon-class, @icon-size) {
button.@{icon-class}.active > .icon,
button.@{icon-class}:active > .icon {background-position-x: -1*@icon-size; --bgX: -(1*@icon-size);}
button.@{icon-class}.disabled > .icon {background-position-x: -2*@icon-size; --bgX: -(2*@icon-size);}
button.@{icon-class}.active .icon,
button.@{icon-class}:active .icon {background-position-x: -1*@icon-size; --bgX: -(1*@icon-size);}
button.@{icon-class}.disabled .icon {background-position-x: -2*@icon-size; --bgX: -(2*@icon-size);}
}
.menu-icon-normal(@icon-class, @index, @icon-size) {

View file

@ -997,14 +997,14 @@ define([
this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion;
/** coauthoring end **/
this.appOptions.isOffline = this.api.asc_isOffline();
this.appOptions.isReviewOnly = (this.permissions.review === true) && (this.permissions.edit === false);
this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights;
this.appOptions.canEdit = (this.permissions.edit !== false || this.permissions.review === true) && // can edit or review
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined
(!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
this.appOptions.canReview = this.appOptions.canLicense && this.appOptions.isEdit && (this.permissions.review===true);
this.appOptions.canUseHistory = this.appOptions.canLicense && !this.appOptions.isLightVersion && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isDesktopApp;
this.appOptions.canReview = this.permissions.review === true && this.appOptions.canLicense && this.appOptions.isEdit;
this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false;
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isDesktopApp;
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
this.appOptions.canUseMailMerge= this.appOptions.canLicense && this.appOptions.canEdit && !this.appOptions.isDesktopApp;
@ -1016,6 +1016,17 @@ define([
this.appOptions.canRename = !!this.permissions.rename;
this.appOptions.buildVersion = params.asc_getBuildVersion();
if ( this.appOptions.isLightVersion ) {
this.appOptions.canUseHistory =
this.appOptions.canReview =
this.appOptions.isReviewOnly = false;
}
if ( !this.appOptions.canCoAuthoring ) {
this.appOptions.canChat =
this.appOptions.canComments = false;
}
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
this.appOptions.canDownloadOrigin = !this.appOptions.nativeApp && this.permissions.download !== false && (type && typeof type[1] === 'string');
this.appOptions.canDownload = !this.appOptions.nativeApp && this.permissions.download !== false && (!type || typeof type[1] !== 'string');

View file

@ -93,7 +93,8 @@ define([
// Create and render main view
this.viewport = this.createView('Viewport').render();
this.header = this.createView('Common.Views.Header', {
headerCaption: 'Document Editor'
headerCaption: 'Document Editor',
storeUsers: DE.getCollection('Common.Collections.Users')
});
Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this));

View file

@ -67,7 +67,7 @@ define([
}
function _clickLanguage(menu, item, state) {
var $parent = $(menu.el.parentNode, this.$el);
var $parent = menu.$el.parent();
$parent.find('#status-label-lang').text(item.caption);
$parent.find('.icon-lang-flag')