diff options
author | Craig Kaiser <craig@bestpractical.com> | 2019-05-23 17:17:29 +0300 |
---|---|---|
committer | Craig Kaiser <craig@bestpractical.com> | 2019-05-23 19:36:11 +0300 |
commit | 8e9d61f8195617dcae11f730416d19b64aaac3eb (patch) | |
tree | 3ceadfbf007a99fa12d43dd737164f62ce4c8fc4 | |
parent | 10113b8ce89c867b4ca032dfd473a53dfce85650 (diff) |
Jump to unread message if transaction has not been loaded then load it4.4/load-unread-transaction-onclick
If the load history as scroll feature is enabled and a user wants to
jump to an unread message the history leading to the unread transaction
may need to be loaded on button click.
-rw-r--r-- | share/html/Ticket/Elements/ScrollShowHistory | 13 | ||||
-rw-r--r-- | share/html/Ticket/Elements/ShowUpdateStatus | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/share/html/Ticket/Elements/ScrollShowHistory b/share/html/Ticket/Elements/ScrollShowHistory index d2aca08a85..d089b4294e 100644 --- a/share/html/Ticket/Elements/ScrollShowHistory +++ b/share/html/Ticket/Elements/ScrollShowHistory @@ -113,9 +113,14 @@ jQuery(function(){ jQuery(".history-container").append(loadLink); }; - var loadHistoryPage = function() { + var loadHistoryPage = function(path) { if (isLoading || disableLoading) return; + if ( path ) { + var regex = /.*(#txn-(\d+)$)/; + hash = regex.exec(path)[1]; + } + isLoading = true; showLoadingMessage(); @@ -127,7 +132,7 @@ jQuery(function(){ loadAll = false; // check for link to specific transaction and make sure we load enough to focus it - if (hash && !lastTransactionId) { + if ( ( hash && !lastTransactionId ) || path ) { var matches = hash.match(/^#txn-(\d+)$/); if (matches) { hashTransactionId = matches[1]; @@ -201,5 +206,9 @@ jQuery(function(){ }); loadHistoryPage(); + + jQuery("#JumpToUnread").click(function(){ + loadHistoryPage(jQuery(this).attr('href')); + }); }); </script> diff --git a/share/html/Ticket/Elements/ShowUpdateStatus b/share/html/Ticket/Elements/ShowUpdateStatus index 9c3bc43f90..3584c7d761 100644 --- a/share/html/Ticket/Elements/ShowUpdateStatus +++ b/share/html/Ticket/Elements/ShowUpdateStatus @@ -52,7 +52,7 @@ <&|/l&>There are unread messages on this ticket.</&> </span> <span class="new-messages-buttons"> -<a class="button small-button" href="<% RT->Config->Get('WebPath') ."/$DisplayPath/Display.html?id=". $Ticket->id ."#txn-" . $txn->id |n %>"><&|/l&>Jump to Unread</&></a> +<a class="button small-button" href="<% RT->Config->Get('WebPath') ."/$DisplayPath/Display.html?id=". $Ticket->id ."#txn-" . $txn->id |n %>" id="JumpToUnread"><&|/l&>Jump to Unread</&></a> <a class="button small-button" href="<% RT->Config->Get('WebPath') ."/$DisplayPath/Display.html?id=". $Ticket->id. "&MarkAsSeen=1" |n %>"><&|/l&>Mark as Seen</&></a> <a class="button small-button" href="<% RT->Config->Get('WebPath') ."/$DisplayPath/Display.html?id=". $Ticket->id ."&MarkAsSeen=1&Anchor=txn-" . $txn->id |n %>"><&|/l&>Jump & Mark as Seen</&></a> </span> |