From 426754dd4dddd9afa7793f075093ff81102930b0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 13 Mar 2011 20:12:17 -0700 Subject: [PATCH] Improve Diffusion commit view featureset. --- src/__celerity_resource_map__.php | 43 +++++++++++-------- .../commit/DiffusionCommitController.php | 30 ++++++++++++- .../base/DiffusionPathChangeQuery.php | 5 +-- .../request/base/DiffusionRequest.php | 26 +++++++++++ .../css/application/diffusion/commit-view.css | 37 ++++++++++++++++ 5 files changed, 118 insertions(+), 23 deletions(-) create mode 100644 webroot/rsrc/css/application/diffusion/commit-view.css diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 1d7f4eb5f8..1b172b910f 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -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', diff --git a/src/applications/diffusion/controller/commit/DiffusionCommitController.php b/src/applications/diffusion/controller/commit/DiffusionCommitController.php index e59ec1486e..32bb7a6d2f 100644 --- a/src/applications/diffusion/controller/commit/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/commit/DiffusionCommitController.php @@ -27,8 +27,34 @@ class DiffusionCommitController extends DiffusionController { )); $detail_panel = new AphrontPanelView(); - $detail_panel->setHeader('Revision Detail'); - $detail_panel->appendChild('
'.$drequest->getCommit().'
'); + + $repository = $drequest->getRepository(); + $commit = $drequest->loadCommit(); + $commit_data = $drequest->loadCommitData(); + + require_celerity_resource('diffusion-commit-view-css'); + + $detail_panel->appendChild( + '
'. + ''. + '

Revision Detail

'. + '
'. + ''. + ''. + ''. + ''. + ''. + '
Author:'.phutil_escape_html($commit_data->getAuthorName()).'
'. + '
'. + '
'. + phutil_escape_html($commit_data->getCommitMessage()). + '
'. + '
'. + '
'); $content[] = $detail_panel; diff --git a/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php b/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php index 7eab3736c4..5cd79d2b27 100644 --- a/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php +++ b/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php @@ -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'), diff --git a/src/applications/diffusion/request/base/DiffusionRequest.php b/src/applications/diffusion/request/base/DiffusionRequest.php index d59a312619..d3758d36fe 100644 --- a/src/applications/diffusion/request/base/DiffusionRequest.php +++ b/src/applications/diffusion/request/base/DiffusionRequest.php @@ -25,6 +25,8 @@ class DiffusionRequest { protected $branch; protected $repository; + protected $repositoryCommit; + protected $repositoryCommitData; final private function __construct() { // @@ -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; } diff --git a/webroot/rsrc/css/application/diffusion/commit-view.css b/webroot/rsrc/css/application/diffusion/commit-view.css new file mode 100644 index 0000000000..8c472a3f82 --- /dev/null +++ b/webroot/rsrc/css/application/diffusion/commit-view.css @@ -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; +} \ No newline at end of file