1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Fix some issues with smelly code

This commit is contained in:
Tim Daubenschütz 2015-09-21 14:22:52 +02:00
parent 8a6674509c
commit 652df66cb3
7 changed files with 18 additions and 61 deletions

View File

@ -16,7 +16,6 @@ class ContractAgreementListActions {
fetchContractAgreementList(issuer, accepted, pending) { fetchContractAgreementList(issuer, accepted, pending) {
this.actions.updateContractAgreementList(null); this.actions.updateContractAgreementList(null);
return Q.Promise((resolve, reject) => { return Q.Promise((resolve, reject) => {
OwnershipFetcher.fetchContractAgreementList(issuer, accepted, pending) OwnershipFetcher.fetchContractAgreementList(issuer, accepted, pending)
.then((contractAgreementList) => { .then((contractAgreementList) => {

View File

@ -203,7 +203,7 @@ let Form = React.createClass({
} }
let buttons = null; let buttons = null;
if (this.state.edited){ if (this.state.edited && !this.props.disabled){
buttons = ( buttons = (
<div className="row" style={{margin: 0}}> <div className="row" style={{margin: 0}}>
<p className="pull-right"> <p className="pull-right">

View File

@ -41,10 +41,6 @@ let InputTextAreaToggable = React.createClass({
} }
}, },
componentWillUnmount() {
this.setState({value: null});
},
handleChange(event) { handleChange(event) {
this.setState({value: event.target.value}); this.setState({value: event.target.value});
this.props.onChange(event); this.props.onChange(event);

View File

@ -42,13 +42,6 @@ let CylandPieceContainer = React.createClass({
UserStore.listen(this.onChange); UserStore.listen(this.onChange);
}, },
componentWillReceiveProps(nextProps) {
if(this.props.params.pieceId !== nextProps.params.pieceId) {
PieceActions.updatePiece({});
PieceActions.fetchOne(nextProps.params.pieceId);
}
},
componentWillUnmount() { componentWillUnmount() {
// Every time we're leaving the piece detail page, // Every time we're leaving the piece detail page,
// just reset the piece that is saved in the piece store // just reset the piece that is saved in the piece store

View File

@ -21,6 +21,12 @@ import Property from '../../../../../../components/ascribe_forms/property';
import InputTextAreaToggable from '../../../../../../components/ascribe_forms/input_textarea_toggable'; import InputTextAreaToggable from '../../../../../../components/ascribe_forms/input_textarea_toggable';
import CollapsibleParagraph from '../../../../../../components/ascribe_collapsible/collapsible_paragraph'; 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 HistoryIterator from '../../../../../ascribe_detail/history_iterator';
import Note from '../../../../../ascribe_detail/note'; import Note from '../../../../../ascribe_detail/note';
@ -44,23 +50,18 @@ let IkonotvPieceContainer = React.createClass({
componentDidMount() { componentDidMount() {
PieceStore.listen(this.onChange); PieceStore.listen(this.onChange);
PieceActions.fetchOne(this.props.params.pieceId);
UserStore.listen(this.onChange); 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, // Every time we're leaving the piece detail page,
// just reset the piece that is saved in the piece store // just reset the piece that is saved in the piece store
// as it will otherwise display wrong/old data once the user loads // as it will otherwise display wrong/old data once the user loads
// the piece detail a second time // the piece detail a second time
PieceActions.updatePiece({}); PieceActions.updatePiece({});
this.loadPiece();
},
componentWillUnmount() {
PieceStore.unlisten(this.onChange); PieceStore.unlisten(this.onChange);
UserStore.unlisten(this.onChange); UserStore.unlisten(this.onChange);
}, },
@ -159,6 +160,7 @@ let IkonotvPieceContainer = React.createClass({
url={ApiUrls.note_private_piece} url={ApiUrls.note_private_piece}
currentUser={this.state.currentUser}/> currentUser={this.state.currentUser}/>
</CollapsibleParagraph> </CollapsibleParagraph>
<IkonotvPieceDetails piece={this.state.piece}/> <IkonotvPieceDetails piece={this.state.piece}/>
</Piece> </Piece>
); );
@ -178,6 +180,11 @@ let IkonotvPieceDetails = React.createClass({
piece: React.PropTypes.object piece: React.PropTypes.object
}, },
handleSuccess() {
let notification = new GlobalNotificationModel('Artist details successfully updated', 'success', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
},
render() { render() {
if (this.props.piece && Object.keys(this.props.piece.extra_data).length !== 0){ if (this.props.piece && Object.keys(this.props.piece.extra_data).length !== 0){
return ( return (

View File

@ -7,8 +7,6 @@ import Property from '../../../../../ascribe_forms/property';
import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_toggable'; import InputTextAreaToggable from '../../../../../ascribe_forms/input_textarea_toggable';
//import FurtherDetailsFileuploader from '../../../../../ascribe_detail/further_details_fileuploader';
import ApiUrls from '../../../../../../constants/api_urls'; import ApiUrls from '../../../../../../constants/api_urls';
import AppConstants from '../../../../../../constants/application_constants'; import AppConstants from '../../../../../../constants/application_constants';
@ -25,12 +23,6 @@ let IkonotvArtistDetailsForm = React.createClass({
disabled: React.PropTypes.bool disabled: React.PropTypes.bool
}, },
getInitialState() {
return {
isUploadReady: true
};
},
getFormData() { getFormData() {
let extradata = {}; let extradata = {};
let formRefs = this.refs.form.refs; 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() { render() {
if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) { if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
return ( return (

View File

@ -23,12 +23,6 @@ let IkonotvArtworkDetailsForm = React.createClass({
disabled: React.PropTypes.bool disabled: React.PropTypes.bool
}, },
getInitialState() {
return {
isUploadReady: true
};
},
getFormData() { getFormData() {
let extradata = {}; let extradata = {};
let formRefs = this.refs.form.refs; 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() { render() {
if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) { if(this.props.piece && this.props.piece.id && this.props.piece.extra_data) {
return ( return (