1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 00:28:00 +02: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
type="email"
placeholder={getLangText('Enter your email')}
name="email"
defaultValue={email}
required/>
</Property>
@ -103,7 +102,6 @@ let LoginForm = React.createClass({
<input
type="password"
placeholder={getLangText('Enter your password')}
name="password"
required/>
</Property>
</Form>

View File

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

View File

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