[Rt-commit] rt branch 5.0/jump-to-unread-on-click created. rt-5.0.3-85-gafc0c56491
BPS Git Server
git at git.bestpractical.com
Thu Aug 18 22:33:59 UTC 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".
The branch, 5.0/jump-to-unread-on-click has been created
at afc0c5649186da1fa06312fa4fa557b7a0fdbbe7 (commit)
- Log -----------------------------------------------------------------
commit afc0c5649186da1fa06312fa4fa557b7a0fdbbe7
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Aug 19 06:28:49 2022 +0800
Prettify "Show ticket history" a bit by rendering it like a button
diff --git a/share/html/Ticket/Elements/ClickToShowHistory b/share/html/Ticket/Elements/ClickToShowHistory
index 956d3bacde..4016da31c3 100644
--- a/share/html/Ticket/Elements/ClickToShowHistory
+++ b/share/html/Ticket/Elements/ClickToShowHistory
@@ -47,7 +47,7 @@
%# END BPS TAGGED BLOCK }}}
<div id="deferred_ticket_history">
<& /Widgets/TitleBoxStart, title => loc('History') &>
- <a class="show-ticket-history" href="<% $display %>"><% loc('Show ticket history') %></a>
+ <a class="show-ticket-history btn btn-primary button" href="<% $display %>"><% loc('Show ticket history') %></a>
<& /Widgets/TitleBoxEnd &>
</div>
commit b52e43eb0a43704c531ffa791fb96a551fb9c46d
Author: sunnavy <sunnavy at bestpractical.com>
Date: Fri Aug 19 06:19:56 2022 +0800
Automatically load history for unread messages with on click setting
With the "click" option set for ticket history, a new message may not be
loaded initially when displaying a ticket. If the "Jump to Unread"
button is clicked, trigger the "click" of "Show ticket history" to load
history and jump to the corresponding transaction.
This also fixes another related issue that when the page has anchor to
some transaction id, browser didn't automatically jump after user clicks
"Show ticket history".
diff --git a/share/html/Ticket/Elements/ClickToShowHistory b/share/html/Ticket/Elements/ClickToShowHistory
index 3cf39400e4..956d3bacde 100644
--- a/share/html/Ticket/Elements/ClickToShowHistory
+++ b/share/html/Ticket/Elements/ClickToShowHistory
@@ -47,9 +47,34 @@
%# END BPS TAGGED BLOCK }}}
<div id="deferred_ticket_history">
<& /Widgets/TitleBoxStart, title => loc('History') &>
- <a href="<% $display %>" onclick="jQuery('#deferred_ticket_history').text(<% loc('Loading...') |n,j%>).load(<% $url |n,j %>); return false;" ><% loc('Show ticket history') %></a>
+ <a class="show-ticket-history" href="<% $display %>"><% loc('Show ticket history') %></a>
<& /Widgets/TitleBoxEnd &>
</div>
+
+<script type="text/javascript">
+jQuery(function(){
+ jQuery('#deferred_ticket_history a.show-ticket-history').click(function() {
+ jQuery('#deferred_ticket_history').text(<% loc('Loading...') |n,j%>).load(<% $url |n,j %>, function() {
+ if ( window.location.hash.match(/#txn-\d+/) ) {
+ var hash = window.location.hash;
+ // Refresh anchor so browser can jump to it accordingly
+ window.location.hash = '';
+ window.location.hash = hash;
+ }
+ });
+ return false;
+ });
+
+ // Catch clicks on unread messages buttons and load history automatically
+ jQuery('.new-messages-buttons > a').on('click', function (e) {
+ var link = jQuery(this);
+ if ( link[0].hash ) {
+ jQuery('#deferred_ticket_history a.show-ticket-history').click();
+ }
+ return true;
+ });
+});
+</script>
<%ARGS>
$Ticket
</%ARGS>
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list