From 0c51eb374e76f27bc46a89c4e7417bf8fe385695 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Wed, 21 Oct 2015 17:37:29 +0200 Subject: [PATCH] Add Lumenus specific piece list --- .../piece_list_bulk_modal.js | 13 ++-- js/components/piece_list.js | 7 ++- .../components/lumenus/lumenus_piece_list.js | 61 +++++++++++++++++++ .../whitelabel/wallet/wallet_routes.js | 4 +- sass/ascribe_piece_list_toolbar.scss | 4 ++ 5 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 js/components/whitelabel/wallet/components/lumenus/lumenus_piece_list.js diff --git a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js index 3e5b6495..f5d97842 100644 --- a/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js +++ b/js/components/ascribe_piece_list_bulk_modal/piece_list_bulk_modal.js @@ -22,9 +22,16 @@ import { getLangText } from '../../utils/lang_utils.js'; let PieceListBulkModal = React.createClass({ propTypes: { + aclFilterBy: React.PropTypes.func, className: React.PropTypes.string }, + getDefaultProps() { + return { + aclFilterBy: (aclName) => aclName !== 'acl_view' + }; + }, + getInitialState() { return mergeOptions( EditionListStore.getState(), @@ -33,8 +40,6 @@ let PieceListBulkModal = React.createClass({ ); }, - - componentDidMount() { EditionListStore.listen(this.onChange); UserStore.listen(this.onChange); @@ -95,7 +100,7 @@ let PieceListBulkModal = React.createClass({ render() { let selectedEditions = this.fetchSelectedEditionList(); - let availableAcls = getAvailableAcls(selectedEditions, (aclName) => aclName !== 'acl_view'); + let availableAcls = getAvailableAcls(selectedEditions, this.props.aclFilterBy); if(Object.keys(availableAcls).length > 0) { return ( @@ -136,4 +141,4 @@ let PieceListBulkModal = React.createClass({ } }); -export default PieceListBulkModal; \ No newline at end of file +export default PieceListBulkModal; diff --git a/js/components/piece_list.js b/js/components/piece_list.js index de40be22..a5b9ff55 100644 --- a/js/components/piece_list.js +++ b/js/components/piece_list.js @@ -30,6 +30,7 @@ import { setDocumentTitle } from '../utils/dom_utils'; let PieceList = React.createClass({ propTypes: { accordionListItemType: React.PropTypes.func, + aclFilterBy: React.PropTypes.func, redirectTo: React.PropTypes.string, customSubmitButton: React.PropTypes.element, filterParams: React.PropTypes.array, @@ -63,7 +64,7 @@ let PieceList = React.createClass({ componentDidMount() { let page = this.props.location.query.page || 1; - + PieceListStore.listen(this.onChange); EditionListStore.listen(this.onChange); @@ -170,7 +171,9 @@ let PieceList = React.createClass({ applyOrderBy={this.applyOrderBy}> {this.props.customSubmitButton} - + diff --git a/js/components/whitelabel/wallet/components/lumenus/lumenus_piece_list.js b/js/components/whitelabel/wallet/components/lumenus/lumenus_piece_list.js new file mode 100644 index 00000000..0a6b3b27 --- /dev/null +++ b/js/components/whitelabel/wallet/components/lumenus/lumenus_piece_list.js @@ -0,0 +1,61 @@ +'use strict'; + +import React from 'react'; +import PieceList from '../../../../piece_list'; + +import UserActions from '../../../../../actions/user_actions'; +import UserStore from '../../../../../stores/user_store'; + +import { getLangText } from '../../../../../utils/lang_utils'; +import { setDocumentTitle } from '../../../../../utils/dom_utils'; + + +let LumenusPieceList = React.createClass({ + propTypes: { + location: React.PropTypes.object + }, + + getInitialState() { + return UserStore.getState(); + }, + + componentDidMount() { + UserStore.listen(this.onChange); + UserActions.fetchCurrentUser(); + }, + + componentWillUnmount() { + UserStore.unlisten(this.onChange); + }, + + onChange(state) { + this.setState(state); + }, + + showOnlyConsignAcl(aclName) { + return aclName === 'acl_consign' || + aclName === 'acl_unconsign'; + }, + + render() { + setDocumentTitle(getLangText('Collection')); + + return ( +
+ +
+ ); + } +}); + +export default LumenusPieceList; diff --git a/js/components/whitelabel/wallet/wallet_routes.js b/js/components/whitelabel/wallet/wallet_routes.js index bcd0a60b..e258dfa7 100644 --- a/js/components/whitelabel/wallet/wallet_routes.js +++ b/js/components/whitelabel/wallet/wallet_routes.js @@ -29,6 +29,8 @@ import IkonotvRegisterPiece from './components/ikonotv/ikonotv_register_piece'; import IkonotvPieceContainer from './components/ikonotv/ikonotv_detail/ikonotv_piece_container'; import IkonotvContractNotifications from './components/ikonotv/ikonotv_contract_notifications'; +import LumenusPieceList from './components/lumenus/lumenus_piece_list'; + import CCRegisterPiece from './components/cc/cc_register_piece'; import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler'; @@ -176,7 +178,7 @@ let ROUTES = { headerTitle='+ NEW WORK'/> diff --git a/sass/ascribe_piece_list_toolbar.scss b/sass/ascribe_piece_list_toolbar.scss index dde7f2f0..166ba382 100644 --- a/sass/ascribe_piece_list_toolbar.scss +++ b/sass/ascribe_piece_list_toolbar.scss @@ -86,4 +86,8 @@ top: 2px; } } + + .dropdown-menu { + min-width: 170px; + } }