From 37e4b68afb74cdc632c2486cbe4d6d58d5913e9a Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 27 May 2016 12:04:36 +0200 Subject: [PATCH] Remove prize whitelabels --- .../ascribe_forms/form_submit_to_prize.js | 89 ---- .../prize/constants/prize_api_urls.js | 28 - .../constants/prize_application_constants.js | 9 - .../pr_forms/pr_register_piece_form.js | 417 --------------- .../portfolioreview/components/pr_hero.js | 33 -- .../portfolioreview/components/pr_landing.js | 124 ----- .../components/pr_register_piece.js | 72 --- .../components/pr_routes/pr_proxy_handler.js | 26 - .../prize/portfolioreview/pr_app.js | 73 --- .../whitelabel/prize/prize_routes.js | 137 ----- .../simple_prize/actions/prize_actions.js | 28 - .../actions/prize_jury_actions.js | 76 --- .../actions/prize_rating_actions.js | 76 --- .../accordion_list_item_prize.js | 191 ------- .../ascribe_buttons/submit_to_prize_button.js | 55 -- .../ascribe_detail/prize_piece_container.js | 495 ------------------ .../simple_prize/components/prize_hero.js | 20 - .../simple_prize/components/prize_landing.js | 111 ---- .../components/prize_login_container.js | 45 -- .../components/prize_piece_list.js | 94 ---- .../components/prize_register_piece.js | 102 ---- .../components/prize_settings_container.js | 302 ----------- .../components/prize_signup_container.js | 61 --- .../simple_prize/fetchers/prize_fetcher.js | 12 - .../fetchers/prize_jury_fetcher.js | 24 - .../fetchers/prize_rating_fetcher.js | 49 -- .../prize/simple_prize/prize_app.js | 61 --- .../simple_prize/stores/prize_jury_store.js | 35 -- .../simple_prize/stores/prize_rating_store.js | 47 -- .../prize/simple_prize/stores/prize_store.js | 18 - .../sluice_selected_prize_action_button.js | 71 --- .../sluice_detail/sluice_piece_container.js | 29 - .../components/23vivi/23vivi_piece_list.js | 2 +- .../components/artcity/artcity_landing.js | 2 +- .../cyland_detail/cyland_piece_container.js | 2 +- .../components/cyland/cyland_landing.js | 2 +- .../components/cyland/cyland_piece_list.js | 2 +- .../cyland/cyland_register_piece.js | 2 +- .../ikonotv/ikonotv_contract_notifications.js | 2 +- .../ikonotv_detail/ikonotv_piece_container.js | 2 +- .../components/ikonotv/ikonotv_landing.js | 2 +- .../components/ikonotv/ikonotv_piece_list.js | 2 +- .../ikonotv/ikonotv_register_piece.js | 2 +- .../components/lumenus/lumenus_landing.js | 2 +- .../components/market/market_piece_list.js | 2 +- .../market/market_register_piece.js | 2 +- js/constants/api_urls.js | 10 +- js/constants/application_constants.js | 11 - js/routes.js | 5 +- 49 files changed, 17 insertions(+), 3047 deletions(-) delete mode 100644 js/components/ascribe_forms/form_submit_to_prize.js delete mode 100644 js/components/whitelabel/prize/constants/prize_api_urls.js delete mode 100644 js/components/whitelabel/prize/constants/prize_application_constants.js delete mode 100644 js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js delete mode 100644 js/components/whitelabel/prize/portfolioreview/components/pr_hero.js delete mode 100644 js/components/whitelabel/prize/portfolioreview/components/pr_landing.js delete mode 100644 js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js delete mode 100644 js/components/whitelabel/prize/portfolioreview/components/pr_routes/pr_proxy_handler.js delete mode 100644 js/components/whitelabel/prize/portfolioreview/pr_app.js delete mode 100644 js/components/whitelabel/prize/prize_routes.js delete mode 100644 js/components/whitelabel/prize/simple_prize/actions/prize_actions.js delete mode 100644 js/components/whitelabel/prize/simple_prize/actions/prize_jury_actions.js delete mode 100644 js/components/whitelabel/prize/simple_prize/actions/prize_rating_actions.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/ascribe_buttons/submit_to_prize_button.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/ascribe_detail/prize_piece_container.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/prize_hero.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/prize_landing.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/prize_login_container.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/prize_piece_list.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/prize_register_piece.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/prize_settings_container.js delete mode 100644 js/components/whitelabel/prize/simple_prize/components/prize_signup_container.js delete mode 100644 js/components/whitelabel/prize/simple_prize/fetchers/prize_fetcher.js delete mode 100644 js/components/whitelabel/prize/simple_prize/fetchers/prize_jury_fetcher.js delete mode 100644 js/components/whitelabel/prize/simple_prize/fetchers/prize_rating_fetcher.js delete mode 100644 js/components/whitelabel/prize/simple_prize/prize_app.js delete mode 100644 js/components/whitelabel/prize/simple_prize/stores/prize_jury_store.js delete mode 100644 js/components/whitelabel/prize/simple_prize/stores/prize_rating_store.js delete mode 100644 js/components/whitelabel/prize/simple_prize/stores/prize_store.js delete mode 100644 js/components/whitelabel/prize/sluice/components/sluice_buttons/sluice_selected_prize_action_button.js delete mode 100644 js/components/whitelabel/prize/sluice/components/sluice_detail/sluice_piece_container.js diff --git a/js/components/ascribe_forms/form_submit_to_prize.js b/js/components/ascribe_forms/form_submit_to_prize.js deleted file mode 100644 index 43f28e2a..00000000 --- a/js/components/ascribe_forms/form_submit_to_prize.js +++ /dev/null @@ -1,89 +0,0 @@ -'use strict'; - -import React from 'react'; - -import Form from './form'; -import Property from './property'; -import InputTextAreaToggable from './input_textarea_toggable'; -import InputCheckbox from './input_checkbox'; - -import Alert from 'react-bootstrap/lib/Alert'; - -import AscribeSpinner from '../ascribe_spinner'; -import ApiUrls from '../../constants/api_urls'; - -import { getLangText } from '../../utils/lang_utils.js'; - -import requests from '../../utils/requests'; - -let PieceSubmitToPrizeForm = React.createClass({ - propTypes: { - piece: React.PropTypes.object, - handleSuccess: React.PropTypes.func - }, - - render() { - return ( -
-

- -

- } - spinner={ -
-

- -

-
}> - - - - - - - - - - {' ' + getLangText('I agree to the Terms of Service the art price') + ' '} - ( - {getLangText('read')} - ) - - - - -

{getLangText('Are you sure you want to submit to the prize?')}

-

{getLangText('This is an irrevocable action%s', '.')}

-
-
- ); - } -}); - - -export default PieceSubmitToPrizeForm; diff --git a/js/components/whitelabel/prize/constants/prize_api_urls.js b/js/components/whitelabel/prize/constants/prize_api_urls.js deleted file mode 100644 index cb4e2e44..00000000 --- a/js/components/whitelabel/prize/constants/prize_api_urls.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -import AppPrizeConstants from './prize_application_constants'; - - -function getPrizeApiUrls(subdomain) { - return { - 'users_login': AppPrizeConstants.prizeApiEndpoint + subdomain + '/users/login/', - 'users_signup': AppPrizeConstants.prizeApiEndpoint + subdomain + '/users/', - 'user': AppPrizeConstants.prizeApiEndpoint + subdomain + '/users/', - 'piece_submit_to_prize': AppPrizeConstants.prizeApiEndpoint + subdomain + '/pieces/${piece_id}/submit/', - 'pieces_list': AppPrizeConstants.prizeApiEndpoint + subdomain + '/pieces/', - 'piece': AppPrizeConstants.prizeApiEndpoint + subdomain + '/pieces/${piece_id}/', - 'prize': AppPrizeConstants.prizeApiEndpoint + subdomain + '/', - 'jurys': AppPrizeConstants.prizeApiEndpoint + subdomain + '/jury/', - 'jury': AppPrizeConstants.prizeApiEndpoint + subdomain + '/jury/${email}/', - '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_average': AppPrizeConstants.prizeApiEndpoint + subdomain + '/ratings/${piece_id}/average/', - 'select_piece': AppPrizeConstants.prizeApiEndpoint + subdomain + '/ratings/${piece_id}/select/', - 'notes': AppPrizeConstants.prizeApiEndpoint + subdomain + '/notes/', - 'note': AppPrizeConstants.prizeApiEndpoint + subdomain + '/notes/${piece_id}/' - }; -} - -export default getPrizeApiUrls; diff --git a/js/components/whitelabel/prize/constants/prize_application_constants.js b/js/components/whitelabel/prize/constants/prize_application_constants.js deleted file mode 100644 index 9ba87a37..00000000 --- a/js/components/whitelabel/prize/constants/prize_application_constants.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -import AppConstants from '../../../../constants/application_constants'; - -let prizeConstants = { - prizeApiEndpoint: AppConstants.apiEndpoint + 'prizes/' -}; - -export default prizeConstants; \ No newline at end of file diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js b/js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js deleted file mode 100644 index 205a5634..00000000 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_forms/pr_register_piece_form.js +++ /dev/null @@ -1,417 +0,0 @@ -'use strict'; - -import React from 'react'; -import { History } from 'react-router'; - -import GlobalNotificationModel from '../../../../../../models/global_notification_model'; -import GlobalNotificationActions from '../../../../../../actions/global_notification_actions'; - -import Form from '../../../../../ascribe_forms/form'; -import Property from '../../../../../ascribe_forms/property'; -import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_toggable'; - -import InputFineuploader from '../../../../../ascribe_forms/input_fineuploader'; -import UploadButton from '../../../../../ascribe_uploader/ascribe_upload_button/upload_button'; - -import AscribeSpinner from '../../../../../ascribe_spinner'; - -import ApiUrls from '../../../../../../constants/api_urls'; -import AppConstants from '../../../../../../constants/application_constants'; -import { validationParts, validationTypes } from '../../../../../../constants/uploader_constants'; - -import requests from '../../../../../../utils/requests'; - -import { getErrorNotificationMessage } from '../../../../../../utils/error_utils'; -import { setCookie } from '../../../../../../utils/fetch_api_utils'; -import { validateForms } from '../../../../../../utils/form_utils'; -import { getLangText } from '../../../../../../utils/lang_utils'; -import { formSubmissionValidation } from '../../../../../ascribe_uploader/react_s3_fine_uploader_utils'; - - -const { object } = React.PropTypes; - -const PRRegisterPieceForm = React.createClass({ - propTypes: { - currentUser: object.isRequired, - location: object - }, - - mixins: [History], - - getInitialState() { - return { - digitalWorkKeyReady: true, - thumbnailKeyReady: true, - - // we set this to true, as it is not required - supportingMaterialsReady: true, - proofOfPaymentReady: true, - piece: null, - submitted: false - }; - }, - - /** - * In this method, we're composing all fields on the page - * in two steps, first submitting the registration of the piece and - * second adding all the additional details - */ - submit() { - if (!this.validateForms()) { - return; - } - - // disable the submission button right after the user - // clicks on it to avoid double submission - this.setState({ - submitted: true - }); - - const { currentUser } = this.props; - const { registerPieceForm, - additionalDataForm, - uploadersForm } = this.refs; - const { digitalWorkKey, - thumbnailKey, - supportingMaterials, - proofOfPayment } = uploadersForm.refs; - const additionalDataFormData = additionalDataForm.getFormData(); - - // composing data for piece registration - const registerPieceFormData = registerPieceForm.getFormData(); - registerPieceFormData.digital_work_key = digitalWorkKey.state.value; - registerPieceFormData.thumbnail_file = thumbnailKey.state.value; - registerPieceFormData.terms = true; - - // submitting the piece - requests - .post(ApiUrls.pieces_list, { body: registerPieceFormData }) - .then(({ piece, notification }) => { - this.setState({piece}, () => { - supportingMaterials.refs.input.createBlobRoutine(); - proofOfPayment.refs.input.createBlobRoutine(); - }); - - setCookie(currentUser.email, piece.id); - - return requests - .post(ApiUrls.piece_extradata, { - body: { - extradata: additionalDataFormData, - piece_id: piece.id - }, - piece_id: piece.id - }) - .then(() => { - const notificationMessage = new GlobalNotificationModel(notification || getLangText('You have successfully submitted "%s" to Portfolio Review 2015', piece.title), 'success', 5000); - GlobalNotificationActions.appendGlobalNotification(notificationMessage); - }); - }) - .then(() => this.history.push(`/pieces/${this.state.piece.id}`)) - .catch((err) => { - const errMessage = (getErrorNotificationMessage(err) || getLangText("Oops! We weren't able to send your submission.")) + - getLangText(' Please contact support@ascribe.io'); - - const notificationMessage = new GlobalNotificationModel(errMessage, 'danger', 10000); - GlobalNotificationActions.appendGlobalNotification(notificationMessage); - - console.logGlobal(new Error('Portfolio Review piece registration failed'), err); - - // Reset the submit button - this.setState({ - submitted: false - }); - }); - }, - - validateForms() { - const { registerPieceForm, - additionalDataForm, - uploadersForm } = this.refs; - - return validateForms([registerPieceForm, additionalDataForm, uploadersForm], true); - }, - - getCreateBlobRoutine() { - const { piece } = this.state; - - if(piece && piece.id) { - return { - url: ApiUrls.blob_otherdatas, - pieceId: piece.id - }; - } else { - return null; - } - }, - - /** - * These two methods are overloaded so that we can track the ready-state - * of each uploader in the component - * @param {string} uploaderKey Name of the uploader's key to track - */ - setIsUploadReady(uploaderKey) { - return (isUploadReady) => { - this.setState({ - [uploaderKey]: isUploadReady - }); - }; - }, - - handleOptionalFileValidationFailed(uploaderKey) { - return () => { - this.setState({ - [uploaderKey]: true - }); - }; - }, - - getSubmitButton() { - const { digitalWorkKeyReady, - thumbnailKeyReady, - supportingMaterialsReady, - proofOfPaymentReady, - submitted } = this.state; - - if(submitted) { - return ( - - - - ); - } else { - return ( - - ); - } - }, - - render() { - const { location } = this.props; - const maxThumbnailSize = validationTypes.workThumbnail.sizeLimit / 1000000; - - return ( -
-
- - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - -
-
- - - {getLangText('By submitting this form, you agree to the') + ' '} - - {getLangText('Terms of Service')} - - {' of Portfolio Review.'} - - -
- {this.getSubmitButton()} -
- ); - } -}); - -export default PRRegisterPieceForm; diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_hero.js b/js/components/whitelabel/prize/portfolioreview/components/pr_hero.js deleted file mode 100644 index e5ec57db..00000000 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_hero.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -import React from 'react'; -import { Link } from 'react-router'; - -import Glyphicon from 'react-bootstrap/lib/Glyphicon'; - -import { getLangText } from '../../../../../utils/lang_utils'; - - -const PRHero = React.createClass({ - propTypes: { - currentUser: React.PropTypes.shape({ - email: React.PropTypes.object - }).isRequired - }, - - render() { - const { currentUser } = this.props; - - return ( -
-

-  {getLangText('Congratulations') + (currentUser.email ? ` ${currentUser.email}!` : '!')} -

-

{getLangText('You have successfully submitted to Portfolio Review 2016.')}

-

Not you? {getLangText('Change account.')}

-
- ); - } -}); - -export default PRHero; diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js b/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js deleted file mode 100644 index 4cb925a8..00000000 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_landing.js +++ /dev/null @@ -1,124 +0,0 @@ -'use strict'; - -import React from 'react'; -import { History } from 'react-router'; - -import Button from 'react-bootstrap/lib/Button'; -import ButtonGroup from 'react-bootstrap/lib/ButtonGroup'; - -import LinkContainer from 'react-router-bootstrap/lib/LinkContainer'; - -import PrizeActions from '../../simple_prize/actions/prize_actions'; -import PrizeStore from '../../simple_prize/stores/prize_store'; - -import { omitFromObject } from '../../../../../utils/general_utils'; -import { getLangText } from '../../../../../utils/lang_utils'; - - -const PRLanding = React.createClass({ - propTypes: { - // Provided from PrizeApp - currentUser: React.PropTypes.object, - whitelabel: React.PropTypes.object, - - // Provided from router - location: React.PropTypes.object - }, - - mixins: [History], - - getInitialState() { - return PrizeStore.getState(); - }, - - componentDidMount() { - const { location } = this.props; - - PrizeStore.listen(this.onChange); - PrizeActions.fetchPrize(); - - if (location.query.redirect) { - window.setTimeout(() => this.history.replace({ - pathname: `/${location.query.redirect}`, - query: omitFromObject(location.query, ['redirect']) - })); - } - }, - - componentWillUnmount() { - PrizeStore.unlisten(this.onChange); - }, - - onChange(state) { - this.setState(state); - }, - - getButtons() { - if (this.state.prize && this.state.prize.active) { - return ( - - - - - -

- {getLangText('or, already an ascribe user?')} -

- - - -
- ); - } else { - return ( - - - {getLangText('Sign up to ascribe')} - - -

- {getLangText('or, already an ascribe user?')} -

- - - -
- ); - } - }, - - getTitle() { - const { prize } = this.state; - - return ( -

- {getLangText(prize && prize.active ? 'This is the submission page for Portfolio Review 2016.' - : 'Submissions for Portfolio Review 2016 are now closed.')} -

- ); - }, - - render() { - return ( -
-
-
-

- {getLangText('Welcome to Portfolio Review 2016')} -

- {this.getTitle()} - {this.getButtons()} -
-
-
- ); - } -}); - -export default PRLanding; diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js b/js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js deleted file mode 100644 index 5f459ecd..00000000 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_register_piece.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -import React from 'react'; -import { Link, History } from 'react-router'; - -import Col from 'react-bootstrap/lib/Col'; -import Row from 'react-bootstrap/lib/Row'; - -import PRRegisterPieceForm from './pr_forms/pr_register_piece_form'; - -import { getLangText } from '../../../../../utils/lang_utils'; -import { setDocumentTitle } from '../../../../../utils/dom_utils'; -import { getCookie } from '../../../../../utils/fetch_api_utils'; - - -const { object } = React.PropTypes; - -const PRRegisterPiece = React.createClass({ - propTypes: { - // Provided from PrizeApp - currentUser: React.PropTypes.object.isRequired, - whitelabel: React.PropTypes.object, - - // Provided from router - location: object - }, - - mixins: [History], - - componentDidUpdate() { - const { currentUser } = this.props; - if (currentUser.email) { - const submittedPieceId = getCookie(currentUser.email); - if (submittedPieceId) { - this.history.push(`/pieces/${submittedPieceId}`); - } - } - }, - - render() { - const { currentUser, location } = this.props; - - setDocumentTitle(getLangText('Submit to Portfolio Review')); - - return ( - - -
-

Portfolio Review

-

{getLangText('Submission closing on %s', ' 27 Dec 2015')}

-

For more information, visit:  - - portfolio-review.de - -

-

- {getLangText("You're submitting as %s. ", currentUser.email)} - {getLangText('Change account?')} -

-
- - - - -
- ); - } -}); - -export default PRRegisterPiece; diff --git a/js/components/whitelabel/prize/portfolioreview/components/pr_routes/pr_proxy_handler.js b/js/components/whitelabel/prize/portfolioreview/components/pr_routes/pr_proxy_handler.js deleted file mode 100644 index f81c4539..00000000 --- a/js/components/whitelabel/prize/portfolioreview/components/pr_routes/pr_proxy_handler.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -import history from '../../../../../../history'; - - -export function AuthPrizeRoleRedirect({ to, when }) { - if (when.constructor !== Array || !when.length) { - throw new Error('`when` of AuthPrizeRoleRedirect must be an array containing values'); - } - if (!to || to.indexOf('/') === -1) { - throw new Error('`to` of AuthPrizeRoleRedirect must be defined and contain a valid route'); - } - - return function(currentUser, query) { - const exprToValidate = when - .map(role => currentUser[role]) - .reduce((a, b) => a || b); - - if (exprToValidate) { - window.setTimeout(() => history.replace({ query, pathname: to })); - return true; - } else { - return false; - } - }; -} diff --git a/js/components/whitelabel/prize/portfolioreview/pr_app.js b/js/components/whitelabel/prize/portfolioreview/pr_app.js deleted file mode 100644 index 2d097c75..00000000 --- a/js/components/whitelabel/prize/portfolioreview/pr_app.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; - -import React from 'react'; -import classNames from 'classnames'; - -import EventActions from '../../../../actions/event_actions'; - -import UserStore from '../../../../stores/user_store'; -import UserActions from '../../../../actions/user_actions'; - -import Hero from './components/pr_hero'; - -import AppBase from '../../../app_base'; -import AppRouteWrapper from '../../../app_route_wrapper'; -import Header from '../../../header'; - -import { getSubdomain } from '../../../../utils/general_utils'; -import { getCookie } from '../../../../utils/fetch_api_utils'; - - -let PRApp = React.createClass({ - propTypes: { - activeRoute: React.PropTypes.object.isRequired, - children: React.PropTypes.element.isRequired, - history: React.PropTypes.object.isRequired, - routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, - - // Provided from AppBase - currentUser: React.PropTypes.object, - whitelabel: React.PropTypes.object - }, - - render() { - const { activeRoute, children, currentUser, history, routes, whitelabel } = this.props; - const subdomain = getSubdomain(); - const path = activeRoute && activeRoute.path; - const Footer = activeRoute && activeRoute.footer; - - let style = {}; - let header; - if (currentUser && currentUser.email && history.isActive(`/pieces/${getCookie(currentUser.email)}`)) { - header = (); - style = { paddingTop: '0 !important' }; - } else if (currentUser && (currentUser.is_admin || currentUser.is_jury || currentUser.is_judge)) { - header = ( -
- ); - } else { - style = { paddingTop: '0 !important' }; - } - - return ( -
- {header} - - {/* Routes are injected here */} - {children} - - {Footer ?
: null} -
- ); - } -}); - -export default AppBase(PRApp); diff --git a/js/components/whitelabel/prize/prize_routes.js b/js/components/whitelabel/prize/prize_routes.js deleted file mode 100644 index f1f32772..00000000 --- a/js/components/whitelabel/prize/prize_routes.js +++ /dev/null @@ -1,137 +0,0 @@ -'use strict'; - -import React from 'react'; -import { Route, IndexRoute } from 'react-router'; - -import { ProxyHandler, AuthRedirect } from '../../../components/ascribe_routes/proxy_handler'; -import { AuthPrizeRoleRedirect } from './portfolioreview/components/pr_routes/pr_proxy_handler'; - -// General components -import EditionContainer from '../../ascribe_detail/edition_container'; -import LogoutContainer from '../../logout_container'; -import PasswordResetContainer from '../../password_reset_container'; -import CoaVerifyContainer from '../../coa_verify_container'; -import ErrorNotFoundPage from '../../error_not_found_page'; - -import SPApp from './simple_prize/prize_app'; -import SPLanding from './simple_prize/components/prize_landing'; -import SPLoginContainer from './simple_prize/components/prize_login_container'; -import SPSignupContainer from './simple_prize/components/prize_signup_container'; -import SPRegisterPiece from './simple_prize/components/prize_register_piece'; -import SPPieceList from './simple_prize/components/prize_piece_list'; -import SPPieceContainer from './simple_prize/components/ascribe_detail/prize_piece_container'; -import SPSettingsContainer from './simple_prize/components/prize_settings_container'; - -import SluicePieceContainer from './sluice/components/sluice_detail/sluice_piece_container'; - -import PRApp from './portfolioreview/pr_app'; -import PRLanding from './portfolioreview/components/pr_landing'; -import PRRegisterPiece from './portfolioreview/components/pr_register_piece'; - -import { getLangText } from '../../../utils/lang_utils'; - - -const ROUTES = { - sluice: ( - - - - - - - - - - - - - - - ), - portfolioreview: ( - - - - - - - - - - - - - - - ) -}; - - -function getRoutes(commonRoutes, subdomain) { - if(subdomain in ROUTES) { - return ROUTES[subdomain]; - } else { - throw new Error('Subdomain wasn\'t specified in the wallet app.'); - } -} - - -export default getRoutes; diff --git a/js/components/whitelabel/prize/simple_prize/actions/prize_actions.js b/js/components/whitelabel/prize/simple_prize/actions/prize_actions.js deleted file mode 100644 index 242bb846..00000000 --- a/js/components/whitelabel/prize/simple_prize/actions/prize_actions.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -import { alt } from '../../../../../alt'; - -import PrizeFetcher from '../fetchers/prize_fetcher'; - -class PrizeActions { - constructor() { - this.generateActions( - 'updatePrize' - ); - } - - fetchPrize() { - PrizeFetcher - .fetch() - .then((res) => { - this.actions.updatePrize({ - prize: res - }); - }) - .catch((err) => { - console.logGlobal(err); - }); - } -} - -export default alt.createActions(PrizeActions); \ No newline at end of file diff --git a/js/components/whitelabel/prize/simple_prize/actions/prize_jury_actions.js b/js/components/whitelabel/prize/simple_prize/actions/prize_jury_actions.js deleted file mode 100644 index 24cf08e8..00000000 --- a/js/components/whitelabel/prize/simple_prize/actions/prize_jury_actions.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -import { alt } from '../../../../../alt'; -import Q from 'q'; - -import PrizeJuryFetcher from '../fetchers/prize_jury_fetcher'; - -class PrizeJuryActions { - constructor() { - this.generateActions( - 'updatePrizeJury', - 'removePrizeJury', - 'activatePrizeJury' - ); - } - - fetchJury() { - return Q.Promise((resolve, reject) => { - PrizeJuryFetcher - .fetch() - .then((res) => { - this.actions.updatePrizeJury(res.members); - resolve(res); - }) - .catch((err) => { - console.logGlobal(err); - reject(err); - }); - }); - } - - activateJury(email) { - return Q.Promise((resolve, reject) => { - PrizeJuryFetcher - .activate(email) - .then((res) => { - resolve(res); - }) - .catch((err) => { - console.logGlobal(err); - reject(err); - }); - }); - } - - revokeJury(email) { - return Q.Promise((resolve, reject) => { - PrizeJuryFetcher - .delete(email) - .then((res) => { - this.actions.removePrizeJury(email); - resolve(res); - }) - .catch((err) => { - console.logGlobal(err); - reject(err); - }); - }); - } - - resendJuryInvitation(email) { - return Q.Promise((resolve, reject) => { - PrizeJuryFetcher - .resend(email) - .then((res) => { - resolve(res); - }) - .catch((err) => { - console.logGlobal(err); - reject(err); - }); - }); - } -} - -export default alt.createActions(PrizeJuryActions); \ No newline at end of file diff --git a/js/components/whitelabel/prize/simple_prize/actions/prize_rating_actions.js b/js/components/whitelabel/prize/simple_prize/actions/prize_rating_actions.js deleted file mode 100644 index 91852704..00000000 --- a/js/components/whitelabel/prize/simple_prize/actions/prize_rating_actions.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -import { alt } from '../../../../../alt'; -import Q from 'q'; - -import PrizeRatingFetcher from '../fetchers/prize_rating_fetcher'; - -class PrizeRatingActions { - constructor() { - this.generateActions( - 'updatePrizeRatings', - 'updatePrizeRatingAverage', - 'updatePrizeRating', - 'resetPrizeRatings' - ); - } - - fetchAverage(pieceId, round) { - return Q.Promise((resolve, reject) => { - PrizeRatingFetcher - .fetchAverage(pieceId, round) - .then((res) => { - this.actions.updatePrizeRatingAverage(res.data); - resolve(res); - }) - .catch((err) => { - console.logGlobal(err); - reject(err); - }); - }); - } - - fetchOne(pieceId, round) { - return Q.Promise((resolve, reject) => { - PrizeRatingFetcher - .fetchOne(pieceId, round) - .then((res) => { - this.actions.updatePrizeRating(res.rating.rating); - resolve(res); - }) - .catch((err) => { - reject(err); - }); - }); - } - - createRating(pieceId, rating, round) { - return Q.Promise((resolve, reject) => { - PrizeRatingFetcher - .rate(pieceId, rating, round) - .then((res) => { - this.actions.updatePrizeRating(res.rating.rating); - resolve(res); - }) - .catch((err) => { - reject(err); - }); - }); - } - - toggleShortlist(pieceId) { - return Q.Promise((resolve, reject) => { - PrizeRatingFetcher - .select(pieceId) - .then((res) => { - this.actions.updatePrizeRatings(res.data.ratings); - resolve(res); - }) - .catch((err) => { - reject(err); - }); - }); - } -} - -export default alt.createActions(PrizeRatingActions); diff --git a/js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js b/js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js deleted file mode 100644 index 938f654f..00000000 --- a/js/components/whitelabel/prize/simple_prize/components/ascribe_accordion_list/accordion_list_item_prize.js +++ /dev/null @@ -1,191 +0,0 @@ -'use strict'; - -import React from 'react'; -import { Link } from 'react-router'; -import StarRating from 'react-star-rating'; -import Moment from 'moment'; - -import PieceListActions from '../../../../../../actions/piece_list_actions'; -import PieceListStore from '../../../../../../stores/piece_list_store'; - -import PrizeRatingActions from '../../actions/prize_rating_actions'; - -import InputCheckbox from '../../../../../ascribe_forms/input_checkbox'; - -import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece'; - -import GlobalNotificationModel from '../../../../../../models/global_notification_model'; -import GlobalNotificationActions from '../../../../../../actions/global_notification_actions'; - -import AclProxy from '../../../../../acl_proxy'; -import SubmitToPrizeButton from './../ascribe_buttons/submit_to_prize_button'; - -import { getLangText } from '../../../../../../utils/lang_utils'; - - -let AccordionListItemPrize = React.createClass({ - propTypes: { - content: React.PropTypes.object.isRequired, - currentUser: React.PropTypes.object.isRequired, - - children: React.PropTypes.oneOfType([ - React.PropTypes.arrayOf(React.PropTypes.element), - React.PropTypes.element - ]), - className: React.PropTypes.string - }, - - getInitialState() { - return PieceListStore.getState(); - }, - - componentDidMount() { - PieceListStore.listen(this.onChange); - }, - - componentWillUnmount() { - PieceListStore.unlisten(this.onChange); - }, - - onChange(state) { - this.setState(state); - }, - - handleSubmitPrizeSuccess(response) { - const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state; - - PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy }); - - const notification = new GlobalNotificationModel(response.notification, 'success', 10000); - GlobalNotificationActions.appendGlobalNotification(notification); - }, - - getPrizeButtons() { - const { currentUser, content: { id, ratings } } = this.props; - - if (currentUser && (currentUser.is_jury || currentUser.is_judge)) { - if (ratings && (ratings.rating || ratings.average)) { - // jury and rating available - let rating = null; - let caption = null; - - if (ratings.rating) { - rating = parseInt(ratings.rating, 10); - caption = getLangText('Your rating'); - } else if (ratings.average) { - rating = ratings.average; - caption = getLangText('Average of ' + ratings.num_ratings + ' rating(s)'); - } - - return ( -
- - - -
- ); - } else { - if (currentUser.is_judge) { - return ( -
- {getLangText('Not rated')} -
- ); - } else { - // jury and no rating yet - return ( -
- - {getLangText('Submit your rating')} - -
- ); - } - } - } else { - return this.getPrizeButtonsParticipant(); - } - }, - - getPrizeButtonsParticipant() { - return ( - - - - ); - }, - - handleShortlistSuccess(message) { - const notification = new GlobalNotificationModel(message, 'success', 2000); - GlobalNotificationActions.appendGlobalNotification(notification); - }, - - refreshPieceData() { - const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state; - - PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy }); - }, - - onSelectChange() { - PrizeRatingActions.toggleShortlist(this.props.content.id) - .then((res) => { - this.refreshPieceData(); - this.handleShortlistSuccess(res.notification); - }); - - }, - - getPrizeBadge() { - const { currentUser } = this.props; - - if (currentUser && currentUser.is_judge) { - return ( - - - - ); - } else { - return null; - } - }, - - render() { - const { children, className, content, currentUser } = this.props; - - // Only show the artist name if you are the participant or if you are a judge and the piece is shortlisted - const artistName = ((currentUser.is_jury && !currentUser.is_judge) || (currentUser.is_judge && !content.selected )) ? -