1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Clean up the prize AccordionList and fix merge bug

This commit is contained in:
Brett Sun 2016-02-05 10:39:46 +01:00
parent 8927ccb847
commit 1091e76447
2 changed files with 36 additions and 30 deletions

View File

@ -89,7 +89,8 @@ let AccordionListItemPrize = React.createClass({
rating={rating} rating={rating}
ratingAmount={5} /> ratingAmount={5} />
</Link> </Link>
</div>); </div>
);
} else { } else {
if (currentUser.is_judge) { if (currentUser.is_judge) {
return ( return (
@ -108,23 +109,21 @@ let AccordionListItemPrize = React.createClass({
); );
} }
} }
} else {
return this.getPrizeButtonsParticipant();
} }
return this.getPrizeButtonsParticipant();
}, },
getPrizeButtonsParticipant() { getPrizeButtonsParticipant() {
return ( return (
<div> <AclProxy
<AclProxy aclObject={this.props.content.acl}
aclObject={this.props.content.acl} aclName="acl_wallet_submit">
aclName="acl_wallet_submit"> <SubmitToPrizeButton
<SubmitToPrizeButton className="pull-right"
className="pull-right" piece={this.props.content}
piece={this.props.content} handleSuccess={this.handleSubmitPrizeSuccess} />
handleSuccess={this.handleSubmitPrizeSuccess}/> </AclProxy>
</AclProxy>
</div>
); );
}, },
@ -149,12 +148,14 @@ let AccordionListItemPrize = React.createClass({
}, },
getPrizeBadge() { getPrizeBadge() {
const { currentUser } = this.props;
if (currentUser && currentUser.is_judge) { if (currentUser && 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={this.onSelectChange}/> onChange={this.onSelectChange} />
</span> </span>
); );
} else { } else {
@ -170,21 +171,19 @@ let AccordionListItemPrize = React.createClass({
<span className="glyphicon glyphicon-eye-close" aria-hidden="true"/> : content.artist_name; <span className="glyphicon glyphicon-eye-close" aria-hidden="true"/> : content.artist_name;
return ( return (
<div> <AccordionListItemPiece
<AccordionListItemPiece className={className}
className={className} piece={content}
piece={content} artistName={artistName}
artistName={artistName} subsubheading={
subsubheading={ <div>
<div> <span>{Moment(content.date_created, 'YYYY-MM-DD').year()}</span>
<span>{Moment(content.date_created, 'YYYY-MM-DD').year()}</span> </div>
</div> }
} buttons={this.getPrizeButtons()}
buttons={this.getPrizeButtons()} badge={this.getPrizeBadge()}>
badge={this.getPrizeBadge()}> {children}
{children} </AccordionListItemPiece>
</AccordionListItemPiece>
</div>
); );
} }
}); });

View File

@ -58,6 +58,12 @@ let PrizePieceList = React.createClass({
} }
}, },
shouldRedirect(pieceCount) {
const { currentUser } = this.props;
return !currentUser.is_admin && !currentUser.is_jury && !currentUser.is_judge && !pieceCount;
},
render() { render() {
const { currentUser, location } = this.props; const { currentUser, location } = this.props;
@ -79,7 +85,8 @@ let PrizePieceList = React.createClass({
customSubmitButton={this.getButtonSubmit()} customSubmitButton={this.getButtonSubmit()}
filterParams={[]} filterParams={[]}
orderParams={orderParams} orderParams={orderParams}
orderBy={currentUser.is_jury ? 'rating' : null} /> orderBy={currentUser.is_jury ? 'rating' : null}
shouldRedirect={this.shouldRedirect} />
); );
} }
}); });