1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00

Disable form when acl_edit is turned off

This commit is contained in:
Brett Sun 2015-12-04 15:35:01 +01:00
parent 5a6026d0ca
commit 0763c45548

View File

@ -32,6 +32,7 @@ let MarketAdditionalDataForm = React.createClass({
React.PropTypes.number, React.PropTypes.number,
React.PropTypes.string React.PropTypes.string
]), ]),
editable: React.PropTypes.bool,
isInline: React.PropTypes.bool, isInline: React.PropTypes.bool,
showHeading: React.PropTypes.bool, showHeading: React.PropTypes.bool,
showNotification: React.PropTypes.bool, showNotification: React.PropTypes.bool,
@ -41,6 +42,7 @@ let MarketAdditionalDataForm = React.createClass({
getDefaultProps() { getDefaultProps() {
return { return {
editable: true,
submitLabel: getLangText('Register work') submitLabel: getLangText('Register work')
}; };
}, },
@ -130,7 +132,7 @@ let MarketAdditionalDataForm = React.createClass({
}, },
render() { render() {
const { isInline, handleSuccess, showHeading, showNotification, submitLabel } = this.props; const { editable, isInline, handleSuccess, showHeading, showNotification, submitLabel } = this.props;
const { piece } = this.state; const { piece } = this.state;
let buttons, spinner, heading; let buttons, spinner, heading;
@ -169,7 +171,8 @@ let MarketAdditionalDataForm = React.createClass({
handleSuccess={showNotification ? this.handleSuccessWithNotification : handleSuccess} handleSuccess={showNotification ? this.handleSuccessWithNotification : handleSuccess}
getFormData={this.getFormData} getFormData={this.getFormData}
buttons={buttons} buttons={buttons}
spinner={spinner}> spinner={spinner}
disabled={!this.props.editable || !piece.acl.acl_edit}>
{heading} {heading}
<FurtherDetailsFileuploader <FurtherDetailsFileuploader
label={getLangText('Marketplace Thumbnail Image')} label={getLangText('Marketplace Thumbnail Image')}
@ -178,10 +181,12 @@ let MarketAdditionalDataForm = React.createClass({
setIsUploadReady={this.setIsUploadReady} setIsUploadReady={this.setIsUploadReady}
isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile} isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile}
pieceId={piece.id} pieceId={piece.id}
otherData={piece.other_data} /> otherData={piece.other_data}
editable={editable} />
<Property <Property
name='artist_bio' name='artist_bio'
label={getLangText('Artist Bio')}> label={getLangText('Artist Bio')}
expanded={editable || !!piece.extra_data.artist_bio}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.artist_bio} defaultValue={piece.extra_data.artist_bio}
@ -190,7 +195,8 @@ let MarketAdditionalDataForm = React.createClass({
</Property> </Property>
<Property <Property
name='work_description' name='work_description'
label={getLangText('Work Description')}> label={getLangText('Work Description')}
expanded={editable || !!piece.extra_data.work_description}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.work_description} defaultValue={piece.extra_data.work_description}
@ -199,7 +205,8 @@ let MarketAdditionalDataForm = React.createClass({
</Property> </Property>
<Property <Property
name='technology_details' name='technology_details'
label={getLangText('Technology Details')}> label={getLangText('Technology Details')}
expanded={editable || !!piece.extra_data.technology_details}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.technology_details} defaultValue={piece.extra_data.technology_details}
@ -208,7 +215,8 @@ let MarketAdditionalDataForm = React.createClass({
</Property> </Property>
<Property <Property
name='display_instructions' name='display_instructions'
label={getLangText('Display Instructions')}> label={getLangText('Display Instructions')}
expanded={editable || !!piece.extra_data.display_instructions}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.display_instructions} defaultValue={piece.extra_data.display_instructions}