1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-23 16:23:33 +01:00

work on register piece for for prize

This commit is contained in:
vrde 2015-07-13 22:58:53 +02:00
parent 5ea6095f6a
commit 19f82b2bbd
4 changed files with 98 additions and 12 deletions

View File

@ -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}
</button>}
spinner={
<span className="btn ascribe-btn ascribe-btn-login ascribe-btn-login-spinner">
@ -77,7 +86,7 @@ let RegisterPieceForm = React.createClass({
</span>
}>
<FormPropertyHeader>
<h3>{getLangText('Register your work')}</h3>
<h3>{this.props.headerMessage}</h3>
</FormPropertyHeader>
<Property
ignoreFocus={true}>

View File

@ -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 (
<PropertyCollapsible
checkboxLabel={getLangText('Specify editions')}>
<span>{getLangText('Editions')}</span>
<input
type="number"
placeholder="(e.g. 32)"
min={0}/>
</PropertyCollapsible>
);
}
},
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( {
<Row className="no-margin">
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
<RegisterPieceForm
{...this.props}
isFineUploaderEditable={this.state.isFineUploaderEditable}
handleSuccess={this.handleSuccess}>
<PropertyCollapsible
checkboxLabel={getLangText('Specify editions')}>
<span>{getLangText('Editions')}</span>
<input
type="number"
placeholder="(e.g. 32)"
min={0}/>
</PropertyCollapsible>
{this.getSpecifyEditions()}
{this.props.children}
{this.getLicenses()}
</RegisterPieceForm>
</Col>

View File

@ -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 (
<RegisterPiece
headerMessage={getLangText('Submit to the prize')}
submitMessage={getLangText('Submit')}
canSpecifyEditions={false} >
<Property
name='artist_statement'
label={getLangText('Artist statement')}
editable={true}>
<InputTextAreaToggable
rows={1}
editable={true}
placeholder={getLangText('Enter your statement')}
required="required"/>
</Property>
<Property
name='work_description'
label={getLangText('Work description')}
editable={true}>
<InputTextAreaToggable
rows={1}
editable={true}
placeholder={getLangText('Enter the description for your work')}
required="required"/>
</Property>
<Property
name="terms"
className="ascribe-settings-property-collapsible-toggle"
style={{paddingBottom: 0}}>
<InputCheckbox/>
</Property>
</RegisterPiece>
);
}
});
export default PrizeRegisterPiece;

View File

@ -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) {
<Route name="login" path="login" handler={LoginContainer} />
<Route name="signup" path="signup" handler={SignupContainer} />
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
<Route name="register_piece" path="register_piece" handler={RegisterPiece} />
<Route name="register_piece" path="register_piece" handler={PrizeRegisterPiece} />
<Route name="pieces" path="collection" handler={PrizePieceList} />
</Route>
);