1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 10:25:08 +01:00

Implement static feedback for submitted pieces

This commit is contained in:
Tim Daubenschütz 2015-11-11 16:27:50 +01:00
parent 66aef4886f
commit 0438f461c2
7 changed files with 121 additions and 29 deletions

View File

@ -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: {

View File

@ -0,0 +1,20 @@
'use strict';
import React from 'react';
import Glyphicon from 'react-bootstrap/lib/Glyphicon';
const PRHero = React.createClass({
render() {
return (
<div className="piece--hero">
<h2><Glyphicon glyph="ok" /> Congratulations!</h2>
<h1>You have successfully submitted to Portfolio Review 2016</h1>
<p>See below, your uploaded portfolio:</p>
</div>
);
}
});
export default PRHero;

View File

@ -87,13 +87,13 @@ const PRLanding = React.createClass({
if (this.state.prize && this.state.prize.active){
return (
<p>
{getLangText('This is the submission page for Portfolio Review 2015.')}
{getLangText('This is the submission page for Portfolio Review 2016.')}
</p>
);
}
return (
<p>
{getLangText('Submissions for Portfolio Review 2015 are now closed.')}
{getLangText('Submissions for Portfolio Review 2016 are now closed.')}
</p>
);
},
@ -103,7 +103,7 @@ const PRLanding = React.createClass({
<div className="row">
<div className="col-xs-12 wp-landing-wrapper">
<h1>
{getLangText('Welcome to Portfolio Review 2015')}
{getLangText('Welcome to Portfolio Review 2016')}
</h1>
{this.getTitle()}
{this.getButtons()}

View File

@ -60,7 +60,7 @@ const PRRegisterPiece = React.createClass({
return (
<Row>
<Col xs={6}>
<div className="register-piece--hero">
<div className="register-piece--info">
<h1>Portfolio Review</h1>
<h2>{getLangText('Submission closing on %s', ' 21 Dec 2015')}</h2>
<p>

View File

@ -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 = <Hero />;
}
return (
<div className={'container ascribe-prize-app client--' + subdomain}>
{children}
<GlobalNotification />
<div id="modal" className="container"></div>
<div>
{header}
<div className={'container ascribe-prize-app client--' + subdomain}>
{children}
<GlobalNotification />
<div id="modal" className="container"></div>
</div>
</div>
);
}
});
export default PrizeApp;
export default PRApp;

View File

@ -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({
<NavigationHeader
piece={this.state.piece}
currentUser={this.state.currentUser}/>
<hr/>
<h1 className="ascribe-detail-title">{this.state.piece.title}</h1>
<DetailProperty label={getLangText('BY')} value={artistName} />
<DetailProperty label={getLangText('DATE')} value={new Date(this.state.piece.date_created).getFullYear()} />
@ -157,7 +162,7 @@ let PieceContainer = React.createClass({
piece={this.state.piece}
currentUser={this.state.currentUser}/>
}>
<PrizePieceDetails piece={this.state.piece}/>
<PrizePieceDetails piece={this.state.piece} location={this.props.location}/>
</Piece>
);
} 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 (
<div style={{marginBottom: '1em'}}>
<div className="row no-margin">
<Link className="disable-select" to={`/pieces/${ nav.prev_index || this.props.piece.id }`}>
<Link className="disable-select" to={`/pieces/${ nav.prev_index || piece.id }`}>
<span className="glyphicon glyphicon-chevron-left pull-left link-ascribe" aria-hidden="true">
{getLangText('Previous')}
</span>
</Link>
<Link className="disable-select" to={`/pieces/${ nav.next_index || this.props.piece.id }`}>
<Link className="disable-select" to={`/pieces/${ nav.next_index || piece.id }`}>
<span className="pull-right link-ascribe">
{getLangText('Next')}
<span className="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
</span>
</Link>
</div>
<hr/>
</div>
);
}
@ -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({
<Form ref='form'>
{Object.keys(this.props.piece.extra_data).map((data) => {
let label = data.replace('_', ' ');
const value = this.props.piece.extra_data[data] || 'N/A';
return (
<Property
name={data}
@ -440,11 +452,20 @@ let PrizePieceDetails = React.createClass({
overrideForm={true}>
<InputTextAreaToggable
rows={1}
defaultValue={this.props.piece.extra_data[data]}/>
</Property>);
}
)}
<hr />
defaultValue={value}/>
</Property>
);
})}
<FurtherDetailsFileuploader
submitFile={() => {}}
setIsUploadReady={() => {}}
isReadyForFormSubmission={() => {}}
editable={false}
overrideForm={true}
pieceId={this.props.piece.id}
otherData={this.props.piece.other_data}
multiple={true}
location={location}/>
</Form>
</CollapsibleParagraph>
);

View File

@ -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;
}
}
}
}