Verified Commit 08c91113 authored by uncol's avatar uncol
Browse files

refactoring

parent 702ba116
Pipeline #8612 passed with stages
in 6 minutes and 27 seconds
...@@ -152,5 +152,37 @@ Ext.define("NOC.core.Application", { ...@@ -152,5 +152,37 @@ Ext.define("NOC.core.Application", {
// //
clearNavTabTooltip: function() { clearNavTabTooltip: function() {
NOC.app.app.clearActiveNavTabTooltip(); NOC.app.app.clearActiveNavTabTooltip();
},
//
toggleLeftToolbar: function() {
var me = this;
me.formLeftToolbar.removeAll(false);
if(me.small) {
Ext.each(me.additionButtons, function(btn) {
btn.setText(btn.config.text);
});
} else {
Ext.each(me.additionButtons, function(btn) {
btn.setText();
});
}
me.formLeftToolbar.add(me.additionButtons);
me.small = !me.small;
},
//
alignButtons: function(buttons) {
var acc = [];
Ext.each(buttons, function(btn) {
if(Ext.isFunction(btn.setTextAlign)) {
btn.setTextAlign("left");
btn.setText();
}
if(Ext.isFunction(btn.setTooltip) && !btn.tooltip && btn.config.text) {
btn.setTooltip(btn.config.text);
}
acc.push(btn);
});
return acc;
} }
}); });
...@@ -40,7 +40,6 @@ Ext.define("NOC.core.ModelApplication", { ...@@ -40,7 +40,6 @@ Ext.define("NOC.core.ModelApplication", {
helpId: undefined, helpId: undefined,
listHelpId: undefined, listHelpId: undefined,
formHelpId: undefined, formHelpId: undefined,
// iconSize: 26,
// //
navTooltipTemplate: new Ext.XTemplate( navTooltipTemplate: new Ext.XTemplate(
'<tpl if="data.name">', '<tpl if="data.name">',
...@@ -725,20 +724,21 @@ Ext.define("NOC.core.ModelApplication", { ...@@ -725,20 +724,21 @@ Ext.define("NOC.core.ModelApplication", {
overflowHandler: "Menu" overflowHandler: "Menu"
}, },
items: me.applyPermissions(formToolbar) items: me.applyPermissions(formToolbar)
}, me.formButtonToolbar] }, me.formLeftToolbar]
}, },
getDefaultFocus: function() { getDefaultFocus: function() {
return focusField; return focusField;
} }
}); });
if(me.formToolbar && me.formToolbar.length) { if(me.formToolbar && me.formToolbar.length) {
me.formButtonToolbar = Ext.create({ me.additionButtons = me.alignButtons(me.applyPermissions(me.formToolbar), true);
me.formLeftToolbar = Ext.create({
xtype: "toolbar", xtype: "toolbar",
dock: "left", dock: "left",
// width: me.iconSize, items: me.additionButtons
items: me.alignButton(me.applyPermissions(me.formToolbar))
}); });
me.formPanel.getRefItems()[0].addDocked(me.formButtonToolbar); me.formPanel.getRefItems()[0].addDocked(me.formLeftToolbar);
me.small = true;
} }
me.form = me.formPanel.items.first().getForm(); me.form = me.formPanel.items.first().getForm();
// detect autofocus field // detect autofocus field
...@@ -1974,52 +1974,5 @@ Ext.define("NOC.core.ModelApplication", { ...@@ -1974,52 +1974,5 @@ Ext.define("NOC.core.ModelApplication", {
html: element.tooltip html: element.tooltip
}); });
} }
},
//
toggleLeftToolbar: function() {
var me = this, text;
Ext.each(me.formButtonToolbar.items.items, function(btn) {
text = btn.getText();
if(btn._hideText) {
btn.setText(btn._text);
btn._hideText = false;
console.log('show');
} else {
// btn.setText();
btn._hideText = true;
console.log('hide');
}
});
// for(var i = 0; i < me.formButtonToolbar.items.items; i++) {
// if(!me.formButtonToolbar.items.items[i]._text){
// me.formButtonToolbar.items.items[i].setText();
// } else {
// me.formButtonToolbar.items.items[i].setText(btn._text);
// }
// }
// quickly by time
// if(me.formButtonToolbar.getWidth() === me.iconSize) {
// me.formButtonToolbar.setWidth("100%");
// } else {
// me.formButtonToolbar.setWidth(me.iconSize);
// }
},
//
alignButton: function(buttons) {
var acc = [];
Ext.each(buttons, function(btn) {
if(Ext.isFunction(btn.setTextAlign)) {
btn.setTextAlign("left");
btn._text = btn.getText();
btn._hideText = true;
btn.setText();
}
if(Ext.isFunction(btn.setTooltip) && !btn.tooltip && btn._text) {
btn.setTooltip(btn._text);
}
acc.push(btn);
});
return acc;
} }
}); });
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment