From 19f82b2bbd83e20fc7a8216be39532e54bd8a842 Mon Sep 17 00:00:00 2001 From: vrde Date: Mon, 13 Jul 2015 22:58:53 +0200 Subject: [PATCH] work on register piece for for prize --- .../ascribe_forms/form_register_piece.js | 13 ++++- js/components/register_piece.js | 43 +++++++++++++--- .../prize/components/register_piece.js | 50 +++++++++++++++++++ js/components/whitelabel/prize/routes.js | 4 +- 4 files changed, 98 insertions(+), 12 deletions(-) create mode 100644 js/components/whitelabel/prize/components/register_piece.js diff --git a/js/components/ascribe_forms/form_register_piece.js b/js/components/ascribe_forms/form_register_piece.js index 6664fe6f..d3748fc0 100644 --- a/js/components/ascribe_forms/form_register_piece.js +++ b/js/components/ascribe_forms/form_register_piece.js @@ -18,11 +18,20 @@ import { getLangText } from '../../utils/lang_utils'; let RegisterPieceForm = React.createClass({ propTypes: { + headerMessage: React.PropTypes.string, + submitMessage: React.PropTypes.string, handleSuccess: React.PropTypes.func, isFineUploaderEditable: React.PropTypes.bool, children: React.PropTypes.element }, + getDefaultProps() { + return { + headerMessage: getLangText('Register your work'), + submitMessage: getLangText('Register work') + }; + }, + getInitialState(){ return { digitalWorkKey: null, @@ -69,7 +78,7 @@ let RegisterPieceForm = React.createClass({ type="submit" className="btn ascribe-btn ascribe-btn-login" disabled={!this.state.isUploadReady}> - {getLangText('Register work')} + {this.props.submitMessage} } spinner={ @@ -77,7 +86,7 @@ let RegisterPieceForm = React.createClass({ }> -

{getLangText('Register your work')}

+

{this.props.headerMessage}

diff --git a/js/components/register_piece.js b/js/components/register_piece.js index 3e9f6c5f..d581f951 100644 --- a/js/components/register_piece.js +++ b/js/components/register_piece.js @@ -29,9 +29,26 @@ import SlidesContainer from './ascribe_slides_container/slides_container'; import { mergeOptions } from '../utils/general_utils'; import { getLangText } from '../utils/lang_utils'; + let RegisterPiece = React.createClass( { + + propTypes: { + headerMessage: React.PropTypes.string, + submitMessage: React.PropTypes.string, + canSpecifyEditions: React.PropTypes.bool, + children: React.PropTypes.oneOfType([ + React.PropTypes.arrayOf(React.PropTypes.element), + React.PropTypes.element]) + }, + mixins: [Router.Navigation], + getDefaultProps() { + return { + canSpecifyEditions: true + }; + }, + getInitialState(){ return mergeOptions( LicenseStore.getState(), @@ -118,6 +135,21 @@ let RegisterPiece = React.createClass( { return null; }, + getSpecifyEditions() { + if (this.props.canSpecifyEditions) { + return ( + + {getLangText('Editions')} + + + ); + } + }, + changeSlide() { // only transition to the login store, if user is not logged in // ergo the currentUser object is not properly defined @@ -135,16 +167,11 @@ let RegisterPiece = React.createClass( { - - {getLangText('Editions')} - - + {this.getSpecifyEditions()} + {this.props.children} {this.getLicenses()} diff --git a/js/components/whitelabel/prize/components/register_piece.js b/js/components/whitelabel/prize/components/register_piece.js new file mode 100644 index 00000000..a1009b4b --- /dev/null +++ b/js/components/whitelabel/prize/components/register_piece.js @@ -0,0 +1,50 @@ +'use strict'; + +import React from 'react'; +import RegisterPiece from '../../../register_piece'; +import Property from '../../../ascribe_forms/property'; +import InputTextAreaToggable from '../../../ascribe_forms/input_textarea_toggable'; +import InputCheckbox from '../../../ascribe_forms/input_checkbox'; + +import { getLangText } from '../../../../utils/lang_utils'; + + +let PrizeRegisterPiece = React.createClass({ + render() { + return ( + + + + + + + + + + + + ); + } +}); + +export default PrizeRegisterPiece; diff --git a/js/components/whitelabel/prize/routes.js b/js/components/whitelabel/prize/routes.js index 10f9d000..b71e893d 100644 --- a/js/components/whitelabel/prize/routes.js +++ b/js/components/whitelabel/prize/routes.js @@ -7,7 +7,7 @@ import Landing from './components/landing'; import LoginContainer from './components/login_container'; import SignupContainer from './components/signup_container'; import PasswordResetContainer from '../../../components/password_reset_container'; -import RegisterPiece from '../../../components/register_piece'; +import PrizeRegisterPiece from './components/register_piece'; import PrizePieceList from './components/piece_list'; import App from './app'; @@ -24,7 +24,7 @@ function getRoutes(commonRoutes) { - + );