Improve pull-request about swimlane description

This commit is contained in:
Frederic Guillot 2015-09-05 12:03:20 -04:00
parent bac18d80f8
commit 512840fe1d
10 changed files with 118 additions and 96 deletions

View File

@ -24,6 +24,7 @@ Contributors:
- [Eskiso](https://github.com/eSkiSo)
- [Esteban Monge](https://github.com/EstebanMonge)
- [Fábio Hideki](https://github.com/fabiohxcx)
- [Fabiano Castro Pereira](https://github.com/fabiano-pereira)
- [Federico Lazcano](https://github.com/lazki)
- [Fengchao](https://github.com/fengchao)
- [Floaltvater](https://github.com/floaltvater)

View File

@ -1,3 +1,16 @@
Version 1.0.19 (unreleased)
---------------------------
New features:
* Add swimlane description
Improvements:
Bug fixes:
* Fix typo in template that prevent the Gitlab oauth link to be displayed
Version 1.0.18
--------------

View File

@ -320,6 +320,18 @@ class Board extends Base
)));
}
/**
* Display swimlane description in tooltip
*
* @access public
*/
public function swimlane()
{
$project = $this->getProject();
$swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id'));
$this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane)));
}
/**
* Enable collapsed mode
*

View File

@ -58,6 +58,7 @@ class Swimlane extends Base
*/
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->swimlane->validateCreation($values);
@ -65,7 +66,7 @@ class Swimlane extends Base
if ($this->swimlane->create($values)) {
$this->session->flash(t('Your swimlane have been created successfully.'));
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $values['project_id'])));
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
}
else {
$this->session->flashError(t('Unable to create your swimlane.'));
@ -250,15 +251,4 @@ class Swimlane extends Base
$this->swimlane->moveDown($project['id'], $swimlane_id);
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
}
/**
* Display swimlane description
*
* @access public
*/
public function description()
{
$swimlane = $this->swimlane->getById($this->request->getIntegerParam('swimlane_id'));
$this->response->html($this->template->render('board/tooltip_description', array('task' => $swimlane)));
}
}

View File

@ -7,6 +7,20 @@
<i class="fa fa-minus-circle hide-icon-swimlane-<?= $swimlane['id'] ?>"></i>
<i class="fa fa-plus-circle show-icon-swimlane-<?= $swimlane['id'] ?>" style="display: none"></i>
</a>
<?php if (! empty($swimlane['description'])): ?>
<span
title="<?= t('Description') ?>"
class="tooltip"
data-href="<?= $this->url->href('board', 'swimlane', array('swimlane_id' => $swimlane['id'], 'project_id' => $project['id'])) ?>">
<i class="fa fa-info-circle"></i>
</span>
<?php endif ?>
<span title="<?= t('Task count') ?>" class="board-column-header-task-count swimlane-task-count-<?= $swimlane['id'] ?>">
(<?= $swimlane['nb_tasks'] ?>)
</span>
<span class="board-swimlane-toggle-title show-icon-swimlane-<?= $swimlane['id'] ?>"><?= $this->e($swimlane['name']) ?></span>
<?php endif ?>
</th>
@ -62,18 +76,6 @@
<?php if (! $hide_swimlane): ?>
<th class="board-swimlane-title">
<?= $this->e($swimlane['name']) ?>
<div title="<?= t('Task count') ?>" class="board-column-header-task-count">
(<span><?= $swimlane['nb_tasks'] ?></span>)
<?php if (! empty($swimlane['description'])): ?>
<span title="<?= t('Description') ?>" class="tooltip"
data-href="<?= $this->url->href('swimlane', 'description', array('swimlane_id' => $swimlane['id'], 'project_id' => $swimlane['project_id'])) ?>">
<i class="fa fa-file-text-o"></i>
</span>
<?php endif ?>
</div>
</th>
<?php endif ?>

View File

@ -14,7 +14,7 @@
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Name'), 'name') ?>
<?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?>
<?= $this->form->text('name', $values, $errors, array('required', 'maxlength="50"')) ?>
<?= $this->form->label(t('Description'), 'description') ?>

File diff suppressed because one or more lines are too long

View File

@ -1,67 +1,69 @@
function Swimlane() {
}
Swimlane.prototype.getStorageKey = function() {
return "hidden_swimlanes_" + $("#board").data("project-id");
};
Swimlane.prototype.expand = function(swimlaneId) {
var swimlaneIds = this.getAllCollapsed();
var index = swimlaneIds.indexOf(swimlaneId);
if (index > -1) {
swimlaneIds.splice(index, 1);
}
localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
$('.swimlane-row-' + swimlaneId).css('display', 'table-row');
$('.show-icon-swimlane-' + swimlaneId).css('display', 'none');
$('.hide-icon-swimlane-' + swimlaneId).css('display', 'inline');
};
Swimlane.prototype.collapse = function(swimlaneId) {
var swimlaneIds = this.getAllCollapsed();
if (swimlaneIds.indexOf(swimlaneId) < 0) {
swimlaneIds.push(swimlaneId);
localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
}
$('.swimlane-row-' + swimlaneId).css('display', 'none');
$('.show-icon-swimlane-' + swimlaneId).css('display', 'inline');
$('.hide-icon-swimlane-' + swimlaneId).css('display', 'none');
};
Swimlane.prototype.isCollapsed = function(swimlaneId) {
return this.getAllCollapsed().indexOf(swimlaneId) > -1;
};
Swimlane.prototype.getAllCollapsed = function() {
return JSON.parse(localStorage.getItem(this.getStorageKey())) || [];
};
Swimlane.prototype.refresh = function() {
var swimlaneIds = this.getAllCollapsed();
for (var i = 0; i < swimlaneIds.length; i++) {
this.collapse(swimlaneIds[i]);
}
};
Swimlane.prototype.listen = function() {
var self = this;
$(document).on('click', ".board-swimlane-toggle", function(e) {
e.preventDefault();
var swimlaneId = $(this).data('swimlane-id');
if (self.isCollapsed(swimlaneId)) {
self.expand(swimlaneId);
}
else {
self.collapse(swimlaneId);
}
});
};
function Swimlane() {
}
Swimlane.prototype.getStorageKey = function() {
return "hidden_swimlanes_" + $("#board").data("project-id");
};
Swimlane.prototype.expand = function(swimlaneId) {
var swimlaneIds = this.getAllCollapsed();
var index = swimlaneIds.indexOf(swimlaneId);
if (index > -1) {
swimlaneIds.splice(index, 1);
}
localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
$('.swimlane-row-' + swimlaneId).css('display', 'table-row');
$('.show-icon-swimlane-' + swimlaneId).css('display', 'none');
$('.hide-icon-swimlane-' + swimlaneId).css('display', 'inline');
$('.swimlane-task-count-' + swimlaneId).css('display', 'inline');
};
Swimlane.prototype.collapse = function(swimlaneId) {
var swimlaneIds = this.getAllCollapsed();
if (swimlaneIds.indexOf(swimlaneId) < 0) {
swimlaneIds.push(swimlaneId);
localStorage.setItem(this.getStorageKey(), JSON.stringify(swimlaneIds));
}
$('.swimlane-row-' + swimlaneId).css('display', 'none');
$('.show-icon-swimlane-' + swimlaneId).css('display', 'inline');
$('.hide-icon-swimlane-' + swimlaneId).css('display', 'none');
$('.swimlane-task-count-' + swimlaneId).css('display', 'none');
};
Swimlane.prototype.isCollapsed = function(swimlaneId) {
return this.getAllCollapsed().indexOf(swimlaneId) > -1;
};
Swimlane.prototype.getAllCollapsed = function() {
return JSON.parse(localStorage.getItem(this.getStorageKey())) || [];
};
Swimlane.prototype.refresh = function() {
var swimlaneIds = this.getAllCollapsed();
for (var i = 0; i < swimlaneIds.length; i++) {
this.collapse(swimlaneIds[i]);
}
};
Swimlane.prototype.listen = function() {
var self = this;
$(document).on('click', ".board-swimlane-toggle", function(e) {
e.preventDefault();
var swimlaneId = $(this).data('swimlane-id');
if (self.isCollapsed(swimlaneId)) {
self.expand(swimlaneId);
}
else {
self.collapse(swimlaneId);
}
});
};

View File

@ -1708,6 +1708,7 @@ Response example:
- Parameters:
- **swimlane_id** (integer, required)
- **name** (string, required)
- **description** (string, optional)
- Result on success: **true**
- Result on failure: **false**
@ -1741,6 +1742,7 @@ Response example:
- Parameters:
- **project_id** (integer, required)
- **name** (string, required)
- **description** (string, optional)
- Result on success: **swimlane_id**
- Result on failure: **false**

View File

@ -37,15 +37,15 @@ class UserApi extends PHPUnit_Framework_TestCase
{
$this->app = new JsonRPC\Client(API_URL);
$this->app->authentication('jsonrpc', API_KEY);
$this->app->debug = true;
// $this->app->debug = true;
$this->admin = new JsonRPC\Client(API_URL);
$this->admin->authentication('admin', 'admin');
$this->admin->debug = true;
// $this->admin->debug = true;
$this->user = new JsonRPC\Client(API_URL);
$this->user->authentication('user', 'password');
$this->user->debug = true;
// $this->user->debug = true;
}
public function testCreateProject()