Rename ProjectEdit controller

This commit is contained in:
Frederic Guillot 2016-05-25 22:46:21 -04:00
parent 24ce1b42f8
commit f2cce5ade8
14 changed files with 52 additions and 52 deletions

View File

@ -5,10 +5,10 @@ namespace Kanboard\Controller;
/**
* Project Edit Controller
*
* @package controller
* @package Kanboard\Controller
* @author Frederic Guillot
*/
class ProjectEdit extends BaseController
class ProjectEditController extends BaseController
{
/**
* General edition (most common operations)
@ -75,7 +75,7 @@ class ProjectEdit extends BaseController
if ($valid) {
if ($this->project->update($values)) {
$this->flash->success(t('Project updated successfully.'));
return $this->response->redirect($this->helper->url->to('ProjectEdit', $redirect, array('project_id' => $project['id'])), true);
return $this->response->redirect($this->helper->url->to('ProjectEditController', $redirect, array('project_id' => $project['id'])), true);
} else {
$this->flash->failure(t('Unable to update this project.'));
}
@ -111,7 +111,7 @@ class ProjectEdit extends BaseController
}
/**
* Common metthod to render different views
* Common method to render different views
*
* @access private
* @param string $template

View File

@ -83,7 +83,7 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('Gantt', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectViewController', array('share', 'updateSharing', 'integrations', 'updateIntegrations', 'notifications', 'updateNotifications', 'duplicate', 'doDuplication'), Role::PROJECT_MANAGER);
$acl->add('ProjectPermissionController', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectEdit', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectEditController', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectFile', '*', Role::PROJECT_MEMBER);
$acl->add('Projectuser', '*', Role::PROJECT_MANAGER);
$acl->add('ProjectStatusController', '*', Role::PROJECT_MANAGER);

View File

@ -65,10 +65,10 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('project/:project_id/overview', 'ProjectOverview', 'show');
// ProjectEdit routes
$container['route']->addRoute('project/:project_id/edit', 'ProjectEdit', 'edit');
$container['route']->addRoute('project/:project_id/edit/dates', 'ProjectEdit', 'dates');
$container['route']->addRoute('project/:project_id/edit/description', 'ProjectEdit', 'description');
$container['route']->addRoute('project/:project_id/edit/priority', 'ProjectEdit', 'priority');
$container['route']->addRoute('project/:project_id/edit', 'ProjectEditController', 'edit');
$container['route']->addRoute('project/:project_id/edit/dates', 'ProjectEditController', 'dates');
$container['route']->addRoute('project/:project_id/edit/description', 'ProjectEditController', 'description');
$container['route']->addRoute('project/:project_id/edit/priority', 'ProjectEditController', 'priority');
// ProjectUser routes
$container['route']->addRoute('projects/managers/:user_id', 'projectuser', 'managers');

View File

@ -12,7 +12,7 @@
<?= $this->form->label(t('Filter'), 'filter') ?>
<?= $this->form->text('filter', $values, $errors, array('required', 'maxlength="100"')) ?>
<?php if ($this->user->hasProjectAccess('ProjectEdit', 'edit', $project['id'])): ?>
<?php if ($this->user->hasProjectAccess('ProjectEditController', 'edit', $project['id'])): ?>
<?= $this->form->checkbox('is_shared', t('Share with all project members'), 1) ?>
<?php endif ?>
@ -21,4 +21,4 @@
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
</div>
</form>
</form>

View File

@ -16,7 +16,7 @@
<?= $this->form->label(t('Filter'), 'filter') ?>
<?= $this->form->text('filter', $values, $errors, array('required', 'maxlength="100"')) ?>
<?php if ($this->user->hasProjectAccess('ProjectEdit', 'edit', $project['id'])): ?>
<?php if ($this->user->hasProjectAccess('ProjectEditController', 'edit', $project['id'])): ?>
<?= $this->form->checkbox('is_shared', t('Share with all project members'), 1, $values['is_shared'] == 1) ?>
<?php else: ?>
<?= $this->form->hidden('is_shared', $values) ?>
@ -29,4 +29,4 @@
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'customfilter', 'index', array('project_id' => $project['id']), false, 'close-popover') ?>
</div>
</form>
</form>

View File

@ -34,7 +34,7 @@
<?= $this->hook->render('template:project:dropdown', array('project' => $project)) ?>
<?php if ($this->user->hasProjectAccess('ProjectEdit', 'edit', $project['id'])): ?>
<?php if ($this->user->hasProjectAccess('ProjectEditController', 'edit', $project['id'])): ?>
<li>
<i class="fa fa-cog fa-fw"></i>
<?= $this->url->link(t('Settings'), 'ProjectViewController', 'show', array('project_id' => $project['id'])) ?>

View File

@ -10,9 +10,9 @@
</li>
<?php endif ?>
<?php if ($this->user->hasProjectAccess('ProjectEdit', 'edit', $project['id'])): ?>
<li <?= $this->app->checkMenuSelection('ProjectEdit') ?>>
<?= $this->url->link(t('Edit project'), 'ProjectEdit', 'edit', array('project_id' => $project['id'])) ?>
<?php if ($this->user->hasProjectAccess('ProjectEditController', 'edit', $project['id'])): ?>
<li <?= $this->app->checkMenuSelection('ProjectEditController') ?>>
<?= $this->url->link(t('Edit project'), 'ProjectEditController', 'edit', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('ProjectViewController', 'share') ?>>
<?= $this->url->link(t('Public access'), 'ProjectViewController', 'share', array('project_id' => $project['id'])) ?>
@ -33,7 +33,7 @@
<?= $this->url->link(t('Categories'), 'category', 'index', array('project_id' => $project['id'])) ?>
</li>
<?php if ($project['is_private'] == 0): ?>
<li <?= $this->app->checkMenuSelection('ProjectPermission') ?>>
<li <?= $this->app->checkMenuSelection('ProjectPermissionController') ?>>
<?= $this->url->link(t('Permissions'), 'ProjectPermissionController', 'index', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>

View File

@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
<li ><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li class="active"><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li ><?= $this->url->link(t('General'), 'ProjectEditController', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li class="active"><?= $this->url->link(t('Dates'), 'ProjectEditController', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Description'), 'ProjectEditController', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Task priority'), 'ProjectEditController', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'dates')) ?>" autocomplete="off">
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEditController', 'update', array('project_id' => $project['id'], 'redirect' => 'dates')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('name', $values) ?>

View File

@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
<li><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li class="active"><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('General'), 'ProjectEditController', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Dates'), 'ProjectEditController', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li class="active"><?= $this->url->link(t('Description'), 'ProjectEditController', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Task priority'), 'ProjectEditController', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'description')) ?>" autocomplete="off">
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEditController', 'update', array('project_id' => $project['id'], 'redirect' => 'description')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('name', $values) ?>

View File

@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
<li class="active"><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li class="active"><?= $this->url->link(t('General'), 'ProjectEditController', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Dates'), 'ProjectEditController', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Description'), 'ProjectEditController', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Task priority'), 'ProjectEditController', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'edit')) ?>" autocomplete="off">
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEditController', 'update', array('project_id' => $project['id'], 'redirect' => 'edit')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>

View File

@ -1,13 +1,13 @@
<div class="page-header">
<h2><?= t('Edit project') ?></h2>
<ul>
<li ><?= $this->url->link(t('General'), 'ProjectEdit', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Dates'), 'ProjectEdit', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li class="active"><?= $this->url->link(t('Task priority'), 'ProjectEdit', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li ><?= $this->url->link(t('General'), 'ProjectEditController', 'edit', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Dates'), 'ProjectEditController', 'dates', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li><?= $this->url->link(t('Description'), 'ProjectEditController', 'description', array('project_id' => $project['id']), false, 'popover-link') ?></li>
<li class="active"><?= $this->url->link(t('Task priority'), 'ProjectEditController', 'priority', array('project_id' => $project['id']), false, 'popover-link') ?></li>
</ul>
</div>
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEdit', 'update', array('project_id' => $project['id'], 'redirect' => 'priority')) ?>" autocomplete="off">
<form method="post" class="popover-form" action="<?= $this->url->href('ProjectEditController', 'update', array('project_id' => $project['id'], 'redirect' => 'priority')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('name', $values) ?>

View File

@ -72,7 +72,7 @@
</li>
<?php endif ?>
<?php if ($this->user->hasProjectAccess('ProjectEdit', 'edit', $project['id'])): ?>
<?php if ($this->user->hasProjectAccess('ProjectEditController', 'edit', $project['id'])): ?>
<li>
<i class="fa fa-cog fa-fw"></i>
<?= $this->url->link(t('Settings'), 'ProjectViewController', 'show', array('project_id' => $project['id'])) ?>

View File

@ -3,9 +3,9 @@
<h3><a href="#" class="fa accordion-toggle"></a> <?= t('Description') ?></h3>
</div>
<div class="accordion-content">
<?php if ($this->user->hasProjectAccess('ProjectEdit', 'description', $project['id'])): ?>
<?php if ($this->user->hasProjectAccess('ProjectEditController', 'description', $project['id'])): ?>
<div class="buttons-header">
<?= $this->url->button('fa-edit', t('Edit description'), 'ProjectEdit', 'description', array('project_id' => $project['id']), 'popover') ?>
<?= $this->url->button('fa-edit', t('Edit description'), 'ProjectEditController', 'description', array('project_id' => $project['id']), 'popover') ?>
</div>
<?php endif ?>
<article class="markdown">

View File

@ -85,7 +85,7 @@ class UserHelperTest extends Base
$this->assertEquals(1, $project->create(array('name' => 'My project')));
$this->assertTrue($helper->hasProjectAccess('ProjectEdit', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('ProjectEditController', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('board', 'show', 1));
}
@ -101,7 +101,7 @@ class UserHelperTest extends Base
$this->assertEquals(1, $project->create(array('name' => 'My project')));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1));
$this->assertFalse($helper->hasProjectAccess('board', 'show', 1));
}
@ -117,7 +117,7 @@ class UserHelperTest extends Base
$this->assertEquals(1, $project->create(array('name' => 'My project')));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1));
$this->assertFalse($helper->hasProjectAccess('board', 'show', 1));
}
@ -138,12 +138,12 @@ class UserHelperTest extends Base
$this->assertEquals(2, $user->create(array('username' => 'user')));
$this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_MANAGER));
$this->assertTrue($helper->hasProjectAccess('ProjectEdit', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('ProjectEditController', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('board', 'show', 1));
$this->assertTrue($helper->hasProjectAccess('task', 'show', 1));
$this->assertTrue($helper->hasProjectAccess('taskcreationcontroller', 'save', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('board', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('task', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2));
@ -166,12 +166,12 @@ class UserHelperTest extends Base
$this->assertEquals(2, $user->create(array('username' => 'user')));
$this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_MANAGER));
$this->assertTrue($helper->hasProjectAccess('ProjectEdit', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('ProjectEditController', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('board', 'show', 1));
$this->assertTrue($helper->hasProjectAccess('task', 'show', 1));
$this->assertTrue($helper->hasProjectAccess('TaskCreationController', 'save', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('board', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('task', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2));
@ -194,12 +194,12 @@ class UserHelperTest extends Base
$this->assertEquals(2, $user->create(array('username' => 'user')));
$this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_MEMBER));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('board', 'show', 1));
$this->assertTrue($helper->hasProjectAccess('task', 'show', 1));
$this->assertTrue($helper->hasProjectAccess('TaskCreationController', 'save', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('board', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('task', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2));
@ -222,12 +222,12 @@ class UserHelperTest extends Base
$this->assertEquals(2, $user->create(array('username' => 'user')));
$this->assertTrue($projectUserRole->addUser(1, 2, Role::PROJECT_VIEWER));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1));
$this->assertTrue($helper->hasProjectAccess('board', 'show', 1));
$this->assertTrue($helper->hasProjectAccess('task', 'show', 1));
$this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 1));
$this->assertFalse($helper->hasProjectAccess('ProjectEdit', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 2));
$this->assertFalse($helper->hasProjectAccess('board', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('task', 'show', 2));
$this->assertFalse($helper->hasProjectAccess('TaskCreationController', 'save', 2));