1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Add additional data fields requested by PR

Also adds way to sort the Properties in Prize Details by appending
`[digit]-[label]` to the Property’s name.
This commit is contained in:
Brett Sun 2015-12-14 13:03:19 +01:00
parent be2f9bbc97
commit d0cef8c836
3 changed files with 48 additions and 21 deletions

View File

@ -93,7 +93,6 @@ let LoginForm = React.createClass({
<input <input
type="email" type="email"
placeholder={getLangText('Enter your email')} placeholder={getLangText('Enter your email')}
name="email"
defaultValue={email} defaultValue={email}
required/> required/>
</Property> </Property>
@ -103,7 +102,6 @@ let LoginForm = React.createClass({
<input <input
type="password" type="password"
placeholder={getLangText('Enter your password')} placeholder={getLangText('Enter your password')}
name="password"
required/> required/>
</Property> </Property>
</Form> </Form>

View File

@ -191,7 +191,7 @@ const PRRegisterPieceForm = React.createClass({
label={getLangText('Full name')}> label={getLangText('Full name')}>
<input <input
type="text" type="text"
placeholder="(e.g. Andy Warhol)" placeholder={getLangText('(e.g. Andy Warhol)')}
required/> required/>
</Property> </Property>
<Property <Property
@ -199,7 +199,7 @@ const PRRegisterPieceForm = React.createClass({
label={getLangText('Title of the Work')}> label={getLangText('Title of the Work')}>
<input <input
type="text" type="text"
placeholder="(e.g. 32 Campbell's Soup Cans)" placeholder={getLangText("(e.g. 32 Campbell's Soup Cans)")}
required/> required/>
</Property> </Property>
<Property <Property
@ -207,7 +207,7 @@ const PRRegisterPieceForm = React.createClass({
label={getLangText('Year of creation')}> label={getLangText('Year of creation')}>
<input <input
type="number" type="number"
placeholder="(e.g. 1962)" placeholder={getLangText('(e.g. 1962)')}
min={1} min={1}
required/> required/>
</Property> </Property>
@ -224,25 +224,51 @@ const PRRegisterPieceForm = React.createClass({
className="ascribe-form-bordered" className="ascribe-form-bordered"
ref="additionalDataForm"> ref="additionalDataForm">
<Property <Property
name='artist_bio' name='1-date_of_birth'
label={getLangText('Date of Birth')}>
<input
type="number"
placeholder={getLangText('(e.g. 1962)')}
min={1900}
required/>
</Property>
<Property
name='2-artist_bio'
label={getLangText('Biography')}> label={getLangText('Biography')}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
placeholder={getLangText('Enter your biography')}/> placeholder={getLangText('Enter your biography')}/>
</Property> </Property>
<Property <Property
name='exhibition' name='3-exhibition'
label={getLangText('Exhibition / Publication history (optional)')}> label={getLangText('Exhibition / Publication history (optional)')}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
placeholder={getLangText('Enter exhibitions and publication history')}/> placeholder={getLangText('Enter exhibitions and publication history')}/>
</Property> </Property>
<Property <Property
name='contact_information' name='4-phone_number'
label={getLangText('Contact information')}> label={getLangText('Phone Number')}>
<InputTextAreaToggable <input
rows={1} type="tel"
placeholder={getLangText('Enter your contact information (phone/website)')}/> placeholder={getLangText('Enter your phone number')}
required/>
</Property>
<Property
name='5-email'
label={getLangText('Email Address')}>
<input
type="email"
placeholder={getLangText('Enter your email')}
required/>
</Property>
<Property
name='6-website'
label={getLangText('Website')}>
<input
type="url"
placeholder={getLangText('Enter your website')}
required/>
</Property> </Property>
</Form> </Form>
<Form <Form

View File

@ -439,18 +439,21 @@ let PrizePieceDetails = React.createClass({
}, },
render() { render() {
if (this.props.piece const { piece } = this.props;
&& this.props.piece.prize
&& this.props.piece.prize.name if (piece &&
&& Object.keys(this.props.piece.extra_data).length !== 0){ piece.prize &&
piece.prize.name &&
Object.keys(piece.extra_data).length !== 0) {
return ( return (
<CollapsibleParagraph <CollapsibleParagraph
title={getLangText('Prize Details')} title={getLangText('Prize Details')}
defaultExpanded={true}> defaultExpanded={true}>
<Form ref='form'> <Form ref='form'>
{Object.keys(this.props.piece.extra_data).map((data) => { {Object.keys(piece.extra_data).sort().map((data) => {
let label = data.replace('_', ' '); // Remove leading number (for sorting), if any, and underscores with spaces
const value = this.props.piece.extra_data[data] || 'N/A'; let label = data.replace(/^\d-/, '').replace(/_/g, ' ');
const value = piece.extra_data[data] || 'N/A';
return ( return (
<Property <Property
@ -470,8 +473,8 @@ let PrizePieceDetails = React.createClass({
isReadyForFormSubmission={() => {}} isReadyForFormSubmission={() => {}}
editable={false} editable={false}
overrideForm={true} overrideForm={true}
pieceId={this.props.piece.id} pieceId={piece.id}
otherData={this.props.piece.other_data} otherData={piece.other_data}
multiple={true} /> multiple={true} />
</Form> </Form>
</CollapsibleParagraph> </CollapsibleParagraph>