Import automatic actions from another project
This commit is contained in:
parent
9983e1422b
commit
1e169ae16c
|
|
@ -3,6 +3,7 @@ Version 1.0.27 (unreleased)
|
|||
|
||||
Improvements:
|
||||
|
||||
* Added the possibility to import automatic actions from another project
|
||||
* Added Ajax loading icon for submit buttons
|
||||
* Added support for HTTP header "X-Forwarded-Proto: https"
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Kanboard\Controller;
|
||||
|
||||
/**
|
||||
* Duplicate automatic action from another project
|
||||
*
|
||||
* @package controller
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class ActionProject extends Base
|
||||
{
|
||||
public function project()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
|
||||
unset($projects[$project['id']]);
|
||||
|
||||
$this->response->html($this->helper->layout->project('action_project/project', array(
|
||||
'project' => $project,
|
||||
'projects_list' => $projects,
|
||||
)));
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$src_project_id = $this->request->getValue('src_project_id');
|
||||
|
||||
if ($this->action->duplicate($src_project_id, $project['id'])) {
|
||||
$this->flash->success(t('Actions duplicated successfully.'));
|
||||
} else {
|
||||
$this->flash->failure(t('Unable to duplicate actions.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('Action', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
}
|
||||
|
|
@ -67,6 +67,7 @@ class AuthenticationProvider implements ServiceProviderInterface
|
|||
$acl->setRoleHierarchy(Role::PROJECT_MEMBER, array(Role::PROJECT_VIEWER));
|
||||
|
||||
$acl->add('Action', '*', Role::PROJECT_MANAGER);
|
||||
$acl->add('ActionProject', '*', Role::PROJECT_MANAGER);
|
||||
$acl->add('Analytic', '*', Role::PROJECT_MANAGER);
|
||||
$acl->add('Board', 'save', Role::PROJECT_MEMBER);
|
||||
$acl->add('BoardPopover', '*', Role::PROJECT_MEMBER);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
<div class="page-header">
|
||||
<h2><?= t('Automatic actions for the project "%s"', $project['name']) ?></h2>
|
||||
<ul>
|
||||
<li>
|
||||
<i class="fa fa-plus fa-fw"></i>
|
||||
<?= $this->url->link(t('Import from another project'), 'ActionProject', 'project', array('project_id' => $project['id']), false, 'popover') ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php if (! empty($actions)): ?>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
<section id="main">
|
||||
<div class="page-header">
|
||||
<h2><?= t('Import actions from another project') ?></h2>
|
||||
</div>
|
||||
<?php if (empty($projects_list)): ?>
|
||||
<p class="alert"><?= t('There is no available project.') ?></p>
|
||||
<?php else: ?>
|
||||
<form class="popover-form" method="post" action="<?= $this->url->href('ActionProject', 'save', array('project_id' => $project['id'])) ?>" autocomplete="off">
|
||||
|
||||
<?= $this->form->csrf() ?>
|
||||
|
||||
<?= $this->form->label(t('Create from another project'), 'src_project_id') ?>
|
||||
<?= $this->form->select('src_project_id', $projects_list) ?>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
|
||||
<?= t('or') ?>
|
||||
<?= $this->url->link(t('cancel'), 'Action', 'index', array(), false, 'close-popover') ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
</section>
|
||||
Loading…
Reference in New Issue