From 7e5662676cb825042fdbdcc67c14b4abd6b66dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Tue, 8 Dec 2015 15:44:46 +0100 Subject: [PATCH] Add header to jury, judge and admin role --- js/components/ascribe_routes/proxy_handler.js | 1 + js/components/header.js | 7 ++++--- js/components/whitelabel/prize/portfolioreview/pr_app.js | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/js/components/ascribe_routes/proxy_handler.js b/js/components/ascribe_routes/proxy_handler.js index 06b27422..228f0f62 100644 --- a/js/components/ascribe_routes/proxy_handler.js +++ b/js/components/ascribe_routes/proxy_handler.js @@ -101,6 +101,7 @@ export function ProxyHandler(...redirectFunctions) { if(!UserStore.isLoading()) { const { currentUser } = this.state; const { query } = this.props.location; + for(let i = 0; i < redirectFunctions.length; i++) { // if a redirectFunction redirects the user, // it should return `true` and therefore diff --git a/js/components/header.js b/js/components/header.js index b3fd543e..6ca96433 100644 --- a/js/components/header.js +++ b/js/components/header.js @@ -55,10 +55,11 @@ let Header = React.createClass({ }, componentDidMount() { - UserActions.fetchCurrentUser(); UserStore.listen(this.onChange); - WhitelabelActions.fetchWhitelabel(); + UserActions.fetchCurrentUser.defer(); + WhitelabelStore.listen(this.onChange); + WhitelabelActions.fetchWhitelabel.defer(); // react-bootstrap 0.25.1 has a bug in which it doesn't // close the mobile expanded navigation after a click by itself. @@ -223,7 +224,7 @@ let Header = React.createClass({ {this.getPoweredBy()} diff --git a/js/components/whitelabel/prize/portfolioreview/pr_app.js b/js/components/whitelabel/prize/portfolioreview/pr_app.js index 93b1a168..cb40adb9 100644 --- a/js/components/whitelabel/prize/portfolioreview/pr_app.js +++ b/js/components/whitelabel/prize/portfolioreview/pr_app.js @@ -41,7 +41,7 @@ let PRApp = React.createClass({ }, render() { - const { history, children } = this.props; + const { history, children, routes } = this.props; const { currentUser } = this.state; let style = {}; let subdomain = getSubdomain(); @@ -51,8 +51,8 @@ let PRApp = React.createClass({ if (currentUser && currentUser.email && history.isActive(`/pieces/${getCookie(currentUser.email)}`)) { header = ; style = { paddingTop: '0 !important' }; - } else if(history.isActive('/collection') || history.isActive('/settings')) { - header =
; + } else if(currentUser && (currentUser.is_admin || currentUser.is_jury || currentUser.is_judge)) { + header =
; } else { style = { paddingTop: '0 !important' }; }