#1144 Add description field to swimlane.
This commit is contained in:
@@ -40,14 +40,18 @@ class Swimlane extends \Core\Base
|
||||
return $this->swimlane->getDefault($project_id);
|
||||
}
|
||||
|
||||
public function addSwimlane($project_id, $name)
|
||||
public function addSwimlane($project_id, $name, $description = '')
|
||||
{
|
||||
return $this->swimlane->create($project_id, $name);
|
||||
return $this->swimlane->create(array('project_id' => $project_id, 'name' => $name, 'description' => $description));
|
||||
}
|
||||
|
||||
public function updateSwimlane($swimlane_id, $name)
|
||||
public function updateSwimlane($swimlane_id, $name, $description = null)
|
||||
{
|
||||
return $this->swimlane->rename($swimlane_id, $name);
|
||||
$values = array('id' => $swimlane_id, 'name' => $name);
|
||||
if (!is_null($description)) {
|
||||
$values['description'] = $description;
|
||||
}
|
||||
return $this->swimlane->update($values);
|
||||
}
|
||||
|
||||
public function removeSwimlane($project_id, $swimlane_id)
|
||||
|
||||
@@ -58,16 +58,14 @@ class Swimlane extends Base
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
|
||||
$values = $this->request->getValues();
|
||||
list($valid, $errors) = $this->swimlane->validateCreation($values);
|
||||
|
||||
if ($valid) {
|
||||
|
||||
if ($this->swimlane->create($project['id'], $values['name'])) {
|
||||
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' => $project['id'])));
|
||||
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $values['project_id'])));
|
||||
}
|
||||
else {
|
||||
$this->session->flashError(t('Unable to create your swimlane.'));
|
||||
@@ -134,8 +132,7 @@ class Swimlane extends Base
|
||||
list($valid, $errors) = $this->swimlane->validateModification($values);
|
||||
|
||||
if ($valid) {
|
||||
|
||||
if ($this->swimlane->rename($values['id'], $values['name'])) {
|
||||
if ($this->swimlane->update($values)) {
|
||||
$this->session->flash(t('Swimlane updated successfully.'));
|
||||
$this->response->redirect($this->helper->url->to('swimlane', 'index', array('project_id' => $project['id'])));
|
||||
}
|
||||
@@ -253,4 +250,15 @@ 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)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class Swimlane extends Base
|
||||
public function getSwimlanes($project_id)
|
||||
{
|
||||
$swimlanes = $this->db->table(self::TABLE)
|
||||
->columns('id', 'name')
|
||||
->columns('id', 'name', 'description')
|
||||
->eq('project_id', $project_id)
|
||||
->eq('is_active', self::ACTIVE)
|
||||
->orderBy('position', 'asc')
|
||||
@@ -216,32 +216,30 @@ class Swimlane extends Base
|
||||
* Add a new swimlane
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id
|
||||
* @param string $name
|
||||
* @param array $values Form values
|
||||
* @return integer|boolean
|
||||
*/
|
||||
public function create($project_id, $name)
|
||||
public function create($values)
|
||||
{
|
||||
return $this->persist(self::TABLE, array(
|
||||
'project_id' => $project_id,
|
||||
'name' => $name,
|
||||
'position' => $this->getLastPosition($project_id),
|
||||
));
|
||||
if (! $this->project->exists($values['project_id'])) {
|
||||
return 0;
|
||||
}
|
||||
$values['position'] = $this->getLastPosition($values['project_id']);
|
||||
return $this->persist(self::TABLE, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a swimlane
|
||||
* Update a swimlane
|
||||
*
|
||||
* @access public
|
||||
* @param integer $swimlane_id Swimlane id
|
||||
* @param string $name Swimlane name
|
||||
* @param array $values Form values
|
||||
* @return bool
|
||||
*/
|
||||
public function rename($swimlane_id, $name)
|
||||
public function update(array $values)
|
||||
{
|
||||
return $this->db->table(self::TABLE)
|
||||
->eq('id', $swimlane_id)
|
||||
->update(array('name' => $name));
|
||||
->eq('id', $values['id'])
|
||||
->update($values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,12 @@ use PDO;
|
||||
use Core\Security;
|
||||
use Model\Link;
|
||||
|
||||
const VERSION = 85;
|
||||
const VERSION = 86;
|
||||
|
||||
function version_86($pdo)
|
||||
{
|
||||
$pdo->exec("ALTER TABLE swimlanes ADD COLUMN description TEXT");
|
||||
}
|
||||
|
||||
function version_85($pdo)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,12 @@ use PDO;
|
||||
use Core\Security;
|
||||
use Model\Link;
|
||||
|
||||
const VERSION = 65;
|
||||
const VERSION = 66;
|
||||
|
||||
function version_66($pdo)
|
||||
{
|
||||
$pdo->exec("ALTER TABLE swimlanes ADD COLUMN description TEXT");
|
||||
}
|
||||
|
||||
function version_65($pdo)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,12 @@ use Core\Security;
|
||||
use PDO;
|
||||
use Model\Link;
|
||||
|
||||
const VERSION = 81;
|
||||
const VERSION = 82;
|
||||
|
||||
function version_82($pdo)
|
||||
{
|
||||
$pdo->exec("ALTER TABLE swimlanes ADD COLUMN description TEXT");
|
||||
}
|
||||
|
||||
function version_81($pdo)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,14 @@
|
||||
|
||||
<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 ?>
|
||||
|
||||
@@ -12,6 +12,27 @@
|
||||
<?= $this->form->label(t('Name'), 'name') ?>
|
||||
<?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?>
|
||||
|
||||
<?= $this->form->label(t('Description'), 'description') ?>
|
||||
|
||||
<div class="form-tabs">
|
||||
|
||||
<div class="write-area">
|
||||
<?= $this->form->textarea('description', $values, $errors) ?>
|
||||
</div>
|
||||
<div class="preview-area">
|
||||
<div class="markdown"></div>
|
||||
</div>
|
||||
<ul class="form-tabs-nav">
|
||||
<li class="form-tab form-tab-selected">
|
||||
<i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a>
|
||||
</li>
|
||||
<li class="form-tab">
|
||||
<a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-help"><?= $this->url->doc(t('Write your text in Markdown'), 'syntax-guide') ?></div>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||
<?= t('or') ?>
|
||||
|
||||
@@ -16,6 +16,26 @@
|
||||
<?= $this->form->label(t('Name'), 'name') ?>
|
||||
<?= $this->form->text('name', $values, $errors, array('autofocus', 'required', 'maxlength="50"')) ?>
|
||||
|
||||
<?= $this->form->label(t('Description'), 'description') ?>
|
||||
|
||||
<div class="form-tabs">
|
||||
<div class="write-area">
|
||||
<?= $this->form->textarea('description', $values, $errors) ?>
|
||||
</div>
|
||||
<div class="preview-area">
|
||||
<div class="markdown"></div>
|
||||
</div>
|
||||
<ul class="form-tabs-nav">
|
||||
<li class="form-tab form-tab-selected">
|
||||
<i class="fa fa-pencil-square-o fa-fw"></i><a id="markdown-write" href="#"><?= t('Write') ?></a>
|
||||
</li>
|
||||
<li class="form-tab">
|
||||
<a id="markdown-preview" href="#"><i class="fa fa-eye fa-fw"></i><?= t('Preview') ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-help"><?= $this->url->doc(t('Write your text in Markdown'), 'syntax-guide') ?></div>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<li>
|
||||
<?= $this->url->link(t('Rename'), 'swimlane', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?>
|
||||
<?= $this->url->link(t('Edit'), 'swimlane', 'edit', array('project_id' => $project['id'], 'swimlane_id' => $swimlane['id'])) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php if ($swimlane['is_active']): ?>
|
||||
|
||||
Reference in New Issue
Block a user