mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Merge branch 'AD-835-make-form-fields-lockable' into AD-613-cyland-white-label-page
Conflicts: js/components/ascribe_detail/further_details_fileuploader.js
This commit is contained in:
commit
09c0451c86
@ -13,6 +13,7 @@ import { getCookie } from '../../utils/fetch_api_utils';
|
||||
|
||||
let FurtherDetailsFileuploader = React.createClass({
|
||||
propTypes: {
|
||||
uploadStarted: React.PropTypes.func,
|
||||
pieceId: React.PropTypes.number,
|
||||
otherData: React.PropTypes.arrayOf(React.PropTypes.object),
|
||||
setIsUploadReady: React.PropTypes.func,
|
||||
@ -34,7 +35,7 @@ let FurtherDetailsFileuploader = React.createClass({
|
||||
// 1. there is no other_data => do not show the fileuploader at all
|
||||
// 2. there is other_data, but user has no edit rights => show fileuploader but without action buttons
|
||||
// 3. both other_data and editable are defined or true => show fileuploader with all action buttons
|
||||
if (!this.props.editable && (!this.props.otherData || this.props.otherData.length == 0)){
|
||||
if (!this.props.editable && (!this.props.otherData || this.props.otherData.length === 0)) {
|
||||
return null;
|
||||
}
|
||||
let otherDataIds = this.props.otherData ? this.props.otherData.map((data)=>{return data.id; }).join() : null;
|
||||
@ -43,6 +44,7 @@ let FurtherDetailsFileuploader = React.createClass({
|
||||
<Property
|
||||
label="Additional files (max. 10MB)">
|
||||
<ReactS3FineUploader
|
||||
uploadStarted={this.props.uploadStarted}
|
||||
keyRoutine={{
|
||||
url: AppConstants.serverUrl + 's3/key/',
|
||||
fileClass: 'otherdata',
|
||||
|
@ -148,7 +148,7 @@ let LoanForm = React.createClass({
|
||||
label={getLangText('Loanee Email')}
|
||||
onBlur={this.handleOnBlur}
|
||||
editable={!this.props.email}
|
||||
overrideForm={!this.props.email}>
|
||||
overrideForm={!!this.props.email}>
|
||||
<input
|
||||
value={this.props.email}
|
||||
type="email"
|
||||
@ -159,7 +159,7 @@ let LoanForm = React.createClass({
|
||||
name='gallery_name'
|
||||
label={getLangText('Gallery/exhibition (optional)')}
|
||||
editable={!this.props.gallery}
|
||||
overrideForm={!this.props.gallery}>
|
||||
overrideForm={!!this.props.gallery}>
|
||||
<input
|
||||
value={this.props.gallery}
|
||||
type="text"
|
||||
|
@ -121,7 +121,6 @@ let SlidesContainer = React.createClass({
|
||||
// then we want to "replace" (in this case append) the current url with ?slide_num=0
|
||||
if(isNaN(slideNum) && this.state.slideNum === -1) {
|
||||
slideNum = 0;
|
||||
|
||||
queryParams.slide_num = slideNum;
|
||||
|
||||
this.replaceWith(this.getPathname(), null, queryParams);
|
||||
|
@ -94,6 +94,7 @@ var ReactS3FineUploader = React.createClass({
|
||||
retry: React.PropTypes.shape({
|
||||
enableAuto: React.PropTypes.bool
|
||||
}),
|
||||
uploadStarted: React.PropTypes.func,
|
||||
setIsUploadReady: React.PropTypes.func,
|
||||
isReadyForFormSubmission: React.PropTypes.func,
|
||||
areAssetsDownloadable: React.PropTypes.bool,
|
||||
@ -580,6 +581,11 @@ var ReactS3FineUploader = React.createClass({
|
||||
return;
|
||||
}
|
||||
|
||||
// Call this method to signal the outside component that an upload is in progress
|
||||
if(this.props.uploadStarted && typeof this.props.uploadStarted === 'function') {
|
||||
this.props.uploadStarted();
|
||||
}
|
||||
|
||||
// if multiple is set to false and user drops multiple files into the dropzone,
|
||||
// take the first one and notify user that only one file can be submitted
|
||||
if(!this.props.multiple && files.length > 1) {
|
||||
|
@ -48,6 +48,12 @@ let CylandAdditionalDataForm = React.createClass({
|
||||
|
||||
},
|
||||
|
||||
uploadStarted() {
|
||||
this.setState({
|
||||
isUploadReady: false
|
||||
});
|
||||
},
|
||||
|
||||
setIsUploadReady(isReady) {
|
||||
this.setState({
|
||||
isUploadReady: isReady
|
||||
@ -94,28 +100,29 @@ let CylandAdditionalDataForm = React.createClass({
|
||||
<Property
|
||||
name='artist_bio'
|
||||
label={getLangText('Artist Biography')}
|
||||
editable={true}>
|
||||
editable={!this.props.disabled}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
editable={true}
|
||||
editable={!this.props.disabled}
|
||||
placeholder={getLangText('Enter the artist\'s biography...')}
|
||||
required="required"/>
|
||||
</Property>
|
||||
<Property
|
||||
name='conceptual_overview'
|
||||
label={getLangText('Conceptual Overview')}
|
||||
editable={true}>
|
||||
editable={!this.props.disabled}>
|
||||
<InputTextAreaToggable
|
||||
rows={1}
|
||||
editable={true}
|
||||
editable={!this.props.disabled}
|
||||
placeholder={getLangText('Enter a conceptual overview...')}
|
||||
required="required"/>
|
||||
</Property>
|
||||
<FurtherDetailsFileuploader
|
||||
uploadStarted={this.uploadStarted}
|
||||
submitKey={this.submitKey}
|
||||
setIsUploadReady={this.setIsUploadReady}
|
||||
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
||||
editable={true}
|
||||
editable={!this.props.disabled}
|
||||
pieceId={this.props.piece.id}
|
||||
otherData={this.props.piece.other_data}
|
||||
multiple={true}/>
|
||||
|
Loading…
Reference in New Issue
Block a user