[Rt-commit] rt branch, 4.4/shortcut-help-conditional, created. rt-4.2.12-344-g0e2d3ee

Dustin Graves dustin at bestpractical.com
Wed Oct 28 17:14:56 EDT 2015


The branch, 4.4/shortcut-help-conditional has been created
        at  0e2d3eea897c0580f4f9ca88879238e0f2eeb20d (commit)

- Log -----------------------------------------------------------------
commit 0e2d3eea897c0580f4f9ca88879238e0f2eeb20d
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Wed Oct 28 21:09:08 2015 +0000

    change keyboard shortcut help to have varying content based on context
    
    Fixes: I#31326

diff --git a/share/html/Helpers/ShortcutHelp b/share/html/Helpers/ShortcutHelp
index 8e6d4f0..e6bfa1e 100644
--- a/share/html/Helpers/ShortcutHelp
+++ b/share/html/Helpers/ShortcutHelp
@@ -45,6 +45,11 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
+<%args>
+$show_search      => 0
+$show_bulk_update => 0
+</%args>
+
 <div class="keyboard-shortcuts">
     <h2><&|/l&>Keyboard Shortcuts</&></h2>
 
@@ -72,6 +77,8 @@
         </div>
     </div>
 
+% if($show_search) {
+
     <div class="titlebox">
         <div class="titlebox-title">
             <span class="left"><&|/l&>Search</&></span>
@@ -96,13 +103,18 @@
                     <td><span class="keyboard-shortcuts-key">c</span></td>
                     <td><&|/l&>Comment on ticket</&></td>
                 </tr>
+% if($show_bulk_update) {
                 <tr>
                     <td><span class="keyboard-shortcuts-key">x</span></td>
-                    <td><&|/l&>Toggle highlighted ticket's checkbox (for bulk update)</&></td>
+                    <td><&|/l&>Toggle highlighted ticket's checkbox</&></td>
                 </tr>
+% }
             </table>
         </div>
     </div>
+
+% }
+
 </div>
 
 % $m->abort;
diff --git a/share/static/js/keyboard-shortcuts.js b/share/static/js/keyboard-shortcuts.js
index ffe05dd..ba8e9b6 100644
--- a/share/static/js/keyboard-shortcuts.js
+++ b/share/static/js/keyboard-shortcuts.js
@@ -29,8 +29,15 @@ jQuery(function() {
             return;
         }
 
+        var is_search = jQuery('body#comp-Search-Results').length > 0;
+        var is_bulk_update = jQuery('body#comp-Search-Bulk').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' );
+
         jQuery.ajax({
-            url: RT.Config.WebHomePath + "/Helpers/ShortcutHelp",
+            url: url,
             success: showModal,
             error: function(xhr, reason) {
                 // give the browser a chance to redraw the readout

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


More information about the rt-commit mailing list