From 4601993a15b7b322176747b8d1dc0e04ed2e51c5 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 9 Jan 2017 14:33:09 +0100 Subject: [PATCH] Followup for issue #584 - Return ticket data on form submission - added T# to form widget. --- .../javascripts/app/views/channel/form.jst.eco | 2 +- public/assets/form/form.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/app/views/channel/form.jst.eco b/app/assets/javascripts/app/views/channel/form.jst.eco index 538339b01..357d26892 100644 --- a/app/assets/javascripts/app/views/channel/form.jst.eco +++ b/app/assets/javascripts/app/views/channel/form.jst.eco @@ -35,7 +35,7 @@
- +
diff --git a/public/assets/form/form.js b/public/assets/form/form.js index cbb655f1d..29f275a85 100644 --- a/public/assets/form/form.js +++ b/public/assets/form/form.js @@ -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, 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 = $('
' + this.options.messageThankYou + '
') + 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 = $('
' + thankYou + '
') this.$form.html(message) }