mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Add Lumenus specific piece list
This commit is contained in:
parent
7116133337
commit
0c51eb374e
@ -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;
|
||||
export default PieceListBulkModal;
|
||||
|
@ -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}
|
||||
</PieceListToolbar>
|
||||
<PieceListBulkModal className="ascribe-piece-list-bulk-modal" />
|
||||
<PieceListBulkModal
|
||||
className="ascribe-piece-list-bulk-modal"
|
||||
aclFilterBy={this.props.aclFilterBy}/>
|
||||
<PieceListFilterDisplay
|
||||
filterBy={this.state.filterBy}
|
||||
filterParams={this.props.filterParams}/>
|
||||
|
@ -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 (
|
||||
<div>
|
||||
<PieceList
|
||||
redirectTo="/register_piece?slide_num=0"
|
||||
aclFilterBy={this.showOnlyConsignAcl}
|
||||
filterParams={[{
|
||||
label: getLangText('Show works I have'),
|
||||
items: [{
|
||||
key: 'acl_consigned',
|
||||
label: getLangText('consigned to Lumenus')
|
||||
}]
|
||||
}]}
|
||||
location={this.props.location}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
export default LumenusPieceList;
|
@ -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'/>
|
||||
<Route
|
||||
path='collection'
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(PieceList)}
|
||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(LumenusPieceList)}
|
||||
headerTitle='COLLECTION'/>
|
||||
<Route path='pieces/:pieceId' component={PieceContainer} />
|
||||
<Route path='editions/:editionId' component={EditionContainer} />
|
||||
|
@ -86,4 +86,8 @@
|
||||
top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
min-width: 170px;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user