From bfac67cc174cb0cb98a07213e7cde9e34c58ef28 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 24 Mar 2014 18:43:45 +0000 Subject: [PATCH] fixed et2_number was not reacting on size attribute --- etemplate/js/et2_widget_number.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/etemplate/js/et2_widget_number.js b/etemplate/js/et2_widget_number.js index d81f99b73d..30bbf54320 100644 --- a/etemplate/js/et2_widget_number.js +++ b/etemplate/js/et2_widget_number.js @@ -70,6 +70,27 @@ var et2_number = et2_textbox.extend( this.setDOMNode(this.input[0]); }, + /** + * Set input widget size + * + * Overwritten from et2_textbox as input type=number seems to ignore size, + * therefore we set width in em instead, if not et2_fullWidth given. + * + * @param _size Rather arbitrary size units, approximately characters + */ + set_size: function(_size) { + if (typeof _size != 'undefined' && _size != this.input.attr("size")) + { + this.size = _size; + this.input.attr("size", this.size); + + if (typeof this.options.class == 'undefined' || this.options.class.search('et2_fullWidth') == -1) + { + this.input.css('width', _size+'em'); + } + } + }, + set_min: function(_value) { this.min = _value; if(this.min == null) {