From 2695dcebe5a85678c851b7b358d953495cd59fe5 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 22 May 2014 12:03:25 -0500 Subject: [PATCH] Canceling implies deleting saved drafts --- include/client/open.inc.php | 10 ++++++++-- include/staff/ticket-open.inc.php | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/client/open.inc.php b/include/client/open.inc.php index afe0b261a..26b6d30ed 100644 --- a/include/client/open.inc.php +++ b/include/client/open.inc.php @@ -94,7 +94,13 @@ if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) { <hr/> <p style="text-align:center;"> <input type="submit" value="Create Ticket"> - <input type="reset" value="Reset"> - <input type="button" value="Cancel" onClick='window.location.href="index.php"'> + <input type="reset" name="reset" value="Reset"> + <input type="button" name="cancel" value="Cancel" onclick="javascript: + $('.richtext').each(function() { + var redactor = $(this).data('redactor'); + if (redactor && redactor.opts.draftDelete) + redactor.deleteDraft(); + }); + window.location.href='index.php';"> </p> </form> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index dbf2180e3..d14f7e98e 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -373,10 +373,17 @@ if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) { </tr> </tbody> </table> -<p style="padding-left:250px;"> +<p style="text-align:center;"> <input type="submit" name="submit" value="Open"> <input type="reset" name="reset" value="Reset"> - <input type="button" name="cancel" value="Cancel" onclick='window.location.href="tickets.php"'> + <input type="button" name="cancel" value="Cancel" onclick="javascript: + $('.richtext').each(function() { + var redactor = $(this).data('redactor'); + if (redactor && redactor.opts.draftDelete) + redactor.deleteDraft(); + }); + window.location.href='tickets.php'; + "> </p> </form> <script type="text/javascript"> -- GitLab