Branding refactoring

This commit is contained in:
Julia Radzhabova 2019-02-07 13:18:56 +03:00
parent 4866923553
commit 89a704950c
13 changed files with 28 additions and 21 deletions

View file

@ -580,8 +580,6 @@
customization: {
about: true,
feedback: false
// ,compactHeader:true
// ,toolbarBreakTabs:true
}
}
};

View file

@ -1156,6 +1156,10 @@ define([
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization);
else if (typeof this.editorConfig.customization == 'object') {
this.editorConfig.customization.compactHeader = this.editorConfig.customization.toolbarBreakTabs =
this.editorConfig.customization.toolbarHideFileName = false;
}
this.appOptions.canRename && appHeader.setCanRename(true);

View file

@ -2778,7 +2778,7 @@ define([
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));
if (!config.canBranding || !config.customization.compactHeader) {
if (!(config.customization && config.customization.compactHeader)) {
// hide 'print' and 'save' buttons group and next separator
me.toolbar.btnPrint.$el.parents('.group').hide().next().hide();

View file

@ -76,7 +76,7 @@ define([
'render:before' : function (toolbar) {
var config = DE.getController('Main').appOptions;
toolbar.setExtra('right', me.header.getPanel('right', config));
if (!config.isEdit || config.canBranding && !!config.customization.compactHeader)
if (!config.isEdit || config.customization && !!config.customization.compactHeader)
toolbar.setExtra('left', me.header.getPanel('left', config));
},
'view:compact' : function (toolbar, state) {
@ -162,7 +162,7 @@ define([
if ( panel ) panel.height = _intvars.get('toolbar-height-tabs');
}
if ( config.canBranding ) {
if ( config.customization ) {
if ( config.customization.toolbarBreakTabs )
me.viewport.vlayout.getItem('toolbar').el.addClass('style-off-tabs');
@ -170,7 +170,7 @@ define([
me.viewport.vlayout.getItem('toolbar').el.addClass('style-skip-docname');
}
if ( config.isEdit && (!config.canBranding || !config.customization.compactHeader)) {
if ( config.isEdit && (!(config.customization && config.customization.compactHeader))) {
var $title = me.viewport.vlayout.getItem('title').el;
$title.html(me.header.getPanel('title', config)).show();
$title.find('.extra').html(me.header.getPanel('left', config));

View file

@ -1565,9 +1565,6 @@ define([
var me = this;
// if (this.mode.isDesktopApp || this.mode.canBrandingExt && this.mode.customization && this.mode.customization.header === false)
// this.mnuitemHideTitleBar.hide();
this.btnMarkers.setMenu(
new Common.UI.Menu({
style: 'min-width: 139px',
@ -2111,7 +2108,7 @@ define([
createSynchTip: function () {
this.synchTooltip = new Common.UI.SynchronizeTip({
extCls: (this.mode.canBranding && !!this.mode.customization.compactHeader) ? undefined : 'inc-index',
extCls: (this.mode.customization && !!this.mode.customization.compactHeader) ? undefined : 'inc-index',
target: this.btnCollabChanges.$el
});
this.synchTooltip.on('dontshowclick', function () {

View file

@ -898,6 +898,10 @@ define([
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
appHeader.setBranding(this.editorConfig.customization);
else if (typeof this.editorConfig.customization == 'object') {
this.editorConfig.customization.compactHeader = this.editorConfig.customization.toolbarBreakTabs =
this.editorConfig.customization.toolbarHideFileName = false;
}
this.appOptions.canRename && appHeader.setCanRename(true);

View file

@ -2019,7 +2019,7 @@ define([
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));
if (!config.canBranding || !config.customization.compactHeader) {
if (!(config.customization && config.customization.compactHeader)) {
// hide 'print' and 'save' buttons group and next separator
me.toolbar.btnPrint.$el.parents('.group').hide().next().hide();

View file

@ -77,7 +77,7 @@ define([
'render:before' : function (toolbar) {
var config = PE.getController('Main').appOptions;
toolbar.setExtra('right', me.header.getPanel('right', config));
if (!config.isEdit || config.canBranding && !!config.customization.compactHeader)
if (!config.isEdit || config.customization && !!config.customization.compactHeader)
toolbar.setExtra('left', me.header.getPanel('left', config));
},
'view:compact' : function (toolbar, state) {
@ -165,7 +165,7 @@ define([
me.viewport.vlayout.getItem('toolbar').height = _intvars.get('toolbar-height-compact');
}
if ( config.isEdit && (!config.canBranding || !config.customization.compactHeader)) {
if ( config.isEdit && (!(config.customization && config.customization.compactHeader))) {
var $title = me.viewport.vlayout.getItem('title').el;
$title.html(me.header.getPanel('title', config)).show();
$title.find('.extra').html(me.header.getPanel('left', config));
@ -185,7 +185,7 @@ define([
toolbar.btnCollabChanges = me.header.btnSave;
}
if ( config.canBranding ) {
if ( config.customization ) {
if ( config.customization.toolbarBreakTabs )
me.viewport.vlayout.getItem('toolbar').el.addClass('style-off-tabs');

View file

@ -1429,7 +1429,7 @@ define([
createSynchTip: function () {
this.synchTooltip = new Common.UI.SynchronizeTip({
extCls: (this.mode.canBranding && !!this.mode.customization.compactHeader) ? undefined : 'inc-index',
extCls: (this.mode.customization && !!this.mode.customization.compactHeader) ? undefined : 'inc-index',
target: this.btnCollabChanges.$el
});
this.synchTooltip.on('dontshowclick', function () {

View file

@ -917,6 +917,10 @@ define([
this.appOptions.canBranding = (licType === Asc.c_oLicenseResult.Success) && (typeof this.editorConfig.customization == 'object');
if (this.appOptions.canBranding)
this.headerView.setBranding(this.editorConfig.customization);
else if (typeof this.editorConfig.customization == 'object') {
this.editorConfig.customization.compactHeader = this.editorConfig.customization.toolbarBreakTabs =
this.editorConfig.customization.toolbarHideFileName = false;
}
this.appOptions.canRename && this.headerView.setCanRename(true);
} else

View file

@ -3111,7 +3111,7 @@ define([
if ( $panel )
me.toolbar.addTab(tab, $panel, 4);
if (!config.canBranding || !config.customization.compactHeader) {
if (!(config.customization && config.customization.compactHeader)) {
// hide 'print' and 'save' buttons group and next separator
me.toolbar.btnPrint.$el.parents('.group').hide().next().hide();

View file

@ -78,10 +78,10 @@ define([
'render:before' : function (toolbar) {
var config = SSE.getController('Main').appOptions;
toolbar.setExtra('right', me.header.getPanel('right', config));
if (!config.isEdit || config.canBranding && !!config.customization.compactHeader)
if (!config.isEdit || config.customization && !!config.customization.compactHeader)
toolbar.setExtra('left', me.header.getPanel('left', config));
if ( me.appConfig && me.appConfig.isEdit && (!config.canBranding || !config.customization.compactHeader) && toolbar.btnCollabChanges )
if ( me.appConfig && me.appConfig.isEdit && !(config.customization && config.customization.compactHeader) && toolbar.btnCollabChanges )
toolbar.btnCollabChanges = me.header.btnSave;
},
@ -148,7 +148,7 @@ define([
me.viewport.vlayout.getItem('toolbar').height = 41;
}
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && (!config.canBranding || !config.customization.compactHeader)) {
if ( config.isEdit && !config.isEditDiagram && !config.isEditMailMerge && !(config.customization && config.customization.compactHeader)) {
var $title = me.viewport.vlayout.getItem('title').el;
$title.html(me.header.getPanel('title', config)).show();
$title.find('.extra').html(me.header.getPanel('left', config));
@ -165,7 +165,7 @@ define([
$filemenu.css('top', _tabs_new_height + _intvars.get('document-title-height'));
}
if ( config.canBranding ) {
if ( config.customization ) {
if ( config.customization.toolbarBreakTabs )
me.viewport.vlayout.getItem('toolbar').el.addClass('style-off-tabs');

View file

@ -2092,7 +2092,7 @@ define([
createSynchTip: function () {
this.synchTooltip = new Common.UI.SynchronizeTip({
extCls: (this.mode.canBranding && !!this.mode.customization.compactHeader) ? undefined : 'inc-index',
extCls: (this.mode.customization && !!this.mode.customization.compactHeader) ? undefined : 'inc-index',
target: this.btnCollabChanges.$el
});
this.synchTooltip.on('dontshowclick', function() {