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