[Rt-commit] rt branch, 4.4/load-unread-transaction-onclick, created. rt-4.4.4-45-g8e9d61f81

Craig Kaiser craig at bestpractical.com
Thu May 23 12:44:14 EDT 2019


The branch, 4.4/load-unread-transaction-onclick has been created
        at  8e9d61f8195617dcae11f730416d19b64aaac3eb (commit)

- Log -----------------------------------------------------------------
commit 8e9d61f8195617dcae11f730416d19b64aaac3eb
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Thu May 23 10:17:29 2019 -0400

    Jump to unread message if transaction has not been loaded then load it
    
    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.

diff --git a/share/html/Ticket/Elements/ScrollShowHistory b/share/html/Ticket/Elements/ScrollShowHistory
index d2aca08a8..d089b4294 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 9c3bc43f9..3584c7d76 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>

-----------------------------------------------------------------------


More information about the rt-commit mailing list