mirror of
https://github.com/ascribe/onion.git
synced 2024-06-28 16:48:04 +02:00
ikonotv initial setup
This commit is contained in:
parent
f77f1d1d5d
commit
8ae7edaa1c
|
@ -0,0 +1,93 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import Router from 'react-router';
|
||||||
|
|
||||||
|
import AccordionListItemPiece from '../../../../../ascribe_accordion_list/accordion_list_item_piece';
|
||||||
|
|
||||||
|
import PieceListActions from '../../../../../../actions/piece_list_actions';
|
||||||
|
import PieceListStore from '../../../../../../stores/piece_list_store';
|
||||||
|
|
||||||
|
import UserStore from '../../../../../../stores/user_store';
|
||||||
|
|
||||||
|
import GlobalNotificationModel from '../../../../../../models/global_notification_model';
|
||||||
|
import GlobalNotificationActions from '../../../../../../actions/global_notification_actions';
|
||||||
|
|
||||||
|
import IkonotvSubmitButton from '../ascribe_buttons/ikonotv_submit_button';
|
||||||
|
import AclProxy from '../../../../../acl_proxy';
|
||||||
|
|
||||||
|
import { getLangText } from '../../../../../../utils/lang_utils';
|
||||||
|
import { mergeOptions } from '../../../../../../utils/general_utils';
|
||||||
|
|
||||||
|
|
||||||
|
let IkonotvAccordionListItem = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
className: React.PropTypes.string,
|
||||||
|
content: React.PropTypes.object,
|
||||||
|
children: React.PropTypes.oneOfType([
|
||||||
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||||
|
React.PropTypes.element
|
||||||
|
])
|
||||||
|
},
|
||||||
|
|
||||||
|
getInitialState() {
|
||||||
|
return mergeOptions(
|
||||||
|
PieceListStore.getState(),
|
||||||
|
UserStore.getState()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
PieceListStore.listen(this.onChange);
|
||||||
|
UserStore.listen(this.onChange);
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
PieceListStore.unlisten(this.onChange);
|
||||||
|
UserStore.unlisten(this.onChange);
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange(state) {
|
||||||
|
this.setState(state);
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSubmitSuccess(response) {
|
||||||
|
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search,
|
||||||
|
this.state.orderBy, this.state.orderAsc, this.state.filterBy);
|
||||||
|
|
||||||
|
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
},
|
||||||
|
|
||||||
|
getSubmitButtons() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<AclProxy
|
||||||
|
aclObject={this.props.content.acl}
|
||||||
|
aclName="acl_submit">
|
||||||
|
<IkonotvSubmitButton
|
||||||
|
className="pull-right"
|
||||||
|
piece={this.props.content}
|
||||||
|
handleSuccess={this.handleSubmitSuccess}/>
|
||||||
|
</AclProxy>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<AccordionListItemPiece
|
||||||
|
className={this.props.className}
|
||||||
|
piece={this.props.content}
|
||||||
|
subsubheading={
|
||||||
|
<div className="pull-left">
|
||||||
|
<span>{this.props.content.date_created.split('-')[0]}</span>
|
||||||
|
</div>}
|
||||||
|
buttons={this.getSubmitButtons()}>
|
||||||
|
{this.props.children}
|
||||||
|
</AccordionListItemPiece>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default IkonotvAccordionListItem;
|
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper';
|
||||||
|
import CylandPieceSubmitForm from '../ascribe_forms/cyland_form_submit';
|
||||||
|
|
||||||
|
import { getLangText } from '../../../../../../utils/lang_utils';
|
||||||
|
|
||||||
|
let IkonotvSubmitButton = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
className: React.PropTypes.string,
|
||||||
|
handleSuccess: React.PropTypes.func,
|
||||||
|
piece: React.PropTypes.object.isRequired
|
||||||
|
},
|
||||||
|
|
||||||
|
getSubmitButton() {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}>
|
||||||
|
{getLangText('Loan to IkonoTV')}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<ModalWrapper
|
||||||
|
trigger={this.getSubmitButton()}
|
||||||
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
title={getLangText('Loan to IkonoTV')}>
|
||||||
|
<CylandPieceSubmitForm
|
||||||
|
piece={this.props.piece}
|
||||||
|
handleSuccess={this.props.handleSuccess}/>
|
||||||
|
</ModalWrapper>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default IkonotvSubmitButton;
|
|
@ -0,0 +1,42 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import PieceList from '../../../../piece_list';
|
||||||
|
|
||||||
|
import UserActions from '../../../../../actions/user_actions';
|
||||||
|
import UserStore from '../../../../../stores/user_store';
|
||||||
|
|
||||||
|
import IkonotvAccordionListItem from './ascribe_accordion_list/ikonotv_accordion_list_item';
|
||||||
|
|
||||||
|
|
||||||
|
let IkonotvPieceList = React.createClass({
|
||||||
|
getInitialState() {
|
||||||
|
return UserStore.getState();
|
||||||
|
},
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
UserStore.listen(this.onChange);
|
||||||
|
UserActions.fetchCurrentUser();
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
UserStore.unlisten(this.onChange);
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange(state) {
|
||||||
|
this.setState(state);
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<PieceList
|
||||||
|
redirectTo="register_piece"
|
||||||
|
accordionListItemType={IkonotvAccordionListItem}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default IkonotvPieceList;
|
|
@ -10,6 +10,12 @@ function getWalletApiUrls(subdomain) {
|
||||||
'piece': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/'
|
'piece': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (subdomain === 'ikonotv'){
|
||||||
|
return {
|
||||||
|
'pieces_list': walletConstants.walletApiEndpoint + subdomain + '/pieces/',
|
||||||
|
'piece': walletConstants.walletApiEndpoint + subdomain + '/pieces/${piece_id}/'
|
||||||
|
};
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,20 @@ let ROUTES = {
|
||||||
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||||
<Route name="settings" path="settings" handler={SettingsContainer} />
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
</Route>
|
</Route>
|
||||||
|
),
|
||||||
|
'ikonotv': (
|
||||||
|
<Route name="app" path={baseUrl} handler={WalletApp}>
|
||||||
|
<Route name="landing" path={baseUrl} handler={CylandRegisterPiece} />
|
||||||
|
<Route name="login" path="login" handler={LoginContainer} />
|
||||||
|
<Route name="logout" path="logout" handler={LogoutContainer} />
|
||||||
|
<Route name="signup" path="signup" handler={SignupContainer} />
|
||||||
|
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
|
||||||
|
<Route name="register_piece" path="register_piece" handler={CylandRegisterPiece} />
|
||||||
|
<Route name="pieces" path="collection" handler={CylandPieceList} />
|
||||||
|
<Route name="piece" path="pieces/:pieceId" handler={CylandPieceContainer} />
|
||||||
|
<Route name="edition" path="editions/:editionId" handler={EditionContainer} />
|
||||||
|
<Route name="settings" path="settings" handler={SettingsContainer} />
|
||||||
|
</Route>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,13 @@ let constants = {
|
||||||
'logo': 'https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/cyland/logo.gif',
|
'logo': 'https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/cyland/logo.gif',
|
||||||
'permissions': ['register', 'edit', 'share', 'del_from_collection'],
|
'permissions': ['register', 'edit', 'share', 'del_from_collection'],
|
||||||
'type': 'wallet'
|
'type': 'wallet'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'subdomain': 'ikonotv',
|
||||||
|
'name': 'IkonoTV',
|
||||||
|
'logo': 'https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/ikonotv/ikono-logo-black.png',
|
||||||
|
'permissions': ['register', 'edit', 'share', 'del_from_collection'],
|
||||||
|
'type': 'wallet'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'defaultDomain': {
|
'defaultDomain': {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user