mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
make cyland submission stateful
This commit is contained in:
parent
0b4b3fa727
commit
d5e8181855
@ -36,12 +36,19 @@ let CylandSubmitButton = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let piece = this.props.piece;
|
||||||
|
let startFrom = 1;
|
||||||
|
|
||||||
|
if(piece && piece.extra_data && Object.keys(piece.extra_data).length > 0) {
|
||||||
|
startFrom = 2;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ButtonLink
|
<ButtonLink
|
||||||
to="register_piece"
|
to="register_piece"
|
||||||
query={{
|
query={{
|
||||||
'slide_num': 0,
|
'slide_num': 0,
|
||||||
'start_from': 1,
|
'start_from': startFrom,
|
||||||
'piece_id': this.props.piece.id
|
'piece_id': this.props.piece.id
|
||||||
}}
|
}}
|
||||||
className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}>
|
className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}>
|
||||||
|
@ -64,17 +64,6 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let artistBio = '';
|
|
||||||
let conceptualOverview = '';
|
|
||||||
|
|
||||||
if (Object.keys(this.props.piece).length !== 0 && Object.keys(this.props.piece.extra_data).length !== 0) {
|
|
||||||
let extraData = this.props.piece.extra_data;
|
|
||||||
|
|
||||||
artistBio = extraData.artist_bio;
|
|
||||||
conceptualOverview = extraData.conceptual_overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(this.props.piece && this.props.piece.id) {
|
if(this.props.piece && this.props.piece.id) {
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
@ -107,7 +96,6 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
rows={1}
|
rows={1}
|
||||||
editable={true}
|
editable={true}
|
||||||
placeholder={getLangText('Enter the artist\'s biography...')}
|
placeholder={getLangText('Enter the artist\'s biography...')}
|
||||||
defaultValue={artistBio}
|
|
||||||
required="required"/>
|
required="required"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property
|
<Property
|
||||||
@ -118,7 +106,6 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
rows={1}
|
rows={1}
|
||||||
editable={true}
|
editable={true}
|
||||||
placeholder={getLangText('Enter a conceptual overview...')}
|
placeholder={getLangText('Enter a conceptual overview...')}
|
||||||
defaultValue={conceptualOverview}
|
|
||||||
required="required"/>
|
required="required"/>
|
||||||
</Property>
|
</Property>
|
||||||
<FurtherDetailsFileuploader
|
<FurtherDetailsFileuploader
|
||||||
|
@ -92,6 +92,8 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
|
|
||||||
handleRegisterSuccess(response){
|
handleRegisterSuccess(response){
|
||||||
|
|
||||||
|
this.refreshPieceList();
|
||||||
|
|
||||||
// also start loading the piece for the next step
|
// also start loading the piece for the next step
|
||||||
if(response && response.piece) {
|
if(response && response.piece) {
|
||||||
PieceActions.updatePiece(response.piece);
|
PieceActions.updatePiece(response.piece);
|
||||||
@ -101,6 +103,7 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleAdditionalDataSuccess() {
|
handleAdditionalDataSuccess() {
|
||||||
|
this.refreshPieceList();
|
||||||
this.refs.slidesContainer.nextSlide();
|
this.refs.slidesContainer.nextSlide();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -108,8 +111,13 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
// once the user was able to register + loan a piece successfully, we need to make sure to keep
|
this.refreshPieceList();
|
||||||
// the piece list up to date
|
|
||||||
|
PieceActions.fetchOne(this.state.piece.id);
|
||||||
|
this.transitionTo('piece', {pieceId: this.state.piece.id});
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshPieceList() {
|
||||||
PieceListActions.fetchPieceList(
|
PieceListActions.fetchPieceList(
|
||||||
this.state.page,
|
this.state.page,
|
||||||
this.state.pageSize,
|
this.state.pageSize,
|
||||||
@ -118,9 +126,6 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
this.state.orderAsc,
|
this.state.orderAsc,
|
||||||
this.state.filterBy
|
this.state.filterBy
|
||||||
);
|
);
|
||||||
|
|
||||||
PieceActions.fetchOne(this.state.piece.id);
|
|
||||||
this.transitionTo('piece', {pieceId: this.state.piece.id});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeSlide() {
|
changeSlide() {
|
||||||
|
Loading…
Reference in New Issue
Block a user