Feature #4082: New user input type in sunstone, text64

(cherry picked from commit c7e76eebdf)
This commit is contained in:
Carlos Martín committed 2015-10-30 11:00:41 +01:00
1 parent 45fdce84da
commit 8cb498b821
3 files changed
+33 -13

No files matched your search

@@ -171,6 +171,7 @@ define(function(require) {
'<td>' +
'<select class="user_input_type" >' +
'<option value="text">' + Locale.tr("text") + '</option>' +
'<option value="text64">' + Locale.tr("text (base64)") + '</option>' +
'<option value="password">' + Locale.tr("password") + '</option>' +
'</select>' +
'</td>' +
+25 -12
View File
@@ -87,8 +87,7 @@ define(function(require) {
network_attrs.push(attrs)
break;
case "text":
text_attrs.push(attrs)
break;
case "text64":
case "password":
text_attrs.push(attrs)
break;
@@ -154,16 +153,30 @@ define(function(require) {
div.append('<div class="instantiate_user_inputs"/>');
$.each(text_attrs, function(index, custom_attr) {
$(".instantiate_user_inputs", div).append(
'<div class="row">' +
'<div class="large-12 large-centered columns">' +
'<label>' +
TemplateUtils.htmlDecode(custom_attr.description) +
'<input type="' + custom_attr.type + '" wizard_field="' + custom_attr.name + '" required/>' +
'</label>' +
'</div>' +
'</div>');
});
var input;
switch (custom_attr.type) {
case "text":
input = '<textarea type="text" rows="1" wizard_field="' + custom_attr.name + '" required/>';
break;
case "text64":
input = '<textarea type="text" rows="1" wizard_field_64="true" wizard_field="' + custom_attr.name + '" required/>';
break;
case "password":
input = '<input type="password" wizard_field="' + custom_attr.name + '" required/>';
break;
}
$(".instantiate_user_inputs", div).append(
'<div class="row">' +
'<div class="large-12 large-centered columns">' +
'<label>' +
TemplateUtils.htmlDecode(custom_attr.description) +
input +
'</label>' +
'</div>' +
'</div>');
});
}
return (network_attrs.length > 0 || text_attrs.length > 0);
@@ -39,13 +39,19 @@ define(function(require) {
(field.attr("type") != "checkbox" || field.prop("checked")) &&
(field.attr("type") != "radio" || field.prop("checked"))) {
var field_name = field.attr('wizard_field');
templateJSON[field_name] = field.val();
if (field.attr('wizard_field_64') == "true"){
templateJSON[field_name] = btoa(field.val());
} else {
templateJSON[field_name] = field.val();
}
}
});
return templateJSON;
}
// TODO: wizard_field_64 for fill method
function _fillWizardFields(context, templateJSON) {
var fields = $('[wizard_field]', context);