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({
|
let FurtherDetailsFileuploader = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
uploadStarted: React.PropTypes.func,
|
||||||
pieceId: React.PropTypes.number,
|
pieceId: React.PropTypes.number,
|
||||||
otherData: React.PropTypes.arrayOf(React.PropTypes.object),
|
otherData: React.PropTypes.arrayOf(React.PropTypes.object),
|
||||||
setIsUploadReady: React.PropTypes.func,
|
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
|
// 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
|
// 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
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
let otherDataIds = this.props.otherData ? this.props.otherData.map((data)=>{return data.id; }).join() : 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
|
<Property
|
||||||
label="Additional files (max. 10MB)">
|
label="Additional files (max. 10MB)">
|
||||||
<ReactS3FineUploader
|
<ReactS3FineUploader
|
||||||
|
uploadStarted={this.props.uploadStarted}
|
||||||
keyRoutine={{
|
keyRoutine={{
|
||||||
url: AppConstants.serverUrl + 's3/key/',
|
url: AppConstants.serverUrl + 's3/key/',
|
||||||
fileClass: 'otherdata',
|
fileClass: 'otherdata',
|
||||||
|
@ -148,7 +148,7 @@ let LoanForm = React.createClass({
|
|||||||
label={getLangText('Loanee Email')}
|
label={getLangText('Loanee Email')}
|
||||||
onBlur={this.handleOnBlur}
|
onBlur={this.handleOnBlur}
|
||||||
editable={!this.props.email}
|
editable={!this.props.email}
|
||||||
overrideForm={!this.props.email}>
|
overrideForm={!!this.props.email}>
|
||||||
<input
|
<input
|
||||||
value={this.props.email}
|
value={this.props.email}
|
||||||
type="email"
|
type="email"
|
||||||
@ -159,7 +159,7 @@ let LoanForm = React.createClass({
|
|||||||
name='gallery_name'
|
name='gallery_name'
|
||||||
label={getLangText('Gallery/exhibition (optional)')}
|
label={getLangText('Gallery/exhibition (optional)')}
|
||||||
editable={!this.props.gallery}
|
editable={!this.props.gallery}
|
||||||
overrideForm={!this.props.gallery}>
|
overrideForm={!!this.props.gallery}>
|
||||||
<input
|
<input
|
||||||
value={this.props.gallery}
|
value={this.props.gallery}
|
||||||
type="text"
|
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
|
// then we want to "replace" (in this case append) the current url with ?slide_num=0
|
||||||
if(isNaN(slideNum) && this.state.slideNum === -1) {
|
if(isNaN(slideNum) && this.state.slideNum === -1) {
|
||||||
slideNum = 0;
|
slideNum = 0;
|
||||||
|
|
||||||
queryParams.slide_num = slideNum;
|
queryParams.slide_num = slideNum;
|
||||||
|
|
||||||
this.replaceWith(this.getPathname(), null, queryParams);
|
this.replaceWith(this.getPathname(), null, queryParams);
|
||||||
|
@ -94,6 +94,7 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
retry: React.PropTypes.shape({
|
retry: React.PropTypes.shape({
|
||||||
enableAuto: React.PropTypes.bool
|
enableAuto: React.PropTypes.bool
|
||||||
}),
|
}),
|
||||||
|
uploadStarted: React.PropTypes.func,
|
||||||
setIsUploadReady: React.PropTypes.func,
|
setIsUploadReady: React.PropTypes.func,
|
||||||
isReadyForFormSubmission: React.PropTypes.func,
|
isReadyForFormSubmission: React.PropTypes.func,
|
||||||
areAssetsDownloadable: React.PropTypes.bool,
|
areAssetsDownloadable: React.PropTypes.bool,
|
||||||
@ -580,6 +581,11 @@ var ReactS3FineUploader = React.createClass({
|
|||||||
return;
|
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,
|
// 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
|
// take the first one and notify user that only one file can be submitted
|
||||||
if(!this.props.multiple && files.length > 1) {
|
if(!this.props.multiple && files.length > 1) {
|
||||||
|
@ -48,6 +48,12 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
uploadStarted() {
|
||||||
|
this.setState({
|
||||||
|
isUploadReady: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
setIsUploadReady(isReady) {
|
setIsUploadReady(isReady) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isUploadReady: isReady
|
isUploadReady: isReady
|
||||||
@ -94,28 +100,29 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
<Property
|
<Property
|
||||||
name='artist_bio'
|
name='artist_bio'
|
||||||
label={getLangText('Artist Biography')}
|
label={getLangText('Artist Biography')}
|
||||||
editable={true}>
|
editable={!this.props.disabled}>
|
||||||
<InputTextAreaToggable
|
<InputTextAreaToggable
|
||||||
rows={1}
|
rows={1}
|
||||||
editable={true}
|
editable={!this.props.disabled}
|
||||||
placeholder={getLangText('Enter the artist\'s biography...')}
|
placeholder={getLangText('Enter the artist\'s biography...')}
|
||||||
required="required"/>
|
required="required"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property
|
<Property
|
||||||
name='conceptual_overview'
|
name='conceptual_overview'
|
||||||
label={getLangText('Conceptual Overview')}
|
label={getLangText('Conceptual Overview')}
|
||||||
editable={true}>
|
editable={!this.props.disabled}>
|
||||||
<InputTextAreaToggable
|
<InputTextAreaToggable
|
||||||
rows={1}
|
rows={1}
|
||||||
editable={true}
|
editable={!this.props.disabled}
|
||||||
placeholder={getLangText('Enter a conceptual overview...')}
|
placeholder={getLangText('Enter a conceptual overview...')}
|
||||||
required="required"/>
|
required="required"/>
|
||||||
</Property>
|
</Property>
|
||||||
<FurtherDetailsFileuploader
|
<FurtherDetailsFileuploader
|
||||||
|
uploadStarted={this.uploadStarted}
|
||||||
submitKey={this.submitKey}
|
submitKey={this.submitKey}
|
||||||
setIsUploadReady={this.setIsUploadReady}
|
setIsUploadReady={this.setIsUploadReady}
|
||||||
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
||||||
editable={true}
|
editable={!this.props.disabled}
|
||||||
pieceId={this.props.piece.id}
|
pieceId={this.props.piece.id}
|
||||||
otherData={this.props.piece.other_data}
|
otherData={this.props.piece.other_data}
|
||||||
multiple={true}/>
|
multiple={true}/>
|
||||||
|
Loading…
Reference in New Issue
Block a user