summaryrefslogtreecommitdiff
path: root/app/Template/project_permission/users.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-12-09 20:35:40 -0500
committerFrederic Guillot <fred@kanboard.net>2016-12-09 20:35:40 -0500
commit67d01951f5a0a8e2201707162c1f7454f26ac798 (patch)
tree17729d00327ee58b6256c6a0ba261624717f5797 /app/Template/project_permission/users.php
parent86d04bc0ef7f6f6f501a0aef16a7855aaebe95c2 (diff)
Rewrite component to change user/group role
Diffstat (limited to 'app/Template/project_permission/users.php')
-rw-r--r--app/Template/project_permission/users.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/app/Template/project_permission/users.php b/app/Template/project_permission/users.php
new file mode 100644
index 00000000..71cf1c4a
--- /dev/null
+++ b/app/Template/project_permission/users.php
@@ -0,0 +1,54 @@
+<?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->app->component('project-select-role', array(
+ 'roles' => $roles,
+ 'role' => $user['role'],
+ 'id' => $user['id'],
+ 'url' => $this->url->to('ProjectPermissionController', 'changeUserRole', array('project_id' => $project['id'])),
+ )) ?>
+ </td>
+ <td>
+ <i class="fa fa-trash-o" aria-hidden="true"></i>
+ <?= $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 ?>