From 6a73a33898c38e994598253bb9e8b52bae4c898f Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 7 Apr 2011 21:43:32 +0200 Subject: [PATCH] added Sonia.util.Link --- .../main/webapp/resources/js/sonia.util.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.util.js b/scm-webapp/src/main/webapp/resources/js/sonia.util.js index 1915436b49..0b7c3fd5dd 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.util.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.util.js @@ -110,3 +110,38 @@ } }); + +Ext.ns('Sonia.util'); + +// link + +Sonia.util.Link = Ext.extend(Ext.BoxComponent, { + + constructor: function(config) { + config = config || {}; + config.xtype = 'box'; + config.autoEl = { tag: 'a', html: config.text, href: '#' }; + Sonia.util.Link.superclass.constructor.apply(this, arguments); + this.addEvents({ + 'click': true, + 'mouseover': true, + 'blur': true + }); + this.text = config.text; + }, + + 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'); }); + } + } + +}); + +// register xtype + +Ext.reg('link', Sonia.util.Link); \ No newline at end of file