Commit 5d1868bb by Ashutosh Mestry Committed by Madhan Neethiraj

ATLAS-2227: UI fix to allow "." in float/double values for tag attributes

parent ea52e1f3
...@@ -98,6 +98,11 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq ...@@ -98,6 +98,11 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
} }
} }
}); });
$('body').on('keypress', 'input.number-input-exponential,.number-input-exponential .select2-search__field', function(e) {
if ((e.which != 8 && e.which != 0) && (e.which < 48 || e.which > 57) && (e.which != 69 && e.which != 101 && e.which != 43 && e.which != 45 && e.which != 46 && e.which != 190)) {
return false;
}
});
// For placeholder support // For placeholder support
if (!('placeholder' in HTMLInputElement.prototype)) { if (!('placeholder' in HTMLInputElement.prototype)) {
......
...@@ -281,7 +281,7 @@ define(['require', ...@@ -281,7 +281,7 @@ define(['require',
'<select class="form-control attributeInputVal attrName" data-key="' + name + '">' + str + '</select></div>'); '<select class="form-control attributeInputVal attrName" data-key="' + name + '">' + str + '</select></div>');
} else { } else {
var textElement = that.getElement(name, typeName); var textElement = that.getElement(name, typeName);
that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + textElement); that.ui.tagAttribute.append('<div class="form-group"><label>' + name + '</label>' + ' (' + typeName + ')' + textElement + '</div>');
} }
}); });
that.$('input[data-type="date"]').each(function() { that.$('input[data-type="date"]').each(function() {
...@@ -312,15 +312,20 @@ define(['require', ...@@ -312,15 +312,20 @@ define(['require',
}, },
getElement: function(labelName, typeName) { getElement: function(labelName, typeName) {
var value = this.tagModel && this.tagModel.attributes ? (this.tagModel.attributes[labelName] || "") : "", var value = this.tagModel && this.tagModel.attributes ? (this.tagModel.attributes[labelName] || "") : "",
className = ((typeName === "int" || typeName === "long" || typeName === "float" || typeName === "byte" || typeName === "double" || typeName === "short") ? "number-input-negative" : "") + " form-control attributeInputVal attrName"; isTypeNumber = typeName === "int" || typeName === "byte" || typeName === "short" || typeName === "double" || typeName === "float",
inputClassName = "form-control attributeInputVal attrName";
if (isTypeNumber) {
inputClassName += ((typeName === "int" || typeName === "byte" || typeName === "short") ? " number-input-negative" : " number-input-exponential");
}
if (typeName === "boolean") { if (typeName === "boolean") {
return '<select class="form-control attributeInputVal attrName" data-key="' + labelName + '" data-type="' + typeName + '"> ' + return '<select class="form-control attributeInputVal attrName" data-key="' + labelName + '" data-type="' + typeName + '"> ' +
'<option value="">--Select true or false--</option>' + '<option value="">--Select true or false--</option>' +
'<option value="true">true</option>' + '<option value="true">true</option>' +
'<option value="false">false</option></select>'; '<option value="false">false</option></select>';
} else { } else {
return '<input type="text" value="' + value + '" class="' + className + '" data-key="' + labelName + '" data-type="' + typeName + '"></input></div>'; return '<input type="text" value="' + value + '" class="' + inputClassName + '" data-key="' + labelName + '" data-type="' + typeName + '"/>';
} }
}, },
saveTagData: function(options) { saveTagData: function(options) {
var that = this; var that = this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment