[DE] refactoring

This commit is contained in:
Maxim Kadushkin 2017-03-16 13:20:07 +03:00
parent 994212108f
commit b57830c9ab
5 changed files with 21 additions and 19 deletions

View file

@ -60,7 +60,9 @@ define([
var tab = {action: 'plugins', caption: 'Addons'};
var $panel = me.panelPlugins.getPanel();
toolbar.addTab(tab, $panel, 'review');
toolbar.addTab(tab, $panel, 4);
}
},
}
}
});

View file

@ -108,7 +108,7 @@ define([
var $panel = this.view.getPanel();
var toolbar = this.getApplication().getController('Toolbar').getView('Toolbar');
toolbar.addTab(tab, $panel, 'layout');
toolbar.addTab(tab, $panel, 3);
this.view.isReviewOnly = mode.isReviewOnly;
this.view.btnAccept.setDisabled(mode.isReviewOnly);

View file

@ -51,7 +51,7 @@ define([
], function (Backbone, headerTemplate) { 'use strict';
Common.Views.Header = Backbone.View.extend(_.extend(function(){
var storeUsers, mode;
var storeUsers, appConfig;
var $userList, $panelUsers, $btnUsers;
var templateUserItem =
@ -161,7 +161,7 @@ define([
.removeClass('dropdown-toggle')
.menu = false;
$panelUsers[(mode && !mode.isReviewOnly && mode.sharingSettingsUrl && mode.sharingSettingsUrl.length) ? 'show' : 'hide']();
$panelUsers[(appConfig && !appConfig.isReviewOnly && appConfig.sharingSettingsUrl && appConfig.sharingSettingsUrl.length) ? 'show' : 'hide']();
}
$btnUsers.find('.caption')

View file

@ -2333,11 +2333,11 @@ define([
this.api.asc_RemoveAllCustomStyles();
},
setTab: function (tab, panel) {
setTab: function (tab) {
$tabs.removeClass('active');
$panels.removeClass('active');
panel = $panels.filter('[data-tab=' + tab + ']');
var panel = $panels.filter('[data-tab=' + tab + ']');
if ( panel.length ) {
lastPanel = tab;
panel.addClass('active');
@ -2358,20 +2358,30 @@ define([
},
addTab: function (tab, panel, after) {
function _get_tab_action(index) {
if ( !config.tabs[index] )
return _get_tab_action(--index);
return config.tabs[index].action;
}
var _tplTab = '<li><a href="#" data-tab="<%= action %>" title="<%= caption %>"><%= caption %></a></li>';
config.tabs[after + 1] = tab;
var _after_action = _get_tab_action( after );
if ( $tabs ) {
// $tabs.find('a[data-tab=' + after + ']').parent()
// .after( _.template(_tpl, tab) );
} else {
var $toolbar = config.$dom;
var $el = $toolbar.find('.tabs a[data-tab=' + after + ']');
var $el = $toolbar.find('.tabs a[data-tab=' + _after_action + ']');
if ( $el.length ) {
$el.parent().after( _.template(_tplTab, tab));
if ( panel ) {
$el = $toolbar.find('.box-panels > .panel[data-tab=' + after + ']');
$el = $toolbar.find('.box-panels > .panel[data-tab=' + _after_action + ']');
if ( $el.length ) {
$el.after(panel);

View file

@ -30,17 +30,7 @@
align-items: stretch;
.extra {
&.left {
height: 42px;
background-color: @tabs-bg-color;
}
&.right {
min-width: 350px;
line-height: @height-tabs;
background-color: @tabs-bg-color;
}
background-color: @tabs-bg-color;
}
}