1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 18:35:09 +01:00

Merge pull request #33 from ascribe/AD-1270-piece-detail-hangs-on-empty-piece-title

Check for piece and edition validity by using their ids instead of titles
This commit is contained in:
Tim Daubenschütz 2015-11-25 11:25:42 +01:00
commit 64030473cd
4 changed files with 10 additions and 18 deletions

View File

@ -42,8 +42,7 @@ import { getLangText } from '../../utils/lang_utils';
let Edition = React.createClass({ let Edition = React.createClass({
propTypes: { propTypes: {
edition: React.PropTypes.object, edition: React.PropTypes.object,
loadEdition: React.PropTypes.func, loadEdition: React.PropTypes.func
location: React.PropTypes.object
}, },
mixins: [History], mixins: [History],
@ -156,8 +155,7 @@ let Edition = React.createClass({
pieceId={this.props.edition.parent} pieceId={this.props.edition.parent}
extraData={this.props.edition.extra_data} extraData={this.props.edition.extra_data}
otherData={this.props.edition.other_data} otherData={this.props.edition.other_data}
handleSuccess={this.props.loadEdition} handleSuccess={this.props.loadEdition} />
location={this.props.location}/>
</CollapsibleParagraph> </CollapsibleParagraph>
<CollapsibleParagraph <CollapsibleParagraph
title={getLangText('SPOOL Details')}> title={getLangText('SPOOL Details')}>

View File

@ -17,8 +17,7 @@ import { setDocumentTitle } from '../../utils/dom_utils';
*/ */
let EditionContainer = React.createClass({ let EditionContainer = React.createClass({
propTypes: { propTypes: {
params: React.PropTypes.object, params: React.PropTypes.object
location: React.PropTypes.object
}, },
getInitialState() { getInitialState() {
@ -67,14 +66,13 @@ let EditionContainer = React.createClass({
}, },
render() { render() {
if(this.state.edition && this.state.edition.title) { if(this.state.edition && this.state.edition.id) {
setDocumentTitle([this.state.edition.artist_name, this.state.edition.title].join(', ')); setDocumentTitle([this.state.edition.artist_name, this.state.edition.title].join(', '));
return ( return (
<Edition <Edition
edition={this.state.edition} edition={this.state.edition}
loadEdition={this.loadEdition} loadEdition={this.loadEdition} />
location={this.props.location}/>
); );
} else { } else {
return ( return (

View File

@ -23,8 +23,7 @@ let FurtherDetails = React.createClass({
pieceId: React.PropTypes.number, pieceId: React.PropTypes.number,
extraData: React.PropTypes.object, extraData: React.PropTypes.object,
otherData: React.PropTypes.arrayOf(React.PropTypes.object), otherData: React.PropTypes.arrayOf(React.PropTypes.object),
handleSuccess: React.PropTypes.func, handleSuccess: React.PropTypes.func
location: React.PropTypes.object
}, },
getInitialState() { getInitialState() {
@ -86,8 +85,7 @@ let FurtherDetails = React.createClass({
overrideForm={true} overrideForm={true}
pieceId={this.props.pieceId} pieceId={this.props.pieceId}
otherData={this.props.otherData} otherData={this.props.otherData}
multiple={true} multiple={true} />
location={this.props.location}/>
</Form> </Form>
</Col> </Col>
</Row> </Row>

View File

@ -50,8 +50,7 @@ import { setDocumentTitle } from '../../utils/dom_utils';
*/ */
let PieceContainer = React.createClass({ let PieceContainer = React.createClass({
propTypes: { propTypes: {
params: React.PropTypes.object, params: React.PropTypes.object
location: React.PropTypes.object
}, },
mixins: [History], mixins: [History],
@ -226,7 +225,7 @@ let PieceContainer = React.createClass({
}, },
render() { render() {
if(this.state.piece && this.state.piece.title) { if(this.state.piece && this.state.piece.id) {
setDocumentTitle([this.state.piece.artist_name, this.state.piece.title].join(', ')); setDocumentTitle([this.state.piece.artist_name, this.state.piece.title].join(', '));
return ( return (
@ -292,8 +291,7 @@ let PieceContainer = React.createClass({
pieceId={this.state.piece.id} pieceId={this.state.piece.id}
extraData={this.state.piece.extra_data} extraData={this.state.piece.extra_data}
otherData={this.state.piece.other_data} otherData={this.state.piece.other_data}
handleSuccess={this.loadPiece} handleSuccess={this.loadPiece} />
location={this.props.location}/>
</CollapsibleParagraph> </CollapsibleParagraph>
</Piece> </Piece>