diff --git a/js/components/whitelabel/prize/components/ascribe_detail/piece_container.js b/js/components/whitelabel/prize/components/ascribe_detail/piece_container.js
index a455b1a4..b552f073 100644
--- a/js/components/whitelabel/prize/components/ascribe_detail/piece_container.js
+++ b/js/components/whitelabel/prize/components/ascribe_detail/piece_container.js
@@ -13,6 +13,8 @@ import PieceListActions from '../../../../../actions/piece_list_actions';
import PrizeRatingActions from '../../actions/prize_rating_actions';
import PrizeRatingStore from '../../stores/prize_rating_store';
+import UserStore from '../../../../../stores/user_store';
+
import Piece from '../../../../../components/ascribe_detail/piece';
import AppConstants from '../../../../../constants/application_constants';
@@ -22,8 +24,12 @@ import Property from '../../../../../components/ascribe_forms/property';
import InputTextAreaToggable from '../../../../../components/ascribe_forms/input_textarea_toggable';
import CollapsibleParagraph from '../../../../../components/ascribe_collapsible/collapsible_paragraph';
+import GlobalNotificationModel from '../../../../../models/global_notification_model';
+import GlobalNotificationActions from '../../../../../actions/global_notification_actions';
+
import DetailProperty from '../../../../ascribe_detail/detail_property';
+import ApiUrls from '../../../../../constants/api_urls';
import { mergeOptions } from '../../../../../utils/general_utils';
import { getLangText } from '../../../../../utils/lang_utils';
/**
@@ -64,6 +70,7 @@ let PieceContainer = React.createClass({
loadPiece={this.loadPiece}
header={
+
{this.state.piece.title}
@@ -87,6 +94,21 @@ let PieceContainer = React.createClass({
}
});
+let NavigationHeader = React.createClass({
+ propTypes: {
+ piece: React.PropTypes.object
+ },
+
+ render() {
+ return (
+
+ navigation
+
+ );
+ }
+});
+
+
let PrizePieceRatings = React.createClass({
propTypes: {
piece: React.PropTypes.object
@@ -95,7 +117,8 @@ let PrizePieceRatings = React.createClass({
getInitialState() {
return mergeOptions(
PieceListStore.getState(),
- PrizeRatingStore.getState()
+ PrizeRatingStore.getState(),
+ UserStore.getState()
);
},
@@ -103,6 +126,7 @@ let PrizePieceRatings = React.createClass({
PrizeRatingStore.listen(this.onChange);
PrizeRatingActions.fetchOne(this.props.piece.id);
PieceListStore.listen(this.onChange);
+ UserStore.listen(this.onChange);
},
componentWillUnmount() {
@@ -113,6 +137,7 @@ let PrizePieceRatings = React.createClass({
PrizeRatingActions.updateRating({});
PrizeRatingStore.unlisten(this.onChange);
PieceListStore.unlisten(this.onChange);
+ UserStore.unlisten(this.onChange);
},
onChange(state) {
@@ -135,26 +160,72 @@ let PrizePieceRatings = React.createClass({
);
},
render(){
- return (
-
YOUR VOTE
- }
- value={
- }
- />);
+ if (this.state.currentUser && this.state.currentUser.is_jury) {
+ return (
+
+
YOUR VOTE
+ }
+ value={
+
+ }/>
+
+ );
+ }
+ return null;
}
});
+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.username && true || false) {
+ return (
+
+ );
+ }
+ return null;
+ }
+});
+
+
let PrizePieceDetails = React.createClass({
propTypes: {
piece: React.PropTypes.object
diff --git a/js/components/whitelabel/prize/constants/api_urls.js b/js/components/whitelabel/prize/constants/api_urls.js
index 480e8d4f..a62d455b 100644
--- a/js/components/whitelabel/prize/constants/api_urls.js
+++ b/js/components/whitelabel/prize/constants/api_urls.js
@@ -16,7 +16,10 @@ function getApiUrls(subdomain) {
'jury_activate': AppPrizeConstants.prizeApiEndpoint + subdomain + '/jury/${email}/activate/',
'jury_resend': AppPrizeConstants.prizeApiEndpoint + subdomain + '/jury/${email}/resend/',
'ratings': AppPrizeConstants.prizeApiEndpoint + subdomain + '/ratings/',
- 'rating': AppPrizeConstants.prizeApiEndpoint + subdomain + '/ratings/${piece_id}/'
+ 'rating': AppPrizeConstants.prizeApiEndpoint + subdomain + '/ratings/${piece_id}/',
+ 'notes': AppPrizeConstants.prizeApiEndpoint + subdomain + '/notes/',
+ 'note': AppPrizeConstants.prizeApiEndpoint + subdomain + '/notes/${piece_id}/'
+
};
}
diff --git a/js/components/whitelabel/prize/fetchers/prize_rating_fetcher.js b/js/components/whitelabel/prize/fetchers/prize_rating_fetcher.js
index 91da0051..b7af8845 100644
--- a/js/components/whitelabel/prize/fetchers/prize_rating_fetcher.js
+++ b/js/components/whitelabel/prize/fetchers/prize_rating_fetcher.js
@@ -13,7 +13,7 @@ let PrizeRatingFetcher = {
},
rate(pieceId, rating) {
- return requests.post('ratings', {body: {'piece_id': pieceId, 'rating': rating}});
+ return requests.post('ratings', {body: {'piece_id': pieceId, 'value': rating}});
}
};