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