Template helpers refactoring

This commit is contained in:
Frédéric Guillot
2014-12-28 11:28:50 -05:00
parent 88d84073ae
commit 34d7450d3c
155 changed files with 1605 additions and 1609 deletions

View File

@@ -1,26 +1,26 @@
<section id="main">
<div class="page-header">
<ul>
<?php if (Helper\is_admin()): ?>
<li><i class="fa fa-plus fa-fw"></i><?= Helper\a(t('New project'), 'project', 'create') ?></li>
<?php if ($this->acl->isAdminUser()): ?>
<li><i class="fa fa-plus fa-fw"></i><?= $this->a(t('New project'), 'project', 'create') ?></li>
<?php endif ?>
<li><i class="fa fa-lock fa-fw"></i><?= Helper\a(t('New private project'), 'project', 'create', array('private' => 1)) ?></li>
<li><i class="fa fa-folder fa-fw"></i><?= Helper\a(t('Project management'), 'project', 'index') ?></li>
<?php if (Helper\is_admin()): ?>
<li><i class="fa fa-user fa-fw"></i><?= Helper\a(t('User management'), 'user', 'index') ?></li>
<li><i class="fa fa-cog fa-fw"></i><?= Helper\a(t('Settings'), 'config', 'index') ?></li>
<li><i class="fa fa-lock fa-fw"></i><?= $this->a(t('New private project'), 'project', 'create', array('private' => 1)) ?></li>
<li><i class="fa fa-folder fa-fw"></i><?= $this->a(t('Project management'), 'project', 'index') ?></li>
<?php if ($this->acl->isAdminUser()): ?>
<li><i class="fa fa-user fa-fw"></i><?= $this->a(t('User management'), 'user', 'index') ?></li>
<li><i class="fa fa-cog fa-fw"></i><?= $this->a(t('Settings'), 'config', 'index') ?></li>
<?php endif ?>
</ul>
</div>
<section id="dashboard">
<div class="dashboard-left-column">
<?= Helper\Template('app/projects', array('projects' => $projects, 'pagination' => $project_pagination)) ?>
<?= Helper\Template('app/tasks', array('tasks' => $tasks, 'pagination' => $task_pagination)) ?>
<?= Helper\Template('app/subtasks', array('subtasks' => $subtasks, 'pagination' => $subtask_pagination)) ?>
<?= $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)) ?>
</div>
<div class="dashboard-right-column">
<h2><?= t('Activity stream') ?></h2>
<?= Helper\template('project/events', array('events' => $events)) ?>
<?= $this->render('project/events', array('events' => $events)) ?>
</div>
</section>
</section>

View File

@@ -4,30 +4,30 @@
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-8"><?= Helper\order('Id', 'id', $pagination) ?></th>
<th class="column-20"><?= Helper\order(t('Project'), 'name', $pagination) ?></th>
<th class="column-8"><?= $this->order('Id', 'id', $pagination) ?></th>
<th class="column-20"><?= $this->order(t('Project'), 'name', $pagination) ?></th>
<th><?= t('Columns') ?></th>
</tr>
<?php foreach ($projects as $project): ?>
<tr>
<td>
<?= Helper\a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?>
<?= $this->a('#'.$project['id'], 'board', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link') ?>
</td>
<td>
<?php if (Helper\is_project_admin($project)): ?>
<?= Helper\a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?>&nbsp;
<?php if ($this->projectPermission->adminAllowed($project['id'], $this->acl->getUserId())): ?>
<?= $this->a('<i class="fa fa-cog"></i>', 'project', 'show', array('project_id' => $project['id']), false, 'dashboard-table-link', t('Settings')) ?>&nbsp;
<?php endif ?>
<?= Helper\a(Helper\escape($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?>
<?= $this->a($this->e($project['name']), 'board', 'show', array('project_id' => $project['id'])) ?>
</td>
<td class="dashboard-project-stats">
<?php foreach ($project['columns'] as $column): ?>
<strong title="<?= t('Task count') ?>"><?= $column['nb_tasks'] ?></strong>
<span><?= Helper\escape($column['title']) ?></span>
<span><?= $this->e($column['title']) ?></span>
<?php endforeach ?>
</td>
</tr>
<?php endforeach ?>
</table>
<?= Helper\paginate($pagination) ?>
<?= $this->paginate($pagination) ?>
<?php endif ?>

View File

@@ -4,28 +4,28 @@
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-10"><?= Helper\order('Id', 'tasks.id', $pagination) ?></th>
<th class="column-20"><?= Helper\order(t('Project'), 'project_name', $pagination) ?></th>
<th class="column-15"><?= Helper\order(t('Status'), 'status', $pagination) ?></th>
<th><?= Helper\order(t('Subtask'), 'title', $pagination) ?></th>
<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>
</tr>
<?php foreach ($subtasks as $subtask): ?>
<tr>
<td class="task-table task-<?= $subtask['color_id'] ?>">
<?= Helper\a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
<?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
</td>
<td>
<?= Helper\a(Helper\escape($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
<?= $this->a($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
</td>
<td>
<?= Helper\escape($subtask['status_name']) ?>
<?= $this->e($subtask['status_name']) ?>
</td>
<td>
<?= Helper\a(Helper\escape($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
<?= $this->a($this->e($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
</td>
</tr>
<?php endforeach ?>
</table>
<?= Helper\paginate($pagination) ?>
<?= $this->paginate($pagination) ?>
<?php endif ?>

View File

@@ -4,21 +4,21 @@
<?php else: ?>
<table class="table-fixed">
<tr>
<th class="column-8"><?= Helper\order('Id', 'tasks.id', $pagination) ?></th>
<th class="column-20"><?= Helper\order(t('Project'), 'project_name', $pagination) ?></th>
<th><?= Helper\order(t('Task'), 'title', $pagination) ?></th>
<th class="column-20"><?= Helper\order(t('Due date'), 'date_due', $pagination) ?></th>
<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>
</tr>
<?php foreach ($tasks as $task): ?>
<tr>
<td class="task-table task-<?= $task['color_id'] ?>">
<?= Helper\a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'])) ?>
<?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'])) ?>
</td>
<td>
<?= Helper\a(Helper\escape($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?>
<?= $this->a($this->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?>
</td>
<td>
<?= Helper\a(Helper\escape($task['title']), 'task', 'show', array('task_id' => $task['id'])) ?>
<?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'])) ?>
</td>
<td>
<?= dt('%B %e, %Y', $task['date_due']) ?>
@@ -27,5 +27,5 @@
<?php endforeach ?>
</table>
<?= Helper\paginate($pagination) ?>
<?= $this->paginate($pagination) ?>
<?php endif ?>