mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Fix some issues with smelly code
This commit is contained in:
parent
8a6674509c
commit
652df66cb3
@ -16,7 +16,6 @@ class ContractAgreementListActions {
|
||||
|
||||
fetchContractAgreementList(issuer, accepted, pending) {
|
||||
this.actions.updateContractAgreementList(null);
|
||||
|
||||
return Q.Promise((resolve, reject) => {
|
||||
OwnershipFetcher.fetchContractAgreementList(issuer, accepted, pending)
|
||||
.then((contractAgreementList) => {
|
||||
|
@ -203,7 +203,7 @@ let Form = React.createClass({
|
||||
}
|
||||
let buttons = null;
|
||||
|
||||
if (this.state.edited){
|
||||
if (this.state.edited && !this.props.disabled){
|
||||
buttons = (
|
||||
<div className="row" style={{margin: 0}}>
|
||||
<p className="pull-right">
|
||||
|
@ -41,10 +41,6 @@ let InputTextAreaToggable = React.createClass({
|
||||
}
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
this.setState({value: null});
|
||||
},
|
||||
|
||||
handleChange(event) {
|
||||
this.setState({value: event.target.value});
|
||||
this.props.onChange(event);
|
||||
|
@ -42,13 +42,6 @@ let CylandPieceContainer = React.createClass({
|
||||
UserStore.listen(this.onChange);
|
||||
},
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if(this.props.params.pieceId !== nextProps.params.pieceId) {
|
||||
PieceActions.updatePiece({});
|
||||
PieceActions.fetchOne(nextProps.params.pieceId);
|
||||
}
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
// Every time we're leaving the piece detail page,
|
||||
// just reset the piece that is saved in the piece store
|
||||
|
@ -21,6 +21,12 @@ import Property from '../../../../../../components/ascribe_forms/property';
|
||||
import InputTextAreaToggable from '../../../../../../components/ascribe_forms/input_textarea_toggable';
|
||||
import CollapsibleParagraph from '../../../../../../components/ascribe_collapsible/collapsible_paragraph';
|
||||
|
||||
import IkonotvArtistDetailsForm from '../ascribe_forms/ikonotv_artist_details_form';
|
||||
import IkonotvArtworkDetailsForm from '../ascribe_forms/ikonotv_artwork_details_form';
|
||||
|
||||
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
||||
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
||||
|
||||
import HistoryIterator from '../../../../../ascribe_detail/history_iterator';
|
||||
import Note from '../../../../../ascribe_detail/note';
|
||||
|
||||
@ -44,23 +50,18 @@ let IkonotvPieceContainer = React.createClass({
|
||||
|
||||
componentDidMount() {
|
||||
PieceStore.listen(this.onChange);
|
||||
PieceActions.fetchOne(this.props.params.pieceId);
|
||||
UserStore.listen(this.onChange);
|
||||
},
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if(this.props.params.pieceId !== nextProps.params.pieceId) {
|
||||
PieceActions.updatePiece({});
|
||||
PieceActions.fetchOne(nextProps.params.pieceId);
|
||||
}
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
// Every time we're leaving the piece detail page,
|
||||
// just reset the piece that is saved in the piece store
|
||||
// as it will otherwise display wrong/old data once the user loads
|
||||
// the piece detail a second time
|
||||
PieceActions.updatePiece({});
|
||||
|
||||
this.loadPiece();
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
PieceStore.unlisten(this.onChange);
|
||||
UserStore.unlisten(this.onChange);
|
||||
},
|
||||
@ -159,6 +160,7 @@ let IkonotvPieceContainer = React.createClass({
|
||||
url={ApiUrls.note_private_piece}
|
||||
currentUser={this.state.currentUser}/>
|
||||
</CollapsibleParagraph>
|
||||
|
||||
<IkonotvPieceDetails piece={this.state.piece}/>
|
||||
</Piece>
|
||||
);
|
||||
@ -178,6 +180,11 @@ let IkonotvPieceDetails = React.createClass({
|
||||
piece: React.PropTypes.object
|
||||
},
|
||||
|
||||
handleSuccess() {
|
||||
let notification = new GlobalNotificationModel('Artist details successfully updated', 'success', 10000);
|
||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||
},
|
||||
|
||||
render() {
|
||||
if (this.props.piece && Object.keys(this.props.piece.extra_data).length !== 0){
|
||||
return (
|
||||
|
@ -7,8 +7,6 @@ import Property from '../../../../../ascribe_forms/property';
|
||||
|
||||
import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_toggable';
|
||||
|
||||
//import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader';
|
||||
|
||||
import ApiUrls from '../../../../../../constants/api_urls';
|
||||
import AppConstants from '../../../../../../constants/application_constants';
|
||||
|
||||
@ -25,12 +23,6 @@ let IkonotvArtistDetailsForm = React.createClass({
|
||||
disabled: React.PropTypes.bool
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
isUploadReady: true
|
||||
};
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
let extradata = {};
|
||||
let formRefs = this.refs.form.refs;
|
||||
@ -49,18 +41,6 @@ let IkonotvArtistDetailsForm = React.createClass({
|
||||
|
||||
},
|
||||
|
||||
uploadStarted() {
|
||||
this.setState({
|
||||
isUploadReady: false
|
||||
});
|
||||
},
|
||||
|
||||
setIsUploadReady(isReady) {
|
||||
this.setState({
|
||||
isUploadReady: isReady
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
|
||||
return (
|
||||
|
@ -23,12 +23,6 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
||||
disabled: React.PropTypes.bool
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
isUploadReady: true
|
||||
};
|
||||
},
|
||||
|
||||
getFormData() {
|
||||
let extradata = {};
|
||||
let formRefs = this.refs.form.refs;
|
||||
@ -47,18 +41,6 @@ let IkonotvArtworkDetailsForm = React.createClass({
|
||||
|
||||
},
|
||||
|
||||
uploadStarted() {
|
||||
this.setState({
|
||||
isUploadReady: false
|
||||
});
|
||||
},
|
||||
|
||||
setIsUploadReady(isReady) {
|
||||
this.setState({
|
||||
isUploadReady: isReady
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user