Display project analytics in modal box

This commit is contained in:
Frederic Guillot 2017-01-08 14:00:51 -05:00
parent ea2cbb76d5
commit b3a450bace
23 changed files with 124 additions and 108 deletions

View File

@ -11,6 +11,7 @@ Improvements:
* Open task import in modal box
* Open form to create customer filters in modal box
* Open project activities in modal box
* Display project analytics in modal box
Version 1.0.36 (Dec 30, 2016)
-----------------------------

View File

@ -19,9 +19,10 @@ class ActivityController extends BaseController
{
$project = $this->getProject();
$this->response->html($this->template->render('activity/project', array(
$this->response->html($this->helper->layout->app('activity/project', array(
'events' => $this->helper->projectActivity->getProjectEvents($project['id']),
'project' => $project,
'title' => t('%s\'s activity', $project['name'])
)));
}

View File

@ -374,7 +374,9 @@ class Paginator
'← '.t('Previous'),
$this->controller,
$this->action,
$this->getUrlParams($this->page - 1, $this->order, $this->direction)
$this->getUrlParams($this->page - 1, $this->order, $this->direction),
false,
'js-modal-replace'
);
} else {
$html .= '← '.t('Previous');
@ -400,7 +402,9 @@ class Paginator
t('Next').' →',
$this->controller,
$this->action,
$this->getUrlParams($this->page + 1, $this->order, $this->direction)
$this->getUrlParams($this->page + 1, $this->order, $this->direction),
false,
'js-modal-replace'
);
} else {
$html .= t('Next').' →';
@ -486,7 +490,9 @@ class Paginator
$label,
$this->controller,
$this->action,
$this->getUrlParams($this->page, $column, $direction)
$this->getUrlParams($this->page, $column, $direction),
false,
'js-modal-replace'
);
}
}

View File

@ -22,7 +22,10 @@ class LayoutHelper extends Base
*/
public function app($template, array $params = array())
{
if ($this->request->isAjax()) {
$isAjax = $this->request->isAjax();
$params['is_ajax'] = $isAjax;
if ($isAjax) {
return $this->template->render($template, $params);
}
@ -160,7 +163,7 @@ class LayoutHelper extends Base
$params['title'] = $params['project']['name'].' > '.$params['title'];
}
return $this->subLayout('analytic/layout', 'analytic/sidebar', $template, $params);
return $this->subLayout('analytic/layout', 'analytic/sidebar', $template, $params, true);
}
/**
@ -188,13 +191,16 @@ class LayoutHelper extends Base
* @param string $sidebar
* @param string $template
* @param array $params
* @param bool $ignoreAjax
* @return string
*/
public function subLayout($sublayout, $sidebar, $template, array $params = array())
public function subLayout($sublayout, $sidebar, $template, array $params = array(), $ignoreAjax = false)
{
$isAjax = $this->request->isAjax();
$params['is_ajax'] = $isAjax;
$content = $this->template->render($template, $params);
if ($this->request->isAjax()) {
if (!$ignoreAjax && $isAjax) {
return $content;
}

View File

@ -75,4 +75,9 @@ class ModalHelper extends Base
{
return $this->helper->url->link($label, $controller, $action, $params, false, 'js-modal-confirm');
}
public function replaceLink($label, $controller, $action, array $params = array())
{
return $this->helper->url->link($label, $controller, $action, $params, false, 'js-modal-replace');
}
}

View File

@ -1,6 +1,8 @@
<div class="page-header">
<h2><?= t('Average time spent into each column') ?></h2>
</div>
<?php if (! $is_ajax): ?>
<div class="page-header">
<h2><?= t('Average time spent into each column') ?></h2>
</div>
<?php endif ?>
<?php if (empty($metrics)): ?>
<p class="alert"><?= t('Not enough data to show the graph.') ?></p>
@ -11,16 +13,16 @@
)) ?>
<table class="table-striped">
<tr>
<th><?= t('Column') ?></th>
<th><?= t('Average time spent') ?></th>
</tr>
<?php foreach ($metrics as $column): ?>
<tr>
<td><?= $this->text->e($column['title']) ?></td>
<td><?= $this->dt->duration($column['average']) ?></td>
</tr>
<?php endforeach ?>
<tr>
<th><?= t('Column') ?></th>
<th><?= t('Average time spent') ?></th>
</tr>
<?php foreach ($metrics as $column): ?>
<tr>
<td><?= $this->text->e($column['title']) ?></td>
<td><?= $this->dt->duration($column['average']) ?></td>
</tr>
<?php endforeach ?>
</table>
<p class="alert alert-info">

View File

@ -1,6 +1,8 @@
<div class="page-header">
<h2><?= t('Burndown chart') ?></h2>
</div>
<?php if (! $is_ajax): ?>
<div class="page-header">
<h2><?= t('Burndown chart') ?></h2>
</div>
<?php endif ?>
<?php if (! $display_graph): ?>
<p class="alert"><?= t('You need at least 2 days of data to show the chart.') ?></p>
@ -15,20 +17,10 @@
<hr/>
<form method="post" class="form-inline" action="<?= $this->url->href('AnalyticController', 'burndown', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<div class="form-inline-group">
<?= $this->form->date(t('Start date'), 'from', $values) ?>
</div>
<div class="form-inline-group">
<?= $this->form->date(t('End date'), 'to', $values) ?>
</div>
<div class="form-inline-group">
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
</div>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
<?= $this->modal->submitButtons(array('submitLabel' => t('Execute'))) ?>
</form>
<p class="alert alert-info"><?= t('This chart show the task complexity over the time (Work Remaining).') ?></p>

View File

@ -1,6 +1,8 @@
<div class="page-header">
<h2><?= t('Cumulative flow diagram') ?></h2>
</div>
<?php if (! $is_ajax): ?>
<div class="page-header">
<h2><?= t('Cumulative flow diagram') ?></h2>
</div>
<?php endif ?>
<?php if (! $display_graph): ?>
<p class="alert"><?= t('You need at least 2 days of data to show the chart.') ?></p>
@ -14,18 +16,8 @@
<hr/>
<form method="post" class="form-inline" action="<?= $this->url->href('AnalyticController', 'cfd', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<div class="form-inline-group">
<?= $this->form->date(t('Start date'), 'from', $values) ?>
</div>
<div class="form-inline-group">
<?= $this->form->date(t('End date'), 'to', $values) ?>
</div>
<div class="form-inline-group">
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
</div>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
<?= $this->modal->submitButtons(array('submitLabel' => t('Execute'))) ?>
</form>

View File

@ -1,10 +1,14 @@
<section id="main">
<?php if ($is_ajax): ?>
<div class="page-header">
<h2><?= $title ?></h2>
</div>
<?php else: ?>
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
<section class="sidebar-container">
<?= $this->render($sidebar_template, array('project' => $project)) ?>
<?php endif ?>
<section class="sidebar-container">
<?= $this->render($sidebar_template, array('project' => $project)) ?>
<div class="sidebar-content">
<?= $content_for_sublayout ?>
</div>
</section>
<div class="sidebar-content">
<?= $content_for_sublayout ?>
</div>
</section>

View File

@ -1,6 +1,8 @@
<div class="page-header">
<h2><?= t('Average Lead and Cycle time') ?></h2>
</div>
<?php if (! $is_ajax): ?>
<div class="page-header">
<h2><?= t('Average Lead and Cycle time') ?></h2>
</div>
<?php endif ?>
<div class="panel">
<ul>
@ -19,20 +21,10 @@
)) ?>
<form method="post" class="form-inline" action="<?= $this->url->href('AnalyticController', 'leadAndCycleTime', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<div class="form-inline-group">
<?= $this->form->date(t('Start date'), 'from', $values) ?>
</div>
<div class="form-inline-group">
<?= $this->form->date(t('End date'), 'to', $values) ?>
</div>
<div class="form-inline-group">
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
</div>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
<?= $this->modal->submitButtons(array('submitLabel' => t('Execute'))) ?>
</form>
<p class="alert alert-info">

View File

@ -1,28 +1,27 @@
<div class="sidebar">
<ul>
<li <?= $this->app->checkMenuSelection('AnalyticController', 'taskDistribution') ?>>
<?= $this->url->link(t('Task distribution'), 'AnalyticController', 'taskDistribution', array('project_id' => $project['id'])) ?>
<?= $this->modal->replaceLink(t('Task distribution'), 'AnalyticController', 'taskDistribution', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AnalyticController', 'userDistribution') ?>>
<?= $this->url->link(t('User repartition'), 'AnalyticController', 'userDistribution', array('project_id' => $project['id'])) ?>
<?= $this->modal->replaceLink(t('User repartition'), 'AnalyticController', 'userDistribution', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AnalyticController', 'cfd') ?>>
<?= $this->url->link(t('Cumulative flow diagram'), 'AnalyticController', 'cfd', array('project_id' => $project['id'])) ?>
<?= $this->modal->replaceLink(t('Cumulative flow diagram'), 'AnalyticController', 'cfd', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AnalyticController', 'burndown') ?>>
<?= $this->url->link(t('Burndown chart'), 'AnalyticController', 'burndown', array('project_id' => $project['id'])) ?>
<?= $this->modal->replaceLink(t('Burndown chart'), 'AnalyticController', 'burndown', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AnalyticController', 'averageTimeByColumn') ?>>
<?= $this->url->link(t('Average time into each column'), 'AnalyticController', 'averageTimeByColumn', array('project_id' => $project['id'])) ?>
<?= $this->modal->replaceLink(t('Average time into each column'), 'AnalyticController', 'averageTimeByColumn', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AnalyticController', 'leadAndCycleTime') ?>>
<?= $this->url->link(t('Lead and cycle time'), 'AnalyticController', 'leadAndCycleTime', array('project_id' => $project['id'])) ?>
<?= $this->modal->replaceLink(t('Lead and cycle time'), 'AnalyticController', 'leadAndCycleTime', array('project_id' => $project['id'])) ?>
</li>
<li <?= $this->app->checkMenuSelection('AnalyticController', 'timeComparison') ?>>
<?= $this->url->link(t('Estimated vs actual time'), 'AnalyticController', 'timeComparison', array('project_id' => $project['id'])) ?>
<?= $this->modal->replaceLink(t('Estimated vs actual time'), 'AnalyticController', 'timeComparison', array('project_id' => $project['id'])) ?>
</li>
<?= $this->hook->render('template:analytic:sidebar', array('project' => $project)) ?>
</ul>
</div>

View File

@ -1,6 +1,8 @@
<div class="page-header">
<h2><?= t('Task distribution') ?></h2>
</div>
<?php if (! $is_ajax): ?>
<div class="page-header">
<h2><?= t('Task distribution') ?></h2>
</div>
<?php endif ?>
<?php if (empty($metrics)): ?>
<p class="alert"><?= t('Not enough data to show the graph.') ?></p>

View File

@ -1,6 +1,8 @@
<div class="page-header">
<h2><?= t('Estimated vs actual time') ?></h2>
</div>
<?php if (! $is_ajax): ?>
<div class="page-header">
<h2><?= t('Estimated vs actual time') ?></h2>
</div>
<?php endif ?>
<div class="panel">
<ul>
@ -27,9 +29,9 @@
<tr>
<th class="column-5"><?= $paginator->order(t('Id'), 'tasks.id') ?></th>
<th><?= $paginator->order(t('Title'), 'tasks.title') ?></th>
<th class="column-5"><?= $paginator->order(t('Status'), 'tasks.is_active') ?></th>
<th class="column-10"><?= $paginator->order(t('Estimated Time'), 'tasks.time_estimated') ?></th>
<th class="column-10"><?= $paginator->order(t('Actual Time'), 'tasks.time_spent') ?></th>
<th class="column-10"><?= $paginator->order(t('Status'), 'tasks.is_active') ?></th>
<th class="column-12"><?= $paginator->order(t('Estimated Time'), 'tasks.time_estimated') ?></th>
<th class="column-12"><?= $paginator->order(t('Actual Time'), 'tasks.time_spent') ?></th>
</tr>
<?php foreach ($paginator->getCollection() as $task): ?>
<tr>

View File

@ -1,6 +1,8 @@
<div class="page-header">
<h2><?= t('User repartition') ?></h2>
</div>
<?php if (! $is_ajax): ?>
<div class="page-header">
<h2><?= t('User repartition') ?></h2>
</div>
<?php endif ?>
<?php if (empty($metrics)): ?>
<p class="alert"><?= t('Not enough data to show the graph.') ?></p>

View File

@ -22,7 +22,7 @@
<?php if ($this->user->hasProjectAccess('AnalyticController', 'taskDistribution', $project['id'])): ?>
<li>
<?= $this->url->icon('line-chart', t('Analytics'), 'AnalyticController', 'taskDistribution', array('project_id' => $project['id'])) ?>
<?= $this->modal->large('line-chart', t('Analytics'), 'AnalyticController', 'taskDistribution', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>

View File

@ -46,7 +46,7 @@
<?php if ($this->user->hasProjectAccess('AnalyticController', 'taskDistribution', $project['id'])): ?>
<li>
<?= $this->url->icon('line-chart', t('Analytics'), 'AnalyticController', 'taskDistribution', array('project_id' => $project['id'])) ?>
<?= $this->modal->large('line-chart', t('Analytics'), 'AnalyticController', 'taskDistribution', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,4 +26,14 @@
KB.onClick('.js-modal-close', function () {
KB.modal.close();
});
KB.onClick('.js-modal-replace', function (e) {
var link = getLink(e);
if (KB.modal.isOpen()) {
KB.modal.replace(link);
} else {
window.location.href = link;
}
});
}());

View File

@ -125,7 +125,7 @@
switch (size) {
case 'large':
return viewport.width < 1300 ? '95%' : '1300px';
return viewport.width < 1350 ? '98%' : '1350px';
case 'medium':
return viewport.width < 1024 ? '70%' : '1024px';
}

View File

@ -1,4 +0,0 @@
@import variables
#main .confirm
max-width: 700px

View File

@ -116,10 +116,15 @@ ul.form-errors li
border: none
label
display: inline
padding-right: 3px
input, select
margin: 0 15px 0 0
.form-required
display: none
.form-actions
display: inline-block
.js-submit-buttons-rendered
display: inline-block
.form-inline-group
display: inline

View File

@ -14,7 +14,6 @@
@import accordion
@import select_dropdown
@import suggest_menu
@import dialog_box
@import modal
@import pagination
@import header