changed the issue show view to show related code revisions

This commit is contained in:
hyung-hwan 2016-01-22 18:44:55 +00:00
parent fdfa5ecaa0
commit 1c8c8c2157
5 changed files with 58 additions and 4 deletions

View File

@ -146,6 +146,7 @@ class Issue extends Controller
{
$this->load->model ('ProjectModel', 'projects');
$this->load->model ('IssueModel', 'issues');
$this->load->model ('CodeModel', 'code');
$login = $this->login->getUser ();
if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '')
@ -217,11 +218,16 @@ class Issue extends Controller
}
else
{
$related_code_revisions = $this->code->getRelatedRevisions ($project->id, $issue->id);
if ($related_code_revisions === FALSE) $related_code_revisions = array();
$data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang);
$data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang);
$data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang);
$data['project'] = $project;
$data['issue'] = $issue;
$data['related_code_revisions'] = $related_code_revisions;
$this->load->view ($this->VIEW_SHOW, $data);
}
}

View File

@ -39,6 +39,29 @@ class CodeModel extends Model
return $query->result();
}
function getRelatedRevisions ($projectid, $issueid)
{
$this->db->trans_begin ();
$this->db->from ('issue');
$this->db->join ('issue_coderev', 'issue.projectid = issue_coderev.projectid AND issue.id = issue_coderev.issueid');
$this->db->where ('issue_coderev.projectid', (string)$projectid);
$this->db->where ('issue_coderev.issueid', $issueid);
$this->db->order_by ('issue_coderev.projectid ASC');
$this->db->order_by ('issue_coderev.coderev ASC');
$this->db->select ('issue_coderev.projectid, issue_coderev.coderev');
$query = $this->db->get ();
if ($this->db->trans_status() === FALSE)
{
$this->errmsg = $this->db->_error_message();
$this->db->trans_rollback ();
return FALSE;
}
$this->db->trans_commit ();
return $query->result();
}
function getReviews ($projectid, $revision)
{
$this->db->trans_begin ();

View File

@ -1014,6 +1014,9 @@ function print_issue_state ($con, $issue, $old, $issue_type_array, $issue_status
print '<ul id="issue_show_coderev_list" class="codepot-horizontal-list">';
foreach ($related_code_revisions as $r)
{
print '<li>';
print anchor ("/code/revision/{$r->projectid}/!./{$r->coderev}", $r->coderev);
print '</li>';
}
print '</ul>';
}

View File

@ -1046,6 +1046,12 @@ ul.codepot-horizontal-list li {
float: left;
}
.codepot-opacity-85 {
filter:alpha(opacity=85); /* IE */
opacity: 0.85; /* Safari, Opera */
-moz-opacity:0.85; /* FireFox */
}
/* === common issue class === */
.codepot-issue-type-defect {

View File

@ -132,6 +132,12 @@ textarea.codepot-issue-edit-comment {
#issue_show_metadata_list li {
margin-top: 0.1em;
margin-bottom: 0.2em;
background-color: #EAEAEA !important;
color: #000000 !important;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#issue_show_state_list,
@ -140,12 +146,22 @@ textarea.codepot-issue-edit-comment {
border-top: 1px dashed #EAEAEA
}
#issue_show_metadata_list li {
background-color: #EAEAEA !important;
color: #000000 !important;
#issue_show_coderev_list {
margin-top: 2em;
}
#issue_show_coderev_list a {
color: #FFFFFF;
background-color: #45A067;
padding: 0.3em;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
filter:alpha(opacity=85); /* IE */
opacity: 0.85; /* Safari, Opera */
-moz-opacity:0.85; /* FireFox */
}
#issue_show_change_form {