Keyboard shortcuts on Ticket/Display.html

Hi

Not sure if this is the place to make feature requests, but is there any chance we can get the “r” and “c” keyboard shortcuts, on Ticket/Display.html?

regards
garry

@G.Booth and I have actually just hacked this in, and in case its helpful for other folk, here’s what we did:

  1. Make a local copy of the share/js/keyboard-shortcuts.js file
  2. Add the following to the end of the local copy:
 jQuery(function() {                             
    var isTicketSummary = jQuery('table.ticket-summary').length;
    if (!isTicketSummary) return;
    var generateUpdateLink = function(ticketId, action) {
        if (!ticketId) return '';
        return RT.Config.WebHomePath + '/Ticket/Update.html?Action=' + action + '&id=' + ticketId;
    };
    var replyToTicket = function() {
        var ticketId = jQuery('tr.id').children('td.value').text();
        var replyLink = generateUpdateLink(ticketId, 'Respond');
        if (!replyLink) return;
        window.location.href = replyLink;
    };
    var commentOnTicket = function() {
        var ticketId = jQuery('tr.id').children('td.value').text();
        var commentLink = generateUpdateLink(ticketId, 'Comment');
        if (!commentLink) return;
        window.location.href = commentLink;
    };
    Mousetrap.bind('r', replyToTicket);
    Mousetrap.bind('c', commentOnTicket);
});
  1. Save, clear Mason cache, restart server, load a Ticket/Display.html and press ‘r’ or ‘c’ to test replies and comments.
  2. Profit. Oh, not wait… :slight_smile:
4 Likes

Hi,
I just noticed your update. Thank you for the sample implementation. Did you get a chance to stitch in the pop-up Keyboard Shortcuts help screen for you change? If not, I will try to post it when I get to it here.

Regards,
Ken