mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
finalize whitelabel custom fields
This commit is contained in:
parent
3d75a9523c
commit
6c2bb041f9
@ -19,6 +19,8 @@ import CollapsibleParagraph from '../../../../../../components/ascribe_collapsib
|
|||||||
import HistoryIterator from '../../../../../ascribe_detail/history_iterator';
|
import HistoryIterator from '../../../../../ascribe_detail/history_iterator';
|
||||||
import Note from '../../../../../ascribe_detail/note';
|
import Note from '../../../../../ascribe_detail/note';
|
||||||
|
|
||||||
|
import CylandAdditionalDataForm from '../../cyland/ascribe_forms/cyland_additional_data_form';
|
||||||
|
|
||||||
import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader';
|
import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader';
|
||||||
import DetailProperty from '../../../../../ascribe_detail/detail_property';
|
import DetailProperty from '../../../../../ascribe_detail/detail_property';
|
||||||
|
|
||||||
@ -102,7 +104,15 @@ let CylandPieceContainer = React.createClass({
|
|||||||
url={ApiUrls.note_private_piece}
|
url={ApiUrls.note_private_piece}
|
||||||
currentUser={this.state.currentUser}/>
|
currentUser={this.state.currentUser}/>
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
<CylandPieceDetails piece={this.state.piece}/>
|
<CollapsibleParagraph
|
||||||
|
title={getLangText('Further Details')}
|
||||||
|
show={true}
|
||||||
|
defaultExpanded={true}>
|
||||||
|
<CylandAdditionalDataForm
|
||||||
|
piece={this.state.piece}
|
||||||
|
disabled={!this.state.piece.acl.acl_edit}
|
||||||
|
isInline={true} />
|
||||||
|
</CollapsibleParagraph>
|
||||||
</Piece>
|
</Piece>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -115,47 +125,4 @@ let CylandPieceContainer = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
let CylandPieceDetails = React.createClass({
|
|
||||||
propTypes: {
|
|
||||||
piece: React.PropTypes.object
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
|
||||||
if (this.props.piece && Object.keys(this.props.piece.extra_data).length !== 0){
|
|
||||||
return (
|
|
||||||
<CollapsibleParagraph
|
|
||||||
title={getLangText('Further Details')}
|
|
||||||
show={true}
|
|
||||||
defaultExpanded={true}>
|
|
||||||
<Form ref='form'>
|
|
||||||
{Object.keys(this.props.piece.extra_data).map((data, i) => {
|
|
||||||
let label = data.replace('_', ' ');
|
|
||||||
return (
|
|
||||||
<Property
|
|
||||||
key={i}
|
|
||||||
name={data}
|
|
||||||
label={label}
|
|
||||||
editable={false}
|
|
||||||
overrideForm={true}>
|
|
||||||
<InputTextAreaToggable
|
|
||||||
rows={1}
|
|
||||||
defaultValue={this.props.piece.extra_data[data]}/>
|
|
||||||
</Property>);
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
<FurtherDetailsFileuploader
|
|
||||||
editable={false}
|
|
||||||
pieceId={this.props.piece.id}
|
|
||||||
otherData={this.props.piece.other_data}
|
|
||||||
multiple={false}/>
|
|
||||||
<hr />
|
|
||||||
</Form>
|
|
||||||
</CollapsibleParagraph>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default CylandPieceContainer;
|
export default CylandPieceContainer;
|
||||||
|
@ -9,6 +9,9 @@ import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_t
|
|||||||
|
|
||||||
import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader';
|
import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader';
|
||||||
|
|
||||||
|
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
||||||
|
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../../constants/api_urls';
|
import ApiUrls from '../../../../../../constants/api_urls';
|
||||||
import AppConstants from '../../../../../../constants/application_constants';
|
import AppConstants from '../../../../../../constants/application_constants';
|
||||||
|
|
||||||
@ -20,10 +23,21 @@ import { formSubmissionValidation } from '../../../../../ascribe_uploader/react_
|
|||||||
|
|
||||||
let CylandAdditionalDataForm = React.createClass({
|
let CylandAdditionalDataForm = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
handleSuccess: React.PropTypes.func.isRequired,
|
handleSuccess: React.PropTypes.func,
|
||||||
piece: React.PropTypes.object.isRequired,
|
piece: React.PropTypes.object.isRequired,
|
||||||
|
disabled: React.PropTypes.bool,
|
||||||
|
isInline: React.PropTypes.bool
|
||||||
|
},
|
||||||
|
|
||||||
disabled: React.PropTypes.bool
|
getDefaultProps() {
|
||||||
|
return {
|
||||||
|
isInline: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSuccess() {
|
||||||
|
let notification = new GlobalNotificationModel('Further details successfully updated', 'success', 10000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
@ -63,56 +77,69 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if(this.props.piece && this.props.piece.id) {
|
let { piece, isInline, disabled, handleSuccess } = this.props;
|
||||||
|
let buttons, spinner, heading;
|
||||||
|
|
||||||
|
if(!isInline) {
|
||||||
|
buttons = (
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
className="btn ascribe-btn ascribe-btn-login"
|
||||||
|
disabled={!this.state.isUploadReady || disabled}>
|
||||||
|
{getLangText('Proceed to loan')}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
|
||||||
|
spinner = (
|
||||||
|
<div className="modal-footer">
|
||||||
|
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
heading = (
|
||||||
|
<div className="ascribe-form-header">
|
||||||
|
<h3>
|
||||||
|
{getLangText('Provide supporting materials')}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(piece && piece.id) {
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
disabled={this.props.disabled}
|
disabled={disabled}
|
||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
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={this.props.handleSuccess}
|
handleSuccess={handleSuccess || this.handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={
|
buttons={buttons}
|
||||||
<button
|
spinner={spinner}>
|
||||||
type="submit"
|
{heading}
|
||||||
className="btn ascribe-btn ascribe-btn-login"
|
|
||||||
disabled={!this.state.isUploadReady || this.props.disabled}>
|
|
||||||
{getLangText('Proceed to loan')}
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
spinner={
|
|
||||||
<div className="modal-footer">
|
|
||||||
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
|
|
||||||
</div>
|
|
||||||
}>
|
|
||||||
<div className="ascribe-form-header">
|
|
||||||
<h3>
|
|
||||||
{getLangText('Provide supporting materials')}
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<Property
|
<Property
|
||||||
name='artist_bio'
|
name='artist_bio'
|
||||||
label={getLangText('Artist Biography')}>
|
label={getLangText('Artist Biography')}>
|
||||||
<InputTextAreaToggable
|
<InputTextAreaToggable
|
||||||
rows={1}
|
rows={1}
|
||||||
placeholder={getLangText('Enter the artist\'s biography...')}
|
defaultValue={piece.extra_data.artist_bio}
|
||||||
required="required"/>
|
placeholder={getLangText('Enter the artist\'s biography...')}/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property
|
<Property
|
||||||
name='conceptual_overview'
|
name='conceptual_overview'
|
||||||
label={getLangText('Conceptual Overview')}>
|
label={getLangText('Conceptual Overview')}>
|
||||||
<InputTextAreaToggable
|
<InputTextAreaToggable
|
||||||
rows={1}
|
rows={1}
|
||||||
placeholder={getLangText('Enter a conceptual overview...')}
|
defaultValue={piece.extra_data.conceptual_overview}
|
||||||
required="required"/>
|
placeholder={getLangText('Enter a conceptual overview...')}/>
|
||||||
</Property>
|
</Property>
|
||||||
<FurtherDetailsFileuploader
|
<FurtherDetailsFileuploader
|
||||||
uploadStarted={this.uploadStarted}
|
uploadStarted={this.uploadStarted}
|
||||||
submitFile={this.submitFile}
|
submitFile={this.submitFile}
|
||||||
setIsUploadReady={this.setIsUploadReady}
|
setIsUploadReady={this.setIsUploadReady}
|
||||||
isReadyForFormSubmission={formSubmissionValidation.fileOptional}
|
isReadyForFormSubmission={formSubmissionValidation.fileOptional}
|
||||||
pieceId={this.props.piece.id}
|
pieceId={piece.id}
|
||||||
otherData={this.props.piece.other_data}
|
otherData={piece.other_data}
|
||||||
multiple={true}/>
|
multiple={true}/>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
@ -20,7 +20,7 @@ import { getLangText } from '../../../../../../utils/lang_utils';
|
|||||||
|
|
||||||
let IkonotvArtistDetailsForm = React.createClass({
|
let IkonotvArtistDetailsForm = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
handleSuccess: React.PropTypes.func.isRequired,
|
handleSuccess: React.PropTypes.func,
|
||||||
piece: React.PropTypes.object.isRequired,
|
piece: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
disabled: React.PropTypes.bool,
|
disabled: React.PropTypes.bool,
|
||||||
@ -57,10 +57,9 @@ let IkonotvArtistDetailsForm = React.createClass({
|
|||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let buttons, spinner, heading;
|
let buttons, spinner, heading;
|
||||||
let { isInline } = this.props;
|
let { isInline, handleSuccess } = this.props;
|
||||||
|
|
||||||
|
|
||||||
if(!isInline) {
|
if(!isInline) {
|
||||||
@ -95,7 +94,7 @@ let IkonotvArtistDetailsForm = React.createClass({
|
|||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: this.props.piece.id})}
|
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: this.props.piece.id})}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={handleSuccess || this.handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
spinner={spinner}>
|
spinner={spinner}>
|
||||||
|
@ -20,6 +20,7 @@ import { getLangText } from '../../../../../../utils/lang_utils';
|
|||||||
|
|
||||||
let IkonotvArtworkDetailsForm = React.createClass({
|
let IkonotvArtworkDetailsForm = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
handleSuccess: React.PropTypes.func,
|
||||||
piece: React.PropTypes.object.isRequired,
|
piece: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
disabled: React.PropTypes.bool,
|
disabled: React.PropTypes.bool,
|
||||||
@ -58,7 +59,7 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
let buttons, spinner, heading;
|
let buttons, spinner, heading;
|
||||||
let { isInline } = this.props;
|
let { isInline, handleSuccess } = this.props;
|
||||||
|
|
||||||
if(!isInline) {
|
if(!isInline) {
|
||||||
buttons = (
|
buttons = (
|
||||||
@ -92,7 +93,7 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
|||||||
className="ascribe-form-bordered"
|
className="ascribe-form-bordered"
|
||||||
ref='form'
|
ref='form'
|
||||||
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: this.props.piece.id})}
|
url={requests.prepareUrl(ApiUrls.piece_extradata, {piece_id: this.props.piece.id})}
|
||||||
handleSuccess={this.handleSuccess}
|
handleSuccess={handleSuccess || this.handleSuccess}
|
||||||
getFormData={this.getFormData}
|
getFormData={this.getFormData}
|
||||||
buttons={buttons}
|
buttons={buttons}
|
||||||
spinner={spinner}>
|
spinner={spinner}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user