1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 11:21:01 +01:00

Improve Diffusion commit view featureset.

This commit is contained in:
epriestley 2011-03-13 20:12:17 -07:00
parent c7d343e05e
commit 426754dd4d
5 changed files with 118 additions and 23 deletions

View file

@ -9,7 +9,7 @@
celerity_register_resource_map(array(
'aphront-crumbs-view-css' =>
array(
'uri' => '/res/4408ef5f/rsrc/css/aphront/crumbs-view.css',
'uri' => '/res/c666a518/rsrc/css/aphront/crumbs-view.css',
'type' => 'css',
'requires' =>
array(
@ -90,7 +90,7 @@ celerity_register_resource_map(array(
),
'aphront-table-view-css' =>
array(
'uri' => '/res/6a70f0f0/rsrc/css/aphront/table-view.css',
'uri' => '/res/7bf17fb8/rsrc/css/aphront/table-view.css',
'type' => 'css',
'requires' =>
array(
@ -197,6 +197,15 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/css/application/differential/table-of-contents.css',
),
'diffusion-commit-view-css' =>
array(
'uri' => '/res/3d212e58/rsrc/css/application/diffusion/commit-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/application/diffusion/commit-view.css',
),
'phabricator-directory-css' =>
array(
'uri' => '/res/6a000601/rsrc/css/application/directory/phabricator-directory.css',
@ -482,7 +491,7 @@ celerity_register_resource_map(array(
), array (
'packages' =>
array (
'04b474ba' =>
'c1818681' =>
array (
'name' => 'core.pkg.css',
'symbols' =>
@ -501,7 +510,7 @@ celerity_register_resource_map(array(
11 => 'phabricator-remarkup-css',
12 => 'syntax-highlighting-css',
),
'uri' => '/res/pkg/04b474ba/core.pkg.css',
'uri' => '/res/pkg/c1818681/core.pkg.css',
'type' => 'css',
),
'76f3c1f8' =>
@ -538,19 +547,19 @@ celerity_register_resource_map(array(
),
'reverse' =>
array (
'phabricator-core-css' => '04b474ba',
'phabricator-core-buttons-css' => '04b474ba',
'phabricator-standard-page-view' => '04b474ba',
'aphront-dialog-view-css' => '04b474ba',
'aphront-form-view-css' => '04b474ba',
'aphront-panel-view-css' => '04b474ba',
'aphront-side-nav-view-css' => '04b474ba',
'aphront-table-view-css' => '04b474ba',
'aphront-tokenizer-control-css' => '04b474ba',
'aphront-typeahead-control-css' => '04b474ba',
'phabricator-directory-css' => '04b474ba',
'phabricator-remarkup-css' => '04b474ba',
'syntax-highlighting-css' => '04b474ba',
'phabricator-core-css' => 'c1818681',
'phabricator-core-buttons-css' => 'c1818681',
'phabricator-standard-page-view' => 'c1818681',
'aphront-dialog-view-css' => 'c1818681',
'aphront-form-view-css' => 'c1818681',
'aphront-panel-view-css' => 'c1818681',
'aphront-side-nav-view-css' => 'c1818681',
'aphront-table-view-css' => 'c1818681',
'aphront-tokenizer-control-css' => 'c1818681',
'aphront-typeahead-control-css' => 'c1818681',
'phabricator-directory-css' => 'c1818681',
'phabricator-remarkup-css' => 'c1818681',
'syntax-highlighting-css' => 'c1818681',
'differential-core-view-css' => '76f3c1f8',
'differential-changeset-view-css' => '76f3c1f8',
'differential-revision-detail-css' => '76f3c1f8',

View file

@ -27,8 +27,34 @@ class DiffusionCommitController extends DiffusionController {
));
$detail_panel = new AphrontPanelView();
$detail_panel->setHeader('Revision Detail');
$detail_panel->appendChild('<div>'.$drequest->getCommit().'</div>');
$repository = $drequest->getRepository();
$commit = $drequest->loadCommit();
$commit_data = $drequest->loadCommitData();
require_celerity_resource('diffusion-commit-view-css');
$detail_panel->appendChild(
'<div class="diffusion-commit-view">'.
'<div class="diffusion-commit-dateline">'.
'r'.$repository->getCallsign().$commit->getCommitIdentifier().
' &middot; '.
date('F jS, Y g:i A', $commit->getEpoch()).
'</div>'.
'<h1>Revision Detail</h1>'.
'<div class="diffusion-commit-details">'.
'<table class="diffusion-commit-properties">'.
'<tr>'.
'<th>Author:</th>'.
'<td>'.phutil_escape_html($commit_data->getAuthorName()).'</td>'.
'</tr>'.
'</table>'.
'<hr />'.
'<div class="diffusion-commit-message">'.
phutil_escape_html($commit_data->getCommitMessage()).
'</div>'.
'</div>'.
'</div>');
$content[] = $detail_panel;

View file

@ -45,10 +45,7 @@ class DiffusionPathChangeQuery {
$drequest = $this->getRequest();
$repository = $drequest->getRepository();
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(),
$drequest->getCommit());
$commit = $drequest->loadCommit();
$raw_changes = queryfx_all(
$repository->establishConnection('r'),

View file

@ -25,6 +25,8 @@ class DiffusionRequest {
protected $branch;
protected $repository;
protected $repositoryCommit;
protected $repositoryCommitData;
final private function __construct() {
// <private>
@ -99,6 +101,30 @@ class DiffusionRequest {
return $this->branch;
}
public function loadCommit() {
if (empty($this->repositoryCommit)) {
$repository = $this->getRepository();
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %d AND commitIdentifier = %s',
$repository->getID(),
$this->getCommit());
$this->repositoryCommit = $commit;
}
return $this->repositoryCommit;
}
public function loadCommitData() {
if (empty($this->repositoryCommitData)) {
$commit = $this->loadCommit();
$data = id(new PhabricatorRepositoryCommitData())->loadOneWhere(
'commitID = %d',
$commit->getID());
$this->repositoryCommitData = $data;
}
return $this->repositoryCommitData;
}
final public function getRawCommit() {
return $this->commit;
}

View file

@ -0,0 +1,37 @@
/**
* @provides diffusion-commit-view-css
*/
.diffusion-commit-details {
padding: 0.5em;
background: #f9f9f9;
border: 1px solid #dddddd;
}
.diffusion-commit-details hr {
height: 1px;
border: none;
background: #dddddd;
}
.diffusion-commit-dateline {
float: right;
color: #555555;
}
.diffusion-commit-properties th {
font-weight: bold;
color: #444444;
text-align: right;
white-space: nowrap;
padding: 2px 4px;
width: 100px;
}
.diffusion-commit-properties td {
padding: 2px 4px;
}
.diffusion-commit-message {
padding: 8px;
}