Pagination refactoring

This commit is contained in:
Frederic Guillot
2015-01-18 17:59:41 -05:00
parent 74e4a7b064
commit 7c1c14cf64
21 changed files with 772 additions and 656 deletions

View File

@@ -14,9 +14,9 @@
</div>
<section id="dashboard">
<div class="dashboard-left-column">
<?= $this->render('app/projects', array('projects' => $projects, 'pagination' => $project_pagination)) ?>
<?= $this->render('app/tasks', array('tasks' => $tasks, 'pagination' => $task_pagination)) ?>
<?= $this->render('app/subtasks', array('subtasks' => $subtasks, 'pagination' => $subtask_pagination)) ?>
<?= $this->render('app/projects', array('paginator' => $project_paginator)) ?>
<?= $this->render('app/tasks', array('paginator' => $task_paginator)) ?>
<?= $this->render('app/subtasks', array('paginator' => $subtask_paginator)) ?>
</div>
<div class="dashboard-right-column">
<h2><?= t('Activity stream') ?></h2>

View File

@@ -1,14 +1,14 @@
<h2><?= t('My projects') ?></h2>
<?php if (empty($projects)): ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('Your are not member of any project.') ?></p>
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-8"><?= $this->order('Id', 'id', $pagination) ?></th>
<th class="column-20"><?= $this->order(t('Project'), 'name', $pagination) ?></th>
<th class="column-8"><?= $paginator->order('Id', 'id') ?></th>
<th class="column-20"><?= $paginator->order(t('Project'), 'name') ?></th>
<th><?= t('Columns') ?></th>
</tr>
<?php foreach ($projects as $project): ?>
<?php foreach ($paginator->getCollection() as $project): ?>
<tr>
<td>
<?= $this->a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?>
@@ -17,6 +17,7 @@
<?php if ($this->isManager($project['id'])): ?>
<?= $this->a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?>&nbsp;
<?php endif ?>
<?= $this->a('<i class="fa fa-calendar"></i>', 'calendar', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Calendar')) ?>&nbsp;
<?= $this->a($this->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?>
</td>
@@ -30,5 +31,5 @@
<?php endforeach ?>
</table>
<?= $this->paginate($pagination) ?>
<?= $paginator ?>
<?php endif ?>

View File

@@ -1,15 +1,15 @@
<h2><?= t('My subtasks') ?></h2>
<?php if (empty($subtasks)): ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('There is nothing assigned to you.') ?></p>
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-10"><?= $this->order('Id', 'tasks.id', $pagination) ?></th>
<th class="column-20"><?= $this->order(t('Project'), 'project_name', $pagination) ?></th>
<th class="column-15"><?= $this->order(t('Status'), 'status', $pagination) ?></th>
<th><?= $this->order(t('Subtask'), 'title', $pagination) ?></th>
<th class="column-10"><?= $paginator->order('Id', 'tasks.id') ?></th>
<th class="column-20"><?= $paginator->order(t('Project'), 'project_name') ?></th>
<th class="column-15"><?= $paginator->order(t('Status'), 'status') ?></th>
<th><?= $paginator->order(t('Subtask'), 'title') ?></th>
</tr>
<?php foreach ($subtasks as $subtask): ?>
<?php foreach ($paginator->getCollection() as $subtask): ?>
<tr>
<td class="task-table color-<?= $subtask['color_id'] ?>">
<?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
@@ -27,5 +27,5 @@
<?php endforeach ?>
</table>
<?= $this->paginate($pagination) ?>
<?= $paginator ?>
<?php endif ?>

View File

@@ -1,15 +1,15 @@
<h2><?= t('My tasks') ?></h2>
<?php if (empty($tasks)): ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('There is nothing assigned to you.') ?></p>
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-8"><?= $this->order('Id', 'tasks.id', $pagination) ?></th>
<th class="column-20"><?= $this->order(t('Project'), 'project_name', $pagination) ?></th>
<th><?= $this->order(t('Task'), 'title', $pagination) ?></th>
<th class="column-20"><?= $this->order(t('Due date'), 'date_due', $pagination) ?></th>
<th class="column-8"><?= $paginator->order('Id', 'tasks.id') ?></th>
<th class="column-20"><?= $paginator->order(t('Project'), 'project_name') ?></th>
<th><?= $paginator->order(t('Task'), 'title') ?></th>
<th class="column-20"><?= $paginator->order(t('Due date'), 'date_due') ?></th>
</tr>
<?php foreach ($tasks as $task): ?>
<?php foreach ($paginator->getCollection() as $task): ?>
<tr>
<td class="task-table color-<?= $task['color_id'] ?>">
<?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
@@ -27,5 +27,5 @@
<?php endforeach ?>
</table>
<?= $this->paginate($pagination) ?>
<?= $paginator ?>
<?php endif ?>

View File

@@ -28,14 +28,13 @@
<input type="submit" value="<?= t('Search') ?>" class="btn btn-blue"/>
</form>
<?php if (empty($tasks) && ! empty($values['search'])): ?>
<?php if (! empty($values['search']) && $paginator->isEmpty()): ?>
<p class="alert"><?= t('Nothing found.') ?></p>
<?php elseif (! empty($tasks)): ?>
<?php elseif (! $paginator->isEmpty()): ?>
<?= $this->render('task/table', array(
'tasks' => $tasks,
'paginator' => $paginator,
'categories' => $categories,
'columns' => $columns,
'pagination' => $pagination,
)) ?>
<?php endif ?>

View File

@@ -20,14 +20,13 @@
</ul>
</div>
<section>
<?php if (empty($tasks)): ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('No task') ?></p>
<?php else: ?>
<?= $this->render('task/table', array(
'tasks' => $tasks,
'paginator' => $paginator,
'categories' => $categories,
'columns' => $columns,
'pagination' => $pagination,
)) ?>
<?php endif ?>
</section>

View File

@@ -1,16 +1,16 @@
<table class="table-fixed table-small">
<tr>
<th class="column-8"><?= $this->order(t('Id'), 'tasks.id', $pagination) ?></th>
<th class="column-8"><?= $this->order(t('Column'), 'tasks.column_id', $pagination) ?></th>
<th class="column-8"><?= $this->order(t('Category'), 'tasks.category_id', $pagination) ?></th>
<th><?= $this->order(t('Title'), 'tasks.title', $pagination) ?></th>
<th class="column-10"><?= $this->order(t('Assignee'), 'users.username', $pagination) ?></th>
<th class="column-10"><?= $this->order(t('Due date'), 'tasks.date_due', $pagination) ?></th>
<th class="column-10"><?= $this->order(t('Date created'), 'tasks.date_creation', $pagination) ?></th>
<th class="column-10"><?= $this->order(t('Date completed'), 'tasks.date_completed', $pagination) ?></th>
<th class="column-5"><?= $this->order(t('Status'), 'tasks.is_active', $pagination) ?></th>
<th class="column-8"><?= $paginator->order(t('Id'), 'tasks.id') ?></th>
<th class="column-8"><?= $paginator->order(t('Column'), 'tasks.column_id') ?></th>
<th class="column-8"><?= $paginator->order(t('Category'), 'tasks.category_id') ?></th>
<th><?= $paginator->order(t('Title'), 'tasks.title') ?></th>
<th class="column-10"><?= $paginator->order(t('Assignee'), 'users.username') ?></th>
<th class="column-10"><?= $paginator->order(t('Due date'), 'tasks.date_due') ?></th>
<th class="column-10"><?= $paginator->order(t('Date created'), 'tasks.date_creation') ?></th>
<th class="column-10"><?= $paginator->order(t('Date completed'), 'tasks.date_completed') ?></th>
<th class="column-5"><?= $paginator->order(t('Status'), 'tasks.is_active') ?></th>
</tr>
<?php foreach ($tasks as $task): ?>
<?php foreach ($paginator->getCollection() as $task): ?>
<tr>
<td class="task-table color-<?= $task['color_id'] ?>">
<?= $this->a('#'.$this->e($task['id']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', t('View this task')) ?>
@@ -53,4 +53,4 @@
<?php endforeach ?>
</table>
<?= $this->paginate($pagination) ?>
<?= $paginator ?>

View File

@@ -7,22 +7,22 @@
<?php endif ?>
</div>
<section>
<?php if (empty($users)): ?>
<?php if ($paginator->isEmpty()): ?>
<p class="alert"><?= t('No user') ?></p>
<?php else: ?>
<table>
<tr>
<th><?= $this->order(t('Id'), 'id', $pagination) ?></th>
<th><?= $this->order(t('Username'), 'username', $pagination) ?></th>
<th><?= $this->order(t('Name'), 'name', $pagination) ?></th>
<th><?= $this->order(t('Email'), 'email', $pagination) ?></th>
<th><?= $this->order(t('Administrator'), 'is_admin', $pagination) ?></th>
<th><?= $this->order(t('Default project'), 'default_project_id', $pagination) ?></th>
<th><?= $this->order(t('Notifications'), 'notifications_enabled', $pagination) ?></th>
<th><?= $paginator->order(t('Id'), 'id') ?></th>
<th><?= $paginator->order(t('Username'), 'username') ?></th>
<th><?= $paginator->order(t('Name'), 'name') ?></th>
<th><?= $paginator->order(t('Email'), 'email') ?></th>
<th><?= $paginator->order(t('Administrator'), 'is_admin') ?></th>
<th><?= $paginator->order(t('Default project'), 'default_project_id') ?></th>
<th><?= $paginator->order(t('Notifications'), 'notifications_enabled') ?></th>
<th><?= t('External accounts') ?></th>
<th><?= $this->order(t('Account type'), 'is_ldap_user', $pagination) ?></th>
<th><?= $paginator->order(t('Account type'), 'is_ldap_user') ?></th>
</tr>
<?php foreach ($users as $user): ?>
<?php foreach ($paginator->getCollection() as $user): ?>
<tr>
<td>
<?= $this->a('#'.$user['id'], 'user', 'show', array('user_id' => $user['id'])) ?>
@@ -66,7 +66,7 @@
<?php endforeach ?>
</table>
<?= $this->paginate($pagination) ?>
<?= $paginator ?>
<?php endif ?>
</section>
</section>