From afa91188d8e265fa3fcaa6b6a93a3190f8bc8019 Mon Sep 17 00:00:00 2001 From: William MARTIN Date: Thu, 6 Jan 2011 22:38:38 +0100 Subject: [PATCH] Enhancement of the view of an issue. Add link previous and after to quickly jump to another issue. Those links are pointing to issue with the same status (open/closed). With little trick on url we can do the same thing for browse "my issue" and "my watchlist". --- src/IDF/Views/Issue.php | 22 ++++++++++++++++++++++ src/IDF/templates/idf/issues/view.html | 9 +++++++++ www/media/idf/css/style.css | 1 + 3 files changed, 32 insertions(+) diff --git a/src/IDF/Views/Issue.php b/src/IDF/Views/Issue.php index 58d4f05..2aa1480 100644 --- a/src/IDF/Views/Issue.php +++ b/src/IDF/Views/Issue.php @@ -435,6 +435,26 @@ class IDF_Views_Issue } } + // Search previous and next issue id + $octags = $prj->getTagIdsByStatus(($closed) ? 'closed' : 'open'); + if (count($octags) == 0) $octags[] = 0; + $sql_previous = new Pluf_SQL('project=%s AND status IN ('.implode(', ', $octags).') AND id<%s', + array($prj->id, $match[2]) + ); + $sql_next = new Pluf_SQL('project=%s AND status IN ('.implode(', ', $octags).') AND id>%s', + array($prj->id, $match[2]) + ); + $previous_issue = Pluf::factory('IDF_Issue')->getList(array('filter' => $sql_previous->gen(), + 'order' => 'id DESC', + 'nb' => 1 + )); + $next_issue = Pluf::factory('IDF_Issue')->getList(array('filter' => $sql_next->gen(), + 'order' => 'id ASC', + 'nb' => 1 + )); + $previous_issue_id = (isset($previous_issue[0])) ? $previous_issue[0]->id : 0; + $next_issue_id = (isset($next_issue[0])) ? $next_issue[0]->id : 0; + $arrays = self::autoCompleteArrays($prj); return Pluf_Shortcuts_RenderToResponse('idf/issues/view.html', array_merge( @@ -447,6 +467,8 @@ class IDF_Views_Issue 'closed' => $closed, 'preview' => $preview, 'interested' => $interested->count(), + 'previous_issue_id' => $previous_issue_id, + 'next_issue_id' => $next_issue_id ), $arrays), $request); diff --git a/src/IDF/templates/idf/issues/view.html b/src/IDF/templates/idf/issues/view.html index 4d0e1ba..4ad9e4e 100644 --- a/src/IDF/templates/idf/issues/view.html +++ b/src/IDF/templates/idf/issues/view.html @@ -1,6 +1,15 @@ {extends "idf/issues/base.html"} {block titleicon}{if $form}
{/if}{/block} {block body} +
+{if $previous_issue_id} +Previous issue +{/if} +{if $previous_issue_id and $next_issue_id} - {/if} +{if $next_issue_id} +Next issue +{/if} +
{assign $i = 0} {assign $nc = $comments.count()} {foreach $comments as $c}{ashowuser 'submitter', $c.get_submitter(), $request} diff --git a/www/media/idf/css/style.css b/www/media/idf/css/style.css index a36e94c..9188e1d 100644 --- a/www/media/idf/css/style.css +++ b/www/media/idf/css/style.css @@ -225,6 +225,7 @@ div.issue-comment { div.issue-comment-first { border-top: 1px solid #d3d7cf; + clear: both; } div.issue-comment-signin {