Browse Source

HUE-5941 [home] Enable keyboard shortcut to select all the documents like on a desktop

Enrico Berti 8 years ago
parent
commit
c34b389
1 changed files with 9 additions and 1 deletions
  1. 9 1
      desktop/core/src/desktop/templates/document_browser.mako

+ 9 - 1
desktop/core/src/desktop/templates/document_browser.mako

@@ -23,7 +23,8 @@ from desktop.views import _ko
 
 <%def name="docBrowser(is_embeddable=False)">
 
-  <script src="/static/desktop/ext/js/bootstrap-fileupload.js" type="text/javascript" charset="utf-8"></script>
+  <script src="${ static('desktop/ext/js/bootstrap-fileupload.js') }" type="text/javascript" charset="utf-8"></script>
+  <script src="${ static('desktop/ext/js/jquery/plugins/jquery.hotkeys.js') }"></script>
   <link rel="stylesheet" href="/static/desktop/ext/css/bootstrap-fileupload.css">
 
   <style>
@@ -1051,6 +1052,13 @@ from desktop.views import _ko
             });
           }
         });
+        $(window).bind('keydown', 'ctrl+a alt+a meta+a', function (e) {
+          self.activeEntry().entries().forEach(function (entry) {
+            entry.selected(true);
+          })
+          e.preventDefault();
+          return false;
+        });
       }
 
       ko.components.register('doc-browser', {