diff --git a/apps/common/main/lib/component/Mixtbar.js b/apps/common/main/lib/component/Mixtbar.js
index 18c878e60..0360db278 100644
--- a/apps/common/main/lib/component/Mixtbar.js
+++ b/apps/common/main/lib/component/Mixtbar.js
@@ -86,8 +86,23 @@ define([
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
+ var _template_tabs =
+ '' +
+ '<' +
+ '' +
+ '<% for(var i in items) { %>' +
+ '- ' +
+ '<% if (items[i].extcls) print(\' \' + items[i].extcls) %>">' +
+ '<%= items[i].caption %>' +
+ '
' +
+ '<% } %>' +
+ '
' +
+ '>' +
+ '';
+
this.$layout = $(options.template({
- tabs: options.tabs
+ tabsmarkup: _.template(_template_tabs)({items: options.tabs})
}));
config.tabs = options.tabs;
@@ -120,7 +135,7 @@ define([
return t.length && t.data('tab') == tag;
},
- setFolded: function(value, defNum) {
+ setFolded: function(value, deftab) {
this.isFolded = value;
var me = this;
@@ -178,9 +193,8 @@ define([
if ( active_panel.length ) {
var tab = active_panel.data('tab');
me.$tabs.find('> a[data-tab=' + tab + ']').parent().toggleClass('active', true);
- } else if (defNum!==undefined && defNum a');
- t.length && me.setTab(t.data('tab'));
+ } else {
+ me.setTab(deftab);
}
}
},
@@ -214,28 +228,40 @@ define([
},
onTabClick: function (e) {
- var _is_active = $(e.currentTarget).hasClass('active');
- if ( _is_active ) {
- if ( this.isFolded ) {
- // this.collapse();
+ var me = this;
+
+ var $target = $(e.currentTarget);
+ var tab = $target.find('> a[data-tab]').data('tab');
+ var islone = $target.hasClass('x-lone');
+ if ( me.isFolded ) {
+ if ( $target.hasClass('x-lone') ) {
+ me.collapse();
+ // me.fireEvent('')
+ } else
+ if ( $target.hasClass('active') ) {
+ me.collapse();
+ } else {
+ me.setTab(tab);
}
} else {
- var tab = $(e.target).data('tab');
- this.setTab(tab);
+ if ( !$target.hasClass('active') && !islone ) {
+ me.setTab(tab);
+ }
}
},
setTab: function (tab) {
+ var me = this;
if ( !tab ) {
- onShowFullviewPanel.call(this, false);
+ // onShowFullviewPanel.call(this, false);
if ( this.isFolded ) { this.collapse(); }
else tab = this.lastPanel;
}
if ( tab ) {
- this.$tabs.removeClass('active');
- this.$panels.removeClass('active');
+ me.$tabs.removeClass('active');
+ me.$panels.removeClass('active');
var panel = this.$panels.filter('[data-tab=' + tab + ']');
if ( panel.length ) {
@@ -244,10 +270,10 @@ define([
}
if ( panel.length ) {
- if ( this.isFolded ) this.expand();
+ if ( me.isFolded ) me.expand();
} else {
- onShowFullviewPanel.call(this, true);
- if ( this.isFolded ) this.collapse();
+ // onShowFullviewPanel.call(this, true);
+ if ( me.isFolded ) me.collapse();
}
var $tp = this.$tabs.find('> a[data-tab=' + tab + ']').parent();
diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js
index 326cf6784..d08a7b27b 100644
--- a/apps/documenteditor/main/app/controller/Toolbar.js
+++ b/apps/documenteditor/main/app/controller/Toolbar.js
@@ -364,7 +364,7 @@ define([
},
onChangeCompactView: function(view, compact) {
- this.toolbar.setFolded(compact, 1);
+ this.toolbar.setFolded(compact, this.appOptions.isEdit ? 'home' : 'plugins');
this.toolbar.fireEvent('view:compact', [this, compact]);
Common.localStorage.setBool('de-compact-toolbar', compact);
@@ -2741,6 +2741,7 @@ define([
onAppReady: function (config) {
var me = this;
+ me.appOptions = config;
if ( config.canCoAuthoring && config.canComments ) {
this.btnsComment = createButtonSet();
@@ -2791,7 +2792,11 @@ define([
},
onFileMenu: function (opts) {
- this.toolbar.setTab( opts == 'show' ? 'file' : undefined );
+ if ( opts == 'show' ) {}
+ else {
+ if ( this.toolbar.isTabActive('file') )
+ this.toolbar.setTab();
+ }
},
textEmptyImgUrl : 'You need to specify image URL.',
diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template
index 7c1ed23c5..3b15aed25 100644
--- a/apps/documenteditor/main/app/template/Toolbar.template
+++ b/apps/documenteditor/main/app/template/Toolbar.template
@@ -1,23 +1,8 @@