summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Api/Swimlane.php12
-rw-r--r--app/Controller/Swimlane.php20
-rw-r--r--app/Model/Swimlane.php28
-rw-r--r--app/Schema/Mysql.php7
-rw-r--r--app/Schema/Postgres.php7
-rw-r--r--app/Schema/Sqlite.php7
-rw-r--r--app/Template/board/table_swimlane.php8
-rw-r--r--app/Template/swimlane/edit.php21
-rw-r--r--app/Template/swimlane/index.php20
-rw-r--r--app/Template/swimlane/table.php2
10 files changed, 103 insertions, 29 deletions
diff --git a/app/Api/Swimlane.php b/app/Api/Swimlane.php
index fb40841f..13838d77 100644
--- a/app/Api/Swimlane.php
+++ b/app/Api/Swimlane.php
@@ -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)
diff --git a/app/Controller/Swimlane.php b/app/Controller/Swimlane.php
index 054fa4ba..02fe8a6e 100644
--- a/app/Controller/Swimlane.php
+++ b/app/Controller/Swimlane.php
@@ -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)));
+ }
}
diff --git a/app/Model/Swimlane.php b/app/Model/Swimlane.php
index 3b78a406..06e879a4 100644
--- a/app/Model/Swimlane.php
+++ b/app/Model/Swimlane.php
@@ -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);
}
/**
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index b1ac0ab9..efdb159b 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -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)
{
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 9477b416..a5d28dcf 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -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)
{
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index b4e4b948..8efa016c 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -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)
{
diff --git a/app/Template/board/table_swimlane.php b/app/Template/board/table_swimlane.php
index be401633..ab4735b1 100644
--- a/app/Template/board/table_swimlane.php
+++ b/app/Template/board/table_swimlane.php
@@ -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 ?>
diff --git a/app/Template/swimlane/edit.php b/app/Template/swimlane/edit.php
index 1788fed2..dfc5cf0b 100644
--- a/app/Template/swimlane/edit.php
+++ b/app/Template/swimlane/edit.php
@@ -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') ?>
diff --git a/app/Template/swimlane/index.php b/app/Template/swimlane/index.php
index daee6af5..1bf31afa 100644
--- a/app/Template/swimlane/index.php
+++ b/app/Template/swimlane/index.php
@@ -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>
diff --git a/app/Template/swimlane/table.php b/app/Template/swimlane/table.php
index f38572a3..b708e633 100644
--- a/app/Template/swimlane/table.php
+++ b/app/Template/swimlane/table.php
@@ -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']): ?>