diff --git a/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js b/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js index bf6301f0..8789f641 100644 --- a/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js +++ b/js/components/whitelabel/prize/components/ascribe_accordion_list/accordion_list_item_prize.js @@ -65,17 +65,28 @@ let AccordionListItemPrize = React.createClass({ getPrizeButtons() { 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 - 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 (
diff --git a/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js b/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js index f49d430d..33cd411a 100644 --- a/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js +++ b/js/components/whitelabel/prize/components/ascribe_detail/prize_piece_container.js @@ -59,6 +59,7 @@ let PieceContainer = React.createClass({ componentWillReceiveProps(nextProps) { if(this.props.params.pieceId !== nextProps.params.pieceId) { PieceActions.updatePiece({}); + console.log('update') PieceActions.fetchOne(nextProps.params.pieceId); } }, @@ -218,19 +219,40 @@ let PrizePieceRatings = React.createClass({ title="Average Rating" show={true} defaultExpanded={true}> -
- +
+

- {this.state.ratings.map((item) => { - return item.user; + {this.state.ratings.map((item, i) => { + let note = item.note ? +
+ note: {item.note} +
: null; + return ( +
+
+ + + + {item.user} + {note} +
+
+ ); })}
); @@ -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 ( -
- - - - -
-
- ); - } - return null; - } -}); - let PrizePieceDetails = React.createClass({ propTypes: { diff --git a/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js b/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js index f7946be5..9d4ae455 100644 --- a/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js +++ b/js/components/whitelabel/wallet/components/cyland/ascribe_forms/cyland_additional_data_form.js @@ -105,6 +105,7 @@ let CylandAdditionalDataForm = React.createClass({ @@ -115,6 +116,7 @@ let CylandAdditionalDataForm = React.createClass({ diff --git a/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js index 8a092bdf..55620f89 100644 --- a/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js +++ b/js/components/whitelabel/wallet/components/cyland/cyland_register_piece.js @@ -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() { PieceListStore.unlisten(this.onChange); UserStore.unlisten(this.onChange); diff --git a/js/components/whitelabel/wallet/constants/wallet_api_urls.js b/js/components/whitelabel/wallet/constants/wallet_api_urls.js index 56b6121e..c1b101a1 100644 --- a/js/components/whitelabel/wallet/constants/wallet_api_urls.js +++ b/js/components/whitelabel/wallet/constants/wallet_api_urls.js @@ -7,7 +7,8 @@ function getWalletApiUrls(subdomain) { if (subdomain === 'cyland'){ return { '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'){ diff --git a/sass/main.scss b/sass/main.scss index fed435f0..a6ab05b3 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -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 { -webkit-user-select: none; diff --git a/sass/whitelabel/prize/index.scss b/sass/whitelabel/prize/index.scss index cc25b7ec..65c4d0c7 100644 --- a/sass/whitelabel/prize/index.scss +++ b/sass/whitelabel/prize/index.scss @@ -1,4 +1,5 @@ @import 'landing'; +@import 'rating'; .ascribe-prize-app { border-radius: 0; diff --git a/sass/whitelabel/prize/rating.scss b/sass/whitelabel/prize/rating.scss new file mode 100644 index 00000000..8ea7c8ba --- /dev/null +++ b/sass/whitelabel/prize/rating.scss @@ -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; + +} \ No newline at end of file