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