1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00

review comments

This commit is contained in:
diminator 2015-08-27 10:10:39 +02:00
parent 11c42fc997
commit 33d5480f2f
3 changed files with 44 additions and 35 deletions

View File

@ -85,8 +85,6 @@ let LoanRequestAnswerForm = React.createClass({
gallery={this.state.loanRequest ? this.state.loanRequest.gallery : null} gallery={this.state.loanRequest ? this.state.loanRequest.gallery : null}
startdate={startDate} startdate={startDate}
enddate={endDate} enddate={endDate}
//showStartDate={false}
//showEndDate={false}
showPassword={true} showPassword={true}
showPersonalMessage={false} showPersonalMessage={false}
handleSuccess={this.handleLoanSuccess}/> handleSuccess={this.handleLoanSuccess}/>

View File

@ -69,18 +69,18 @@ let AccordionListItemPrize = React.createClass({
getPrizeButtons() { getPrizeButtons() {
if (this.state.currentUser && this.state.currentUser.is_jury){ if (this.state.currentUser && this.state.currentUser.is_jury){
if (this.props.content.ratings && if ((this.props.content.ratings) &&
(this.props.content.ratings.rating || this.props.content.ratings.average)){ (this.props.content.ratings.rating || this.props.content.ratings.average)){
// jury and rating available // jury and rating available
let rating = null, let rating = null,
caption = null; caption = null;
if (this.props.content.ratings.rating){ if (this.props.content.ratings.rating){
rating = parseInt(this.props.content.ratings.rating, 10); rating = parseInt(this.props.content.ratings.rating, 10);
caption = 'Your rating'; caption = getLangText('Your rating');
} }
else if (this.props.content.ratings.average){ else if (this.props.content.ratings.average){
rating = this.props.content.ratings.average; rating = this.props.content.ratings.average;
caption = 'Average of ' + this.props.content.ratings.num_ratings + ' rating(s)'; caption = getLangText('Average of ' + this.props.content.ratings.num_ratings + ' rating(s)');
} }
return ( return (
@ -101,7 +101,7 @@ let AccordionListItemPrize = React.createClass({
if (this.state.currentUser.is_judge){ if (this.state.currentUser.is_judge){
return ( return (
<div className="react-rating-caption pull-right"> <div className="react-rating-caption pull-right">
Not rated {getLangText('Not rated')}
</div> </div>
); );
} }
@ -109,7 +109,7 @@ let AccordionListItemPrize = React.createClass({
return ( return (
<div className="react-rating-caption pull-right"> <div className="react-rating-caption pull-right">
<Link to='piece' params={{pieceId: this.props.content.id}}> <Link to='piece' params={{pieceId: this.props.content.id}}>
Submit your rating {getLangText('Submit your rating')}
</Link> </Link>
</div> </div>
); );
@ -144,25 +144,28 @@ let AccordionListItemPrize = React.createClass({
this.state.orderBy, this.state.orderAsc, this.state.filterBy); this.state.orderBy, this.state.orderAsc, this.state.filterBy);
}, },
onSelectChange(){
PrizeRatingActions.toggleShortlist(this.props.content.id)
.then(
(res) => {
this.refreshPieceData();
return res;
})
.then(
(res) => {
this.handleShortlistSuccess(res.notification);
}
);
},
getPrizeBadge(){ getPrizeBadge(){
if (this.state.currentUser && this.state.currentUser.is_judge) { if (this.state.currentUser && this.state.currentUser.is_judge) {
return ( return (
<span className="pull-right ascribe-checkbox-wrapper ascribe-checkbox-badge"> <span className="pull-right ascribe-checkbox-wrapper ascribe-checkbox-badge">
<InputCheckbox <InputCheckbox
defaultChecked={this.props.content.selected} defaultChecked={this.props.content.selected}
onChange={() => { onChange={this.onSelectChange}/>
PrizeRatingActions.toggleShortlist(this.props.content.id)
.then(
(res) => {
this.refreshPieceData();
return res;
})
.then(
(res) => {
this.handleShortlistSuccess(res.notification);
}
);
}}/>
</span> </span>
); );
} }
@ -170,6 +173,7 @@ let AccordionListItemPrize = React.createClass({
}, },
render() { render() {
// Only show the artist name if you are the participant or if you are a judge and the piece is shortlisted
let artistName = ((this.state.currentUser.is_jury && !this.state.currentUser.is_judge) || let artistName = ((this.state.currentUser.is_jury && !this.state.currentUser.is_judge) ||
(this.state.currentUser.is_judge && !this.props.content.selected )) ? (this.state.currentUser.is_judge && !this.props.content.selected )) ?
<span className="glyphicon glyphicon-eye-close" aria-hidden="true"/> : this.props.content.artist_name; <span className="glyphicon glyphicon-eye-close" aria-hidden="true"/> : this.props.content.artist_name;

View File

@ -106,9 +106,11 @@ let PieceContainer = React.createClass({
render() { render() {
if('title' in this.state.piece) { if('title' in this.state.piece) {
// Only show the artist name if you are the participant or if you are a judge and the piece is shortlisted
let artistName = ((this.state.currentUser.is_jury && !this.state.currentUser.is_judge) || let artistName = ((this.state.currentUser.is_jury && !this.state.currentUser.is_judge) ||
(this.state.currentUser.is_judge && !this.state.piece.selected )) ? (this.state.currentUser.is_judge && !this.state.piece.selected )) ?
<span className="glyphicon glyphicon-eye-close" aria-hidden="true"/> : this.state.piece.artist_name; <span className="glyphicon glyphicon-eye-close" aria-hidden="true"/> : this.state.piece.artist_name;
// Only show the artist email if you are a judge and the piece is shortlisted
let artistEmail = (this.state.currentUser.is_judge && this.state.piece.selected ) ? let artistEmail = (this.state.currentUser.is_judge && this.state.piece.selected ) ?
<DetailProperty label="REGISTREE" value={ this.state.piece.user_registered } /> : null; <DetailProperty label="REGISTREE" value={ this.state.piece.user_registered } /> : null;
return ( return (
@ -277,32 +279,36 @@ let PrizePieceRatings = React.createClass({
this.state.orderBy, this.state.orderAsc, this.state.filterBy); this.state.orderBy, this.state.orderAsc, this.state.filterBy);
}, },
onSelectChange() {
PrizeRatingActions.toggleShortlist(this.props.piece.id)
.then(
(res) => {
this.refreshPieceData();
return res;
})
.then(
(res) => {
this.handleShortlistSuccess(res.notification);
}
);
},
render(){ render(){
if (this.props.piece && this.props.currentUser && this.props.currentUser.is_judge && this.state.average) { if (this.props.piece && this.props.currentUser && this.props.currentUser.is_judge && this.state.average) {
// Judge sees shortlisting, average and per-jury notes
return ( return (
<div> <div>
<CollapsibleParagraph <CollapsibleParagraph
title="Shortlisting" title={getLangText('Shortlisting')}
show={true} show={true}
defaultExpanded={true}> defaultExpanded={true}>
<div className="row no-margin"> <div className="row no-margin">
<span className="ascribe-checkbox-wrapper" style={{marginLeft: '1.5em'}}> <span className="ascribe-checkbox-wrapper" style={{marginLeft: '1.5em'}}>
<InputCheckbox <InputCheckbox
defaultChecked={this.props.piece.selected} defaultChecked={this.props.piece.selected}
onChange={() => { onChange={this.onSelectChange}>
PrizeRatingActions.toggleShortlist(this.props.piece.id)
.then(
(res) => {
this.refreshPieceData();
return res;
})
.then(
(res) => {
this.handleShortlistSuccess(res.notification);
}
); }}>
<span> <span>
Select for the prize {getLangText('Select for the prize')}
</span> </span>
</InputCheckbox> </InputCheckbox>
</span> </span>
@ -313,7 +319,7 @@ let PrizePieceRatings = React.createClass({
<hr /> <hr />
</CollapsibleParagraph> </CollapsibleParagraph>
<CollapsibleParagraph <CollapsibleParagraph
title="Average Rating" title={getLangText('Average Rating')}
show={true} show={true}
defaultExpanded={true}> defaultExpanded={true}>
<div id="list-rating" style={{marginLeft: '1.5em', marginBottom: '1em'}}> <div id="list-rating" style={{marginLeft: '1.5em', marginBottom: '1em'}}>
@ -356,6 +362,7 @@ let PrizePieceRatings = React.createClass({
</div>); </div>);
} }
else if (this.props.currentUser && this.props.currentUser.is_jury) { else if (this.props.currentUser && this.props.currentUser.is_jury) {
// Jury can set rating and note
return ( return (
<CollapsibleParagraph <CollapsibleParagraph
title="Rating" title="Rating"