summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-09-18 21:19:48 -0400
committerFrederic Guillot <fred@kanboard.net>2016-09-18 21:19:48 -0400
commit3043163747b13ce1942b2e55977cf7c5417021de (patch)
tree31552d8bfdf3b7a6eedfaded116b863e980f86b4 /app/Template
parent4bc83646b0b15bff9ae55083121f66b7a89e433d (diff)
Add column restrictions to custom project roles
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/board/table_column.php2
-rw-r--r--app/Template/column_move_restriction/create.php2
-rw-r--r--app/Template/column_restriction/create.php22
-rw-r--r--app/Template/column_restriction/remove.php14
-rw-r--r--app/Template/project_role/show.php34
-rw-r--r--app/Template/task/dropdown.php2
-rw-r--r--app/Template/task/sidebar.php2
7 files changed, 71 insertions, 7 deletions
diff --git a/app/Template/board/table_column.php b/app/Template/board/table_column.php
index c0b71eab..3daa8aed 100644
--- a/app/Template/board/table_column.php
+++ b/app/Template/board/table_column.php
@@ -12,7 +12,7 @@
<!-- column in expanded mode -->
<div class="board-column-expanded">
- <?php if (! $not_editable && $this->user->hasProjectAccess('TaskCreationController', 'show', $column['project_id'])): ?>
+ <?php if (! $not_editable && $this->projectRole->canCreateTaskInColumn($column['project_id'], $column['id'])): ?>
<div class="board-add-icon">
<?= $this->url->link('+', 'TaskCreationController', 'show', array('project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']), false, 'popover', t('Add a new task')) ?>
</div>
diff --git a/app/Template/column_move_restriction/create.php b/app/Template/column_move_restriction/create.php
index 8d161c3e..1eb6d539 100644
--- a/app/Template/column_move_restriction/create.php
+++ b/app/Template/column_move_restriction/create.php
@@ -1,6 +1,6 @@
<section id="main">
<div class="page-header">
- <h2><?= t('New column restriction for the role "%s"', $role['role']) ?></h2>
+ <h2><?= t('New drag and drop restriction for the role "%s"', $role['role']) ?></h2>
</div>
<form class="popover-form" method="post" action="<?= $this->url->href('ColumnMoveRestrictionController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
diff --git a/app/Template/column_restriction/create.php b/app/Template/column_restriction/create.php
new file mode 100644
index 00000000..982733b4
--- /dev/null
+++ b/app/Template/column_restriction/create.php
@@ -0,0 +1,22 @@
+<section id="main">
+ <div class="page-header">
+ <h2><?= t('New column restriction for the role "%s"', $role['role']) ?></h2>
+ </div>
+ <form class="popover-form" method="post" action="<?= $this->url->href('ColumnRestrictionController', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
+ <?= $this->form->csrf() ?>
+ <?= $this->form->hidden('project_id', $values) ?>
+ <?= $this->form->hidden('role_id', $values) ?>
+
+ <?= $this->form->label(t('Rule'), 'rule') ?>
+ <?= $this->form->select('rule', $rules, $values, $errors) ?>
+
+ <?= $this->form->label(t('Column'), 'column_id') ?>
+ <?= $this->form->select('column_id', $columns, $values, $errors) ?>
+
+ <div class="form-actions">
+ <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
+ <?= t('or') ?>
+ <?= $this->url->link(t('cancel'), 'ProjectRoleController', 'show', array(), false, 'close-popover') ?>
+ </div>
+ </form>
+</section>
diff --git a/app/Template/column_restriction/remove.php b/app/Template/column_restriction/remove.php
new file mode 100644
index 00000000..97650e2d
--- /dev/null
+++ b/app/Template/column_restriction/remove.php
@@ -0,0 +1,14 @@
+<div class="page-header">
+ <h2><?= t('Remove a column restriction') ?></h2>
+</div>
+
+<div class="confirm">
+ <p class="alert alert-info">
+ <?= t('Do you really want to remove this column restriction?') ?>
+ </p>
+
+ <div class="form-actions">
+ <?= $this->url->link(t('Yes'), 'ColumnRestrictionController', 'remove', array('project_id' => $project['id'], 'restriction_id' => $restriction['restriction_id']), true, 'btn btn-red') ?>
+ <?= t('or') ?> <?= $this->url->link(t('cancel'), 'ProjectRoleController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?>
+ </div>
+</div>
diff --git a/app/Template/project_role/show.php b/app/Template/project_role/show.php
index 81281a3e..59200fc9 100644
--- a/app/Template/project_role/show.php
+++ b/app/Template/project_role/show.php
@@ -24,7 +24,11 @@
</li>
<li>
<i class="fa fa-plus fa-fw" aria-hidden="true"></i>
- <?= $this->url->link(t('Add a new column restriction'), 'ColumnMoveRestrictionController', 'create', array('project_id' => $project['id'], 'role_id' => $role['role_id']), false, 'popover') ?>
+ <?= $this->url->link(t('Add a new drag and drop restriction'), 'ColumnMoveRestrictionController', 'create', array('project_id' => $project['id'], 'role_id' => $role['role_id']), false, 'popover') ?>
+ </li>
+ <li>
+ <i class="fa fa-plus fa-fw" aria-hidden="true"></i>
+ <?= $this->url->link(t('Add a new column restriction'), 'ColumnRestrictionController', 'create', array('project_id' => $project['id'], 'role_id' => $role['role_id']), false, 'popover') ?>
</li>
<li>
<i class="fa fa-pencil fa-fw" aria-hidden="true"></i>
@@ -41,7 +45,7 @@
<?= t('Actions') ?>
</th>
</tr>
- <?php if (empty($role['project_restrictions']) && empty($role['column_restrictions'])): ?>
+ <?php if (empty($role['project_restrictions']) && empty($role['column_restrictions']) && empty($role['column_move_restrictions'])): ?>
<tr>
<td colspan="2"><?= t('There is no restriction for this role.') ?></td>
</tr>
@@ -49,6 +53,9 @@
<?php foreach ($role['project_restrictions'] as $restriction): ?>
<tr>
<td>
+ <i class="fa fa-ban fa-fw" aria-hidden="true"></i>
+ <strong><?= t('Project') ?></strong>
+ <i class="fa fa-arrow-right fa-fw" aria-hidden="true"></i>
<?= $this->text->e($restriction['title']) ?>
</td>
<td>
@@ -60,7 +67,28 @@
<?php foreach ($role['column_restrictions'] as $restriction): ?>
<tr>
<td>
- <?= t('Only moving task from the column "%s" to "%s" is permitted', $restriction['src_column_title'], $restriction['dst_column_title']) ?>
+ <?php if (strpos($restriction['rule'], 'block') === 0): ?>
+ <i class="fa fa-ban fa-fw" aria-hidden="true"></i>
+ <?php else: ?>
+ <i class="fa fa-check-circle-o fa-fw" aria-hidden="true"></i>
+ <?php endif ?>
+ <strong><?= $this->text->e($restriction['column_title']) ?></strong>
+ <i class="fa fa-arrow-right fa-fw" aria-hidden="true"></i>
+ <?= $this->text->e($restriction['title']) ?>
+ </td>
+ <td>
+ <i class="fa fa-trash-o fa-fw" aria-hidden="true"></i>
+ <?= $this->url->link(t('Remove'), 'ColumnRestrictionController', 'confirm', array('project_id' => $project['id'], 'restriction_id' => $restriction['restriction_id']), false, 'popover') ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ <?php foreach ($role['column_move_restrictions'] as $restriction): ?>
+ <tr>
+ <td>
+ <i class="fa fa-check-circle-o fa-fw" aria-hidden="true"></i>
+ <strong><?= $this->text->e($restriction['src_column_title']) ?> / <?= $this->text->e($restriction['dst_column_title']) ?></strong>
+ <i class="fa fa-arrow-right fa-fw" aria-hidden="true"></i>
+ <?= t('Only moving task between those columns is permitted') ?>
</td>
<td>
<i class="fa fa-trash-o fa-fw" aria-hidden="true"></i>
diff --git a/app/Template/task/dropdown.php b/app/Template/task/dropdown.php
index 127fc89c..f2423dd8 100644
--- a/app/Template/task/dropdown.php
+++ b/app/Template/task/dropdown.php
@@ -49,7 +49,7 @@
<?= $this->url->link(t('Remove'), 'TaskSuppressionController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li>
<?php endif ?>
- <?php if (isset($task['is_active']) && $this->user->hasProjectAccess('TaskStatusController', 'close', $task['project_id'])): ?>
+ <?php if (isset($task['is_active']) && $this->projectRole->canChangeTaskStatusInColumn($task['project_id'], $task['column_id'])): ?>
<li>
<?php if ($task['is_active'] == 1): ?>
<i class="fa fa-times fa-fw"></i>
diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php
index 87fe8cee..640423f4 100644
--- a/app/Template/task/sidebar.php
+++ b/app/Template/task/sidebar.php
@@ -78,7 +78,7 @@
<i class="fa fa-clone fa-fw"></i>
<?= $this->url->link(t('Move to another project'), 'TaskDuplicationController', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li>
- <?php if ($this->user->hasProjectAccess('TaskStatusController', 'close', $task['project_id'])): ?>
+ <?php if ($this->projectRole->canChangeTaskStatusInColumn($task['project_id'], $task['column_id'])): ?>
<?php if ($task['is_active'] == 1): ?>
<li>
<i class="fa fa-arrows fa-fw"></i>