Pārlūkot izejas kodu

HUE-6854 [home] Clicking on a folder should open it

Enrico Berti 8 gadi atpakaļ
vecāks
revīzija
3459708cb4

+ 12 - 10
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -84,16 +84,18 @@
       ko.bindingHandlers.click.init(element, function () {
         return function (data, event) {
           var url = ko.unwrap(valueAccessor());
-          var prefix = '';
-          if (IS_HUE_4) {
-            prefix = '/hue' + (url.indexOf('/') === 0 ? '' : '/');
-          }
-          if ($(element).attr('target')) {
-            window.open(prefix + url, $(element).attr('target'));
-          } else if (event.ctrlKey || event.metaKey || event.which === 2) {
-            window.open(prefix + url, '_blank');
-          } else {
-            huePubSub.publish('open.link', url);
+          if (url) {
+            var prefix = '';
+            if (IS_HUE_4) {
+              prefix = '/hue' + (url.indexOf('/') === 0 ? '' : '/');
+            }
+            if ($(element).attr('target')) {
+              window.open(prefix + url, $(element).attr('target'));
+            } else if (event.ctrlKey || event.metaKey || event.which === 2) {
+              window.open(prefix + url, '_blank');
+            } else {
+              huePubSub.publish('open.link', url);
+            }
           }
         }
       }, allBindings, viewModel, bindingContext);

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

@@ -484,7 +484,7 @@ from desktop.views import _ko
               </ul>
               <div class="doc-browser-primary-col">
                 <!-- ko template: { name: 'document-icon-template', data: { document: $data, showShareAddon: true } } --><!-- /ko -->
-                <a href="javascript: void(0);" data-bind="text: definition().name, hueLink: definition().type === 'directory' ? '#' : definition().absoluteUrl, attr: { 'title': definition().name }" class="margin-left-5"></a>
+                <a href="javascript: void(0);" data-bind="text: definition().name, click: open, hueLink: definition().type === 'directory' ? '' : definition().absoluteUrl, attr: { 'title': definition().name }" class="margin-left-5"></a>
               </div>
               <div class="doc-browser-attr-group">
                 <!-- ko with: definition -->