508 Fixes

Addresses #1021 mostly by adding label tags, generating unique element
ids as needed.

In the process, moved the label text that gets set in the
___ContentTypeView.js files to the respective handlebar templates; the
text was static as far as I could tell.

There are additional minor 508 improvements that can be made with the
tables (scope tags, header attributes)
This commit is contained in:
Joe Wolf
2015-05-15 11:16:50 -04:00
parent b5039b28b0
commit 488611a4ff
15 changed files with 40 additions and 45 deletions

View File

@@ -7,7 +7,7 @@ Handlebars.registerHelper('sanitize', function(html) {
});
Handlebars.registerHelper('renderTextParam', function(param) {
var result, type = 'text';
var result, type = 'text', idAtt = '';
var isArray = param.type.toLowerCase() === 'array' || param.allowMultiple;
var defaultValue = isArray && Array.isArray(param.default) ? param.default.join('\n') : param.default;
@@ -16,11 +16,15 @@ Handlebars.registerHelper('renderTextParam', function(param) {
}
if(param.format && param.format === 'password') {
type = 'password';
type = 'password';
}
if(param.valueId) {
idAtt = ' id=\'' + param.valueId + '\'';
}
if(isArray) {
result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + param.name + '\'';
result = '<textarea class=\'body-textarea' + (param.required ? ' required' : '') + '\' name=\'' + param.name + '\'' + idAtt;
result += ' placeholder=\'Provide multiple values in new lines' + (param.required ? ' (at least one required).' : '.') + '\'>';
result += defaultValue + '</textarea>';
} else {
@@ -29,7 +33,7 @@ Handlebars.registerHelper('renderTextParam', function(param) {
parameterClass += ' required';
}
result = '<input class=\'' + parameterClass + '\' minlength=\'' + (param.required ? 1 : 0) + '\'';
result += ' name=\'' + param.name +'\' placeholder=\'' + (param.required ? '(required)' : '') + '\'';
result += ' name=\'' + param.name +'\' placeholder=\'' + (param.required ? '(required)' : '') + '\'' + idAtt;
result += ' type=\'' + type + '\' value=\'' + defaultValue + '\'/>';
}
return new Handlebars.SafeString(result);