From e1799cac7d209dbe8f68586406775998b6323400 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Oct 2014 10:46:24 +0000 Subject: [PATCH] * all apps: custom fields of type "float" allow to specify maxlength,size,min,max comma-separated in length field --- etemplate/js/et2_extension_customfields.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_extension_customfields.js b/etemplate/js/et2_extension_customfields.js index bf05e29cc1..c55dec5da1 100644 --- a/etemplate/js/et2_extension_customfields.js +++ b/etemplate/js/et2_extension_customfields.js @@ -416,6 +416,22 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput } return true; }, + _setup_float: function(field_name, field, attrs) { + // No label on the widget itself + delete(attrs.label); + + field.type = 'float'; + + if(field.len) + { + var size = field.len.split(','); + attrs.maxlength = size[0]; + attrs.size = size.length > 1 && size[1] !== '' ? size[1] : size[0]; + if (size.length > 2 && size[2] !== '') attrs.min = size[2]; + if (size.length > 3 && size[3] !== '') attrs.max = size[3]; + } + return true; + }, _setup_select: function(field_name, field, attrs) { // No label on the widget itself delete(attrs.label); @@ -486,7 +502,7 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput delete(attrs.label); attrs.label = field.label; - + // Simple case, one widget for a custom field if(Object.keys(field.values).length == 1) {