Skip to content

Commit

Permalink
Add the href link to project name, which will load
Browse files Browse the repository at this point in the history
the ticket lists for the project.
  • Loading branch information
seanchen committed Jan 22, 2014
1 parent 3ed16da commit fc65044
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
24 changes: 14 additions & 10 deletions wp-trac-client/templates/page-trac.php
Expand Up @@ -12,20 +12,17 @@
// the page slug will be the project name.
$version = $_GET['version'];
$milestone = $_GET['milestone'];
if (empty($version)) {
// using the default sprint.
//$defaults = wptc_widget_ticket_defaults();
//$version = $defaults['version'];
//$project = $defaults['project'];
} else {
$project = $_GET['project'];
if (!empty($version)) {
// get the project name
$project = wptc_get_project_name($version);
}
?>


<div id="left_column">
<div class='leftnav'>
<?php if (!empty($version)) { ?>
<?php if (!empty($project)) { ?>
<div id='sprint-nav' class="widget">
<h2 class='widgettitle'>
Project: <b><?php echo $project;?></b>
Expand All @@ -42,7 +39,8 @@

<div id="content">

<?php if (empty($version) && empty($milestone)) {
<?php if (empty($version) && empty($milestone)
&& empty($project)) {

echo wptc_widget_trac_homepage();

Expand All @@ -61,9 +59,15 @@
<?php
$query = "milestone=" . $milestone;
echo wptc_view_tickets_dt($query);
?>

<?php } ?>
} else if (!empty($project)) { ?>

<h2>Tickets for Project: <em><?php echo $project ?></em></h2>

<?php
$query = "project=" . $project;
echo wptc_view_tickets_dt($query);
} ?>

</div> <?php // END right_column ?>

Expand Down
4 changes: 3 additions & 1 deletion wp-trac-client/widgets.php
Expand Up @@ -754,6 +754,8 @@ function wptc_widget_ticket_info($ticket) {
wptc_widget_user_href($ticket['reporter']);
$ticket_owner_href =
wptc_widget_user_href($ticket['owner']);
$ticket_project_href =
wptc_widget_project_href($ticket['project']);
$ticket_milestone_href =
wptc_widget_milestone_href($ticket['milestone']);
$ticket_version_href =
Expand Down Expand Up @@ -801,7 +803,7 @@ function wptc_widget_ticket_info($ticket) {
Project:
</th>
<td headers="h_project">
{$ticket['project']}
<a href="{$ticket_project_href}">{$ticket['project']}</a>
</td>
<th id="h_priority">
Priority:
Expand Down
13 changes: 12 additions & 1 deletion wp-trac-client/widgets/utils.php
Expand Up @@ -155,7 +155,7 @@ function wptc_widget_version_href($version) {
}

/**
* generate the href link for version field.
* generate the href link for milestone field.
*/
function wptc_widget_milestone_href($milestone) {

Expand All @@ -164,3 +164,14 @@ function wptc_widget_milestone_href($milestone) {

return apply_filters('wptc_widget_milestone_href', $href);
}

/**
* generate the href link for project field.
*/
function wptc_widget_project_href($project) {

$base = wptc_widget_base_href();
$href = $base . '?project=' . $project;

return apply_filters('wptc_widget_project_href', $href);
}

0 comments on commit fc65044

Please sign in to comment.