From 0438f461c2c45066fa02f927736d7edbdcd83ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 11 Nov 2015 16:27:50 +0100 Subject: [PATCH] Implement static feedback for submitted pieces --- .../pr_forms/pr_register_piece_form.js | 4 +- .../portfolioreview/components/pr_hero.js | 20 ++++++++ .../portfolioreview/components/pr_landing.js | 6 +-- .../components/pr_register_piece.js | 2 +- .../prize/portfolioreview/pr_app.js | 46 +++++++++++++++--- .../ascribe_detail/prize_piece_container.js | 47 ++++++++++++++----- .../portfolioreview_custom_style.scss | 25 +++++++++- 7 files changed, 121 insertions(+), 29 deletions(-) create mode 100644 js/components/whitelabel/prize/portfolioreview/components/pr_hero.js diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js b/js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js index 04f84d47..47e1f012 100644 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js +++ b/js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js @@ -67,8 +67,6 @@ const PRRegisterPieceForm = React.createClass({ registerPieceFormData.thumbnail_file = thumbnailKey.state.value; registerPieceFormData.terms = true; - console.log(registerPieceFormData); - // submitting the piece requests .post(ApiUrls.pieces_list, { body: registerPieceFormData }) @@ -81,7 +79,7 @@ const PRRegisterPieceForm = React.createClass({ proofOfPayment.refs.input.createBlobRoutine(); }); - //setCookie(currentUser.email, piece.id); + setCookie(currentUser.email, piece.id); return requests.post(ApiUrls.piece_extradata, { body: { diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_hero.js b/js/components/whitelabel/prize/portfolioreview/components/pr_hero.js new file mode 100644 index 00000000..3f962119 --- /dev/null +++ b/js/components/whitelabel/prize/portfolioreview/components/pr_hero.js @@ -0,0 +1,20 @@ +'use strict'; + +import React from 'react'; + +import Glyphicon from 'react-bootstrap/lib/Glyphicon'; + + +const PRHero = React.createClass({ + render() { + return ( +
+

Congratulations!

+

You have successfully submitted to Portfolio Review 2016

+

See below, your uploaded portfolio:

+
+ ); + } +}); + +export default PRHero; \ No newline at end of file diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js b/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js index e88efff2..739f2b49 100644 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js +++ b/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js @@ -87,13 +87,13 @@ const PRLanding = React.createClass({ if (this.state.prize && this.state.prize.active){ return (

- {getLangText('This is the submission page for Portfolio Review 2015.')} + {getLangText('This is the submission page for Portfolio Review 2016.')}

); } return (

- {getLangText('Submissions for Portfolio Review 2015 are now closed.')} + {getLangText('Submissions for Portfolio Review 2016 are now closed.')}

); }, @@ -103,7 +103,7 @@ const PRLanding = React.createClass({

- {getLangText('Welcome to Portfolio Review 2015')} + {getLangText('Welcome to Portfolio Review 2016')}

{this.getTitle()} {this.getButtons()} diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js b/js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js index 38f166a6..3ba91060 100644 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js +++ b/js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js @@ -60,7 +60,7 @@ const PRRegisterPiece = React.createClass({ return ( -
+

Portfolio Review

{getLangText('Submission closing on %s', ' 21 Dec 2015')}

diff --git a/js/components/whitelabel/prize/portfolioreview/pr_app.js b/js/components/whitelabel/prize/portfolioreview/pr_app.js index 22a837be..7e66c43c 100644 --- a/js/components/whitelabel/prize/portfolioreview/pr_app.js +++ b/js/components/whitelabel/prize/portfolioreview/pr_app.js @@ -3,10 +3,16 @@ import React from 'react'; import GlobalNotification from '../../../global_notification'; +import Hero from './components/pr_hero'; + +import UserStore from '../../../../stores/user_store'; +import UserActions from '../../../../actions/user_actions'; + import { getSubdomain } from '../../../../utils/general_utils'; +import { getCookie } from '../../../../utils/fetch_api_utils'; -let PrizeApp = React.createClass({ +let PRApp = React.createClass({ propTypes: { children: React.PropTypes.oneOfType([ React.PropTypes.arrayOf(React.PropTypes.element), @@ -16,18 +22,44 @@ let PrizeApp = React.createClass({ routes: React.PropTypes.arrayOf(React.PropTypes.object) }, + getInitialState() { + return UserStore.getState(); + }, + + componentDidMount() { + UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); + }, + + componentWillUnmount() { + UserStore.unlisten(this.onChange); + }, + + onChange(state) { + this.setState(state); + }, + render() { - const { children } = this.props; + const { history, children } = this.props; + const { currentUser } = this.state; let subdomain = getSubdomain(); + let header; + + if (currentUser && currentUser.email && history.isActive(`/pieces/${getCookie(currentUser.email)}`)) { + header = ; + } return ( -

- {children} - - +
+ {header} +
+ {children} + + +
); } }); -export default PrizeApp; +export default PRApp; diff --git a/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js b/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js index 25354dc1..358c3524 100644 --- a/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js +++ b/js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js @@ -16,6 +16,7 @@ import PrizeRatingActions from '../../actions/prize_rating_actions'; import PrizeRatingStore from '../../stores/prize_rating_store'; import UserStore from '../../../../../../stores/user_store'; +import UserActions from '../../../../../../actions/user_actions'; import Piece from '../../../../../../components/ascribe_detail/piece'; import Note from '../../../../../../components/ascribe_detail/note'; @@ -27,6 +28,8 @@ import Property from '../../../../../../components/ascribe_forms/property'; import InputTextAreaToggable from '../../../../../../components/ascribe_forms/input_textarea_toggable'; import CollapsibleParagraph from '../../../../../../components/ascribe_collapsible/collapsible_paragraph'; +import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader'; + import InputCheckbox from '../../../../../ascribe_forms/input_checkbox'; import LoanForm from '../../../../../ascribe_forms/form_loan'; import ListRequestActions from '../../../../../ascribe_forms/list_form_request_actions'; @@ -48,7 +51,8 @@ import { setDocumentTitle } from '../../../../../../utils/dom_utils'; */ let PieceContainer = React.createClass({ propTypes: { - params: React.PropTypes.object + params: React.PropTypes.object, + location: React.PropTypes.object }, getInitialState() { @@ -62,6 +66,7 @@ let PieceContainer = React.createClass({ PieceStore.listen(this.onChange); PieceActions.fetchOne(this.props.params.pieceId); UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); // Every time we enter the piece detail page, just reset the piece // store as it will otherwise display wrong/old data once the user loads @@ -142,7 +147,7 @@ let PieceContainer = React.createClass({ -
+

{this.state.piece.title}

@@ -157,7 +162,7 @@ let PieceContainer = React.createClass({ piece={this.state.piece} currentUser={this.state.currentUser}/> }> - + ); } else { @@ -177,24 +182,28 @@ let NavigationHeader = React.createClass({ }, render() { - if (this.props.currentUser && this.props.currentUser.email && this.props.piece && this.props.piece.navigation) { - let nav = this.props.piece.navigation; + const { currentUser, piece } = this.props; + + if (currentUser && currentUser.email && currentUser.is_judge && currentUser.is_jury && + !currentUser.is_admin && piece && piece.navigation) { + let nav = piece.navigation; return (
- + - + {getLangText('Next')}
+
); } @@ -417,7 +426,8 @@ let PrizePieceRatings = React.createClass({ let PrizePieceDetails = React.createClass({ propTypes: { - piece: React.PropTypes.object + piece: React.PropTypes.object, + location: React.PropTypes.object }, render() { @@ -432,6 +442,8 @@ let PrizePieceDetails = React.createClass({
{Object.keys(this.props.piece.extra_data).map((data) => { let label = data.replace('_', ' '); + const value = this.props.piece.extra_data[data] || 'N/A'; + return ( - ); - } - )} -
+ defaultValue={value}/> + + ); + })} + {}} + setIsUploadReady={() => {}} + isReadyForFormSubmission={() => {}} + editable={false} + overrideForm={true} + pieceId={this.props.piece.id} + otherData={this.props.piece.other_data} + multiple={true} + location={location}/> ); diff --git a/sass/whitelabel/prize/portfolioreview/portfolioreview_custom_style.scss b/sass/whitelabel/prize/portfolioreview/portfolioreview_custom_style.scss index f60caf92..a9240dd5 100644 --- a/sass/whitelabel/prize/portfolioreview/portfolioreview_custom_style.scss +++ b/sass/whitelabel/prize/portfolioreview/portfolioreview_custom_style.scss @@ -1,7 +1,7 @@ .client--portfolioreview { - padding-top: 20px !important; + padding-top: 0 !important; - .register-piece--hero { + .register-piece--info { text-align: center; h1, h2 { @@ -38,4 +38,25 @@ border-bottom: none; } } + + .piece--hero { + text-align: center; + padding: 1em 0 1em 0; + margin-bottom: 3em; + border-bottom: 1px solid rgba(0, 0, 0, .1); + + background-color: white; + + h2 { + margin-top: 0; + } + } + + .ascribe-property { + > p { + > span { + text-transform: capitalize; + } + } + } } \ No newline at end of file