fix bug in Sonia.util.Link

This commit is contained in:
Sebastian Sdorra
2011-06-15 08:56:16 +02:00
parent b7cfe3a14b
commit 7f2bcacead
3 changed files with 18 additions and 28 deletions

View File

@@ -69,12 +69,8 @@ Sonia.repository.ExtendedInfoPanel = Ext.extend(Sonia.repository.InfoPanel,{
xtype: 'link', xtype: 'link',
colspan: 2, colspan: 2,
text: this.repositoryBrowserText, text: this.repositoryBrowserText,
listeners: { handler: this.openRepositoryBrowser,
click: { scope: this
fn: this.openRepositoryBrowser,
scope: this
}
}
}; };
}, },

View File

@@ -143,12 +143,8 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, {
xtype: 'link', xtype: 'link',
colspan: 2, colspan: 2,
text: this.changesetViewerText, text: this.changesetViewerText,
listeners: { handler: this.openChangesetViewer,
click: { scope: this
fn: this.openChangesetViewer,
scope: this
}
}
}; };
}, },

View File

@@ -31,27 +31,25 @@
Sonia.util.Link = Ext.extend(Ext.BoxComponent, { Sonia.util.Link = Ext.extend(Ext.BoxComponent, {
handler: null,
scope: null,
constructor: function(config) { constructor: function(config) {
config = config || {}; config = config || {};
config.xtype = 'box'; config.xtype = 'box';
config.autoEl = { tag: 'a', html: config.text, href: '#' }; config.autoEl = { tag: 'a', html: config.text, href: '#' };
Sonia.util.Link.superclass.constructor.apply(this, arguments); config.listeners = {
this.addEvents({ render: function(c) {
'click': true, c.getEl().on('click', function(){
'mouseover': true, if (this.handler){
'blur': true this.scope ? this.handler.call(this.scope) : this.handler();
}); }
this.text = config.text; }, this);
}, }
onRender: function() {
theLnk = this;
this.constructor.superclass.onRender.apply(this, arguments);
if (!theLnk.disabled) {
this.el.on('blur', function(e) { theLnk.fireEvent('blur'); });
this.el.on('click', function(e) { theLnk.fireEvent('click'); });
this.el.on('mouseover', function(e) { theLnk.fireEvent('mouseover'); });
} }
Sonia.util.Link.superclass.constructor.apply(this, arguments);
this.text = config.text;
} }
}); });