mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
Merge with AD-1290
This commit is contained in:
commit
3fb4ae55bf
@ -27,21 +27,15 @@ let EditionContainer = React.createClass({
|
|||||||
return EditionStore.getState();
|
return EditionStore.getState();
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange(state) {
|
|
||||||
this.setState(state);
|
|
||||||
if (!state.edition.digital_work) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let isEncoding = state.edition.digital_work.isEncoding;
|
|
||||||
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
|
||||||
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
|
||||||
this.setState({timerId: timerId});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
EditionStore.listen(this.onChange);
|
EditionStore.listen(this.onChange);
|
||||||
EditionActions.fetchOne(this.props.params.editionId);
|
|
||||||
|
// Every time we enter the edition detail page, just reset the edition
|
||||||
|
// store as it will otherwise display wrong/old data once the user loads
|
||||||
|
// the edition detail a second time
|
||||||
|
EditionActions.updateEdition({});
|
||||||
|
|
||||||
|
this.loadEdition();
|
||||||
},
|
},
|
||||||
|
|
||||||
// This is done to update the container when the user clicks on the prev or next
|
// This is done to update the container when the user clicks on the prev or next
|
||||||
@ -54,15 +48,21 @@ let EditionContainer = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
// Every time we're leaving the edition detail page,
|
|
||||||
// just reset the edition that is saved in the edition store
|
|
||||||
// as it will otherwise display wrong/old data once the user loads
|
|
||||||
// the edition detail a second time
|
|
||||||
EditionActions.updateEdition({});
|
|
||||||
window.clearInterval(this.state.timerId);
|
window.clearInterval(this.state.timerId);
|
||||||
EditionStore.unlisten(this.onChange);
|
EditionStore.unlisten(this.onChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChange(state) {
|
||||||
|
this.setState(state);
|
||||||
|
if (!state.edition.digital_work) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let isEncoding = state.edition.digital_work.isEncoding;
|
||||||
|
if (state.edition.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
|
||||||
|
let timerId = window.setInterval(() => EditionActions.fetchOne(this.props.params.editionId), 10000);
|
||||||
|
this.setState({timerId: timerId});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
loadEdition() {
|
loadEdition() {
|
||||||
EditionActions.fetchOne(this.props.params.editionId);
|
EditionActions.fetchOne(this.props.params.editionId);
|
||||||
|
@ -49,8 +49,8 @@ import { setDocumentTitle } from '../../utils/dom_utils';
|
|||||||
*/
|
*/
|
||||||
let PieceContainer = React.createClass({
|
let PieceContainer = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
params: React.PropTypes.object,
|
|
||||||
furtherDetailsType: React.PropTypes.func,
|
furtherDetailsType: React.PropTypes.func,
|
||||||
|
params: React.PropTypes.object,
|
||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -78,15 +78,16 @@ let PieceContainer = React.createClass({
|
|||||||
PieceListStore.listen(this.onChange);
|
PieceListStore.listen(this.onChange);
|
||||||
UserActions.fetchCurrentUser();
|
UserActions.fetchCurrentUser();
|
||||||
PieceStore.listen(this.onChange);
|
PieceStore.listen(this.onChange);
|
||||||
PieceActions.fetchOne(this.props.params.pieceId);
|
|
||||||
|
// Every time we enter the piece detail page, just reset 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() {
|
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({});
|
|
||||||
PieceStore.unlisten(this.onChange);
|
PieceStore.unlisten(this.onChange);
|
||||||
UserStore.unlisten(this.onChange);
|
UserStore.unlisten(this.onChange);
|
||||||
PieceListStore.unlisten(this.onChange);
|
PieceListStore.unlisten(this.onChange);
|
||||||
@ -276,6 +277,15 @@ let PieceContainer = React.createClass({
|
|||||||
successMessage={getLangText('Private note saved')}
|
successMessage={getLangText('Private note saved')}
|
||||||
url={ApiUrls.note_private_piece}
|
url={ApiUrls.note_private_piece}
|
||||||
currentUser={this.state.currentUser}/>
|
currentUser={this.state.currentUser}/>
|
||||||
|
<Note
|
||||||
|
id={this.getId}
|
||||||
|
label={getLangText('Piece note (public)')}
|
||||||
|
defaultValue={this.state.piece.public_note || null}
|
||||||
|
placeholder={getLangText('Enter your comments ...')}
|
||||||
|
editable={!!this.state.piece.acl.acl_edit}
|
||||||
|
successMessage={getLangText('Public piece note saved')}
|
||||||
|
url={ApiUrls.note_public_piece}
|
||||||
|
currentUser={this.state.currentUser}/>
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title={getLangText('Further Details')}
|
title={getLangText('Further Details')}
|
||||||
|
@ -47,6 +47,10 @@ import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
|||||||
* This is the component that implements resource/data specific functionality
|
* This is the component that implements resource/data specific functionality
|
||||||
*/
|
*/
|
||||||
let PieceContainer = React.createClass({
|
let PieceContainer = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
params: React.PropTypes.object
|
||||||
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
PieceStore.getState(),
|
PieceStore.getState(),
|
||||||
@ -58,6 +62,11 @@ let PieceContainer = React.createClass({
|
|||||||
PieceStore.listen(this.onChange);
|
PieceStore.listen(this.onChange);
|
||||||
PieceActions.fetchOne(this.props.params.pieceId);
|
PieceActions.fetchOne(this.props.params.pieceId);
|
||||||
UserStore.listen(this.onChange);
|
UserStore.listen(this.onChange);
|
||||||
|
|
||||||
|
// Every time we enter the piece detail page, just reset the piece
|
||||||
|
// store as it will otherwise display wrong/old data once the user loads
|
||||||
|
// the piece detail a second time
|
||||||
|
PieceActions.updatePiece({});
|
||||||
},
|
},
|
||||||
|
|
||||||
// This is done to update the container when the user clicks on the prev or next
|
// This is done to update the container when the user clicks on the prev or next
|
||||||
@ -70,11 +79,6 @@ let PieceContainer = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
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({});
|
|
||||||
PieceStore.unlisten(this.onChange);
|
PieceStore.unlisten(this.onChange);
|
||||||
UserStore.unlisten(this.onChange);
|
UserStore.unlisten(this.onChange);
|
||||||
},
|
},
|
||||||
|
@ -51,9 +51,8 @@ let CylandPieceContainer = React.createClass({
|
|||||||
UserStore.listen(this.onChange);
|
UserStore.listen(this.onChange);
|
||||||
PieceListStore.listen(this.onChange);
|
PieceListStore.listen(this.onChange);
|
||||||
|
|
||||||
// Every time we're leaving the piece detail page,
|
// Every time we enter the piece detail page, just reset the piece
|
||||||
// just reset the piece that is saved in the piece store
|
// 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({});
|
||||||
|
|
||||||
|
@ -52,9 +52,8 @@ let IkonotvPieceContainer = React.createClass({
|
|||||||
UserStore.listen(this.onChange);
|
UserStore.listen(this.onChange);
|
||||||
PieceListStore.listen(this.onChange);
|
PieceListStore.listen(this.onChange);
|
||||||
|
|
||||||
// Every time we're leaving the piece detail page,
|
// Every time we enter the piece detail page, just reset the piece
|
||||||
// just reset the piece that is saved in the piece store
|
// 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({});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user