mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Clean up whitelabel AdditionalDataForms
This commit is contained in:
parent
50129b9d0c
commit
8d9df43339
@ -23,9 +23,10 @@ import { formSubmissionValidation } from '../../../../../ascribe_uploader/react_
|
||||
|
||||
let CylandAdditionalDataForm = React.createClass({
|
||||
propTypes: {
|
||||
handleSuccess: React.PropTypes.func,
|
||||
piece: React.PropTypes.object.isRequired,
|
||||
|
||||
disabled: React.PropTypes.bool,
|
||||
handleSuccess: React.PropTypes.func,
|
||||
isInline: React.PropTypes.bool
|
||||
},
|
||||
|
||||
@ -42,13 +43,13 @@ let CylandAdditionalDataForm = React.createClass({
|
||||
},
|
||||
|
||||
handleSuccess() {
|
||||
let notification = new GlobalNotificationModel(getLangText('Further details successfully updated'), 'success', 10000);
|
||||
const notification = new GlobalNotificationModel(getLangText('Further details successfully updated'), 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
let extradata = {};
|
||||
let formRefs = this.refs.form.refs;
|
||||
const extradata = {};
|
||||
const formRefs = this.refs.form.refs;
|
||||
|
||||
// Put additional fields in extra data object
|
||||
Object
|
||||
@ -71,8 +72,11 @@ let CylandAdditionalDataForm = React.createClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
let { piece, isInline, disabled, handleSuccess, location } = this.props;
|
||||
let buttons, spinner, heading;
|
||||
const { disabled, handleSuccess, isInline, piece } = this.props;
|
||||
|
||||
let buttons;
|
||||
let spinner;
|
||||
let heading;
|
||||
|
||||
if (!isInline) {
|
||||
buttons = (
|
||||
@ -101,7 +105,7 @@ let CylandAdditionalDataForm = React.createClass({
|
||||
);
|
||||
}
|
||||
|
||||
if(piece && piece.id) {
|
||||
if (piece.id && piece.extra_data) {
|
||||
return (
|
||||
<Form
|
||||
disabled={disabled}
|
||||
|
@ -122,6 +122,7 @@ let IkonotvPieceContainer = React.createClass({
|
||||
|
||||
if (piece.id) {
|
||||
setDocumentTitle([piece.artist_name, piece.title].join(', '));
|
||||
|
||||
return (
|
||||
<WalletPieceContainer
|
||||
piece={piece}
|
||||
|
@ -20,11 +20,10 @@ import { getLangText } from '../../../../../../utils/lang_utils';
|
||||
|
||||
let IkonotvArtistDetailsForm = React.createClass({
|
||||
propTypes: {
|
||||
handleSuccess: React.PropTypes.func,
|
||||
piece: React.PropTypes.object.isRequired,
|
||||
|
||||
disabled: React.PropTypes.bool,
|
||||
|
||||
handleSuccess: React.PropTypes.func,
|
||||
isInline: React.PropTypes.bool
|
||||
},
|
||||
|
||||
@ -35,8 +34,8 @@ let IkonotvArtistDetailsForm = React.createClass({
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
let extradata = {};
|
||||
let formRefs = this.refs.form.refs;
|
||||
const extradata = {};
|
||||
const formRefs = this.refs.form.refs;
|
||||
|
||||
// Put additional fields in extra data object
|
||||
Object
|
||||
@ -53,20 +52,23 @@ let IkonotvArtistDetailsForm = React.createClass({
|
||||
},
|
||||
|
||||
handleSuccess() {
|
||||
let notification = new GlobalNotificationModel('Artist details successfully updated', 'success', 10000);
|
||||
const notification = new GlobalNotificationModel('Artist details successfully updated', 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
render() {
|
||||
let buttons, spinner, heading;
|
||||
let { isInline, handleSuccess } = this.props;
|
||||
const { disabled, isInline, handleSuccess, piece } = this.props;
|
||||
|
||||
let buttons;
|
||||
let spinner;
|
||||
let heading;
|
||||
|
||||
if (!isInline) {
|
||||
buttons = (
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-default btn-wide"
|
||||
disabled={this.props.disabled}>
|
||||
disabled={disabled}>
|
||||
{getLangText('Proceed to loan')}
|
||||
</button>
|
||||
);
|
||||
@ -88,13 +90,13 @@ let IkonotvArtistDetailsForm = React.createClass({
|
||||
);
|
||||
}
|
||||
|
||||
if (this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
|
||||
if (piece.id && piece.extra_data) {
|
||||
return (
|
||||
<Form
|
||||
disabled={this.props.disabled}
|
||||
disabled={disabled}
|
||||
className="ascribe-form-bordered"
|
||||
ref='form'
|
||||
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: this.props.piece.id})}
|
||||
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: piece.id})}
|
||||
handleSuccess={handleSuccess || this.handleSuccess}
|
||||
getFormData={this.getFormData}
|
||||
buttons={buttons}
|
||||
@ -103,39 +105,38 @@ let IkonotvArtistDetailsForm = React.createClass({
|
||||
<Property
|
||||
name='artist_website'
|
||||
label={getLangText('Artist Website')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.artist_website}>
|
||||
expanded={!disabled || !!piece.extra_data.artist_website}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.artist_website}
|
||||
defaultValue={piece.extra_data.artist_website}
|
||||
placeholder={getLangText('The artist\'s website if present...')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='gallery_website'
|
||||
label={getLangText('Website of related Gallery, Museum, etc.')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.gallery_website}>
|
||||
expanded={!disabled || !!piece.extra_data.gallery_website}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.gallery_website}
|
||||
defaultValue={piece.extra_data.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={!this.props.disabled || !!this.props.piece.extra_data.additional_websites}>
|
||||
expanded={!disabled || !!piece.extra_data.additional_websites}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.additional_websites}
|
||||
defaultValue={piece.extra_data.additional_websites}
|
||||
placeholder={getLangText('Enter additional Websites/Publications if any')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='conceptual_overview'
|
||||
label={getLangText('Short text about the Artist')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.conceptual_overview}>
|
||||
expanded={!disabled || !!piece.extra_data.conceptual_overview}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.conceptual_overview}
|
||||
placeholder={getLangText('Enter a short bio about the Artist')}
|
||||
/>
|
||||
defaultValue={piece.extra_data.conceptual_overview}
|
||||
placeholder={getLangText('Enter a short bio about the Artist')} />
|
||||
</Property>
|
||||
</Form>
|
||||
);
|
||||
|
@ -20,11 +20,10 @@ import { getLangText } from '../../../../../../utils/lang_utils';
|
||||
|
||||
let IkonotvArtworkDetailsForm = React.createClass({
|
||||
propTypes: {
|
||||
handleSuccess: React.PropTypes.func,
|
||||
piece: React.PropTypes.object.isRequired,
|
||||
|
||||
disabled: React.PropTypes.bool,
|
||||
|
||||
handleSuccess: React.PropTypes.func,
|
||||
isInline: React.PropTypes.bool
|
||||
},
|
||||
|
||||
@ -35,8 +34,8 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
let extradata = {};
|
||||
let formRefs = this.refs.form.refs;
|
||||
const extradata = {};
|
||||
const formRefs = this.refs.form.refs;
|
||||
|
||||
// Put additional fields in extra data object
|
||||
Object
|
||||
@ -53,20 +52,23 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
||||
},
|
||||
|
||||
handleSuccess() {
|
||||
let notification = new GlobalNotificationModel('Artwork details successfully updated', 'success', 10000);
|
||||
const notification = new GlobalNotificationModel('Artwork details successfully updated', 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
render() {
|
||||
let buttons, spinner, heading;
|
||||
let { isInline, handleSuccess } = this.props;
|
||||
const { disabled, isInline, handleSuccess, piece } = this.props;
|
||||
|
||||
let buttons;
|
||||
let spinner;
|
||||
let heading;
|
||||
|
||||
if (!isInline) {
|
||||
buttons = (
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-default btn-wide"
|
||||
disabled={this.props.disabled}>
|
||||
disabled={disabled}>
|
||||
{getLangText('Proceed to artist details')}
|
||||
</button>
|
||||
);
|
||||
@ -88,13 +90,13 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
||||
);
|
||||
}
|
||||
|
||||
if (this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
|
||||
if (piece.id && piece.extra_data) {
|
||||
return (
|
||||
<Form
|
||||
disabled={this.props.disabled}
|
||||
disabled={disabled}
|
||||
className="ascribe-form-bordered"
|
||||
ref='form'
|
||||
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: this.props.piece.id})}
|
||||
url={requests.prepareUrl(ApiUrls.piece_extradata, { piece_id: piece.id })}
|
||||
handleSuccess={handleSuccess || this.handleSuccess}
|
||||
getFormData={this.getFormData}
|
||||
buttons={buttons}
|
||||
@ -103,55 +105,55 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
||||
<Property
|
||||
name='medium'
|
||||
label={getLangText('Medium')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.medium}>
|
||||
expanded={!disabled || !!piece.extra_data.medium}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.medium}
|
||||
defaultValue={piece.extra_data.medium}
|
||||
placeholder={getLangText('The medium of the file (i.e. photo, video, other, ...)')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='size_duration'
|
||||
label={getLangText('Size/Duration')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.size_duration}>
|
||||
expanded={!disabled || !!piece.extra_data.size_duration}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.size_duration}
|
||||
defaultValue={piece.extra_data.size_duration}
|
||||
placeholder={getLangText('Size in centimeters. Duration in minutes.')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='copyright'
|
||||
label={getLangText('Copyright')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.copyright}>
|
||||
expanded={!disabled || !!piece.extra_data.copyright}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.copyright}
|
||||
defaultValue={piece.extra_data.copyright}
|
||||
placeholder={getLangText('Which copyright is attached to this work?')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='courtesy_of'
|
||||
label={getLangText('Courtesy of')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.courtesy_of}>
|
||||
expanded={!disabled || !!piece.extra_data.courtesy_of}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.courtesy_of}
|
||||
defaultValue={piece.extra_data.courtesy_of}
|
||||
placeholder={getLangText('The current owner of the artwork')} />
|
||||
</Property>
|
||||
<Property
|
||||
name='copyright_of_photography'
|
||||
label={getLangText('Copyright of Photography')}
|
||||
expanded={!this.props.disabled || !!this.props.piece.extra_data.copyright_of_photography}>
|
||||
expanded={!disabled || !!piece.extra_data.copyright_of_photography}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.copyright_of_photography}
|
||||
defaultValue={piece.extra_data.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={!this.props.disabled || !!this.props.piece.extra_data.additional_details}>
|
||||
expanded={!disabled || !!piece.extra_data.additional_details}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
defaultValue={this.props.piece.extra_data.additional_details}
|
||||
defaultValue={piece.extra_data.additional_details}
|
||||
placeholder={getLangText('Insert artwork overview')} />
|
||||
</Property>
|
||||
</Form>
|
||||
|
@ -109,7 +109,7 @@ let MarketAdditionalDataForm = React.createClass({
|
||||
render() {
|
||||
const {
|
||||
editable,
|
||||
extraData,
|
||||
extraData = {},
|
||||
isInline,
|
||||
handleSuccess,
|
||||
otherData,
|
||||
@ -118,8 +118,9 @@ let MarketAdditionalDataForm = React.createClass({
|
||||
showNotification,
|
||||
submitLabel } = this.props;
|
||||
|
||||
let buttons, heading;
|
||||
let spinner = <AscribeSpinner color='dark-blue' size='lg' />;
|
||||
let buttons;
|
||||
let heading;
|
||||
let spinner;
|
||||
|
||||
if (!isInline) {
|
||||
buttons = (
|
||||
@ -134,7 +135,7 @@ let MarketAdditionalDataForm = React.createClass({
|
||||
spinner = (
|
||||
<div className="modal-footer">
|
||||
<p className="pull-right">
|
||||
{spinner}
|
||||
<AscribeSpinner color='dark-blue' size='md' />
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
@ -148,6 +149,7 @@ let MarketAdditionalDataForm = React.createClass({
|
||||
) : null;
|
||||
}
|
||||
|
||||
if (pieceId) {
|
||||
return (
|
||||
<Form
|
||||
className="ascribe-form-bordered"
|
||||
@ -210,6 +212,13 @@ let MarketAdditionalDataForm = React.createClass({
|
||||
</Property>
|
||||
</Form>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="ascribe-loading-position">
|
||||
<AscribeSpinner color='dark-blue' size='md' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user