Followup for issue #584 - Return ticket data on form submission - added T# to form widget.

This commit is contained in:
Martin Edenhofer 2017-01-09 14:33:09 +01:00
parent b213ae689b
commit 4601993a15
2 changed files with 9 additions and 5 deletions

View file

@ -35,7 +35,7 @@
<label for="form-message-thank-you"><%- @T('Message after sending form') %></label>
</div>
<div class="controls">
<textarea type="text" id="form-message-thank-you" name="messageThankYou" rows="3"><%- @Ti('Thank you for your inquiry! We\'ll contact you soon as possible.') %></textarea>
<textarea type="text" id="form-message-thank-you" name="messageThankYou" rows="3"><%- @Ti('Thank you for your inquiry (#%s)! We\'ll contact you soon as possible.') %></textarea>
</div>
</div>
</fieldset>

View file

@ -13,7 +13,7 @@ $(function() {
$('#feedback-form').ZammadForm({
messageTitle: 'Feedback Form', // optional
messageSubmit: 'Submit', // optional
messageThankYou: 'Thank you for your inquiry! We\'ll contact you soon as possible.', // optional
messageThankYou: 'Thank you for your inquiry (#%s)! We\'ll contact you soon as possible.', // optional
messageNoConfig: 'Unable to load form config from server. Maybe featrue is disabled.', // optional
showTitle: true,
lang: 'de', // optional, <html lang="xx"> will be used per default
@ -237,7 +237,7 @@ $(function() {
}
// ticket has been created
_this.thanks()
_this.thanks(data)
}).fail(function() {
_this.$form.find('button').prop('disabled', false)
@ -336,8 +336,12 @@ $(function() {
}
// thanks
Plugin.prototype.thanks = function(e) {
var message = $('<div class="js-thankyou">' + this.options.messageThankYou + '</div>')
Plugin.prototype.thanks = function(data) {
var thankYou = this.options.messageThankYou
if (data.ticket && data.ticket.number) {
thankYou = thankYou.replace('%s', data.ticket.number)
}
var message = $('<div class="js-thankyou">' + thankYou + '</div>')
this.$form.html(message)
}