2015-07-08 22:54:07 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import Row from 'react-bootstrap/lib/Row';
|
|
|
|
import Col from 'react-bootstrap/lib/Col';
|
|
|
|
|
2015-07-13 18:13:16 +02:00
|
|
|
import PieceActions from '../../actions/piece_actions';
|
|
|
|
|
2015-07-08 22:54:07 +02:00
|
|
|
import MediaContainer from './media_container';
|
|
|
|
|
2015-07-15 15:00:39 +02:00
|
|
|
|
2015-07-08 22:54:07 +02:00
|
|
|
/**
|
|
|
|
* This is the component that implements display-specific functionality
|
|
|
|
*/
|
|
|
|
let Piece = React.createClass({
|
|
|
|
propTypes: {
|
2016-02-05 11:53:33 +01:00
|
|
|
piece: React.PropTypes.object.isRequired,
|
|
|
|
|
|
|
|
buttons: React.PropTypes.object,
|
2016-01-11 17:52:32 +01:00
|
|
|
currentUser: React.PropTypes.object,
|
2015-08-11 17:12:12 +02:00
|
|
|
header: React.PropTypes.object,
|
|
|
|
subheader: React.PropTypes.object,
|
2015-10-28 18:37:09 +01:00
|
|
|
children: React.PropTypes.oneOfType([
|
|
|
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
|
|
|
React.PropTypes.element
|
|
|
|
])
|
2015-07-08 22:54:07 +02:00
|
|
|
},
|
|
|
|
|
2016-01-11 19:34:39 +01:00
|
|
|
updatePiece() {
|
2016-02-05 10:38:59 +01:00
|
|
|
return PieceActions.fetchPiece(this.props.piece.id);
|
2015-07-13 18:13:16 +02:00
|
|
|
},
|
|
|
|
|
2015-07-13 17:09:44 +02:00
|
|
|
render() {
|
2016-01-11 17:52:32 +01:00
|
|
|
const { buttons, children, currentUser, header, piece, subheader } = this.props;
|
|
|
|
|
2015-07-08 22:54:07 +02:00
|
|
|
return (
|
|
|
|
<Row>
|
2015-12-23 09:37:03 +01:00
|
|
|
<Col md={6} className="ascribe-print-col-left">
|
2015-07-08 22:54:07 +02:00
|
|
|
<MediaContainer
|
2016-01-11 17:52:32 +01:00
|
|
|
content={piece}
|
|
|
|
currentUser={currentUser}
|
2016-01-11 19:34:39 +01:00
|
|
|
refreshObject={this.updatePiece} />
|
2015-07-08 22:54:07 +02:00
|
|
|
</Col>
|
2015-12-23 09:37:03 +01:00
|
|
|
<Col md={6} className="ascribe-edition-details ascribe-print-col-right">
|
2016-01-11 17:52:32 +01:00
|
|
|
{header}
|
|
|
|
{subheader}
|
|
|
|
{buttons}
|
2015-07-13 17:09:44 +02:00
|
|
|
|
2016-01-11 17:52:32 +01:00
|
|
|
{children}
|
2015-07-08 22:54:07 +02:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default Piece;
|