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".
This commit is contained in:
William MARTIN 2011-01-06 22:38:38 +01:00
parent c2a9a60aa7
commit afa91188d8
3 changed files with 32 additions and 0 deletions

View File

@ -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);

View File

@ -1,6 +1,15 @@
{extends "idf/issues/base.html"}
{block titleicon}{if $form}<form class="star" method="post" action="{url 'IDF_Views_Issue::star', array($project.shortname, $issue.id)}"><input type="image" src="{if $starred}{media '/idf/img/star.png'}{else}{media '/idf/img/star-grey.png'}{/if}" name="submit" title="{if $starred}{trans 'Remove this issue from your watch list'}{else}{trans 'Add this issue to your watch list'}{/if}" /></form> {/if}{/block}
{block body}
<div style="float:right;">
{if $previous_issue_id}
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $previous_issue_id)}" title="{if $closed}{trans 'Click here to view the previous closed issue'}{else}{trans 'Click here to view the previous open issue'}{/if}">Previous issue</a>
{/if}
{if $previous_issue_id and $next_issue_id} - {/if}
{if $next_issue_id}
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $next_issue_id)}" title="{if $closed}{trans 'Click here to view the next closed issue'}{else}{trans 'Click here to view the next open issue'}{/if}">Next issue</a>
{/if}
</div>
{assign $i = 0}
{assign $nc = $comments.count()}
{foreach $comments as $c}{ashowuser 'submitter', $c.get_submitter(), $request}

View File

@ -225,6 +225,7 @@ div.issue-comment {
div.issue-comment-first {
border-top: 1px solid #d3d7cf;
clear: both;
}
div.issue-comment-signin {