From 87665b089e224e185fbe6d2f0860f073f707d82f Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 20 Apr 2015 16:15:17 -0500
Subject: [PATCH] templates: Add typeahead to thank-you pages

---
 include/ajax.content.php   | 1 +
 include/staff/page.inc.php | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/include/ajax.content.php b/include/ajax.content.php
index 536b4d48f..fb5b49540 100644
--- a/include/ajax.content.php
+++ b/include/ajax.content.php
@@ -209,6 +209,7 @@ class ContentAjaxAPI extends AjaxController {
             Http::response(400, '`root` is required parameter');
 
         switch ($_GET['root']) {
+        case 'thank-you':
         case 'cannedresponse':
             $roots = array('ticket');
             break;
diff --git a/include/staff/page.inc.php b/include/staff/page.inc.php
index 6326500ab..ea373533c 100644
--- a/include/staff/page.inc.php
+++ b/include/staff/page.inc.php
@@ -145,6 +145,7 @@ if ($page && count($langs) > 1) { ?>
             lang="<?php echo $cfg->getPrimaryLanguage(); ?>">
         <textarea name="body" cols="21" rows="12" style="width:100%" class="richtext draft"
 <?php
+    if (!$info['type'] || $info['type'] == 'thank-you') echo 'data-root-context="thank-you"';
     list($draft, $attrs) = Draft::getDraftAndDataAttrs('page', $info['id'], $info['body']);
     echo $attrs; ?>><?php echo $draft ?: $info['body']; ?></textarea>
         </div>
@@ -156,6 +157,7 @@ if ($page && count($langs) > 1) { ?>
         <div id="translation-<?php echo $tag; ?>" class="tab_content"
             style="display:none;" lang="<?php echo $tag; ?>">
         <textarea name="trans[<?php echo $tag; ?>][body]" cols="21" rows="12"
+<?php if ($info['type'] == 'thank-you') echo 'data-root-context="thank-you"'; ?>
             style="width:100%" class="richtext draft"
 <?php
     list($draft, $attrs) = Draft::getDraftAndDataAttrs('page', $info['id'].'.'.$tag, $info['trans'][$tag]);
-- 
GitLab