Add column description (merge/change pull-request #549)
This commit is contained in:
parent
b42830e77d
commit
40ca850707
|
|
@ -148,8 +148,8 @@ Contributors:
|
|||
|
||||
- Alex Butum
|
||||
- [Aleix Pol](https://github.com/aleixpol)
|
||||
- [Ashish Kulkarni](https://github.com/ashkulz)
|
||||
- [Ashbike](https://github.com/ashbike)
|
||||
- [Ashish Kulkarni](https://github.com/ashkulz)
|
||||
- [Chorgroup](https://github.com/chorgroup)
|
||||
- Claudio Lobo
|
||||
- [Cluxter](https://github.com/cluxter)
|
||||
|
|
|
|||
|
|
@ -205,6 +205,7 @@ class Board extends Base
|
|||
|
||||
foreach ($columns as $column) {
|
||||
$values['title['.$column['id'].']'] = $column['title'];
|
||||
$values['description['.$column['id'].']'] = $column['description'];
|
||||
$values['task_limit['.$column['id'].']'] = $column['task_limit'] ?: null;
|
||||
}
|
||||
|
||||
|
|
@ -218,28 +219,39 @@ class Board extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate and update a board
|
||||
* Display a form to edit a board
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function update()
|
||||
public function editColumn(array $values = array(), array $errors = array())
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$columns = $this->board->getColumns($project['id']);
|
||||
$data = $this->request->getValues();
|
||||
$values = $columns_list = array();
|
||||
$column = $this->board->getColumn($this->request->getIntegerParam('column_id'));
|
||||
|
||||
foreach ($columns as $column) {
|
||||
$columns_list[$column['id']] = $column['title'];
|
||||
$values['title['.$column['id'].']'] = isset($data['title'][$column['id']]) ? $data['title'][$column['id']] : '';
|
||||
$values['task_limit['.$column['id'].']'] = isset($data['task_limit'][$column['id']]) ? $data['task_limit'][$column['id']] : 0;
|
||||
}
|
||||
$this->response->html($this->projectLayout('board/edit_column', array(
|
||||
'errors' => $errors,
|
||||
'values' => $values ?: $column,
|
||||
'project' => $project,
|
||||
'column' => $column,
|
||||
'title' => t('Edit column "%s"', $column['title'])
|
||||
)));
|
||||
}
|
||||
|
||||
list($valid, $errors) = $this->board->validateModification($columns_list, $values);
|
||||
/**
|
||||
* Validate and update a column
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function updateColumn()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$values = $this->request->getValues();
|
||||
|
||||
list($valid, $errors) = $this->board->validateModification($values);
|
||||
|
||||
if ($valid) {
|
||||
|
||||
if ($this->board->update($data)) {
|
||||
if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
|
||||
$this->session->flash(t('Board updated successfully.'));
|
||||
$this->response->redirect('?controller=board&action=edit&project_id='.$project['id']);
|
||||
}
|
||||
|
|
@ -248,7 +260,7 @@ class Board extends Base
|
|||
}
|
||||
}
|
||||
|
||||
$this->edit($values, $errors);
|
||||
$this->editcolumn($values, $errors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -271,7 +283,7 @@ class Board extends Base
|
|||
|
||||
if ($valid) {
|
||||
|
||||
if ($this->board->addColumn($project['id'], $data['title'])) {
|
||||
if ($this->board->addColumn($project['id'], $data['title'],$data['description'])) {
|
||||
$this->session->flash(t('Board updated successfully.'));
|
||||
$this->response->redirect('?controller=board&action=edit&project_id='.$project['id']);
|
||||
}
|
||||
|
|
@ -449,7 +461,7 @@ class Board extends Base
|
|||
}
|
||||
|
||||
/**
|
||||
* Display the description
|
||||
* Display task description
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Acl extends Base
|
|||
private $manager_acl = array(
|
||||
'action' => '*',
|
||||
'analytic' => '*',
|
||||
'board' => array('movecolumn', 'edit', 'update', 'add', 'remove'),
|
||||
'board' => array('movecolumn', 'edit', 'editcolumn', 'updatecolumn', 'add', 'remove'),
|
||||
'category' => '*',
|
||||
'export' => array('tasks', 'subtasks', 'summary'),
|
||||
'project' => array('edit', 'update', 'share', 'integration', 'users', 'alloweverybody', 'allow', 'setowner', 'revoke', 'duplicate', 'disable', 'enable'),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Board extends Base
|
|||
$column_name = trim($column_name);
|
||||
|
||||
if (! empty($column_name)) {
|
||||
$columns[] = array('title' => $column_name, 'task_limit' => 0);
|
||||
$columns[] = array('title' => $column_name, 'task_limit' => 0, 'description' => '');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +73,7 @@ class Board extends Base
|
|||
'position' => ++$position,
|
||||
'project_id' => $project_id,
|
||||
'task_limit' => $column['task_limit'],
|
||||
'description' => $column['description'],
|
||||
);
|
||||
|
||||
if (! $this->db->table(self::TABLE)->save($values)) {
|
||||
|
|
@ -94,7 +95,7 @@ class Board extends Base
|
|||
public function duplicate($project_from, $project_to)
|
||||
{
|
||||
$columns = $this->db->table(Board::TABLE)
|
||||
->columns('title', 'task_limit')
|
||||
->columns('title', 'task_limit', 'description')
|
||||
->eq('project_id', $project_from)
|
||||
->asc('position')
|
||||
->findAll();
|
||||
|
|
@ -109,48 +110,22 @@ class Board extends Base
|
|||
* @param integer $project_id Project id
|
||||
* @param string $title Column title
|
||||
* @param integer $task_limit Task limit
|
||||
* @param string $description Column description
|
||||
* @return boolean|integer
|
||||
*/
|
||||
public function addColumn($project_id, $title, $task_limit = 0)
|
||||
public function addColumn($project_id, $title, $task_limit = 0, $description = '')
|
||||
{
|
||||
$values = array(
|
||||
'project_id' => $project_id,
|
||||
'title' => $title,
|
||||
'task_limit' => $task_limit,
|
||||
'position' => $this->getLastColumnPosition($project_id) + 1,
|
||||
'description' => $description,
|
||||
);
|
||||
|
||||
return $this->persist(self::TABLE, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update columns
|
||||
*
|
||||
* @access public
|
||||
* @param array $values Form values
|
||||
* @return boolean
|
||||
*/
|
||||
public function update(array $values)
|
||||
{
|
||||
$columns = array();
|
||||
|
||||
foreach (array('title', 'task_limit') as $field) {
|
||||
foreach ($values[$field] as $column_id => $value) {
|
||||
$columns[$column_id][$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->startTransaction();
|
||||
|
||||
foreach ($columns as $column_id => $values) {
|
||||
$this->updateColumn($column_id, $values['title'], (int) $values['task_limit']);
|
||||
}
|
||||
|
||||
$this->db->closeTransaction();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a column
|
||||
*
|
||||
|
|
@ -158,13 +133,15 @@ class Board extends Base
|
|||
* @param integer $column_id Column id
|
||||
* @param string $title Column title
|
||||
* @param integer $task_limit Task limit
|
||||
* @param string $description Optional description
|
||||
* @return boolean
|
||||
*/
|
||||
public function updateColumn($column_id, $title, $task_limit = 0)
|
||||
public function updateColumn($column_id, $title, $task_limit = 0, $description = '')
|
||||
{
|
||||
return $this->db->table(self::TABLE)->eq('id', $column_id)->update(array(
|
||||
'title' => $title,
|
||||
'task_limit' => $task_limit,
|
||||
'description' => $description,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -369,22 +346,16 @@ class Board extends Base
|
|||
* Validate column modification
|
||||
*
|
||||
* @access public
|
||||
* @param array $columns Original columns List
|
||||
* @param array $values Required parameters to update a column
|
||||
* @return array $valid, $errors [0] = Success or not, [1] = List of errors
|
||||
*/
|
||||
public function validateModification(array $columns, array $values)
|
||||
public function validateModification(array $values)
|
||||
{
|
||||
$rules = array();
|
||||
|
||||
foreach ($columns as $column_id => $column_title) {
|
||||
$rules[] = new Validators\Integer('task_limit['.$column_id.']', t('This value must be an integer'));
|
||||
$rules[] = new Validators\GreaterThan('task_limit['.$column_id.']', t('This value must be greater than %d', 0), 0);
|
||||
$rules[] = new Validators\Required('title['.$column_id.']', t('The title is required'));
|
||||
$rules[] = new Validators\MaxLength('title['.$column_id.']', t('The maximum length is %d characters', 50), 50);
|
||||
}
|
||||
|
||||
$v = new Validator($values, $rules);
|
||||
$v = new Validator($values, array(
|
||||
new Validators\Integer('task_limit', t('This value must be an integer')),
|
||||
new Validators\Required('title', t('The title is required')),
|
||||
new Validators\MaxLength('title', t('The maximum length is %d characters', 50), 50),
|
||||
));
|
||||
|
||||
return array(
|
||||
$v->execute(),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,12 @@ namespace Schema;
|
|||
use PDO;
|
||||
use Core\Security;
|
||||
|
||||
const VERSION = 41;
|
||||
const VERSION = 42;
|
||||
|
||||
function version_42($pdo)
|
||||
{
|
||||
$pdo->exec('ALTER TABLE columns ADD COLUMN description TEXT');
|
||||
}
|
||||
|
||||
function version_41($pdo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,12 @@ namespace Schema;
|
|||
use PDO;
|
||||
use Core\Security;
|
||||
|
||||
const VERSION = 22;
|
||||
const VERSION = 23;
|
||||
|
||||
function version_23($pdo)
|
||||
{
|
||||
$pdo->exec('ALTER TABLE columns ADD COLUMN description TEXT');
|
||||
}
|
||||
|
||||
function version_22($pdo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,12 @@ namespace Schema;
|
|||
use Core\Security;
|
||||
use PDO;
|
||||
|
||||
const VERSION = 40;
|
||||
const VERSION = 41;
|
||||
|
||||
function version_41($pdo)
|
||||
{
|
||||
$pdo->exec('ALTER TABLE columns ADD COLUMN description TEXT');
|
||||
}
|
||||
|
||||
function version_40($pdo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,50 +1,44 @@
|
|||
<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="<?= $this->u('board', 'update', array('project_id' => $project['id'])) ?>" autocomplete="off">
|
||||
<?= $this->formCsrf() ?>
|
||||
<?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><?= $this->formLabel('#'.++$i, 'title['.$column['id'].']', array('title="column_id='.$column['id'].'"')) ?></td>
|
||||
<td><?= $this->formText('title['.$column['id'].']', $values, $errors, array('required', 'maxlength="50"')) ?></td>
|
||||
<td><?= $this->formNumber('task_limit['.$column['id'].']', $values, $errors, array('placeholder="'.t('limit').'"')) ?></td>
|
||||
<td>
|
||||
<ul>
|
||||
<?php if ($column['position'] != 1): ?>
|
||||
<li>
|
||||
<?= $this->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>
|
||||
<?= $this->a(t('Move Down'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<li>
|
||||
<?= $this->a(t('Remove'), 'board', 'remove', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<th><?= t('Column title') ?></th>
|
||||
<th><?= t('Description') ?></th>
|
||||
<th><?= t('Task limit') ?></th>
|
||||
<th><?= t('Actions') ?></th>
|
||||
</tr>
|
||||
<?php foreach ($columns as $column): ?>
|
||||
<tr>
|
||||
<td class="column-30"><?= $this->e($column['title']) ?></td>
|
||||
<td><?= $this->e($column['description']) ?></td>
|
||||
<td class="column-10"><?= $this->e($column['task_limit']) ?></td>
|
||||
<td class="column-20">
|
||||
<ul>
|
||||
<li>
|
||||
<?= $this->a(t('Edit'), 'board', 'editColumn', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>
|
||||
</li>
|
||||
<?php if ($column['position'] != 1): ?>
|
||||
<li>
|
||||
<?= $this->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>
|
||||
<?= $this->a(t('Move Down'), 'board', 'moveColumn', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<li>
|
||||
<?= $this->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>
|
||||
<hr/>
|
||||
<h3><?= t('Add a new column') ?></h3>
|
||||
<form method="post" action="<?= $this->u('board', 'add', array('project_id' => $project['id'])) ?>" autocomplete="off">
|
||||
|
||||
|
|
@ -54,6 +48,9 @@
|
|||
|
||||
<?= $this->formLabel(t('Title'), 'title') ?>
|
||||
<?= $this->formText('title', $values, $errors, array('required', 'maxlength="50"')) ?>
|
||||
<?= $this->formLabel(t('Description'), 'description') ?>
|
||||
<?= $this->formTextarea('description', $values, $errors) ?>
|
||||
<div class="form-help"><a href="http://kanboard.net/documentation/syntax-guide" target="_blank" rel="noreferrer"><?= t('Write your text in Markdown') ?></a></div>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Add this column') ?>" class="btn btn-blue"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<div class="page-header">
|
||||
<h2><?= t('Edit column "%s"', $column['title']) ?></h2>
|
||||
</div>
|
||||
|
||||
<form method="post" action="<?= $this->u('board', 'updateColumn', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>" autocomplete="off">
|
||||
|
||||
<?= $this->formCsrf() ?>
|
||||
|
||||
<?= $this->formHidden('id', $values) ?>
|
||||
<?= $this->formHidden('project_id', $values) ?>
|
||||
|
||||
<?= $this->formLabel(t('Title'), 'title') ?>
|
||||
<?= $this->formText('title', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?>
|
||||
|
||||
<?= $this->formLabel(t('Task limit'), 'task_limit') ?>
|
||||
<?= $this->formNumber('task_limit', $values, $errors) ?>
|
||||
|
||||
<?= $this->formLabel(t('Description'), 'description') ?>
|
||||
<?= $this->formTextarea('description', $values, $errors) ?>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -25,8 +25,14 @@
|
|||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?= $this->e($column['title']) ?>
|
||||
|
||||
<?php if (! empty($column['description'])): ?>
|
||||
<span class="column-tooltip" title="<?= $this->e($column['description']) ?>">
|
||||
<?= $this->e($column['title']) ?>
|
||||
</span>
|
||||
<?php else: ?>
|
||||
<?= $this->e($column['title']) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($column['task_limit']): ?>
|
||||
<span title="<?= t('Task limit') ?>" class="task-limit">
|
||||
(<span id="task-number-column-<?= $column['id'] ?>"><?= $column['nb_tasks'] ?></span>/<?= $this->e($column['task_limit']) ?>)
|
||||
|
|
|
|||
|
|
@ -41,13 +41,15 @@
|
|||
</div>
|
||||
<table class="table-stripped">
|
||||
<tr>
|
||||
<th width="50%"><?= t('Column') ?></th>
|
||||
<th><?= t('Task limit') ?></th>
|
||||
<th><?= t('Active tasks') ?></th>
|
||||
<th class="column-30"><?= t('Column') ?></th>
|
||||
<th><?= t('Description') ?></th>
|
||||
<th class="column-20"><?= t('Task limit') ?></th>
|
||||
<th class="column-20"><?= t('Active tasks') ?></th>
|
||||
</tr>
|
||||
<?php foreach ($stats['columns'] as $column): ?>
|
||||
<tr>
|
||||
<td><?= $this->e($column['title']) ?></td>
|
||||
<td><?= $this->e($column['description']) ?></td>
|
||||
<td><?= $column['task_limit'] ?: '∞' ?></td>
|
||||
<td><?= $column['nb_active_tasks'] ?></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ d.parent().addClass("form-tab-selected");e.find(".markdown").html(a);e.css("heig
|
|||
$("body").data("login-url")}}})},Init:function(){$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd",constrainInput:!1});$("#board-selector").chosen({width:180});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});$("#markdown-preview").click(Kanboard.MarkdownPreview);$("#markdown-write").click(Kanboard.MarkdownWriter);window.setInterval(Kanboard.CheckSession,6E4);$(".auto-select").focus(function(){$(this).select()});
|
||||
Mousetrap.bind("ctrl+enter",function(){$("form").submit()})}}}();
|
||||
Kanboard.Board=function(){function a(a){Kanboard.Popover(a,Kanboard.Init)}function d(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($(".task-creation-popover").attr("href"),Kanboard.Init)})}function c(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){e(b.item.attr("data-task-id"),b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$(".assignee-popover").click(Kanboard.Popover);
|
||||
$(".category-popover").click(Kanboard.Popover);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".task-board-tooltip").tooltip({track:!1,position:{my:"left-20 top",at:"center bottom+9",using:function(a,b){$(this).css(a);var c=b.target.left+b.target.width/2-b.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(b.vertical).addClass(0==c?"align-left":"align-right").appendTo(this)}},content:function(a){if(a=$(this).attr("data-href")){var b=
|
||||
this;$.get(a,function k(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var c=$(b).tooltip("option","position");c.of=$(b);a.position(c);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$.get($(this).attr("href"),k)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter",function(){var a=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout",
|
||||
function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var c=parseInt($("#board").attr("data-check-interval"));0<c&&(h=window.setInterval(b,1E3*c))}function f(){$("[data-task-url]").off();clearInterval(h)}function e(a,b,e,d){f();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json",
|
||||
type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:b,swimlane_id:d,position:e}),success:function(a){$("#board").remove();$("#main").append(a);c();g()}})}function b(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();$("#main").append(a);f();c();g()}}})}function g(){var a=$("#form-user_id").val(),b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),e=$("#board").data("project-id");
|
||||
$("[data-task-id]").each(function(e,d){var f=d.getAttribute("data-owner-id"),g=d.getAttribute("data-due-date"),h=d.getAttribute("data-category-id");d.style.opacity=f!=a&&-1!=a?"0.2":"1.0";!c||""!=g&&"0"!=g||(d.style.opacity="0.2");h!=b&&-1!=b&&(d.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+e+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+e+"_form-category_id",b);Kanboard.SetStorageItem("board_filter_"+e+"_filter-due-date",~~c)}function l(){var a=$("#board").data("project-id");
|
||||
$("#form-user_id").change(g);$("#form-category_id").change(g);$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");g();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-category_id")||-1);+Kanboard.GetStorageItem("board_filter_"+a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");g()}var h=
|
||||
null;return{Init:function(){c();l();d()}}}();
|
||||
$(".category-popover").click(Kanboard.Popover);$(".task-edit-popover").click(a);$(".task-creation-popover").click(a);$(".task-description-popover").click(a);$(".column-tooltip").tooltip({content:function(a){return $(this).attr("title")}});$(".task-board-tooltip").tooltip({track:!1,position:{my:"left-20 top",at:"center bottom+9",using:function(a,b){$(this).css(a);var c=b.target.left+b.target.width/2-b.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(b.vertical).addClass(0==c?"align-left":
|
||||
"align-right").appendTo(this)}},content:function(a){if(a=$(this).attr("data-href")){var b=this;$.get(a,function k(a){$(".ui-tooltip-content:visible").html(a);a=$(".ui-tooltip:visible");a.css({top:"",left:""});a.children(".tooltip-arrow").remove();var c=$(b).tooltip("option","position");c.of=$(b);a.position(c);$("#tooltip-subtasks a").click(function(a){a.preventDefault();a.stopPropagation();$.get($(this).attr("href"),k)})});return'<i class="fa fa-refresh fa-spin fa-2x"></i>'}}}).on("mouseenter",function(){var a=
|
||||
this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(a).tooltip("close")})}).on("mouseleave focusout",function(a){a.stopImmediatePropagation();var b=this;setTimeout(function(){$(".ui-tooltip:hover").length||$(b).tooltip("close")},100)});$("[data-task-url]").each(function(){$(this).click(function(){window.location=$(this).attr("data-task-url")})});var c=parseInt($("#board").attr("data-check-interval"));0<c&&(h=window.setInterval(b,1E3*c))}function f(){$("[data-task-url]").off();
|
||||
clearInterval(h)}function e(a,b,e,d){f();$.ajax({cache:!1,url:$("#board").attr("data-save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a,column_id:b,swimlane_id:d,position:e}),success:function(a){$("#board").remove();$("#main").append(a);c();g()}})}function b(){Kanboard.IsVisible()&&$.ajax({cache:!1,url:$("#board").attr("data-check-url"),statusCode:{200:function(a){$("#board").remove();$("#main").append(a);f();c();g()}}})}function g(){var a=$("#form-user_id").val(),
|
||||
b=$("#form-category_id").val(),c=$("#filter-due-date").hasClass("filter-on"),e=$("#board").data("project-id");$("[data-task-id]").each(function(e,d){var f=d.getAttribute("data-owner-id"),g=d.getAttribute("data-due-date"),h=d.getAttribute("data-category-id");d.style.opacity=f!=a&&-1!=a?"0.2":"1.0";!c||""!=g&&"0"!=g||(d.style.opacity="0.2");h!=b&&-1!=b&&(d.style.opacity="0.2")});Kanboard.SetStorageItem("board_filter_"+e+"_form-user_id",a);Kanboard.SetStorageItem("board_filter_"+e+"_form-category_id",
|
||||
b);Kanboard.SetStorageItem("board_filter_"+e+"_filter-due-date",~~c)}function l(){var a=$("#board").data("project-id");$("#form-user_id").change(g);$("#form-category_id").change(g);$("#filter-due-date").click(function(a){$(this).toggleClass("filter-on");g();a.preventDefault()});$("#form-user_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-user_id")||-1);$("#form-category_id").val(Kanboard.GetStorageItem("board_filter_"+a+"_form-category_id")||-1);+Kanboard.GetStorageItem("board_filter_"+
|
||||
a+"_filter-due-date")?$("#filter-due-date").addClass("filter-on"):$("#filter-due-date").removeClass("filter-on");g()}var h=null;return{Init:function(){c();l();d()}}}();
|
||||
Kanboard.Calendar=function(){function a(a){$.ajax({cache:!1,url:$("#calendar").data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({task_id:a.id,date_due:a.start.format()})})}function d(a){var b=$("#calendar"),c=b.data("check-url"),d={start:b.fullCalendar("getView").start.format(),end:b.fullCalendar("getView").end.format()};jQuery.extend(d,a);for(var f in d)c+="&"+f+"="+d[f];$.getJSON(c,function(a){b.fullCalendar("removeEvents");b.fullCalendar("addEventSource",
|
||||
a);b.fullCalendar("rerenderEvents")})}function c(){var a={};$(".calendar-filter").each(function(b,c){a[$(this).attr("name")]=$(this).val()});Kanboard.SetStorageItem(f,JSON.stringify(a));d(a)}var f="";return{Init:function(){f="calendar_filters_"+$("#calendar").data("project-id");var e=$("#calendar"),b=e.data("translations");e.fullCalendar({editable:!0,eventLimit:!0,header:{left:"prev,next today",center:"title",right:""},eventDrop:a,monthNames:[b.January,b.February,b.March,b.April,b.May,b.June,b.July,
|
||||
b.August,b.September,b.October,b.November,b.December],monthNamesShort:[b.Jan,b.Feb,b.Mar,b.Apr,b.May,b.Jun,b.Jul,b.Aug,b.Sep,b.Oct,b.Nov,b.Dec],buttonText:{today:b.Today},dayNames:[b.Sunday,b.Monday,b.Tuesday,b.Wednesday,b.Thursday,b.Friday,b.Saturday],dayNamesShort:[b.Sun,b.Mon,b.Tue,b.Wed,b.Thu,b.Fri,b.Sat]});e=Kanboard.GetStorageItem(f);if("undefined"!==e&&""!==e){var e=JSON.parse(e),g;for(g in e)$("select[name="+g+"]").val(e[g])}d(e||{});$(".calendar-filter").change(c)}}}();Kanboard.Task=function(){return{Init:function(){$(".file-popover").click(Kanboard.Popover)}}}();
|
||||
|
|
|
|||
|
|
@ -50,7 +50,13 @@ Kanboard.Board = (function() {
|
|||
// Description popover
|
||||
$(".task-description-popover").click(on_popover);
|
||||
|
||||
// Tooltips
|
||||
$(".column-tooltip").tooltip({
|
||||
content: function(e) {
|
||||
return $(this).attr("title");
|
||||
}
|
||||
});
|
||||
|
||||
// Tooltips for tasks
|
||||
$(".task-board-tooltip").tooltip({
|
||||
track: false,
|
||||
position: {
|
||||
|
|
|
|||
|
|
@ -854,6 +854,7 @@ Response example:
|
|||
- **column_id** (integer, required)
|
||||
- **title** (string, required)
|
||||
- **task_limit** (integer, optional)
|
||||
- **description** (string, optional)
|
||||
- Result on success: **true**
|
||||
- Result on failure: **false**
|
||||
|
||||
|
|
@ -889,6 +890,7 @@ Response example:
|
|||
- **project_id** (integer, required)
|
||||
- **title** (string, required)
|
||||
- **task_limit** (integer, optional)
|
||||
- **description** (string, optional)
|
||||
- Result on success: **column_id**
|
||||
- Result on failure: **false**
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ class BoardTest extends Base
|
|||
|
||||
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
|
||||
$this->assertNotFalse($b->addColumn(1, 'another column'));
|
||||
$this->assertNotFalse($b->addColumn(1, 'one more', 3));
|
||||
$this->assertNotFalse($b->addColumn(1, 'one more', 3, 'one more description'));
|
||||
|
||||
$columns = $b->getColumns(1);
|
||||
$this->assertTrue(is_array($columns));
|
||||
|
|
@ -219,6 +219,7 @@ class BoardTest extends Base
|
|||
$this->assertEquals('one more', $columns[5]['title']);
|
||||
$this->assertEquals(3, $columns[5]['task_limit']);
|
||||
$this->assertEquals(6, $columns[5]['position']);
|
||||
$this->assertEquals('one more description', $columns[5]['description']);
|
||||
}
|
||||
|
||||
public function testMoveColumns()
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class TaskStatusTest extends Base
|
|||
$this->assertNotEmpty($task);
|
||||
$this->assertEquals(Task::STATUS_OPEN, $task['is_active']);
|
||||
$this->assertEquals(0, $task['date_completed']);
|
||||
$this->assertEquals(time(), $task['date_modification']);
|
||||
$this->assertEquals(time(), $task['date_modification'], 1);
|
||||
|
||||
$called = $this->container['dispatcher']->getCalledListeners();
|
||||
$this->assertArrayHasKey('task.close.TaskStatusTest::onTaskClose', $called);
|
||||
|
|
|
|||
Loading…
Reference in New Issue