refactoring

This commit is contained in:
Maxim Kadushkin 2017-08-30 15:23:22 +03:00
parent fe462bd08b
commit e4881516ba
4 changed files with 64 additions and 32 deletions

View file

@ -108,6 +108,7 @@ define([
$scrollR.on('click', onScrollTabs.bind(this, 'right'));
$boxTabs.on('dblclick', '> .ribtab', onTabDblclick.bind(this));
$boxTabs.on('click', '> .ribtab', me.onTabClick.bind(this));
},
isTabActive: function(tag) {
@ -164,6 +165,12 @@ define([
// clearTimeout(optsFold.timer);
optsFold.$bar.removeClass('folded');
optsFold.$box.off();
var active_panel = optsFold.$box.find('.panel.active');
if ( active_panel.length ) {
var tab = active_panel.data('tab');
me.$tabs.find('> a[data-tab=' + tab + ']').parent().toggleClass('active', true);
}
}
},
@ -194,6 +201,18 @@ define([
}
},
onTabClick: function (e) {
var _is_active = $(e.currentTarget).hasClass('active');
if ( _is_active ) {
if ( this.isFolded ) {
// this.collapse();
}
} else {
var tab = $(e.target).data('tab');
this.setTab(tab);
}
},
setTab: function (tab) {
if ( !tab ) {
onShowFullviewPanel.call(this, false);

View file

@ -1187,17 +1187,6 @@ define([
this.needShowSynchTip = false;
/** coauthoring end **/
me.$tabs.parent().on('click', '.ribtab', function (e) {
var tab = $(e.target).data('tab');
if (tab == 'file') {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
me.setTab(tab);
});
Common.NotificationCenter.on({
'window:resize': function() {
Common.UI.Mixtbar.prototype.onResize.apply(me, arguments);
@ -1223,6 +1212,21 @@ define([
return this;
},
onTabClick: function (e) {
var tab = $(e.target).data('tab'),
me = this;
if ( !me.isTabActive(tab) ) {
if ( tab == 'file' ) {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
}
Common.UI.Mixtbar.prototype.onTabClick.apply(me, arguments);
},
rendererComponents: function (html) {
var $host = $(html);
var _injectComponent = function (id, cmp) {

View file

@ -931,16 +931,6 @@ define([
this.fireEvent('render:after', [this]);
Common.UI.Mixtbar.prototype.afterRender.call(this);
me.$tabs.parent().on('click', '.ribtab', function (e) {
var tab = $(e.target).data('tab');
if (tab == 'file') {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
me.setTab(tab);
});
Common.NotificationCenter.on({
'window:resize': function() {
@ -955,6 +945,21 @@ define([
return this;
},
onTabClick: function (e) {
var tab = $(e.target).data('tab'),
me = this;
if ( !me.isTabActive(tab) ) {
if ( tab == 'file' ) {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
}
Common.UI.Mixtbar.prototype.onTabClick.apply(this, arguments);
},
rendererComponents: function (html) {
var $host = $(html);
var _injectComponent = function (id, cmp) {

View file

@ -1259,17 +1259,6 @@ define([
this.fireEvent('render:after', [this]);
Common.UI.Mixtbar.prototype.afterRender.call(this);
me.$tabs.parent().on('click', '.ribtab', function (e) {
var tab = $(e.target).data('tab');
if (tab == 'file') {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
me.setTab(tab);
});
Common.NotificationCenter.on({
'window:resize': function() {
Common.UI.Mixtbar.prototype.onResize.apply(me, arguments);
@ -1283,6 +1272,21 @@ define([
return this;
},
onTabClick: function (e) {
var tab = $(e.target).data('tab'),
me = this;
if ( !me.isTabActive(tab) ) {
if ( tab == 'file' ) {
me.fireEvent('file:open');
} else
if ( me.isTabActive('file') )
me.fireEvent('file:close');
}
Common.UI.Mixtbar.prototype.onTabClick.apply(this, arguments);
},
rendererComponents: function(html) {
var $host = $(html);
var _injectComponent = function (id, cmp) {