mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +01:00
average rating
cyland bug fix
This commit is contained in:
parent
1b335e31a4
commit
15bcd4ba14
@ -65,17 +65,28 @@ 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 && this.props.content.ratings.rating){
|
if (this.props.content.ratings &&
|
||||||
|
(this.props.content.ratings.rating || this.props.content.ratings.average)){
|
||||||
// jury and rating available
|
// jury and rating available
|
||||||
let rating = parseInt(this.props.content.ratings.rating, 10);
|
let rating = null,
|
||||||
|
caption = null;
|
||||||
|
if (this.props.content.ratings.rating){
|
||||||
|
rating = parseInt(this.props.content.ratings.rating, 10);
|
||||||
|
caption = 'Your rating';
|
||||||
|
}
|
||||||
|
else if (this.props.content.ratings.average){
|
||||||
|
rating = this.props.content.ratings.average;
|
||||||
|
caption = 'Average (' + this.props.content.ratings.ratings.length + ' ratings)';
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="list-rating" className="pull-right">
|
<div id="list-rating" className="pull-right">
|
||||||
<Link to='piece' params={{pieceId: this.props.content.id}}>
|
<Link to='piece' params={{pieceId: this.props.content.id}}>
|
||||||
<StarRating
|
<StarRating
|
||||||
ref='rating'
|
ref='rating'
|
||||||
name="prize-rating"
|
name="prize-rating"
|
||||||
caption="Your rating"
|
caption={caption}
|
||||||
step={1}
|
step={0.5}
|
||||||
size='sm'
|
size='sm'
|
||||||
rating={rating}
|
rating={rating}
|
||||||
ratingAmount={5} />
|
ratingAmount={5} />
|
||||||
|
@ -59,6 +59,7 @@ let PieceContainer = React.createClass({
|
|||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if(this.props.params.pieceId !== nextProps.params.pieceId) {
|
if(this.props.params.pieceId !== nextProps.params.pieceId) {
|
||||||
PieceActions.updatePiece({});
|
PieceActions.updatePiece({});
|
||||||
|
console.log('update')
|
||||||
PieceActions.fetchOne(nextProps.params.pieceId);
|
PieceActions.fetchOne(nextProps.params.pieceId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -218,7 +219,7 @@ let PrizePieceRatings = React.createClass({
|
|||||||
title="Average Rating"
|
title="Average Rating"
|
||||||
show={true}
|
show={true}
|
||||||
defaultExpanded={true}>
|
defaultExpanded={true}>
|
||||||
<div style={{marginLeft: '1.5em', marginBottom: '1em'}}>
|
<div id="list-rating" style={{marginLeft: '1.5em', marginBottom: '1em'}}>
|
||||||
<StarRating
|
<StarRating
|
||||||
ref='average-rating'
|
ref='average-rating'
|
||||||
name="average-rating"
|
name="average-rating"
|
||||||
@ -229,8 +230,29 @@ let PrizePieceRatings = React.createClass({
|
|||||||
ratingAmount={5}/>
|
ratingAmount={5}/>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
{this.state.ratings.map((item) => {
|
{this.state.ratings.map((item, i) => {
|
||||||
return item.user;
|
let note = item.note ?
|
||||||
|
<div className="rating-note">
|
||||||
|
note: {item.note}
|
||||||
|
</div> : null;
|
||||||
|
return (
|
||||||
|
<div className="rating-list">
|
||||||
|
<div id="list-rating" className="row no-margin">
|
||||||
|
<span className="pull-right">
|
||||||
|
<StarRating
|
||||||
|
ref={'rating' + i}
|
||||||
|
name={'rating' + i}
|
||||||
|
caption=""
|
||||||
|
size='sm'
|
||||||
|
step={0.5}
|
||||||
|
rating={item.rating}
|
||||||
|
ratingAmount={5}/>
|
||||||
|
</span>
|
||||||
|
<span> {item.user}</span>
|
||||||
|
{note}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
<hr />
|
<hr />
|
||||||
</CollapsibleParagraph>);
|
</CollapsibleParagraph>);
|
||||||
@ -267,43 +289,6 @@ let PrizePieceRatings = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let PersonalNote = React.createClass({
|
|
||||||
propTypes: {
|
|
||||||
piece: React.PropTypes.object,
|
|
||||||
currentUser: React.PropTypes.object
|
|
||||||
},
|
|
||||||
showNotification(){
|
|
||||||
let notification = new GlobalNotificationModel(getLangText('Jury note saved'), 'success');
|
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
|
||||||
if (this.props.currentUser && this.props.currentUser.username) {
|
|
||||||
return (
|
|
||||||
<Form
|
|
||||||
url={ApiUrls.notes}
|
|
||||||
handleSuccess={this.showNotification}>
|
|
||||||
<Property
|
|
||||||
name='value'
|
|
||||||
label={getLangText('Jury note')}
|
|
||||||
editable={true}>
|
|
||||||
<InputTextAreaToggable
|
|
||||||
rows={1}
|
|
||||||
editable={true}
|
|
||||||
defaultValue={this.props.piece && this.props.piece.note_from_user ? this.props.piece.note_from_user.note : null}
|
|
||||||
placeholder={getLangText('Enter your comments...')}/>
|
|
||||||
</Property>
|
|
||||||
<Property hidden={true} name='piece_id'>
|
|
||||||
<input defaultValue={this.props.piece.id}/>
|
|
||||||
</Property>
|
|
||||||
<hr />
|
|
||||||
</Form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
let PrizePieceDetails = React.createClass({
|
let PrizePieceDetails = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
@ -105,6 +105,7 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
<InputTextAreaToggable
|
<InputTextAreaToggable
|
||||||
rows={1}
|
rows={1}
|
||||||
editable={!this.props.disabled}
|
editable={!this.props.disabled}
|
||||||
|
defaultValue={this.props.piece.extra_data.artist_bio}
|
||||||
placeholder={getLangText('Enter the artist\'s biography...')}
|
placeholder={getLangText('Enter the artist\'s biography...')}
|
||||||
required="required"/>
|
required="required"/>
|
||||||
</Property>
|
</Property>
|
||||||
@ -115,6 +116,7 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
<InputTextAreaToggable
|
<InputTextAreaToggable
|
||||||
rows={1}
|
rows={1}
|
||||||
editable={!this.props.disabled}
|
editable={!this.props.disabled}
|
||||||
|
defaultValue={this.props.piece.extra_data.conceptual_overview}
|
||||||
placeholder={getLangText('Enter a conceptual overview...')}
|
placeholder={getLangText('Enter a conceptual overview...')}
|
||||||
required="required"/>
|
required="required"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
@ -77,6 +77,15 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// This is done to update the container when the user clicks on the prev or next
|
||||||
|
// button to update the URL parameter (and therefore to switch pieces)
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
if(this.props.params.pieceId !== nextProps.params.pieceId) {
|
||||||
|
PieceActions.updatePiece({});
|
||||||
|
PieceActions.fetchOne(nextProps.params.pieceId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
PieceListStore.unlisten(this.onChange);
|
PieceListStore.unlisten(this.onChange);
|
||||||
UserStore.unlisten(this.onChange);
|
UserStore.unlisten(this.onChange);
|
||||||
|
@ -7,7 +7,8 @@ function getWalletApiUrls(subdomain) {
|
|||||||
if (subdomain === 'cyland'){
|
if (subdomain === 'cyland'){
|
||||||
return {
|
return {
|
||||||
'pieces_list': walletConstants.walletApiEndpoint + subdomain + '/pieces/',
|
'pieces_list': walletConstants.walletApiEndpoint + subdomain + '/pieces/',
|
||||||
'piece': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/'
|
'piece': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/',
|
||||||
|
'piece_extradata': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/extradata/'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (subdomain === 'ikonotv'){
|
else if (subdomain === 'ikonotv'){
|
||||||
|
@ -403,17 +403,6 @@ hr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.rating-container .rating-stars {
|
|
||||||
width: 25px;
|
|
||||||
color: #02b6a3;
|
|
||||||
}
|
|
||||||
#list-rating > a > span > span > .rating-container .rating-stars{
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.react-rating-caption {
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.disable-select {
|
.disable-select {
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@import 'landing';
|
@import 'landing';
|
||||||
|
@import 'rating';
|
||||||
|
|
||||||
.ascribe-prize-app {
|
.ascribe-prize-app {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
34
sass/whitelabel/prize/rating.scss
Normal file
34
sass/whitelabel/prize/rating.scss
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
.rating-container .rating-stars {
|
||||||
|
width: 25px;
|
||||||
|
color: #02b6a3;
|
||||||
|
}
|
||||||
|
|
||||||
|
#list-rating {
|
||||||
|
> a > span > span > .rating-container .rating-stars {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
> span > span > span > .rating-container .rating-stars {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
> span > span > .rating-container .rating-stars {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.react-rating-caption {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-list {
|
||||||
|
margin-left: 1.5em;
|
||||||
|
font-size: 0.9em;
|
||||||
|
margin-bottom: 0.3em;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-note {
|
||||||
|
color: #666;
|
||||||
|
font-style: italic;
|
||||||
|
padding: 0.2em;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user