1
0
mirror of https://github.com/ascribe/onion.git synced 2024-07-01 06:02:12 +02:00

tested and fixed ikonotv

This commit is contained in:
diminator 2015-12-02 21:42:35 +01:00
parent 743c11df5b
commit 565bf308ae

View File

@ -16,6 +16,9 @@ import UserActions from '../../../../../actions/user_actions';
import PieceStore from '../../../../../stores/piece_store'; import PieceStore from '../../../../../stores/piece_store';
import PieceActions from '../../../../../actions/piece_actions'; import PieceActions from '../../../../../actions/piece_actions';
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
import WhitelabelStore from '../../../../../stores/whitelabel_store';
import GlobalNotificationModel from '../../../../../models/global_notification_model'; import GlobalNotificationModel from '../../../../../models/global_notification_model';
import GlobalNotificationActions from '../../../../../actions/global_notification_actions'; import GlobalNotificationActions from '../../../../../actions/global_notification_actions';
@ -47,6 +50,7 @@ let IkonotvRegisterPiece = React.createClass({
UserStore.getState(), UserStore.getState(),
PieceListStore.getState(), PieceListStore.getState(),
PieceStore.getState(), PieceStore.getState(),
WhitelabelStore.getState(),
{ {
step: 0, step: 0,
pageExitWarning: getLangText("If you leave this form now, your work will not be loaned to Ikono TV.") pageExitWarning: getLangText("If you leave this form now, your work will not be loaned to Ikono TV.")
@ -57,7 +61,9 @@ let IkonotvRegisterPiece = React.createClass({
PieceListStore.listen(this.onChange); PieceListStore.listen(this.onChange);
UserStore.listen(this.onChange); UserStore.listen(this.onChange);
PieceStore.listen(this.onChange); PieceStore.listen(this.onChange);
WhitelabelStore.listen(this.onChange);
UserActions.fetchCurrentUser(); UserActions.fetchCurrentUser();
WhitelabelActions.fetchWhitelabel();
// Before we load the new piece, we reset the piece store to delete old data that we do // Before we load the new piece, we reset the piece store to delete old data that we do
// not want to display to the user. // not want to display to the user.
@ -81,6 +87,7 @@ let IkonotvRegisterPiece = React.createClass({
PieceListStore.unlisten(this.onChange); PieceListStore.unlisten(this.onChange);
UserStore.unlisten(this.onChange); UserStore.unlisten(this.onChange);
PieceStore.unlisten(this.onChange); PieceStore.unlisten(this.onChange);
WhitelabelStore.listen(this.onChange);
}, },
onChange(state) { onChange(state) {
@ -152,7 +159,8 @@ let IkonotvRegisterPiece = React.createClass({
canSubmit() { canSubmit() {
let currentUser = this.state.currentUser; let currentUser = this.state.currentUser;
return currentUser && currentUser.acl && currentUser.acl.acl_wallet_submit; let whitelabel = this.state.whitelabel;
return currentUser && currentUser.acl && currentUser.acl.acl_wallet_submit && whitelabel && whitelabel.user;
}, },
getSlideArtistDetails() { getSlideArtistDetails() {
@ -194,15 +202,16 @@ let IkonotvRegisterPiece = React.createClass({
let today = new Moment(); let today = new Moment();
let enddate = new Moment(); let enddate = new Moment();
enddate.add(2, 'years'); enddate.add(2, 'years');
const {piece, whitelabel} = this.state;
return ( return (
<div data-slide-title={getLangText('Loan')}> <div data-slide-title={getLangText('Loan')}>
<Row className="no-margin"> <Row className="no-margin">
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}> <Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
<LoanForm <LoanForm
loanHeading={getLangText('Loan to IkonoTV archive')} loanHeading={getLangText('Loan to IkonoTV archive')}
id={{piece_id: this.state.piece.id}} id={{piece_id: piece.id}}
url={ApiUrls.ownership_loans_pieces} url={ApiUrls.ownership_loans_pieces}
email="submissions@ikono.org" email={whitelabel.user}
startdate={today} startdate={today}
enddate={enddate} enddate={enddate}
showStartDate={false} showStartDate={false}