Add project restrictions for custom roles
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-menu"><?= t('Restrictions for the role "%s"', $role['role']) ?> <i class="fa fa-caret-down"></i></a>
|
||||
<ul>
|
||||
<li>
|
||||
<i class="fa fa-plus fa-fw" aria-hidden="true"></i>
|
||||
<?= $this->url->link(t('Add a new project restriction'), 'ProjectRoleRestrictionController', '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'), 'ColumnMoveRestrictionController', 'create', array('project_id' => $project['id'], 'role_id' => $role['role_id']), false, 'popover') ?>
|
||||
@@ -33,15 +37,26 @@
|
||||
<?= t('Actions') ?>
|
||||
</th>
|
||||
</tr>
|
||||
<?php if (empty($role['restrictions'])): ?>
|
||||
<?php if (empty($role['project_restrictions']) && empty($role['column_restrictions'])): ?>
|
||||
<tr>
|
||||
<td colspan="2"><?= t('There is no restriction for this role.') ?></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($role['restrictions'] as $restriction): ?>
|
||||
<?php foreach ($role['project_restrictions'] as $restriction): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= t('Moving task from the column "%s" to "%s" is permitted', $restriction['src_column_title'], $restriction['dst_column_title']) ?>
|
||||
<?= $this->text->e($restriction['title']) ?>
|
||||
</td>
|
||||
<td>
|
||||
<i class="fa fa-trash-o fa-fw" aria-hidden="true"></i>
|
||||
<?= $this->url->link(t('Remove'), 'ProjectRoleRestrictionController', 'confirm', array('project_id' => $project['id'], 'restriction_id' => $restriction['restriction_id']), false, 'popover') ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?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']) ?>
|
||||
</td>
|
||||
<td>
|
||||
<i class="fa fa-trash-o fa-fw" aria-hidden="true"></i>
|
||||
|
||||
19
app/Template/project_role_restriction/create.php
Normal file
19
app/Template/project_role_restriction/create.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<section id="main">
|
||||
<div class="page-header">
|
||||
<h2><?= t('New project restriction for the role "%s"', $role['role']) ?></h2>
|
||||
</div>
|
||||
<form class="popover-form" method="post" action="<?= $this->url->href('ProjectRoleRestrictionController', '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('Restriction'), 'rule') ?>
|
||||
<?= $this->form->select('rule', $restrictions, $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>
|
||||
14
app/Template/project_role_restriction/remove.php
Normal file
14
app/Template/project_role_restriction/remove.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<div class="page-header">
|
||||
<h2><?= t('Remove a project restriction') ?></h2>
|
||||
</div>
|
||||
|
||||
<div class="confirm">
|
||||
<p class="alert alert-info">
|
||||
<?= t('Do you really want to remove this project restriction: "%s"?', $this->text->in($restriction['rule'], $restrictions)) ?>
|
||||
</p>
|
||||
|
||||
<div class="form-actions">
|
||||
<?= $this->url->link(t('Yes'), 'ProjectRoleRestrictionController', '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>
|
||||
@@ -43,7 +43,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->canRemoveTask($task)): ?>
|
||||
<?php if ($this->projectRole->canRemoveTask($task)): ?>
|
||||
<li>
|
||||
<i class="fa fa-trash-o fa-fw"></i>
|
||||
<?= $this->url->link(t('Remove'), 'TaskSuppressionController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<?= $this->url->link(t('Open this task'), 'TaskStatusController', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($this->user->canRemoveTask($task)): ?>
|
||||
<?php if ($this->projectRole->canRemoveTask($task)): ?>
|
||||
<li>
|
||||
<i class="fa fa-trash-o fa-fw"></i>
|
||||
<?= $this->url->link(t('Remove'), 'TaskSuppressionController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'popover') ?>
|
||||
|
||||
Reference in New Issue
Block a user