fix readonly buttons were clickable: ignoring now click and add/remove et2_clickable (temp. also changing cursor: default/pointer, as et2_button sets cursor: pointer)

This commit is contained in:
Ralf Becker 2014-02-13 18:41:04 +00:00
parent c5d1cc8cd1
commit 551dff28e3

View File

@ -222,6 +222,24 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM],
{
this.update_image();
}
// dont show readonly buttons as clickable
if (this.btn || this.image)
{
(this.btn || this.image)
.toggleClass('et2_clickable', !_ro)
.css('cursor', _ro ? 'default' : 'pointer'); // temp. 'til it is removed from et2_button
}
}
},
attachToDOM: function() {
this._super.apply(this, arguments);
if (this.options.readonly)
{
(this.btn || this.image)
.removeClass('et2_clickable')
.css('cursor', 'default'); // temp. 'til it is removed from et2_button
}
},
@ -236,6 +254,9 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM],
* @returns {Boolean}
*/
click: function(_ev) {
// ignore click on readonly button
if (this.options.readonly) return false;
this.clicked = true;
if (!this._super.apply(this, arguments))