Start templates cleanup and reorganisation

This commit is contained in:
Frédéric Guillot
2014-11-09 20:04:27 -05:00
parent e89ba5e9e6
commit 7eadf7cfd8
28 changed files with 182 additions and 195 deletions

View File

@@ -0,0 +1,21 @@
<section id="main">
<section>
<h3><?= t('Change assignee for the task "%s"', $values['title']) ?></h3>
<form method="post" action="<?= Helper\u('board', 'updateAssignee', array('task_id' => $values['id'])) ?>">
<?= Helper\form_csrf() ?>
<?= Helper\form_hidden('id', $values) ?>
<?= Helper\form_hidden('project_id', $values) ?>
<?= Helper\form_label(t('Assignee'), 'owner_id') ?>
<?= Helper\form_select('owner_id', $users_list, $values) ?><br/>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
<?= Helper\a(t('cancel'), 'board', 'show', array('project_id' => $project['id'])) ?>
</div>
</form>
</section>
</section>

View File

@@ -0,0 +1,22 @@
<section id="main">
<section>
<h3><?= t('Change category for the task "%s"', $values['title']) ?></h3>
<form method="post" action="<?= Helper\u('board', 'updateCategory', array('task_id' => $values['id'])) ?>">
<?= Helper\form_csrf() ?>
<?= Helper\form_hidden('id', $values) ?>
<?= Helper\form_hidden('project_id', $values) ?>
<?= Helper\form_label(t('Category'), 'category_id') ?>
<?= Helper\form_select('category_id', $categories_list, $values) ?><br/>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
<?= Helper\a(t('cancel'), 'board', 'show', array('project_id' => $project['id'])) ?>
</div>
</form>
</section>
</section>

View File

@@ -0,0 +1,61 @@
<div class="page-header">
<h2><?= t('Edit the board for "%s"', $project['name']) ?></h2>
</div>
<section>
<h3><?= t('Change columns') ?></h3>
<form method="post" action="<?= Helper\u('board', 'update', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
<?php $i = 0; ?>
<table>
<tr>
<th><?= t('Position') ?></th>
<th><?= t('Column title') ?></th>
<th><?= t('Task limit') ?></th>
<th><?= t('Actions') ?></th>
</tr>
<?php foreach ($columns as $column): ?>
<tr>
<td><?= Helper\form_label(t('Column %d', ++$i), 'title['.$column['id'].']', array('title="column_id='.$column['id'].'"')) ?></td>
<td><?= Helper\form_text('title['.$column['id'].']', $values, $errors, array('required')) ?></td>
<td><?= Helper\form_number('task_limit['.$column['id'].']', $values, $errors, array('placeholder="'.t('limit').'"')) ?></td>
<td>
<ul>
<?php if ($column['position'] != 1): ?>
<li>
<?= Helper\a(t('Move Up'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?>
</li>
<?php endif ?>
<?php if ($column['position'] != count($columns)): ?>
<li>
<?= Helper\a(t('Move Down'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?>
</li>
<?php endif ?>
<li>
<?= Helper\a(t('Remove'), 'board', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>
</li>
</ul>
</td>
</tr>
<?php endforeach ?>
</table>
<div class="form-actions">
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/>
</div>
</form>
<h3><?= t('Add a new column') ?></h3>
<form method="post" action="<?= Helper\u('board', 'add', array('project_id' => $project['id'])) ?>" autocomplete="off">
<?= Helper\form_csrf() ?>
<?= Helper\form_hidden('project_id', $values) ?>
<?= Helper\form_label(t('Title'), 'title') ?>
<?= Helper\form_text('title', $values, $errors, array('required')) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Add this column') ?>" class="btn btn-blue"/>
</div>
</form>

View File

@@ -0,0 +1,35 @@
<div class="page-header">
<ul>
<li>
<?= t('Filter by user') ?>
<?= Helper\form_select('user_id', $users) ?>
</li>
<li>
<?= t('Filter by category') ?>
<?= Helper\form_select('category_id', $categories) ?>
</li>
<li>
<a href="#" id="filter-due-date"><?= t('Filter by due date') ?></a>
</li>
<li>
<i class="fa fa-search"></i>
<?= Helper\a(t('Search'), 'project', 'search', array('project_id' => $project['id'])) ?>
</li>
<li>
<i class="fa fa-check-square-o fa-fw"></i>
<?= Helper\a(t('Completed tasks'), 'project', 'tasks', array('project_id' => $project['id'])) ?>
</li>
<li>
<i class="fa fa-dashboard fa-fw"></i>
<?= Helper\a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?>
</li>
<li>
<i class="fa fa-line-chart fa-fw"></i>
<?= Helper\a(t('Analytics'), 'analytic', 'repartition', array('project_id' => $project['id'])) ?>
</li>
<?php if (Helper\is_admin()): ?>
<li><i class="fa fa-cog fa-fw"></i>
<?= Helper\a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?>
<?php endif ?>
</ul>
</div>

View File

@@ -0,0 +1,21 @@
<section id="main">
<?= Helper\template('board/filters', array(
'categories' => $categories,
'users' => $users,
'project' => $project,
)) ?>
<?php if (empty($board)): ?>
<p class="alert alert-error"><?= t('There is no column in your project!') ?></p>
<?php else: ?>
<?= Helper\template('board/show', array(
'project' => $project,
'board' => $board,
'categories' => $categories,
'board_private_refresh_interval' => $board_private_refresh_interval,
'board_highlight_period' => $board_highlight_period,
)) ?>
<?php endif ?>
</section>

View File

@@ -0,0 +1,15 @@
<div class="page-header">
<h2><?= t('Remove a column') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info">
<?= t('Do you really want to remove this column: "%s"?', $column['title']) ?>
<?= t('This action will REMOVE ALL TASKS associated to this column!') ?>
</p>
<div class="form-actions">
<?= Helper\a(t('Yes'), 'board', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'], 'remove' => 'yes'), true, 'btn btn-red') ?>
<?= t('or') ?> <?= Helper\a(t('cancel'), 'board', 'edit', array('project_id' => $project['id'])) ?>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<section id="main" class="public-board">
<?php if (empty($columns)): ?>
<p class="alert alert-error"><?= t('There is no column in your project!') ?></p>
<?php else: ?>
<table id="board">
<tr>
<?php $column_with = round(100 / count($columns), 2); ?>
<?php foreach ($columns as $column): ?>
<th width="<?= $column_with ?>%">
<?= Helper\escape($column['title']) ?>
<?php if ($column['task_limit']): ?>
<span title="<?= t('Task limit') ?>" class="task-limit">(<?= Helper\escape(count($column['tasks']).'/'.$column['task_limit']) ?>)</span>
<?php endif ?>
</th>
<?php endforeach ?>
</tr>
<tr>
<?php foreach ($columns as $column): ?>
<td class="column <?= $column['task_limit'] && count($column['tasks']) > $column['task_limit'] ? 'task-limit-warning' : '' ?>">
<?php foreach ($column['tasks'] as $task): ?>
<div class="task-board task-<?= $task['color_id'] ?>">
<?= Helper\template('board/task', array('task' => $task, 'categories' => $categories, 'not_editable' => true, 'project' => $project)) ?>
</div>
<?php endforeach ?>
</td>
<?php endforeach ?>
</tr>
</table>
<?php endif ?>
</section>

View File

@@ -0,0 +1,51 @@
<table id="board"
data-project-id="<?= $project['id'] ?>"
data-check-interval="<?= $board_private_refresh_interval ?>"
data-save-url="<?= Helper\u('board', 'save', array('project_id' => $project['id'])) ?>"
data-check-url="<?= Helper\u('board', 'check', array('project_id' => $project['id'], 'timestamp' => time())) ?>"
>
<tr>
<?php $column_with = round(100 / count($board), 2); ?>
<?php foreach ($board as $column): ?>
<th width="<?= $column_with ?>%">
<div class="board-add-icon">
<?= Helper\a('+', 'task', 'create', array('project_id' => $column['project_id'], 'column_id' => $column['id']), false, '', t('Add a new task')) ?>
</div>
<?= Helper\escape($column['title']) ?>
<?php if ($column['task_limit']): ?>
<span title="<?= t('Task limit') ?>" class="task-limit">
(<span id="task-number-column-<?= $column['id'] ?>"><?= count($column['tasks']) ?></span>/<?= Helper\escape($column['task_limit']) ?>)
</span>
<?php else: ?>
<span title="<?= t('Task count') ?>" class="task-count">
(<span id="task-number-column-<?= $column['id'] ?>"><?= count($column['tasks']) ?></span>)
</span>
<?php endif ?>
</th>
<?php endforeach ?>
</tr>
<tr>
<?php foreach ($board as $column): ?>
<td
id="column-<?= $column['id'] ?>"
class="column <?= $column['task_limit'] && count($column['tasks']) > $column['task_limit'] ? 'task-limit-warning' : '' ?>"
data-column-id="<?= $column['id'] ?>"
data-task-limit="<?= $column['task_limit'] ?>"
>
<?php foreach ($column['tasks'] as $task): ?>
<div class="task-board draggable-item task-<?= $task['color_id'] ?> <?= $task['date_modification'] > time() - $board_highlight_period ? 'task-board-recent' : '' ?>"
data-task-id="<?= $task['id'] ?>"
data-owner-id="<?= $task['owner_id'] ?>"
data-category-id="<?= $task['category_id'] ?>"
data-due-date="<?= $task['date_due'] ?>"
data-task-url="<?= Helper\u('task', 'show', array('task_id' => $task['id'])) ?>"
title="<?= t('View this task') ?>">
<?= Helper\template('board/task', array('task' => $task, 'categories' => $categories)) ?>
</div>
<?php endforeach ?>
</td>
<?php endforeach ?>
</tr>
</table>

115
app/Template/board/task.php Normal file
View File

@@ -0,0 +1,115 @@
<?php if (isset($not_editable)): ?>
<?= Helper\a('#'.$task['id'], 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?>
<?php if ($task['reference']): ?>
<span class="task-board-reference" title="<?= t('Reference') ?>">
(<?= $task['reference'] ?>)
</span>
<?php endif ?>
&nbsp;-&nbsp;
<span class="task-board-user">
<?php if (! empty($task['owner_id'])): ?>
<?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?>
<?php else: ?>
<span class="task-board-nobody"><?= t('Nobody assigned') ?></span>
<?php endif ?>
</span>
<?php if ($task['score']): ?>
<span class="task-score"><?= Helper\escape($task['score']) ?></span>
<?php endif ?>
<div class="task-board-title">
<?= Helper\a(Helper\escape($task['title']), 'task', 'readonly', array('task_id' => $task['id'], 'token' => $project['token'])) ?>
</div>
<?php else: ?>
<?= Helper\a('#'.$task['id'], 'task', 'edit', array('task_id' => $task['id']), false, 'task-edit-popover', t('Edit this task')) ?>
<?php if ($task['reference']): ?>
<span class="task-board-reference" title="<?= t('Reference') ?>">
(<?= $task['reference'] ?>)
</span>
<?php endif ?>
&nbsp;-&nbsp;
<span class="task-board-user">
<?= Helper\a(
! empty($task['owner_id']) ? t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) : t('Nobody assigned'),
'board',
'changeAssignee',
array('task_id' => $task['id']),
false,
'assignee-popover',
t('Change assignee')
) ?>
</span>
<?php if ($task['score']): ?>
<span class="task-score"><?= Helper\escape($task['score']) ?></span>
<?php endif ?>
<div class="task-board-title">
<?= Helper\a(Helper\escape($task['title']), 'task', 'show', array('task_id' => $task['id']), false, '', t('View this task')) ?>
</div>
<?php endif ?>
<?php if ($task['category_id']): ?>
<div class="task-board-category-container">
<span class="task-board-category">
<?= Helper\a(
Helper\in_list($task['category_id'], $categories),
'board',
'changeCategory',
array('task_id' => $task['id']),
false,
'category-popover',
t('Change category')
) ?>
</span>
</div>
<?php endif ?>
<?php if (! empty($task['date_due']) || ! empty($task['nb_files']) || ! empty($task['nb_comments']) || ! empty($task['description']) || ! empty($task['nb_subtasks'])): ?>
<div class="task-board-footer">
<?php if (! empty($task['date_due'])): ?>
<div class="task-board-date <?= time() > $task['date_due'] ? 'task-board-date-overdue' : '' ?>">
<?= dt('%B %e, %Y', $task['date_due']) ?>
</div>
<?php endif ?>
<div class="task-board-icons">
<?php if (! empty($task['nb_subtasks'])): ?>
<span title="<?= t('Sub-Tasks') ?>"><?= $task['nb_completed_subtasks'].'/'.$task['nb_subtasks'] ?> <i class="fa fa-bars"></i></span>
<?php endif ?>
<?php if (! empty($task['nb_files'])): ?>
<span title="<?= t('Attachments') ?>"><?= $task['nb_files'] ?> <i class="fa fa-paperclip"></i></span>
<?php endif ?>
<?php if (! empty($task['nb_comments'])): ?>
<span title="<?= p($task['nb_comments'], t('%d comment', $task['nb_comments']), t('%d comments', $task['nb_comments'])) ?>"><?= $task['nb_comments'] ?> <i class="fa fa-comment-o"></i></span>
<?php endif ?>
<?php if (! empty($task['description'])): ?>
<span title="<?= t('Description') ?>">
<?php if (! isset($not_editable)): ?>
<a class="task-description-popover" href="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>"><i class="fa fa-file-text-o" data-href="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>"></i></a>
<?php else: ?>
<i class="fa fa-file-text-o"></i>
<?php endif ?>
</span>
<?php endif ?>
</div>
</div>
<?php endif ?>