From 7c52546ed2b5ed724d19af95fe97726ab6156291 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 12 Oct 2017 15:25:13 -0700 Subject: Generate a link if the reference is a URL --- app/Helper/TaskHelper.php | 15 +++++++++++++++ app/Template/board/task_footer.php | 2 +- app/Template/task/details.php | 2 +- app/Template/task_list/task_icons.php | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php index 3b9e9745..065ece10 100644 --- a/app/Helper/TaskHelper.php +++ b/app/Helper/TaskHelper.php @@ -220,6 +220,21 @@ class TaskHelper extends Base return $html; } + public function renderReference(array $task) + { + if (! empty($task['reference'])) { + $reference = $this->helper->text->e($task['reference']); + + if (filter_var($task['reference'], FILTER_VALIDATE_URL) !== false) { + return sprintf('%s', $reference, $reference); + } + + return $reference; + } + + return ''; + } + public function getProgress($task) { if (! isset($this->columns[$task['project_id']])) { diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index c78616e9..4ea5bb31 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -32,7 +32,7 @@
- text->e($task['reference']) ?> + task->renderReference($task) ?>
diff --git a/app/Template/task/details.php b/app/Template/task/details.php index a42e09d1..3b4d4b38 100644 --- a/app/Template/task/details.php +++ b/app/Template/task/details.php @@ -22,7 +22,7 @@
  • - text->e($task['reference']) ?> + task->renderReference($task) ?>
  • diff --git a/app/Template/task_list/task_icons.php b/app/Template/task_list/task_icons.php index 03a891a2..d02c9021 100644 --- a/app/Template/task_list/task_icons.php +++ b/app/Template/task_list/task_icons.php @@ -1,7 +1,7 @@
    - text->e($task['reference']) ?> + task->renderReference($task) ?> -- cgit v1.2.3