2015-06-05 11:06:36 +02:00
|
|
|
'use strict';
|
|
|
|
|
2015-06-01 13:18:24 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
2015-12-18 14:59:15 +01:00
|
|
|
const TableItemAclFiltered = React.createClass({
|
2015-06-01 13:18:24 +02:00
|
|
|
propTypes: {
|
2015-07-14 14:16:51 +02:00
|
|
|
content: React.PropTypes.object,
|
2015-12-18 14:59:15 +01:00
|
|
|
notifications: React.PropTypes.array
|
2015-06-01 13:18:24 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2015-12-18 14:59:15 +01:00
|
|
|
const availableAcls = ['acl_consign', 'acl_loan', 'acl_transfer', 'acl_view', 'acl_share', 'acl_unshare', 'acl_delete'];
|
|
|
|
if (this.props.notifications && this.props.notifications.length) {
|
2015-07-14 14:16:51 +02:00
|
|
|
return (
|
|
|
|
<span>
|
2015-09-03 17:25:22 +02:00
|
|
|
{this.props.notifications[0].action_str}
|
2015-07-14 14:16:51 +02:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
2015-06-03 10:45:23 +02:00
|
|
|
|
2015-12-18 14:59:15 +01:00
|
|
|
const filteredAcls = Object.keys(this.props.content)
|
|
|
|
.filter((key) => availableAcls.indexOf(key) > -1 && this.props.content[key])
|
|
|
|
.map((acl) => acl.split('acl_')[1])
|
|
|
|
.join('/');
|
2015-07-13 19:46:06 +02:00
|
|
|
|
2015-06-01 13:18:24 +02:00
|
|
|
return (
|
|
|
|
<span>
|
2015-12-18 14:59:15 +01:00
|
|
|
{filteredAcls}
|
2015-06-01 13:18:24 +02:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default TableItemAclFiltered;
|