From 4decaeca904dc1ff73885f6aec761a1633c597d7 Mon Sep 17 00:00:00 2001 From: aydreeihn <adriane@enhancesoft.com> Date: Thu, 26 Jul 2018 11:02:23 -0500 Subject: [PATCH] Web Portal Fixes: - Add space between column headers and sort arrow - Fix sorting by 'Subject' column - Fix redactor issues with 'Reset' button - Make sure text within redactor is cleared correctly - Make sure we don't keep attachments if Reset - Make sure redactor is reinitialized where needed --- include/client/tickets.inc.php | 10 +++++----- js/redactor-osticket.js | 27 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/include/client/tickets.inc.php b/include/client/tickets.inc.php index fab773d8e..99fb7a329 100644 --- a/include/client/tickets.inc.php +++ b/include/client/tickets.inc.php @@ -201,19 +201,19 @@ if ($closedTickets) {?> <thead> <tr> <th nowrap> - <a href="tickets.php?sort=ID&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Ticket ID"><?php echo __('Ticket #');?><i class="icon-sort"></i></a> + <a href="tickets.php?sort=ID&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Ticket ID"><?php echo __('Ticket #');?> <i class="icon-sort"></i></a> </th> <th width="120"> - <a href="tickets.php?sort=date&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Date"><?php echo __('Create Date');?><i class="icon-sort"></i></a> + <a href="tickets.php?sort=date&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Date"><?php echo __('Create Date');?> <i class="icon-sort"></i></a> </th> <th width="100"> - <a href="tickets.php?sort=status&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Status"><?php echo __('Status');?><i class="icon-sort"></i></a> + <a href="tickets.php?sort=status&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Status"><?php echo __('Status');?> <i class="icon-sort"></i></a> </th> <th width="320"> - <a href="tickets.php?sort=subj&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Subject"><?php echo __('Subject');?><i class="icon-sort"></i></a> + <a href="tickets.php?sort=subject&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Subject"><?php echo __('Subject');?> <i class="icon-sort"></i></a> </th> <th width="120"> - <a href="tickets.php?sort=dept&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Department"><?php echo __('Department');?><i class="icon-sort"></i></a> + <a href="tickets.php?sort=dept&order=<?php echo $negorder; ?><?php echo $qstr; ?>" title="Sort By Department"><?php echo __('Department');?> <i class="icon-sort"></i></a> </th> </tr> </thead> diff --git a/js/redactor-osticket.js b/js/redactor-osticket.js index 23a30fc29..da4b1c203 100644 --- a/js/redactor-osticket.js +++ b/js/redactor-osticket.js @@ -94,6 +94,7 @@ RedactorPlugins.draft = function() { // No change yet — dont't show the button return; } + this.$box.find('textarea').attr('data-draft-id', this.opts.draftId); if (data && this.code.get()) { this.$draft_saved.show().delay(5000).fadeOut(); } @@ -290,10 +291,20 @@ $(function() { var reset = $('input[type=reset]', el.closest('form')); if (reset) { reset.click(function() { - if (el.hasClass('draft')) - el.redactor('deleteDraft'); - else - el.redactor('set', '', false, false); + var file = $('.file'); + if (file) + file.remove(); + if (el.attr('data-draft-id')) + el.redactor('draft.deleteDraft').attr('data-draft-id', ''); + else { + try { + el.redactor('insert.set', '', false, false); + } + catch (error) { + el.redactor(); //reinitialize redactor + el.redactor('insert.set', '', false, false); + } + } }); } $('input[type=submit]', el.closest('form')).on('click', function() { @@ -301,7 +312,13 @@ $(function() { // where Redactor does not sync properly after adding an image. // Therefore, the ::get() call will not include text added after // the image was inserted. - el.redactor('code.sync'); + try { + el.redactor('code.sync'); + } + catch (error) { + el.redactor(); //reinitialize redactor + el.redactor('code.sync'); + } }); if (!$.clientPortal) { options['plugins'] = options['plugins'].concat( -- GitLab