diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-08-02 11:44:53 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-08-02 11:46:44 +0200 |
commit | f8bb4e10ae5378122328f8e105494fd7af3db260 (patch) | |
tree | 0d7c51eafd269193b66a7796ed15d349ee9d70d7 /core | |
parent | b12c1cb32521f643bcb3e2c4238fa2b9cf0fda55 (diff) | |
download | nextcloud-server-f8bb4e10ae5378122328f8e105494fd7af3db260.tar.gz nextcloud-server-f8bb4e10ae5378122328f8e105494fd7af3db260.zip |
use fixed OC.Breadcrumb.push()
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 88 |
1 files changed, 32 insertions, 56 deletions
diff --git a/core/js/js.js b/core/js/js.js index 17a24dd4bc5..03f660be62c 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -370,67 +370,43 @@ OC.Notification={ OC.Breadcrumb={ container:null, crumbs:[], - show:function(dir, filename, link){ + show:function(dir, leafname, leaflink){ OC.Breadcrumb.clear(); - var path = dir.split('/'); - //add home - var link = OC.linkTo('files','index.php'); - - var crumb=$('<div/>'); - crumb.addClass('crumb'); + // show home + path in subdirectories + if (dir && dir !== '/') { + //add home + var link = OC.linkTo('files','index.php'); - var crumbLink=$('<a/>'); - crumbLink.attr('href',link); - - var crumbImg=$('<img/>'); - crumbImg.attr('src',OC.imagePath('core','places/home')); - crumbLink.append(crumbImg); - crumb.append(crumbLink); - OC.Breadcrumb.crumbs.push(crumb); - - //add path parts - var pathurl = ''; - jQuery.each(path, function(i,name) { - if (name !== '') { - pathurl = pathurl+'/'+name; - var link = OC.linkTo('files','index.php')+'?dir='+encodeURIComponent(pathurl); - - var crumb=$('<div/>'); - crumb.addClass('crumb'); - - var crumbLink=$('<a/>'); - crumbLink.attr('href',link); - crumbLink.text(name); - crumb.append(crumbLink); - OC.Breadcrumb.crumbs.push(crumb); - } - }); - - //add filename (optional) - if (filename && link) { - pathurl = pathurl+'/'+filename; - - var crumb=$('<div/>'); - crumb.addClass('crumb'); - - var crumbLink=$('<a/>'); - crumbLink.attr('href',link); - crumbLink.text(filename); - crumb.append(crumbLink); - OC.Breadcrumb.crumbs.push(crumb); - } - - // update crumb array - var lastCrumb = OC.Breadcrumb.crumbs.pop(); - lastCrumb = jQuery(lastCrumb).addClass('last'); - OC.Breadcrumb.crumbs.push(lastCrumb); - var crumbs = OC.Breadcrumb.crumbs; - crumbs.reverse(); - jQuery.each(crumbs, function(i,crumb){ + var crumb=$('<div/>'); + crumb.addClass('crumb'); + + var crumbLink=$('<a/>'); + crumbLink.attr('href',link); + + var crumbImg=$('<img/>'); + crumbImg.attr('src',OC.imagePath('core','places/home')); + crumbLink.append(crumbImg); + crumb.append(crumbLink); OC.Breadcrumb.container.prepend(crumb); - }); + OC.Breadcrumb.crumbs.push(crumb); + + //add path parts + var segments = dir.split('/'); + var pathurl = ''; + jQuery.each(segments, function(i,name) { + if (name !== '') { + pathurl = pathurl+'/'+name; + var link = OC.linkTo('files','index.php')+'?dir='+encodeURIComponent(pathurl); + OC.Breadcrumb.push(name, link); + } + }); + } + //add leafname + if (leafname && leaflink) { + OC.Breadcrumb.push(leafname, leaflink); + } }, push:function(name, link){ if(!OC.Breadcrumb.container){//default |