Refactoring: added controlled middleware and changed response class

This commit is contained in:
Frederic Guillot
2016-05-15 18:31:47 -04:00
parent 108e867605
commit 67b8361649
105 changed files with 1586 additions and 1147 deletions

View File

@@ -1,27 +0,0 @@
<div class="sidebar">
<h2><?= $this->text->e($user['name'] ?: $user['username']) ?></h2>
<ul>
<li <?= $this->app->checkMenuSelection('app', 'index') ?>>
<?= $this->url->link(t('Overview'), 'app', 'index', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('app', 'projects') ?>>
<?= $this->url->link(t('My projects'), 'app', 'projects', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('app', 'tasks') ?>>
<?= $this->url->link(t('My tasks'), 'app', 'tasks', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('app', 'subtasks') ?>>
<?= $this->url->link(t('My subtasks'), 'app', 'subtasks', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('app', 'calendar') ?>>
<?= $this->url->link(t('My calendar'), 'app', 'calendar', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('app', 'activity') ?>>
<?= $this->url->link(t('My activity stream'), 'app', 'activity', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('app', 'notifications') ?>>
<?= $this->url->link(t('My notifications'), 'app', 'notifications', array('user_id' => $user['id'])) ?>
</li>
<?= $this->hook->render('template:dashboard:sidebar') ?>
</ul>
</div>

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<h2><?= t('Application settings') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('config', 'application') ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'application')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<h2><?= t('Board settings') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('config', 'board') ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'board')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>

View File

@@ -2,7 +2,7 @@
<h2><?= t('Calendar settings') ?></h2>
</div>
<section>
<form method="post" action="<?= $this->url->href('config', 'calendar') ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'calendar')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
@@ -31,4 +31,4 @@
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
</div>
</form>
</section>
</section>

View File

@@ -2,7 +2,7 @@
<h2><?= t('Integration with third-party services') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('config', 'integrations') ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'integrations')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->hook->render('template:config:integrations', array('values' => $values)) ?>
@@ -14,4 +14,4 @@
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
</div>
</form>
</form>

View File

@@ -1,10 +1,9 @@
<section id="main">
<section class="sidebar-container" id="config-section">
<?= $this->render($sidebar_template) ?>
<div class="sidebar-content">
<?= $content_for_sublayout ?>
</div>
</section>
</section>
</section>

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<h2><?= t('Project settings') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('config', 'project') ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'project')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>

View File

@@ -2,7 +2,7 @@
<h2><?= t('Webhook settings') ?></h2>
</div>
<section>
<form method="post" action="<?= $this->url->href('config', 'webhook') ?>" autocomplete="off">
<form method="post" action="<?= $this->url->href('config', 'save', array('redirect' => 'webhook')) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
@@ -32,4 +32,4 @@
<?= $this->url->link(t('Reset token'), 'config', 'token', array('type' => 'webhook'), true) ?>
</li>
</ul>
</section>
</section>

View File

@@ -1,5 +1,5 @@
<div class="page-header">
<h2><?= $this->url->link(t('My projects'), 'app', 'projects', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
<h2><?= $this->url->link(t('My projects'), 'DashboardController', 'projects', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
</div>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('Your are not member of any project.') ?></p>

View File

@@ -7,6 +7,6 @@
</form>
</div>
<?= $this->render('app/projects', array('paginator' => $project_paginator, 'user' => $user)) ?>
<?= $this->render('app/tasks', array('paginator' => $task_paginator, 'user' => $user)) ?>
<?= $this->render('app/subtasks', array('paginator' => $subtask_paginator, 'user' => $user)) ?>
<?= $this->render('dashboard/projects', array('paginator' => $project_paginator, 'user' => $user)) ?>
<?= $this->render('dashboard/tasks', array('paginator' => $task_paginator, 'user' => $user)) ?>
<?= $this->render('dashboard/subtasks', array('paginator' => $subtask_paginator, 'user' => $user)) ?>

View File

@@ -0,0 +1,27 @@
<div class="sidebar">
<h2><?= $this->text->e($user['name'] ?: $user['username']) ?></h2>
<ul>
<li <?= $this->app->checkMenuSelection('DashboardController', 'show') ?>>
<?= $this->url->link(t('Overview'), 'DashboardController', 'show', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('DashboardController', 'projects') ?>>
<?= $this->url->link(t('My projects'), 'DashboardController', 'projects', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('DashboardController', 'tasks') ?>>
<?= $this->url->link(t('My tasks'), 'DashboardController', 'tasks', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('DashboardController', 'subtasks') ?>>
<?= $this->url->link(t('My subtasks'), 'DashboardController', 'subtasks', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('DashboardController', 'calendar') ?>>
<?= $this->url->link(t('My calendar'), 'DashboardController', 'calendar', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('DashboardController', 'activity') ?>>
<?= $this->url->link(t('My activity stream'), 'DashboardController', 'activity', array('user_id' => $user['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('DashboardController', 'notifications') ?>>
<?= $this->url->link(t('My notifications'), 'DashboardController', 'notifications', array('user_id' => $user['id'])) ?>
</li>
<?= $this->hook->render('template:dashboard:sidebar') ?>
</ul>
</div>

View File

@@ -1,5 +1,5 @@
<div class="page-header">
<h2><?= $this->url->link(t('My subtasks'), 'app', 'subtasks', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
<h2><?= $this->url->link(t('My subtasks'), 'DashboardController', 'subtasks', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
</div>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('There is nothing assigned to you.') ?></p>
@@ -40,4 +40,4 @@
</table>
<?= $paginator ?>
<?php endif ?>
<?php endif ?>

View File

@@ -1,5 +1,5 @@
<div class="page-header">
<h2><?= $this->url->link(t('My tasks'), 'app', 'tasks', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
<h2><?= $this->url->link(t('My tasks'), 'DashboardController', 'tasks', array('user_id' => $user['id'])) ?> (<?= $paginator->getTotal() ?>)</h2>
</div>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('There is nothing assigned to you.') ?></p>

View File

@@ -2,7 +2,7 @@
<nav>
<h1>
<span class="logo">
<?= $this->url->link('K<span>B</span>', 'app', 'index', array(), false, '', t('Dashboard')) ?>
<?= $this->url->link('K<span>B</span>', 'DashboardController', 'show', array(), false, '', t('Dashboard')) ?>
</span>
<span class="title">
<?= $this->text->e($title) ?>
@@ -34,7 +34,7 @@
<li class="user-links">
<?php if ($this->user->hasNotifications()): ?>
<span class="notification">
<?= $this->url->link('<i class="fa fa-bell web-notification-icon"></i>', 'app', 'notifications', array('user_id' => $this->user->getId()), false, '', t('Unread notifications')) ?>
<?= $this->url->link('<i class="fa fa-bell web-notification-icon"></i>', 'DashboardController', 'notifications', array('user_id' => $this->user->getId()), false, '', t('Unread notifications')) ?>
</span>
<?php endif ?>
@@ -63,7 +63,7 @@
<li class="no-hover"><strong><?= $this->text->e($this->user->getFullname()) ?></strong></li>
<li>
<i class="fa fa-tachometer fa-fw"></i>
<?= $this->url->link(t('My dashboard'), 'app', 'index', array('user_id' => $this->user->getId())) ?>
<?= $this->url->link(t('My dashboard'), 'DashboardController', 'show', array('user_id' => $this->user->getId())) ?>
</li>
<li>
<i class="fa fa-home fa-fw"></i>

View File

@@ -44,7 +44,7 @@
<?= $this->hook->render('template:layout:head') ?>
</head>
<body data-status-url="<?= $this->url->href('app', 'status') ?>"
<body data-status-url="<?= $this->url->href('UserHelper', 'status') ?>"
data-login-url="<?= $this->url->href('auth', 'login') ?>"
data-keyboard-shortcut-url="<?= $this->url->href('Doc', 'shortcuts') ?>"
data-timezone="<?= $this->app->getTimezone() ?>"

View File

@@ -8,7 +8,7 @@
<?php endif ?>
<?php if ($this->user->isAdmin()): ?>
<li>
<?= $this->url->link(t('User dashboard'), 'app', 'index', array('user_id' => $user['id'])) ?>
<?= $this->url->link(t('User dashboard'), 'DashboardController', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?>
@@ -80,4 +80,4 @@
<?= $this->hook->render('template:user:sidebar:actions', array('user' => $user)) ?>
</ul>
</div>
</div>