Sha256: 783ddd1b7eb26e4450b901900937d6a974b9e287b4635e628fb85e9bf02fca45

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

class Lanes.Access.Screens.UserManagement extends Lanes.React.Screen

    getInitialState: ->
        fields = [
            {id:'id', visible: false}
            'login', 'name', 'email', {id:'role_names', title:'Role Names'}
        ]
        query: new Lanes.Models.Query(fields: fields, src: Lanes.Models.User)

    rolesForUser: (user) ->
        _.map user.role_names, (rn) -> {id: rn, name: _.titleize(rn) }

    setRolesForUser: (roles, options) ->
        options.model.role_names = _.map(roles, 'id')

    editors: (props) ->
        role_names: ({model}) =>
            <LC.SelectField
                id="role_names"
                key="row-select"
                queryModel={Lanes.Models.User}
                fieldOnly editOnly multiSelect writable
                model={model}
                labelField='name'
                getSelection={@rolesForUser}
                setSelection={@setRolesForUser}
                choices={Lanes.Models.Role.all.models}
                fetchWhenOpen={false}
                name="role_names"
            />

    render: ->
        <LC.ScreenWrapper identifier="user-management" flexVertical>
            <h1>Users Management</h1>
            <LC.Grid
                editorProps={height: 350, syncImmediatly: true}
                query={@state.query}
                allowCreate
                editor={Lanes.Access.Screens.UserManagement.Editor}
                columEditors={@editors()}
                ref="grid"/>
        </LC.ScreenWrapper>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lanes-0.6.1 client/lanes/access/screens/user-management/UserManagement.cjsx
lanes-0.6.0 client/lanes/access/screens/user-management/UserManagement.cjsx
lanes-0.5.6 client/lanes/access/screens/user-management/UserManagement.cjsx
lanes-0.5.5 client/lanes/access/screens/user-management/UserManagement.cjsx
lanes-0.5.0 client/lanes/access/screens/user-management/UserManagement.cjsx