[Rt-commit] rt branch, 4.4/keyboard-shortcut-correspond, repushed
Craig Kaiser
craig at bestpractical.com
Thu Apr 5 15:13:06 EDT 2018
The branch 4.4/keyboard-shortcut-correspond was deleted and repushed:
was 2fd822bf150684159509cf7beba2851ced988a3e
now 4738a5e2ed22de8a8e4cbd63cb99009f35e04da0
1: 2fd822bf1 ! 1: 4738a5e2e Add key shortcut for correspond on ticket
@@ -32,11 +32,11 @@
+ <hr class="clear">
+ <table>
+ <tr>
-+ <td class="key-column"><span class="keyboard-shortcuts-key">r t</span></td>
++ <td class="key-column"><span class="keyboard-shortcuts-key">r</span></td>
+ <td><&|/l&>Reply To Current Ticket</&></td>
+ </tr>
+ <tr>
-+ <td class="key-column"><span class="keyboard-shortcuts-key">c t</span></td>
++ <td class="key-column"><span class="keyboard-shortcuts-key">c</span></td>
+ <td><&|/l&>Comment On Current Ticket</&></td>
+ </tr>
+ </table>
@@ -65,32 +65,6 @@
--- a/share/static/js/keyboard-shortcuts.js
+++ b/share/static/js/keyboard-shortcuts.js
@@
- window.location.href = homeLink.attr('href');
- };
-
-+ var generateUpdateLink = function(ticketId, action) {
-+ if (!ticketId) return '';
-+ return RT.Config.WebHomePath + '/Ticket/Update.html?Action=' + action + '&id=' + ticketId;
-+ };
-+
-+ var replyToTicketSummary = function() {
-+ var ticketId = jQuery('tr.id').children('td.value').text();
-+ var replyLink = generateUpdateLink(ticketId, 'Respond');
-+ if (!replyLink) return;
-+ window.location.href = replyLink;
-+ };
-+
-+ var commentOnTicketSummary = function() {
-+ var ticketId = jQuery('tr.id').children('td.value').text();
-+ var commentLink = generateUpdateLink(ticketId, 'Comment');
-+ if (!commentLink) return;
-+ window.location.href = commentLink;
-+ };
-+
- var simpleSearch = function() {
- var searchInput = jQuery('#simple-search').find('input');
- if (!searchInput.length) { // try SelfService simple search
-@@
var is_search = jQuery('body#comp-Search-Results').length > 0;
var is_bulk_update = jQuery('body#comp-Search-Bulk').length > 0;
@@ -108,8 +82,46 @@
Mousetrap.bind('g h', goHome);
Mousetrap.bind('/', simpleSearch);
Mousetrap.bind('?', openHelp);
-+ Mousetrap.bind(['r', 't'], replyToTicketSummary);
-+ Mousetrap.bind(['c', 't'], commentOnTicketSummary);
- });
+-});
- jQuery(function() {
+-jQuery(function() {
+ // Only load these shortcuts if there is a ticket list on the page
+ var hasTicketList = jQuery('table.ticket-list').length;
+ if (!hasTicketList) return;
+@@
+ };
+
+ var replyToTicket = function() {
+- if (!currentRow) return;
+-
+- var ticketId = currentRow.closest('tbody').data('recordId');
+- var replyLink = generateUpdateLink(ticketId, 'Respond');
++ var ticketId = jQuery('tr.id').children('td.value').text();
++ if (!currentRow && !ticketId ) return;
++ if ( !currentRow ) {
++ var replyLink = generateUpdateLink(ticketId, 'Respond');
++ } else {
++ var ticketId = currentRow.closest('tbody').data('recordId');
++ var replyLink = generateUpdateLink(ticketId, 'Respond');
++ };
+ if (!replyLink) return;
+
+ window.location.href = replyLink;
+ };
+
+ var commentOnTicket = function() {
+- if (!currentRow) return;
+-
+- var ticketId = currentRow.closest('tbody').data('recordId');
+- var commentLink = generateUpdateLink(ticketId, 'Comment');
++ var ticketId = jQuery('tr.id').children('td.value').text();
++ if (!currentRow && !ticketId) return;
++ if ( !currentRow ) {
++ var commentLink = generateUpdateLink(ticketId, 'Comment');
++ } else {
++ var ticketId = currentRow.closest('tbody').data('recordId');
++ var commentLink = generateUpdateLink(ticketId, 'Comment');
++ };
+ if (!commentLink) return;
+
+ window.location.href = commentLink;
More information about the rt-commit
mailing list