Add changes for PR comments

This commit is contained in:
Brett Sun 2016-01-18 13:29:08 +01:00
parent 621cc76e4a
commit 23ccad9b5f
8 changed files with 66 additions and 52 deletions

View File

@ -15,6 +15,8 @@ import PieceExtraDataForm from './../ascribe_forms/form_piece_extradata';
import { formSubmissionValidation } from '../ascribe_uploader/react_s3_fine_uploader_utils';
import { getLangText } from '../../utils/lang_utils';
let FurtherDetails = React.createClass({
propTypes: {
@ -33,11 +35,13 @@ let FurtherDetails = React.createClass({
},
showNotification() {
if (typeof this.props.handleSucess === 'function') {
this.props.handleSuccess();
const { handleSuccess } = this.props;
if (typeof handleSucess === 'function') {
handleSuccess();
}
const notification = new GlobalNotificationModel('Details updated', 'success');
const notification = new GlobalNotificationModel(getLangText('Details updated'), 'success');
GlobalNotificationActions.appendGlobalNotification(notification);
},

View File

@ -194,7 +194,7 @@ let PieceContainer = React.createClass({
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search,
this.state.orderBy, this.state.orderAsc, this.state.filterBy);
const notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
const notification = new GlobalNotificationModel(getLangText('Editions successfully created'), 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
},

View File

@ -141,7 +141,7 @@ let PrizePieceContainer = React.createClass({
}
// Only show the artist email if you are a judge and the piece is shortlisted
const artistEmail = (currentUser.is_judge && piece.selected ) ? (
const artistEmail = currentUser.is_judge && piece.selected ? (
<DetailProperty
label={getLangText('REGISTREE')}
value={piece.user_registered} />
@ -406,7 +406,7 @@ let PrizePieceRatings = React.createClass({
ratingAmount={5} />
</div>
<Note
id={() => { return { 'piece_id': this.props.piece.id }; }}
id={() => ({ 'piece_id': this.props.piece.id })}
label={getLangText('Jury note')}
defaultValue={this.props.piece.note_from_user || null}
placeholder={getLangText('Enter your comments ...')}

View File

@ -105,13 +105,15 @@ let CylandAdditionalDataForm = React.createClass({
);
}
if (piece.id && piece.extra_data) {
if (piece.id) {
const { extra_data: extraData = {} } = piece;
return (
<Form
disabled={disabled}
className="ascribe-form-bordered"
ref='form'
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: piece.id})}
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: piece.id })}
handleSuccess={handleSuccess || this.handleSuccess}
getFormData={this.getFormData}
buttons={buttons}
@ -120,64 +122,64 @@ let CylandAdditionalDataForm = React.createClass({
<Property
name='artist_bio'
label={getLangText('Artist Biography')}
expanded={!disabled || !!piece.extra_data.artist_bio}>
expanded={!disabled || !!extraData.artist_bio}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.artist_bio}
defaultValue={extraData.artist_bio}
placeholder={getLangText('Enter the artist\'s biography...')} />
</Property>
<Property
name='artist_contact_information'
label={getLangText('Artist Contact Information')}
expanded={!disabled || !!piece.extra_data.artist_contact_information}>
expanded={!disabled || !!extraData.artist_contact_information}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.artist_contact_information}
defaultValue={extraData.artist_contact_information}
placeholder={getLangText('Enter the artist\'s contact information...')} />
</Property>
<Property
name='conceptual_overview'
label={getLangText('Conceptual Overview')}
expanded={!disabled || !!piece.extra_data.conceptual_overview}>
expanded={!disabled || !!extraData.conceptual_overview}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.conceptual_overview}
defaultValue={extraData.conceptual_overview}
placeholder={getLangText('Enter a conceptual overview...')} />
</Property>
<Property
name='medium'
label={getLangText('Medium (technical specifications)')}
expanded={!disabled || !!piece.extra_data.medium}>
expanded={!disabled || !!extraData.medium}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.medium}
defaultValue={extraData.medium}
placeholder={getLangText('Enter the medium (and other technical specifications)...')} />
</Property>
<Property
name='size_duration'
label={getLangText('Size / Duration')}
expanded={!disabled || !!piece.extra_data.size_duration}>
expanded={!disabled || !!extraData.size_duration}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.size_duration}
defaultValue={extraData.size_duration}
placeholder={getLangText('Enter the size / duration...')} />
</Property>
<Property
name='display_instructions'
label={getLangText('Display instructions')}
expanded={!disabled || !!piece.extra_data.display_instructions}>
expanded={!disabled || !!extraData.display_instructions}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.display_instructions}
defaultValue={extraData.display_instructions}
placeholder={getLangText('Enter the display instructions...')} />
</Property>
<Property
name='additional_details'
label={getLangText('Additional details')}
expanded={!disabled || !!piece.extra_data.additional_details}>
expanded={!disabled || !!extraData.additional_details}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.additional_details}
defaultValue={extraData.additional_details}
placeholder={getLangText('Enter additional details...')} />
</Property>
<FurtherDetailsFileuploader

View File

@ -52,7 +52,7 @@ let IkonotvArtistDetailsForm = React.createClass({
},
handleSuccess() {
const notification = new GlobalNotificationModel('Artist details successfully updated', 'success', 10000);
const notification = new GlobalNotificationModel(getLangText('Artist details successfully updated'), 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
@ -90,13 +90,15 @@ let IkonotvArtistDetailsForm = React.createClass({
);
}
if (piece.id && piece.extra_data) {
if (piece.id) {
const { extra_data: extraData = {} } = piece;
return (
<Form
disabled={disabled}
className="ascribe-form-bordered"
ref='form'
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: piece.id})}
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: piece.id })}
handleSuccess={handleSuccess || this.handleSuccess}
getFormData={this.getFormData}
buttons={buttons}
@ -105,37 +107,37 @@ let IkonotvArtistDetailsForm = React.createClass({
<Property
name='artist_website'
label={getLangText('Artist Website')}
expanded={!disabled || !!piece.extra_data.artist_website}>
expanded={!disabled || !!extraData.artist_website}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.artist_website}
defaultValue={extraData.artist_website}
placeholder={getLangText('The artist\'s website if present...')} />
</Property>
<Property
name='gallery_website'
label={getLangText('Website of related Gallery, Museum, etc.')}
expanded={!disabled || !!piece.extra_data.gallery_website}>
expanded={!disabled || !!extraData.gallery_website}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.gallery_website}
defaultValue={extraData.gallery_website}
placeholder={getLangText('The website of any related Gallery or Museum')} />
</Property>
<Property
name='additional_websites'
label={getLangText('Additional Websites/Publications/Museums/Galleries')}
expanded={!disabled || !!piece.extra_data.additional_websites}>
expanded={!disabled || !!extraData.additional_websites}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.additional_websites}
defaultValue={extraData.additional_websites}
placeholder={getLangText('Enter additional Websites/Publications if any')} />
</Property>
<Property
name='conceptual_overview'
label={getLangText('Short text about the Artist')}
expanded={!disabled || !!piece.extra_data.conceptual_overview}>
expanded={!disabled || !!extraData.conceptual_overview}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.conceptual_overview}
defaultValue={extraData.conceptual_overview}
placeholder={getLangText('Enter a short bio about the Artist')} />
</Property>
</Form>

View File

@ -52,7 +52,7 @@ let IkonotvArtworkDetailsForm = React.createClass({
},
handleSuccess() {
const notification = new GlobalNotificationModel('Artwork details successfully updated', 'success', 10000);
const notification = new GlobalNotificationModel(getLangText('Artwork details successfully updated'), 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
@ -91,6 +91,8 @@ let IkonotvArtworkDetailsForm = React.createClass({
}
if (piece.id && piece.extra_data) {
const { extra_data: extraData = {} } = piece;
return (
<Form
disabled={disabled}
@ -105,55 +107,55 @@ let IkonotvArtworkDetailsForm = React.createClass({
<Property
name='medium'
label={getLangText('Medium')}
expanded={!disabled || !!piece.extra_data.medium}>
expanded={!disabled || !!extraData.medium}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.medium}
defaultValue={extraData.medium}
placeholder={getLangText('The medium of the file (i.e. photo, video, other, ...)')} />
</Property>
<Property
name='size_duration'
label={getLangText('Size/Duration')}
expanded={!disabled || !!piece.extra_data.size_duration}>
expanded={!disabled || !!extraData.size_duration}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.size_duration}
defaultValue={extraData.size_duration}
placeholder={getLangText('Size in centimeters. Duration in minutes.')} />
</Property>
<Property
name='copyright'
label={getLangText('Copyright')}
expanded={!disabled || !!piece.extra_data.copyright}>
expanded={!disabled || !!extraData.copyright}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.copyright}
defaultValue={extraData.copyright}
placeholder={getLangText('Which copyright is attached to this work?')} />
</Property>
<Property
name='courtesy_of'
label={getLangText('Courtesy of')}
expanded={!disabled || !!piece.extra_data.courtesy_of}>
expanded={!disabled || !!extraData.courtesy_of}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.courtesy_of}
defaultValue={extraData.courtesy_of}
placeholder={getLangText('The current owner of the artwork')} />
</Property>
<Property
name='copyright_of_photography'
label={getLangText('Copyright of Photography')}
expanded={!disabled || !!piece.extra_data.copyright_of_photography}>
expanded={!disabled || !!extraData.copyright_of_photography}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.copyright_of_photography}
defaultValue={extraData.copyright_of_photography}
placeholder={getLangText('Who should be attributed for the photography?')} />
</Property>
<Property
name='additional_details'
label={getLangText('Additional Details about the artwork')}
expanded={!disabled || !!piece.extra_data.additional_details}>
expanded={!disabled || !!extraData.additional_details}>
<InputTextAreaToggable
rows={1}
defaultValue={piece.extra_data.additional_details}
defaultValue={extraData.additional_details}
placeholder={getLangText('Insert artwork overview')} />
</Property>
</Form>

View File

@ -53,12 +53,16 @@ let MarketSubmitButton = React.createClass({
canEditionBeSubmitted(edition) {
if (edition && edition.extra_data && edition.other_data) {
const { extra_data: extraData, other_data: otherData } = edition;
const {
extra_data: {
artist_bio: artistBio,
display_instructions: displayInstructions,
technology_details: technologyDetails,
work_description: workDescription
},
other_data: otherData } = edition;
if (extraData.artist_bio && extraData.work_description && extraData.technology_details &&
extraData.display_instructions && otherData.length) {
return true;
}
return artistBio && displayInstructions && technologyDetails && workDescription && otherData.length;
}
return false;

View File

@ -215,7 +215,7 @@ let MarketAdditionalDataForm = React.createClass({
} else {
return (
<div className="ascribe-loading-position">
<AscribeSpinner color='dark-blue' size='md' />
<AscribeSpinner color='dark-blue' size='lg' />
</div>
);
}