Refresh the board only when it's necessary and add a link on the task title
This commit is contained in:
@@ -523,6 +523,10 @@ div.task a:hover {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.task-title a {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
#infos,
|
#infos,
|
||||||
div.task {
|
div.task {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -147,9 +147,10 @@
|
|||||||
try {
|
try {
|
||||||
var response = JSON.parse(this.responseText);
|
var response = JSON.parse(this.responseText);
|
||||||
|
|
||||||
if (response.result == true) {
|
if (response.result == false) {
|
||||||
|
window.alert('Unable to update the board');
|
||||||
// TODO: don't refresh the whole page!
|
}
|
||||||
|
else if (response.refresh == true) {
|
||||||
window.location = "?controller=board&action=show&project_id=" + projectId;
|
window.location = "?controller=board&action=show&project_id=" + projectId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ abstract class Base
|
|||||||
$this->task = $registry->task;
|
$this->task = $registry->task;
|
||||||
$this->user = $registry->user;
|
$this->user = $registry->user;
|
||||||
$this->comment = $registry->comment;
|
$this->comment = $registry->comment;
|
||||||
|
$this->event = $registry->shared('event');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeAction($controller, $action)
|
public function beforeAction($controller, $action)
|
||||||
|
|||||||
@@ -276,7 +276,8 @@ class Board extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->response->json(array(
|
$this->response->json(array(
|
||||||
'result' => $this->board->saveTasksPosition($this->request->getValues())
|
'result' => $this->board->saveTasksPosition($this->request->getValues()),
|
||||||
|
'refresh' => $this->event->getLastListenerExecuted() !== ''
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,14 @@ class Event
|
|||||||
*/
|
*/
|
||||||
private $listeners = array();
|
private $listeners = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last listener executed
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $lastListener = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last triggered event
|
* The last triggered event
|
||||||
*
|
*
|
||||||
@@ -74,11 +82,24 @@ class Event
|
|||||||
|
|
||||||
if (isset($this->listeners[$eventName])) {
|
if (isset($this->listeners[$eventName])) {
|
||||||
foreach ($this->listeners[$eventName] as $listener) {
|
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
|
* Get the last fired event
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<div class="task-title">
|
<div class="task-title">
|
||||||
<?= Helper\escape($task['title']) ?>
|
<a href="?controller=task&action=show&task_id=<?= $task['id'] ?>" title="<?= t('Show this task') ?>"><?= Helper\escape($task['title']) ?></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="task-footer">
|
<div class="task-footer">
|
||||||
|
|||||||
Reference in New Issue
Block a user