summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/css/app.css4
-rw-r--r--assets/js/board.js7
-rw-r--r--controllers/base.php1
-rw-r--r--controllers/board.php3
-rw-r--r--core/event.php23
-rw-r--r--templates/board_index.php2
6 files changed, 34 insertions, 6 deletions
diff --git a/assets/css/app.css b/assets/css/app.css
index 93321c2e..274c11a3 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -523,6 +523,10 @@ div.task a:hover {
text-decoration: underline;
}
+div.task-title a {
+ font-weight: normal;
+}
+
#infos,
div.task {
position: relative;
diff --git a/assets/js/board.js b/assets/js/board.js
index 501c39c3..3c5ec51c 100644
--- a/assets/js/board.js
+++ b/assets/js/board.js
@@ -147,9 +147,10 @@
try {
var response = JSON.parse(this.responseText);
- if (response.result == true) {
-
- // TODO: don't refresh the whole page!
+ if (response.result == false) {
+ window.alert('Unable to update the board');
+ }
+ else if (response.refresh == true) {
window.location = "?controller=board&action=show&project_id=" + projectId;
}
}
diff --git a/controllers/base.php b/controllers/base.php
index dd7c0642..81fb8884 100644
--- a/controllers/base.php
+++ b/controllers/base.php
@@ -14,6 +14,7 @@ abstract class Base
$this->task = $registry->task;
$this->user = $registry->user;
$this->comment = $registry->comment;
+ $this->event = $registry->shared('event');
}
public function beforeAction($controller, $action)
diff --git a/controllers/board.php b/controllers/board.php
index f0af2606..b07ca61c 100644
--- a/controllers/board.php
+++ b/controllers/board.php
@@ -276,7 +276,8 @@ class Board extends Base
}
$this->response->json(array(
- 'result' => $this->board->saveTasksPosition($this->request->getValues())
+ 'result' => $this->board->saveTasksPosition($this->request->getValues()),
+ 'refresh' => $this->event->getLastListenerExecuted() !== ''
));
}
}
diff --git a/core/event.php b/core/event.php
index 7addb41d..672146f3 100644
--- a/core/event.php
+++ b/core/event.php
@@ -29,6 +29,14 @@ class Event
private $listeners = array();
/**
+ * The last listener executed
+ *
+ * @access private
+ * @var string
+ */
+ private $lastListener = '';
+
+ /**
* The last triggered event
*
* @access private
@@ -74,12 +82,25 @@ class Event
if (isset($this->listeners[$eventName])) {
foreach ($this->listeners[$eventName] as $listener) {
- $listener->execute($data); // TODO: keep an history of executed actions for unit test
+ if ($listener->execute($data)) {
+ $this->lastListener = get_class($listener);
+ }
}
}
}
/**
+ * Get the last listener executed
+ *
+ * @access public
+ * @return string Event name
+ */
+ public function getLastListenerExecuted()
+ {
+ return $this->lastListener;
+ }
+
+ /**
* Get the last fired event
*
* @access public
diff --git a/templates/board_index.php b/templates/board_index.php
index e6054189..6138ee50 100644
--- a/templates/board_index.php
+++ b/templates/board_index.php
@@ -71,7 +71,7 @@
<?php endif ?>
<div class="task-title">
- <?= Helper\escape($task['title']) ?>
+ <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>" title="<?= t('Show this task') ?>"><?= Helper\escape($task['title']) ?></a>
</div>
<div class="task-footer">