diff options
Diffstat (limited to 'app/Template/project_permission/index.php')
-rw-r--r-- | app/Template/project_permission/index.php | 134 |
1 files changed, 15 insertions, 119 deletions
diff --git a/app/Template/project_permission/index.php b/app/Template/project_permission/index.php index c7b17782..689966b6 100644 --- a/app/Template/project_permission/index.php +++ b/app/Template/project_permission/index.php @@ -5,125 +5,21 @@ <?php if ($project['is_everybody_allowed']): ?> <div class="alert"><?= t('Everybody have access to this project.') ?></div> <?php else: ?> - - <?php if (empty($users)): ?> - <div class="alert"><?= t('No user have been allowed specifically.') ?></div> - <?php else: ?> - <table class="table-scrolling"> - <tr> - <th class="column-50"><?= t('User') ?></th> - <th><?= t('Role') ?></th> - <?php if ($project['is_private'] == 0): ?> - <th class="column-15"><?= t('Actions') ?></th> - <?php endif ?> - </tr> - <?php foreach ($users as $user): ?> - <tr> - <td><?= $this->text->e($user['name'] ?: $user['username']) ?></td> - <td> - <?= $this->form->select( - 'role-'.$user['id'], - $roles, - array('role-'.$user['id'] => $user['role']), - array(), - array('data-url="'.$this->url->href('ProjectPermissionController', 'changeUserRole', array('project_id' => $project['id'])).'"', 'data-id="'.$user['id'].'"'), - 'project-change-role' - ) ?> - </td> - <td> - <?= $this->url->link(t('Remove'), 'ProjectPermissionController', 'removeUser', array('project_id' => $project['id'], 'user_id' => $user['id']), true) ?> - </td> - </tr> - <?php endforeach ?> - </table> - <?php endif ?> - - <?php if ($project['is_private'] == 0): ?> - <div class="listing"> - <form method="post" action="<?= $this->url->href('ProjectPermissionController', 'addUser', array('project_id' => $project['id'])) ?>" autocomplete="off" class="form-inline"> - <?= $this->form->csrf() ?> - <?= $this->form->hidden('project_id', array('project_id' => $project['id'])) ?> - <?= $this->form->hidden('user_id', $values) ?> - - <?= $this->form->label(t('Name'), 'name') ?> - <?= $this->form->text('name', $values, $errors, array( - 'required', - 'placeholder="'.t('Enter user name...').'"', - 'title="'.t('Enter user name...').'"', - 'data-dst-field="user_id"', - 'data-search-url="'.$this->url->href('UserAjaxController', 'autocomplete').'"', - ), - 'autocomplete') ?> - - <?= $this->form->select('role', $roles, $values, $errors) ?> - - <button type="submit" class="btn btn-blue"><?= t('Add') ?></button> - </form> - </div> - <?php endif ?> - - <div class="page-header"> - <h2><?= t('Allowed Groups') ?></h2> - </div> - - <?php if (empty($groups)): ?> - <div class="alert"><?= t('No group have been allowed specifically.') ?></div> - <?php else: ?> - <table class="table-scrolling"> - <tr> - <th class="column-50"><?= t('Group') ?></th> - <th><?= t('Role') ?></th> - <?php if ($project['is_private'] == 0): ?> - <th class="column-15"><?= t('Actions') ?></th> - <?php endif ?> - </tr> - <?php foreach ($groups as $group): ?> - <tr> - <td><?= $this->text->e($group['name']) ?></td> - <td> - <?= $this->form->select( - 'role-'.$group['id'], - $roles, - array('role-'.$group['id'] => $group['role']), - array(), - array('data-url="'.$this->url->href('ProjectPermissionController', 'changeGroupRole', array('project_id' => $project['id'])).'"', 'data-id="'.$group['id'].'"'), - 'project-change-role' - ) ?> - </td> - <td> - <?= $this->url->link(t('Remove'), 'ProjectPermissionController', 'removeGroup', array('project_id' => $project['id'], 'group_id' => $group['id']), true) ?> - </td> - </tr> - <?php endforeach ?> - </table> - <?php endif ?> - - <?php if ($project['is_private'] == 0): ?> - <div class="listing"> - <form method="post" action="<?= $this->url->href('ProjectPermissionController', 'addGroup', array('project_id' => $project['id'])) ?>" autocomplete="off" class="form-inline"> - <?= $this->form->csrf() ?> - <?= $this->form->hidden('project_id', array('project_id' => $project['id'])) ?> - <?= $this->form->hidden('group_id', $values) ?> - <?= $this->form->hidden('external_id', $values) ?> - - <?= $this->form->label(t('Group Name'), 'name') ?> - <?= $this->form->text('name', $values, $errors, array( - 'required', - 'placeholder="'.t('Enter group name...').'"', - 'title="'.t('Enter group name...').'"', - 'data-dst-field="group_id"', - 'data-dst-extra-field="external_id"', - 'data-search-url="'.$this->url->href('GroupAjaxController', 'autocomplete').'"', - ), - 'autocomplete') ?> - - <?= $this->form->select('role', $roles, $values, $errors) ?> - - <button type="submit" class="btn btn-blue"><?= t('Add') ?></button> - </form> - </div> - <?php endif ?> - + <?= $this->render('project_permission/users', array( + 'project' => $project, + 'roles' => $roles, + 'users' => $users, + 'errors' => $errors, + 'values' => $values, + )) ?> + + <?= $this->render('project_permission/groups', array( + 'project' => $project, + 'roles' => $roles, + 'groups' => $groups, + 'errors' => $errors, + 'values' => $values, + )) ?> <?php endif ?> <?php if ($project['is_private'] == 0): ?> |