-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathroles.jsx
34 lines (31 loc) · 852 Bytes
/
roles.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* RolesList, implemented as pure component
*/
import React, { define } from 'react-mvx'
export const RolesList = ({ roles, selectedLink }) => (
<table>
<tbody>
{ roles.map( role => (
<RoleView key={ role.cid }
role={ role }
selectedLink={ selectedLink }
/>
)) }
</tbody>
</table>
);
export const RoleView = ({ role, selectedLink }) => (
<tr className={ selectedLink.value === role ? 'selected' : '' }
onClick={ () => selectedLink.set( role ) }
>
<td className='field'>
{ role.id }
</td>
<td className='field'>
{ role.name }
</td>
<td className='field'>
{ role.users.pluck( 'name' ).join( ', ' ) }
</td>
</tr>
);