|
|
@ -27,13 +27,17 @@ let Breadcrumb = React.createClass({
|
|
|
|
if (this.context.router) {
|
|
|
|
if (this.context.router) {
|
|
|
|
routes = this.context.router.getCurrentRoutes();
|
|
|
|
routes = this.context.router.getCurrentRoutes();
|
|
|
|
params = this.context.router.getCurrentParams();
|
|
|
|
params = this.context.router.getCurrentParams();
|
|
|
|
crumbs = routes.map(function(route) {
|
|
|
|
crumbs = routes.map(function(route, i) {
|
|
|
|
var name = route.name.replace(/\:(.*)/g, function(replacement, key) {
|
|
|
|
var name = route.name.replace(/\:(.*)/g, function(replacement, key) {
|
|
|
|
return params[key] || replacement;
|
|
|
|
return params[key] || replacement;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return <BreadcrumbItem>
|
|
|
|
var link;
|
|
|
|
<Link to={route.path} params={params}>{name}</Link>
|
|
|
|
if (i === routes.length - 1) {
|
|
|
|
</BreadcrumbItem>;
|
|
|
|
link = <span>{name}</span>;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
link = <Link to={route.path} params={params}>{name}</Link>;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return <BreadcrumbItem>{link}</BreadcrumbItem>;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
crumbs = this.props.children;
|
|
|
|
crumbs = this.props.children;
|
|
|
|