Skip to content

Commit d654f7a

Browse files
committed
Refactor WorkbookHeaderPanel to make it easier to extend
1 parent 01f9e32 commit d654f7a

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

laboratory/resources/web/laboratory/panel/WorkbookHeaderPanel.js

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,49 @@
66
*/
77
Ext4.define('Laboratory.panel.WorkbookHeaderPanel', {
88
extend: 'LDK.panel.WebpartPanel',
9+
panelTitle: 'Details',
10+
911
initComponent: function(){
1012
Ext4.apply(this, {
11-
title: 'Details',
13+
title: this.panelTitle,
1214
defaults: {
1315
border: false
1416
},
15-
items: [{
16-
html: 'Description:',
17-
style: 'font-weight: bold;'
18-
},
19-
this.getFieldCfg('description', this.description)
20-
,{
21-
html: 'Materials:',
22-
style: 'font-weight: bold;padding-top: 10px;'
23-
},
24-
this.getFieldCfg('materials', this.materials)
25-
,{
26-
html: 'Methods:',
27-
style: 'font-weight: bold;padding-top: 10px;'
28-
},
29-
this.getFieldCfg('methods', this.methods)
30-
,{
31-
html: 'Results:',
32-
style: 'font-weight: bold;padding-top: 10px;'
33-
},
34-
this.getFieldCfg('results', this.results)
35-
,{
36-
html: 'Tags:',
37-
style: 'font-weight: bold;padding-top: 10px;'
38-
},
39-
this.getTagFieldCfg()
40-
]
17+
items: this.getPanelItems()
4118
});
4219

4320
this.callParent(arguments);
4421
},
4522

23+
getPanelItems: function() {
24+
return [{
25+
html: 'Description:',
26+
style: 'font-weight: bold;'
27+
},
28+
this.getFieldCfg('description', this.description)
29+
,{
30+
html: 'Materials:',
31+
style: 'font-weight: bold;padding-top: 10px;'
32+
},
33+
this.getFieldCfg('materials', this.materials)
34+
,{
35+
html: 'Methods:',
36+
style: 'font-weight: bold;padding-top: 10px;'
37+
},
38+
this.getFieldCfg('methods', this.methods)
39+
,{
40+
html: 'Results:',
41+
style: 'font-weight: bold;padding-top: 10px;'
42+
},
43+
this.getFieldCfg('results', this.results)
44+
,{
45+
html: 'Tags:',
46+
style: 'font-weight: bold;padding-top: 10px;'
47+
},
48+
this.getTagFieldCfg()
49+
];
50+
},
51+
4652
getTagFieldCfg: function(){
4753
var cfg = {
4854
layout: 'hbox',

0 commit comments

Comments
 (0)