1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-23 01:36:28 +02: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}
startdate={startDate}
enddate={endDate}
//showStartDate={false}
//showEndDate={false}
showPassword={true}
showPersonalMessage={false}
handleSuccess={this.handleLoanSuccess}/>

View File

@ -69,18 +69,18 @@ let AccordionListItemPrize = React.createClass({
getPrizeButtons() {
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)){
// jury and rating available
let rating = null,
caption = null;
if (this.props.content.ratings.rating){
rating = parseInt(this.props.content.ratings.rating, 10);
caption = 'Your rating';
caption = getLangText('Your rating');
}
else if (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 (
@ -101,7 +101,7 @@ let AccordionListItemPrize = React.createClass({
if (this.state.currentUser.is_judge){
return (
<div className="react-rating-caption pull-right">
Not rated
{getLangText('Not rated')}
</div>
);
}
@ -109,7 +109,7 @@ let AccordionListItemPrize = React.createClass({
return (
<div className="react-rating-caption pull-right">
<Link to='piece' params={{pieceId: this.props.content.id}}>
Submit your rating
{getLangText('Submit your rating')}
</Link>
</div>
);
@ -144,25 +144,28 @@ let AccordionListItemPrize = React.createClass({
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(){
if (this.state.currentUser && this.state.currentUser.is_judge) {
return (
<span className="pull-right ascribe-checkbox-wrapper ascribe-checkbox-badge">
<InputCheckbox
defaultChecked={this.props.content.selected}
onChange={() => {
PrizeRatingActions.toggleShortlist(this.props.content.id)
.then(
(res) => {
this.refreshPieceData();
return res;
})
.then(
(res) => {
this.handleShortlistSuccess(res.notification);
}
);
}}/>
onChange={this.onSelectChange}/>
</span>
);
}
@ -170,6 +173,7 @@ let AccordionListItemPrize = React.createClass({
},
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) ||
(this.state.currentUser.is_judge && !this.props.content.selected )) ?
<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() {
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) ||
(this.state.currentUser.is_judge && !this.state.piece.selected )) ?
<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 ) ?
<DetailProperty label="REGISTREE" value={ this.state.piece.user_registered } /> : null;
return (
@ -277,32 +279,36 @@ let PrizePieceRatings = React.createClass({
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(){
if (this.props.piece && this.props.currentUser && this.props.currentUser.is_judge && this.state.average) {
// Judge sees shortlisting, average and per-jury notes
return (
<div>
<CollapsibleParagraph
title="Shortlisting"
title={getLangText('Shortlisting')}
show={true}
defaultExpanded={true}>
<div className="row no-margin">
<span className="ascribe-checkbox-wrapper" style={{marginLeft: '1.5em'}}>
<InputCheckbox
defaultChecked={this.props.piece.selected}
onChange={() => {
PrizeRatingActions.toggleShortlist(this.props.piece.id)
.then(
(res) => {
this.refreshPieceData();
return res;
})
.then(
(res) => {
this.handleShortlistSuccess(res.notification);
}
); }}>
onChange={this.onSelectChange}>
<span>
Select for the prize
{getLangText('Select for the prize')}
</span>
</InputCheckbox>
</span>
@ -313,7 +319,7 @@ let PrizePieceRatings = React.createClass({
<hr />
</CollapsibleParagraph>
<CollapsibleParagraph
title="Average Rating"
title={getLangText('Average Rating')}
show={true}
defaultExpanded={true}>
<div id="list-rating" style={{marginLeft: '1.5em', marginBottom: '1em'}}>
@ -356,6 +362,7 @@ let PrizePieceRatings = React.createClass({
</div>);
}
else if (this.props.currentUser && this.props.currentUser.is_jury) {
// Jury can set rating and note
return (
<CollapsibleParagraph
title="Rating"