Hide Plugins tab when no plugins. Hide Review tab when no buttons on this tab (for the future).
This commit is contained in:
parent
20ea8595ba
commit
8cce90d8f0
|
@ -92,6 +92,10 @@ define([
|
|||
|
||||
config.tabs = options.tabs;
|
||||
$(document.body).on('click', onClickDocument.bind(this));
|
||||
|
||||
Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){
|
||||
this.setVisible(action, visible)
|
||||
}, this));
|
||||
},
|
||||
|
||||
afterRender: function() {
|
||||
|
@ -253,7 +257,7 @@ define([
|
|||
return config.tabs[index].action;
|
||||
}
|
||||
|
||||
var _tabTemplate = _.template('<li class="ribtab"><div class="tab-bg" /><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
|
||||
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><div class="tab-bg" /><a href="#" data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
|
||||
|
||||
config.tabs[after + 1] = tab;
|
||||
var _after_action = _get_tab_action(after);
|
||||
|
@ -315,6 +319,11 @@ define([
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
setVisible: function (tab, visible) {
|
||||
if ( tab && this.$tabs )
|
||||
this.$tabs.find('> a[data-tab=' + tab + ']').parent().css('display', visible ? '' : 'none');
|
||||
}
|
||||
};
|
||||
}()));
|
||||
|
|
|
@ -57,6 +57,8 @@ define([
|
|||
this.addListeners({
|
||||
'Toolbar': {
|
||||
'render:before' : function (toolbar) {
|
||||
me.toolbar = toolbar;
|
||||
|
||||
var appOptions = me.getApplication().getController('Main').appOptions;
|
||||
|
||||
if ( appOptions.isEdit && !appOptions.isEditMailMerge && !appOptions.isEditDiagram ) {
|
||||
|
@ -173,6 +175,8 @@ define([
|
|||
arr.push(plugin);
|
||||
});
|
||||
this.api.asc_pluginsRegister('', arr);
|
||||
if (this.toolbar && storePlugins.length>0)
|
||||
this.toolbar.setVisible('plugins', true);
|
||||
},
|
||||
|
||||
onAddPlugin: function (model) {
|
||||
|
|
|
@ -662,6 +662,8 @@ define([
|
|||
me.btnDocLang.updateHint(me.tipSetDocLang);
|
||||
me.btnSetSpelling.updateHint(me.tipSetSpelling);
|
||||
|
||||
Common.NotificationCenter.trigger('tab:visible', 'review', true);
|
||||
|
||||
setEvents.call(me);
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue