Applied QA to match Zammad code style.

This commit is contained in:
Thorsten Eckel 2017-09-07 14:24:58 +02:00
parent 3a2a34e064
commit fae4809fc7

View file

@ -26,6 +26,7 @@ $(function() {
tag: 'input',
type: 'text',
placeholder: 'Your Name',
defaultValue: '',
},
{
display: 'Email',
@ -33,12 +34,14 @@ $(function() {
tag: 'input',
type: 'email',
placeholder: 'Your Email',
defaultValue: function () {return User.email;},
},
{
display: 'Message',
name: 'body',
tag: 'textarea',
placeholder: 'Your Message...',
defaultValue: '',
rows: 7,
},
{
@ -73,23 +76,23 @@ $(function() {
name: 'name',
tag: 'input',
type: 'text',
value: '',
placeholder: 'Your Name',
defaultValue: '',
},
{
display: 'Email',
name: 'email',
tag: 'input',
type: 'email',
value: '',
placeholder: 'Your Email',
defaultValue: '',
},
{
display: 'Message',
name: 'body',
tag: 'textarea',
placeholder: 'Your Message...',
value: '',
defaultValue: '',
rows: 7,
},
],
@ -363,14 +366,14 @@ $(function() {
$form.append('<h2>' + this.options.messageTitle + '</h2>')
}
$.each(this.options.attributes, function(index, value) {
var item = $('<div class="form-group"><label>' + _this.T(value.display) + '</label></div>')
var _defaultValue = (typeof value.value === 'function') ? value.value() : value.value;
var item = $('<div class="form-group"><label>' + _this.T(value.display) + '</label></div>');
var defaultValue = (typeof value.defaultValue === 'function') ? value.defaultValue() : value.defaultValue;
for (var i=0; i < (value.repeat ? value.repeat : 1); i++) {
if (value.tag == 'input') {
item.append('<input class="form-control" name="' + value.name + '" type="' + value.type + '" placeholder="' + _this.T(value.placeholder) + '" value="' + (_defaultValue || '') + '">')
item.append('<input class="form-control" name="' + value.name + '" type="' + value.type + '" placeholder="' + _this.T(value.placeholder) + '" value="' + (defaultValue || '') + '">')
}
else if (value.tag == 'textarea') {
item.append('<textarea class="form-control" name="' + value.name + '" placeholder="' + _this.T(value.placeholder) + '" rows="' + value.rows + '">' + (_defaultValue || '') + '</textarea>')
item.append('<textarea class="form-control" name="' + value.name + '" placeholder="' + _this.T(value.placeholder) + '" rows="' + value.rows + '">' + (defaultValue || '') + '</textarea>')
}
}
$form.append(item)