[Rt-commit] rt branch, 4.4/keyboard-shortcut-correspond, repushed
Craig Kaiser
craig at bestpractical.com
Tue May 8 11:24:14 EDT 2018
The branch 4.4/keyboard-shortcut-correspond was deleted and repushed:
was 90bd40dccb101146fd91c83515051f9087498d94
now 4630b0f56b38651df6145b40d53593bb4e038750
1: 90bd40dcc ! 1: 4630b0f56 Add keyboard shortcuts for reply and comment
@@ -1,6 +1,10 @@
Author: craig Kaiser <craig at bestpractical.com>
- Update shortcuts to r and c
+ Add keyboard shortcuts for reply and comment
+
+ If the user is on a ticket page where the action link for reply or
+ comment is available, then they should be able to use the keyboard
+ shortcuts 'r' and 'c'.
diff --git a/share/html/Elements/ShortcutHelp b/share/html/Elements/ShortcutHelp
--- a/share/html/Elements/ShortcutHelp
@@ -11,18 +15,18 @@
<%args>
-$show_search => 0
-$show_bulk_update => 0
++$show_bulk_update => 0
+$show_search => 0
-+$show_bulk_update => 0
-+$show_ticket_summary => 0
++$show_ticket_reply => 0
++$show_ticket_comment => 0
</%args>
<div class="keyboard-shortcuts">
@@
- </div>
% }
--
-+% if ($show_ticket_summary) {
+
++% if ($show_ticket_reply || $show_ticket_comment) {
+ <div class="titlebox">
+ <div class="titlebox-title">
+ <span class="left"><&|/l&>Ticket Display</&></span>
@@ -31,14 +35,17 @@
+ <div class="titlebox-content">
+ <hr class="clear">
+ <table>
++% if ( $show_ticket_reply ) {
+ <tr>
+ <td class="key-column"><span class="keyboard-shortcuts-key">r</span></td>
+ <td><&|/l&>Reply To Current Ticket</&></td>
+ </tr>
++% } if ( $show_ticket_comment ) {
+ <tr>
+ <td class="key-column"><span class="keyboard-shortcuts-key">c</span></td>
+ <td><&|/l&>Comment On Current Ticket</&></td>
+ </tr>
++% }
+ </table>
+ </div>
+ </div>
@@ -56,7 +63,21 @@
-$show_bulk_update => 0
+$show_search => 0
+$show_bulk_update => 0
-+$show_ticket_summary => 0
++$show_ticket_reply => 0
++$show_ticket_comment => 0
+ </%args>
+ <& /Elements/ShortcutHelp, %ARGS &>
+ % $m->abort;
+
+diff --git a/share/html/SelfService/Helpers/ShortcutHelp b/share/html/SelfService/Helpers/ShortcutHelp
+--- a/share/html/SelfService/Helpers/ShortcutHelp
++++ b/share/html/SelfService/Helpers/ShortcutHelp
+@@
+ <%args>
+ $show_search => 0
+ $show_bulk_update => 0
++$show_ticket_reply => 0
++$show_ticket_comment => 0
</%args>
<& /Elements/ShortcutHelp, %ARGS &>
% $m->abort;
@@ -94,13 +115,15 @@
var is_search = jQuery('body#comp-Search-Results').length > 0;
var is_bulk_update = jQuery('body#comp-Search-Bulk').length > 0;
-+ var is_ticket_summary = jQuery('table.ticket-summary').length > 0;
++ var is_ticket_reply = jQuery('a#page-actions-reply').length > 0;
++ var is_ticket_comment = jQuery('a#page-actions-comment').length > 0;
var url = RT.Config.WebHomePath + '/Helpers/ShortcutHelp' +
'?show_search=' + ( is_search || is_bulk_update ? '1' : '0' ) +
- '&show_bulk_update=' + ( is_bulk_update ? '1' : '0' );
+ '&show_bulk_update=' + ( is_bulk_update ? '1' : '0' ) +
-+ '&show_ticket_summary=' + ( is_ticket_summary ? '1' : '0' );
++ '&show_ticket_reply=' + ( is_ticket_reply ? '1' : '0' ) +
++ '&show_ticket_comment=' + ( is_ticket_comment ? '1' : '0' );
jQuery.ajax({
url: url,
@@ -113,3 +136,26 @@
});
jQuery(function() {
+@@
+ Mousetrap.bind('x', toggleTicketCheckbox);
+ });
+
++jQuery(function() {
++ // Only load these shortcuts if on ticket display page
++ var ticket_reply = jQuery('a#page-actions-reply');
++ var ticket_comment = jQuery('a#page-actions-comment');
++ if (!ticket_reply.length && !ticket_comment.length) return;
++
++ var replyToTicket = function() {
++ if (!ticket_reply.length) return;
++ window.location.href = ticket_reply.attr('href');
++ };
++
++ var commentOnTicket = function() {
++ if (!ticket_comment.length) return;
++ window.location.href = ticket_comment.attr('href');
++ };
++
++ Mousetrap.bind('r', replyToTicket);
++ Mousetrap.bind('c', commentOnTicket);
++});
More information about the rt-commit
mailing list