Skip to content

Commit

Permalink
Added incident descritpions to the report view
Browse files Browse the repository at this point in the history
  • Loading branch information
m0hamed committed Aug 11, 2013
1 parent b16b9b5 commit 0112c75
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
23 changes: 21 additions & 2 deletions app/View/Helper/ReportsHelper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
/* vim: set expandtab sw=2 ts=2 sts=2: */
App::uses('AppHelper', 'View/Helper');
App::uses('Sanitize', 'Utility');

Expand All @@ -25,10 +26,28 @@ public function entriesFromRelateReports($entries, $totalCount) {
public function createIncidentsLinks($incidents) {
$links = array();
foreach ($incidents as $incident) {
$incidentId = $incident["Incident"]["id"];
$links[] = "<a href='/incidents/view/$incidentId'>#$incidentId</a>";
$links[] = $this->linkToIncident($incident);
}
$string = implode(", ", $links);
return $string;
}

public function linkToIncident($incident) {
$incidentId = $incident["Incident"]["id"];
$link = "<a href='/incidents/view/$incidentId'>#$incidentId</a>";
return $link;
}

public function incidentsDescriptions($incidents) {
$descriptions = "";
foreach ($incidents as $incident) {
$descriptions .= "<span>Incident ";
$descriptions .= $this->linkToIncident($incident);
$descriptions .= ":</span>";
$descriptions .= "<pre>";
$descriptions .= $incident["Incident"]["steps"];
$descriptions .= "</pre>";
}
return $descriptions;
}
}
15 changes: 4 additions & 11 deletions app/View/Reports/view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</tr>
<tr>
<td>Incident Count</td>
<td><?php echo count($incidents) ." incidents of this bug"; ?></td>
<td><?php echo count($incidents) . " incidents of this bug"; ?></td>
</tr>
<tr>
<td>Submition Date</td>
Expand All @@ -66,15 +66,6 @@
<?php echo $incidents[0]["Incident"]["created"]; ?>
</td>
</tr>
<tr>
<td>Steps leading to the error</td>
<td>
<p>Incidents with a description:
<?php echo $this->Reports->
createIncidentsLinks($incidents_with_description); ?>
</p>
</td>
</tr>
<tr>
<td>Stack</td>
<td>
Expand All @@ -85,9 +76,11 @@
</td>
</tr>
<tr>
<td>Related reports</td>
<td>Incidents</td>
<td>
<?php echo $this->Reports->createIncidentsLinks($incidents); ?>
</td>
</tr>
</table>
<h4>Descriptions submited by users:</h4>
<?php echo $this->Reports->incidentsDescriptions($incidents_with_description); ?>

0 comments on commit 0112c75

Please sign in to comment.