mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +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({
|
let PieceListBulkModal = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
aclFilterBy: React.PropTypes.func,
|
||||||
className: React.PropTypes.string
|
className: React.PropTypes.string
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDefaultProps() {
|
||||||
|
return {
|
||||||
|
aclFilterBy: (aclName) => aclName !== 'acl_view'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return mergeOptions(
|
return mergeOptions(
|
||||||
EditionListStore.getState(),
|
EditionListStore.getState(),
|
||||||
@ -33,8 +40,6 @@ let PieceListBulkModal = React.createClass({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
EditionListStore.listen(this.onChange);
|
EditionListStore.listen(this.onChange);
|
||||||
UserStore.listen(this.onChange);
|
UserStore.listen(this.onChange);
|
||||||
@ -95,7 +100,7 @@ let PieceListBulkModal = React.createClass({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
let selectedEditions = this.fetchSelectedEditionList();
|
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) {
|
if(Object.keys(availableAcls).length > 0) {
|
||||||
return (
|
return (
|
||||||
|
@ -30,6 +30,7 @@ import { setDocumentTitle } from '../utils/dom_utils';
|
|||||||
let PieceList = React.createClass({
|
let PieceList = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
accordionListItemType: React.PropTypes.func,
|
accordionListItemType: React.PropTypes.func,
|
||||||
|
aclFilterBy: React.PropTypes.func,
|
||||||
redirectTo: React.PropTypes.string,
|
redirectTo: React.PropTypes.string,
|
||||||
customSubmitButton: React.PropTypes.element,
|
customSubmitButton: React.PropTypes.element,
|
||||||
filterParams: React.PropTypes.array,
|
filterParams: React.PropTypes.array,
|
||||||
@ -170,7 +171,9 @@ let PieceList = React.createClass({
|
|||||||
applyOrderBy={this.applyOrderBy}>
|
applyOrderBy={this.applyOrderBy}>
|
||||||
{this.props.customSubmitButton}
|
{this.props.customSubmitButton}
|
||||||
</PieceListToolbar>
|
</PieceListToolbar>
|
||||||
<PieceListBulkModal className="ascribe-piece-list-bulk-modal" />
|
<PieceListBulkModal
|
||||||
|
className="ascribe-piece-list-bulk-modal"
|
||||||
|
aclFilterBy={this.props.aclFilterBy}/>
|
||||||
<PieceListFilterDisplay
|
<PieceListFilterDisplay
|
||||||
filterBy={this.state.filterBy}
|
filterBy={this.state.filterBy}
|
||||||
filterParams={this.props.filterParams}/>
|
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 IkonotvPieceContainer from './components/ikonotv/ikonotv_detail/ikonotv_piece_container';
|
||||||
import IkonotvContractNotifications from './components/ikonotv/ikonotv_contract_notifications';
|
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 CCRegisterPiece from './components/cc/cc_register_piece';
|
||||||
|
|
||||||
import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
|
import AuthProxyHandler from '../../../components/ascribe_routes/proxy_routes/auth_proxy_handler';
|
||||||
@ -176,7 +178,7 @@ let ROUTES = {
|
|||||||
headerTitle='+ NEW WORK'/>
|
headerTitle='+ NEW WORK'/>
|
||||||
<Route
|
<Route
|
||||||
path='collection'
|
path='collection'
|
||||||
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(PieceList)}
|
component={AuthProxyHandler({to: '/login', when: 'loggedOut'})(LumenusPieceList)}
|
||||||
headerTitle='COLLECTION'/>
|
headerTitle='COLLECTION'/>
|
||||||
<Route path='pieces/:pieceId' component={PieceContainer} />
|
<Route path='pieces/:pieceId' component={PieceContainer} />
|
||||||
<Route path='editions/:editionId' component={EditionContainer} />
|
<Route path='editions/:editionId' component={EditionContainer} />
|
||||||
|
@ -86,4 +86,8 @@
|
|||||||
top: 2px;
|
top: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-menu {
|
||||||
|
min-width: 170px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user