From 41c9a10c84c765f0c55bfe3e97cb6c82c479217f Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 5 Jan 2016 17:28:45 +0100 Subject: [PATCH 1/5] Use a default shouldRedirect that just always returns true --- js/components/piece_list.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/components/piece_list.js b/js/components/piece_list.js index de979e65..dfe30a9c 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -53,7 +53,6 @@ let PieceList = React.createClass({ accordionListItemType: AccordionListItemWallet, bulkModalButtonListType: AclButtonList, canLoadPieceList: true, - orderParams: ['artist_name', 'title'], filterParams: [{ label: getLangText('Show works I can'), items: [ @@ -61,7 +60,9 @@ let PieceList = React.createClass({ 'acl_consign', 'acl_create_editions' ] - }] + }], + orderParams: ['artist_name', 'title'], + shouldRedirect: () => true }; }, From 9b1e6cc8a1f1c7d19b498c7b2fde9738f2c3eca8 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Thu, 21 Jan 2016 15:11:19 +0100 Subject: [PATCH 2/5] Small stylistic changes to Header and NavRoutes --- js/components/header.js | 29 ++++++++++++++++---------- js/components/nav_routes_links.js | 20 +++++++++--------- js/components/nav_routes_links_link.js | 10 ++++----- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/js/components/header.js b/js/components/header.js index c16cba86..68f50f7c 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -93,16 +93,16 @@ let Header = React.createClass({ Whitelabel brand ); + } else { + return ( + + + + ); } - - return ( - - - - ); }, - getPoweredBy(){ + getPoweredBy() { return ( ); - navRoutesLinks = ; - } - else { + + navRoutesLinks = ( + + ); + } else { account = ( diff --git a/js/components/nav_routes_links.js b/js/components/nav_routes_links.js index b2c9d9c3..2a78a337 100644 --- a/js/components/nav_routes_links.js +++ b/js/components/nav_routes_links.js @@ -29,28 +29,28 @@ let NavRoutesLinks = React.createClass({ * @return {Array} Array of ReactElements that can be displayed to the user */ extractLinksFromRoutes(node, userAcl, i) { - if(!node) { + if (!node) { return; } - let links = node.childRoutes.map((child, j) => { + const links = node.childRoutes.map((child, j) => { + const { aclName, headerTitle, path, childRoutes } = child; let childrenFn = null; - let { aclName, headerTitle, path, childRoutes } = child; // If the node has children that could be rendered, then we want // to execute this function again with the child as the root // // Otherwise we'll just pass childrenFn as false - if(child.childRoutes && child.childRoutes.length > 0) { + if (child.childRoutes && child.childRoutes.length) { childrenFn = this.extractLinksFromRoutes(child, userAcl, i++); } // We validate if the user has set the title correctly, // otherwise we're not going to render his route - if(headerTitle && typeof headerTitle === 'string') { + if (headerTitle && typeof headerTitle === 'string') { // if there is an aclName present on the route definition, // we evaluate it against the user's acl - if(aclName && typeof aclName !== 'undefined') { + if (aclName && typeof aclName !== 'undefined') { return ( + children={childrenFn} /> ); } else { @@ -70,7 +70,7 @@ let NavRoutesLinks = React.createClass({ headerTitle={headerTitle} routePath={'/' + path} depth={i} - children={childrenFn}/> + children={childrenFn} /> ); } } else { @@ -84,7 +84,7 @@ let NavRoutesLinks = React.createClass({ }, render() { - let {routes, userAcl} = this.props; + const {routes, userAcl} = this.props; return (