mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
Change default collection filter for lumens admin
This commit is contained in:
parent
f92fa972bf
commit
b100fdd80a
@ -7,7 +7,7 @@ import LumenusSubmitButton from './lumenus_submit_button';
|
|||||||
import DeleteButton from '../../../../../ascribe_buttons/delete_button';
|
import DeleteButton from '../../../../../ascribe_buttons/delete_button';
|
||||||
import ShareButton from '../../../../../ascribe_buttons/acls/share_button';
|
import ShareButton from '../../../../../ascribe_buttons/acls/share_button';
|
||||||
import TransferButton from '../../../../../ascribe_buttons/acls/transfer_button';
|
import TransferButton from '../../../../../ascribe_buttons/acls/transfer_button';
|
||||||
import UnconsignButton from '../../../../../ascribe_buttons/acls/transfer_button';
|
import UnconsignButton from '../../../../../ascribe_buttons/acls/unconsign_button';
|
||||||
|
|
||||||
import UserActions from '../../../../../../actions/user_actions';
|
import UserActions from '../../../../../../actions/user_actions';
|
||||||
import UserStore from '../../../../../../stores/user_store';
|
import UserStore from '../../../../../../stores/user_store';
|
||||||
|
@ -6,15 +6,48 @@ import LumenusAclButtonList from './lumenus_buttons/lumenus_acl_button_list';
|
|||||||
|
|
||||||
import PieceList from '../../../../piece_list';
|
import PieceList from '../../../../piece_list';
|
||||||
|
|
||||||
import { getLangText } from '../../../../../utils/lang_utils';
|
import UserActions from '../../../../../actions/user_actions';
|
||||||
|
import UserStore from '../../../../../stores/user_store';
|
||||||
|
import WhitelabelActions from '../../../../../actions/whitelabel_actions';
|
||||||
|
import WhitelabelStore from '../../../../../stores/whitelabel_store';
|
||||||
|
|
||||||
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
import { setDocumentTitle } from '../../../../../utils/dom_utils';
|
||||||
|
import { mergeOptions } from '../../../../../utils/general_utils';
|
||||||
|
import { getLangText } from '../../../../../utils/lang_utils';
|
||||||
|
|
||||||
let LumenusPieceList = React.createClass({
|
let LumenusPieceList = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
location: React.PropTypes.object
|
location: React.PropTypes.object
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getInitialState() {
|
||||||
|
return mergeOptions(
|
||||||
|
UserStore.getState(),
|
||||||
|
WhitelabelStore.getState()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
UserStore.listen(this.onChange);
|
||||||
|
WhitelabelStore.listen(this.onChange);
|
||||||
|
|
||||||
|
UserActions.fetchCurrentUser();
|
||||||
|
WhitelabelActions.fetchWhitelabel();
|
||||||
|
},
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
UserStore.unlisten(this.onChange);
|
||||||
|
WhitelabelStore.unlisten(this.onChange);
|
||||||
|
},
|
||||||
|
|
||||||
|
onChange(state) {
|
||||||
|
this.setState(state);
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { currentUser, whitelabel } = this.state;
|
||||||
|
const isUserAdmin = currentUser.email === whitelabel.user;
|
||||||
|
|
||||||
setDocumentTitle(getLangText('Collection'));
|
setDocumentTitle(getLangText('Collection'));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -24,8 +57,8 @@ let LumenusPieceList = React.createClass({
|
|||||||
filterParams={[{
|
filterParams={[{
|
||||||
label: getLangText('Show works I can'),
|
label: getLangText('Show works I can'),
|
||||||
items: [{
|
items: [{
|
||||||
key: 'acl_consign',
|
key: isUserAdmin ? 'acl_transfer' : 'acl_consign',
|
||||||
label: getLangText('consign to Lumenus'),
|
label: getLangText(isUserAdmin ? 'transfer' : 'consign to Lumenus'),
|
||||||
defaultValue: true
|
defaultValue: true
|
||||||
}]
|
}]
|
||||||
}]}
|
}]}
|
||||||
|
Loading…
Reference in New Issue
Block a user