extends ../layout/default.jade

block title
    | Rights Management
    
block pageheader
    | Rights - #{user.username} - Edit
        
block content
    form(action='/rights/user/' + user.id, method='POST')
        .form-group
            label(for='permissions[]') Permissions
            a.btn.btn-success.fa.fa-plus.pull-right#btnAddPermission(href='#')
            each permission in user.permissions
                input.form-control(type='text', name='permissions[]', placeholder='Permission', value=permission)
            input.form-control(type='text', name='permissions[]', placeholder='Permission')
        .form-group
            input(type='hidden', name='_method', value='PATCH')
            button.btn.btn-success(type='submit') Save

extends ../layout/default.jade

block title
    | Rights Management
    
block pageheader
    | Rights - #{user.username} - Edit
        
block content
    form(action='/rights/user/' + user.id, method='POST')
        .form-group
            label(for='permissions[]') Permissions
            a.btn.btn-success.fa.fa-plus.pull-right#btnAddPermission(href='#')
            each permission in user.permissions
                input.form-control(type='text', name='permissions[]', placeholder='Permission', value=permission)
            input.form-control(type='text', name='permissions[]', placeholder='Permission')
        .form-group
            label Permission Groups
            each group in groups
                .checkbox
                    label
                        - var in_group = _.find(user.groups, function(to_check) { return to_check.id == group.id; })
                        if in_group
                            input(type='checkbox', name='groups[]', value=group.id, checked)
                            = group.name
                        else
                            input(type='checkbox', name='groups[]', value=group.id)
                            = group.name
        .form-group
            input(type='hidden', name='_method', value='PATCH')
            button.btn.btn-success(type='submit') Save

Allow selecting of groups in user edit view.
Allow selecting of groups in user edit view.
