Browse Source

HUE-848 [fb] / breadcrumb not sending to /

Forcing root folder on empty background url
Enrico Berti 13 years ago
parent
commit
6afbbe4c28

+ 1 - 1
apps/filebrowser/src/filebrowser/templates/fb_components.mako

@@ -59,7 +59,7 @@ from django.utils.translation import ugettext as _
                         <% label = breadcrumb_item['label'] %>
                         <% label = breadcrumb_item['label'] %>
                         %if label == '/':
                         %if label == '/':
                                 <li><a href="/filebrowser/view${breadcrumb_item['url']}"><span
                                 <li><a href="/filebrowser/view${breadcrumb_item['url']}"><span
-                                        class="divider">${label | h}<span></a></li>
+                                        class="divider">${label | h}</span></a></li>
                         %else:
                         %else:
                                 <li><a href="/filebrowser/view${breadcrumb_item['url']}">${label | h}</a><span class="divider">/</span></li>
                                 <li><a href="/filebrowser/view${breadcrumb_item['url']}">${label | h}</a><span class="divider">/</span></li>
                         %endif
                         %endif

+ 6 - 2
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -445,9 +445,9 @@ from django.utils.translation import ugettext as _
             });
             });
 
 
             $(window).bind("hashchange", function() {
             $(window).bind("hashchange", function() {
-                var hash = window.location.hash.substring(2);
+                var hash = window.location.hash.substring(1);
                 if (hash != null && hash != "") {
                 if (hash != null && hash != "") {
-                    viewModel.targetPath("${url('filebrowser.views.view', path=urlencode('/'))}" + hash);
+                    viewModel.targetPath("${url('filebrowser.views.view', path=urlencode('/'))}" + hash.substring(1));
                     viewModel.retrieveData();
                     viewModel.retrieveData();
                 }
                 }
             });
             });
@@ -495,6 +495,10 @@ from django.utils.translation import ugettext as _
                 url:breadcrumb.url,
                 url:breadcrumb.url,
                 label:breadcrumb.label,
                 label:breadcrumb.label,
                 show:function () {
                 show:function () {
+                    if (this.url == null || this.url == ""){
+                        // forcing root on empty breadcrumb url
+                        this.url = "/";
+                    }
                     viewModel.targetPath("${url('filebrowser.views.view', path=urlencode('/'))}" + this.url);
                     viewModel.targetPath("${url('filebrowser.views.view', path=urlencode('/'))}" + this.url);
                     window.location.hash = this.url;
                     window.location.hash = this.url;
                 }
                 }