Add story points for tasks

This commit is contained in:
Frédéric Guillot
2014-02-24 21:22:32 -05:00
parent 565290fbf9
commit 44fc9c081f
12 changed files with 65 additions and 2 deletions

View File

@@ -115,6 +115,7 @@ input[type="checkbox"] {
border: 1px solid #ccc; border: 1px solid #ccc;
} }
input[type="number"],
input[type="date"], input[type="date"],
input[type="email"], input[type="email"],
input[type="tel"], input[type="tel"],
@@ -130,6 +131,7 @@ input[type="text"] {
appearance: none; appearance: none;
} }
input[type="number"]:focus,
input[type="date"]:focus, input[type="date"]:focus,
input[type="email"]:focus, input[type="email"]:focus,
input[type="tel"]:focus, input[type="tel"]:focus,
@@ -142,6 +144,10 @@ textarea:focus {
box-shadow: 0 0 8px rgba(82, 168, 236, 0.6); box-shadow: 0 0 8px rgba(82, 168, 236, 0.6);
} }
input[type="number"] {
width: 50px;
}
textarea { textarea {
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 3px; padding: 3px;
@@ -494,11 +500,35 @@ div.task a:hover {
text-decoration: underline; text-decoration: underline;
} }
#infos,
div.task {
position: relative;
}
.task-score {
font-weight: bold;
position: absolute;
}
div.task .task-score {
font-size: 1.5em;
right: 5px;
top: 0;
}
/* task view */
article.task li { article.task li {
margin-left: 20px; margin-left: 20px;
list-style-type: square; list-style-type: square;
} }
article .task-score {
font-size: 1.9em;
right: 10px;
top: 5px;
}
/* task colors */
tr td.task-blue, tr td.task-blue,
.task-blue { .task-blue {
background-color: rgb(219, 235, 255); background-color: rgb(219, 235, 255);

View File

@@ -230,3 +230,8 @@ function form_date($name, $values = array(), array $errors = array(), array $att
{ {
return form_input('date', $name, $values, $errors, $attributes, $class); return form_input('date', $name, $values, $errors, $attributes, $class);
} }
function form_number($name, $values = array(), array $errors = array(), array $attributes = array(), $class = '')
{
return form_input('number', $name, $values, $errors, $attributes, $class);
}

View File

@@ -186,4 +186,5 @@ return array(
'Timezone' => 'Fuseau horaire', 'Timezone' => 'Fuseau horaire',
'Sorry, I didn\'t found this information in my database!' => 'Désolé, je n\'ai pas trouvé cette information dans ma base de données !', 'Sorry, I didn\'t found this information in my database!' => 'Désolé, je n\'ai pas trouvé cette information dans ma base de données !',
'Page not found' => 'Page introuvable', 'Page not found' => 'Page introuvable',
'Story Points' => 'Complexité',
); );

View File

@@ -186,4 +186,5 @@ return array(
'Timezone' => 'Strefa czasowa', 'Timezone' => 'Strefa czasowa',
//'Sorry, I didn\'t found this information in my database!' => '', //'Sorry, I didn\'t found this information in my database!' => '',
//'Page not found' => '', //'Page not found' => '',
//'Story Points' => '',
); );

View File

@@ -17,7 +17,7 @@ require __DIR__.'/schema.php';
abstract class Base abstract class Base
{ {
const APP_VERSION = 'master'; const APP_VERSION = 'master';
const DB_VERSION = 4; const DB_VERSION = 5;
const DB_FILENAME = 'data/db.sqlite'; const DB_FILENAME = 'data/db.sqlite';
private static $dbInstance = null; private static $dbInstance = null;

View File

@@ -2,6 +2,11 @@
namespace Schema; namespace Schema;
function version_5($pdo)
{
$pdo->exec("ALTER TABLE tasks ADD column score INTEGER");
}
function version_4($pdo) function version_4($pdo)
{ {
$pdo->exec("ALTER TABLE config ADD column timezone TEXT DEFAULT 'UTC'"); $pdo->exec("ALTER TABLE config ADD column timezone TEXT DEFAULT 'UTC'");

View File

@@ -40,6 +40,7 @@ class Task extends Base
self::TABLE.'.owner_id', self::TABLE.'.owner_id',
self::TABLE.'.position', self::TABLE.'.position',
self::TABLE.'.is_active', self::TABLE.'.is_active',
self::TABLE.'.score',
\Model\Project::TABLE.'.name AS project_name', \Model\Project::TABLE.'.name AS project_name',
\Model\Board::TABLE.'.title AS column_title', \Model\Board::TABLE.'.title AS column_title',
\Model\User::TABLE.'.username' \Model\User::TABLE.'.username'
@@ -71,6 +72,7 @@ class Task extends Base
self::TABLE.'.owner_id', self::TABLE.'.owner_id',
self::TABLE.'.position', self::TABLE.'.position',
self::TABLE.'.is_active', self::TABLE.'.is_active',
self::TABLE.'.score',
\Model\Board::TABLE.'.title AS column_title', \Model\Board::TABLE.'.title AS column_title',
\Model\User::TABLE.'.username' \Model\User::TABLE.'.username'
) )
@@ -95,7 +97,7 @@ class Task extends Base
{ {
return $this->db return $this->db
->table(self::TABLE) ->table(self::TABLE)
->columns('tasks.id', 'title', 'color_id', 'project_id', 'owner_id', 'column_id', 'position', 'users.username') ->columns('tasks.id', 'title', 'color_id', 'project_id', 'owner_id', 'column_id', 'position', 'score', 'users.username')
->join('users', 'id', 'owner_id') ->join('users', 'id', 'owner_id')
->eq('project_id', $project_id) ->eq('project_id', $project_id)
->eq('column_id', $column_id) ->eq('column_id', $column_id)
@@ -179,6 +181,7 @@ class Task extends Base
new Validators\Required('column_id', t('The column is required')), new Validators\Required('column_id', t('The column is required')),
new Validators\Integer('column_id', t('This value must be an integer')), new Validators\Integer('column_id', t('This value must be an integer')),
new Validators\Integer('owner_id', t('This value must be an integer')), new Validators\Integer('owner_id', t('This value must be an integer')),
new Validators\Integer('score', t('This value must be an integer')),
new Validators\Required('title', t('The title is required')), new Validators\Required('title', t('The title is required')),
new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200), new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200),
)); ));
@@ -200,6 +203,7 @@ class Task extends Base
new Validators\Required('column_id', t('The column is required')), new Validators\Required('column_id', t('The column is required')),
new Validators\Integer('column_id', t('This value must be an integer')), new Validators\Integer('column_id', t('This value must be an integer')),
new Validators\Integer('owner_id', t('This value must be an integer')), new Validators\Integer('owner_id', t('This value must be an integer')),
new Validators\Integer('score', t('This value must be an integer')),
new Validators\Required('title', t('The title is required')), new Validators\Required('title', t('The title is required')),
new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200), new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200),
)); ));

View File

@@ -52,6 +52,10 @@
<?php endif ?> <?php endif ?>
</span> </span>
<?php if ($task['score']): ?>
<span class="task-score"><?= Helper\escape($task['score']) ?></span>
<?php endif ?>
<div class="task-title"> <div class="task-title">
<?= Helper\escape($task['title']) ?> <?= Helper\escape($task['title']) ?>
</div> </div>

View File

@@ -29,6 +29,10 @@
<?php endif ?> <?php endif ?>
</span> </span>
<?php if ($task['score']): ?>
<span class="task-score"><?= Helper\escape($task['score']) ?></span>
<?php endif ?>
<div class="task-title"> <div class="task-title">
<?= Helper\escape($task['title']) ?> <?= Helper\escape($task['title']) ?>
</div> </div>

View File

@@ -20,6 +20,9 @@
<?= Helper\form_label(t('Assignee'), 'owner_id') ?> <?= Helper\form_label(t('Assignee'), 'owner_id') ?>
<?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/> <?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Story Points'), 'score') ?>
<?= Helper\form_number('score', $values, $errors) ?><br/>
<?= Helper\form_label(t('Description'), 'description') ?> <?= Helper\form_label(t('Description'), 'description') ?>
<?= Helper\form_textarea('description', $values, $errors) ?><br/> <?= Helper\form_textarea('description', $values, $errors) ?><br/>

View File

@@ -20,6 +20,9 @@
<?= Helper\form_label(t('Assignee'), 'owner_id') ?> <?= Helper\form_label(t('Assignee'), 'owner_id') ?>
<?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/> <?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/>
<?= Helper\form_label(t('Story Points'), 'score') ?>
<?= Helper\form_number('score', $values, $errors) ?><br/>
<?= Helper\form_label(t('Description'), 'description') ?> <?= Helper\form_label(t('Description'), 'description') ?>
<?= Helper\form_textarea('description', $values, $errors) ?><br/> <?= Helper\form_textarea('description', $values, $errors) ?><br/>

View File

@@ -8,6 +8,9 @@
<section> <section>
<h3><?= t('Details') ?></h3> <h3><?= t('Details') ?></h3>
<article id="infos" class="task task-<?= $task['color_id'] ?>"> <article id="infos" class="task task-<?= $task['color_id'] ?>">
<?php if ($task['score']): ?>
<span class="task-score"><?= Helper\escape($task['score']) ?></span>
<?php endif ?>
<ul> <ul>
<li> <li>
<?= dt('Created on %B %e, %G at %k:%M %p', $task['date_creation']) ?> <?= dt('Created on %B %e, %G at %k:%M %p', $task['date_creation']) ?>