From f5a5e045a6b1d3e63a2242408e146102ac97d079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= <tim@ascribe.io> Date: Fri, 6 Nov 2015 12:09:31 +0100 Subject: [PATCH] Finalize boilerplate for portfolioreview subdomain --- README.md | 2 + .../portfolioreview/components/pr_landing.js | 117 ++++++++++++++++++ .../prize/portfolioreview/pr_app.js | 35 ++++++ .../whitelabel/prize/prize_routes.js | 27 +++- js/constants/application_constants.js | 7 ++ 5 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 js/components/whitelabel/prize/portfolioreview/components/pr_landing.js create mode 100644 js/components/whitelabel/prize/portfolioreview/pr_app.js diff --git a/README.md b/README.md index 1dc4492b..16fba17d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ Additionally, to work on the white labeling functionality, you need to edit your 127.0.0.1 cyland.localhost.com 127.0.0.1 ikonotv.localhost.com 127.0.0.1 sluice.localhost.com +127.0.0.1 lumenus.localhost.com +127.0.0.1 portfolioreview.localhost.com ``` diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js b/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js new file mode 100644 index 00000000..e88efff2 --- /dev/null +++ b/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js @@ -0,0 +1,117 @@ +'use strict'; + +import React from 'react'; +import { History } from 'react-router'; + +import PrizeActions from '../../simple_prize/actions/prize_actions'; +import PrizeStore from '../../simple_prize/stores/prize_store'; + +import Button from 'react-bootstrap/lib/Button'; +import ButtonGroup from 'react-bootstrap/lib/ButtonGroup'; + +import LinkContainer from 'react-router-bootstrap/lib/LinkContainer'; + +import UserStore from '../../../../../stores/user_store'; +import UserActions from '../../../../../actions/user_actions'; + +import { mergeOptions } from '../../../../../utils/general_utils'; +import { getLangText } from '../../../../../utils/lang_utils'; + +const PRLanding = React.createClass({ + + mixins: [History], + + getInitialState() { + return mergeOptions( + PrizeStore.getState(), + UserStore.getState() + ); + }, + + componentDidMount() { + UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); + PrizeStore.listen(this.onChange); + PrizeActions.fetchPrize(); + }, + + componentWillUnmount() { + UserStore.unlisten(this.onChange); + PrizeStore.unlisten(this.onChange); + }, + + onChange(state) { + this.setState(state); + }, + + getButtons() { + if (this.state.prize && this.state.prize.active){ + return ( + <ButtonGroup className="enter" bsSize="large" vertical> + <LinkContainer to="/signup"> + <Button> + {getLangText('Sign up to submit')} + </Button> + </LinkContainer> + + <p> + {getLangText('or, already an ascribe user?')} + </p> + <LinkContainer to="/login"> + <Button> + {getLangText('Log in to submit')} + </Button> + </LinkContainer> + </ButtonGroup> + ); + } + return ( + <ButtonGroup className="enter" bsSize="large" vertical> + <a className="btn btn-default" href="https://www.ascribe.io/app/signup"> + {getLangText('Sign up to ascribe')} + </a> + + <p> + {getLangText('or, already an ascribe user?')} + </p> + <LinkContainer to="/login"> + <Button> + {getLangText('Log in')} + </Button> + </LinkContainer> + </ButtonGroup> + ); + }, + + getTitle() { + if (this.state.prize && this.state.prize.active){ + return ( + <p> + {getLangText('This is the submission page for Portfolio Review 2015.')} + </p> + ); + } + return ( + <p> + {getLangText('Submissions for Portfolio Review 2015 are now closed.')} + </p> + ); + }, + render() { + return ( + <div className="container"> + <div className="row"> + <div className="col-xs-12 wp-landing-wrapper"> + <h1> + {getLangText('Welcome to Portfolio Review 2015')} + </h1> + {this.getTitle()} + {this.getButtons()} + </div> + </div> + </div> + ); + } +}); + +export default PRLanding; \ No newline at end of file diff --git a/js/components/whitelabel/prize/portfolioreview/pr_app.js b/js/components/whitelabel/prize/portfolioreview/pr_app.js new file mode 100644 index 00000000..072542f9 --- /dev/null +++ b/js/components/whitelabel/prize/portfolioreview/pr_app.js @@ -0,0 +1,35 @@ +'use strict'; + +import React from 'react'; +import Footer from '../../../footer'; +import GlobalNotification from '../../../global_notification'; + +import { getSubdomain } from '../../../../utils/general_utils'; + + +let PrizeApp = React.createClass({ + propTypes: { + children: React.PropTypes.oneOfType([ + React.PropTypes.arrayOf(React.PropTypes.element), + React.PropTypes.element + ]), + history: React.PropTypes.object, + routes: React.PropTypes.arrayOf(React.PropTypes.object) + }, + + render() { + const { children } = this.props; + let subdomain = getSubdomain(); + + return ( + <div className={'container ascribe-prize-app client--' + subdomain}> + {children} + <GlobalNotification /> + <div id="modal" className="container"></div> + <Footer /> + </div> + ); + } +}); + +export default PrizeApp; diff --git a/js/components/whitelabel/prize/prize_routes.js b/js/components/whitelabel/prize/prize_routes.js index a9004927..9396a354 100644 --- a/js/components/whitelabel/prize/prize_routes.js +++ b/js/components/whitelabel/prize/prize_routes.js @@ -12,6 +12,9 @@ import SPPieceContainer from './simple_prize/components/ascribe_detail/prize_pie import SPSettingsContainer from './simple_prize/components/prize_settings_container'; import SPApp from './simple_prize/prize_app'; +import PRApp from './portfolioreview/pr_app'; +import PRLanding from './portfolioreview/components/pr_landing'; + import EditionContainer from '../../ascribe_detail/edition_container'; import LogoutContainer from '../../logout_container'; import PasswordResetContainer from '../../password_reset_container'; @@ -22,7 +25,7 @@ import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/au const ROUTES = { - 'sluice': ( + sluice: ( <Route path='/' component={SPApp}> <IndexRoute component={SPLanding} /> <Route @@ -54,6 +57,28 @@ const ROUTES = { <Route path='verify' component={CoaVerifyContainer} /> <Route path='*' component={ErrorNotFoundPage} /> </Route> + ), + portfolioreview: ( + <Route path='/' component={PRApp}> + <IndexRoute component={PRLanding} /> + <Route + path='register_piece' + component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(SPRegisterPiece)} + headerTitle='+ NEW WORK'/> + <Route + path='login' + component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SPLoginContainer)} /> + <Route + path='logout' + component={AuthProxyHandler({to: '/', when: 'loggedOut'})(LogoutContainer)}/> + <Route + path='signup' + component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(SPSignupContainer)} /> + <Route + path='password_reset' + component={AuthProxyHandler({to: '/collection', when: 'loggedIn'})(PasswordResetContainer)} /> + <Route path='*' component={ErrorNotFoundPage} /> + </Route> ) }; diff --git a/js/constants/application_constants.js b/js/constants/application_constants.js index 0fe5e210..b175c158 100644 --- a/js/constants/application_constants.js +++ b/js/constants/application_constants.js @@ -46,6 +46,13 @@ let constants = { 'logo': 'https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/ikonotv/ikono-logo-black.png', 'permissions': ['register', 'edit', 'share', 'del_from_collection'], 'type': 'wallet' + }, + { + 'subdomain': 'portfolioreview', + 'name': 'Portfolio Review', + 'logo': 'http://notfoundlogo.de', + 'permissions': ['register', 'edit', 'share', 'del_from_collection'], + 'type': 'prize' } ], 'defaultDomain': {