diff --git a/js/components/whitelabel/wallet/components/ikonotv/ascribe_accordion_list/ikonotv_accordion_list_item.js b/js/components/whitelabel/wallet/components/ikonotv/ascribe_accordion_list/ikonotv_accordion_list_item.js new file mode 100644 index 00000000..f89fd46b --- /dev/null +++ b/js/components/whitelabel/wallet/components/ikonotv/ascribe_accordion_list/ikonotv_accordion_list_item.js @@ -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 ( +
+ + + +
+ ); + }, + + render() { + return ( + + {this.props.content.date_created.split('-')[0]} + } + buttons={this.getSubmitButtons()}> + {this.props.children} + + ); + } +}); + +export default IkonotvAccordionListItem; diff --git a/js/components/whitelabel/wallet/components/ikonotv/ascribe_buttons/ikonotv_submit_button.js b/js/components/whitelabel/wallet/components/ikonotv/ascribe_buttons/ikonotv_submit_button.js new file mode 100644 index 00000000..0ebf352a --- /dev/null +++ b/js/components/whitelabel/wallet/components/ikonotv/ascribe_buttons/ikonotv_submit_button.js @@ -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 ( + + ); + }, + + render() { + return ( + + + + + ); + } +}); + +export default IkonotvSubmitButton; \ No newline at end of file diff --git a/js/components/whitelabel/wallet/components/ikonotv/ikonotv_piece_list.js b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_piece_list.js new file mode 100644 index 00000000..e4c83d97 --- /dev/null +++ b/js/components/whitelabel/wallet/components/ikonotv/ikonotv_piece_list.js @@ -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 ( +
+ +
+ ); + } +}); + +export default IkonotvPieceList; diff --git a/js/components/whitelabel/wallet/constants/wallet_api_urls.js b/js/components/whitelabel/wallet/constants/wallet_api_urls.js index cd3e4fdb..56b6121e 100644 --- a/js/components/whitelabel/wallet/constants/wallet_api_urls.js +++ b/js/components/whitelabel/wallet/constants/wallet_api_urls.js @@ -10,6 +10,12 @@ function getWalletApiUrls(subdomain) { '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 {}; } diff --git a/js/components/whitelabel/wallet/wallet_routes.js b/js/components/whitelabel/wallet/wallet_routes.js index b5821670..f2aaf1f7 100644 --- a/js/components/whitelabel/wallet/wallet_routes.js +++ b/js/components/whitelabel/wallet/wallet_routes.js @@ -57,6 +57,20 @@ let ROUTES = { + ), + 'ikonotv': ( + + + + + + + + + + + + ) }; diff --git a/js/constants/application_constants.js b/js/constants/application_constants.js index 530aaece..a1b0a157 100644 --- a/js/constants/application_constants.js +++ b/js/constants/application_constants.js @@ -39,6 +39,13 @@ let constants = { 'logo': 'https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/cyland/logo.gif', 'permissions': ['register', 'edit', 'share', 'del_from_collection'], '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': {