1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Entirely replace the old filetree UI with the "flank" UI

Summary:
Ref T13516. Deletes all old filetree / flex / active / collapse nav code in favor of the new code.

Restores the inline tips in the path tree.

Test Plan: {F7374175}

Maniphest Tasks: T13516

Differential Revision: https://secure.phabricator.com/D21154
This commit is contained in:
epriestley 2020-04-21 14:27:27 -07:00
parent ba8071bbef
commit 12eddb18fb
19 changed files with 121 additions and 896 deletions

View file

@ -9,10 +9,10 @@ return array(
'names' => array(
'conpherence.pkg.css' => '3c8a0668',
'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => 'a4a2417c',
'core.pkg.js' => 'd092ddaf',
'differential.pkg.css' => '607c84be',
'differential.pkg.js' => '58e09368',
'core.pkg.css' => '4d5d0922',
'core.pkg.js' => '544bc792',
'differential.pkg.css' => 'cb99cd21',
'differential.pkg.js' => 'b3589d05',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7',
'maniphest.pkg.css' => '35995d6d',
@ -29,7 +29,7 @@ return array(
'rsrc/css/aphront/multi-column.css' => 'fbc00ba3',
'rsrc/css/aphront/notification.css' => '30240bd2',
'rsrc/css/aphront/panel-view.css' => '46923d46',
'rsrc/css/aphront/phabricator-nav-view.css' => 'f8a0c1bf',
'rsrc/css/aphront/phabricator-nav-view.css' => '423f92cc',
'rsrc/css/aphront/table-view.css' => '0bb61df1',
'rsrc/css/aphront/tokenizer.css' => '34e2a838',
'rsrc/css/aphront/tooltip.css' => 'e3f2412f',
@ -40,7 +40,7 @@ return array(
'rsrc/css/application/base/main-menu-view.css' => 'bcec20f0',
'rsrc/css/application/base/notification-menu.css' => '4df1ee30',
'rsrc/css/application/base/phui-theme.css' => '35883b37',
'rsrc/css/application/base/standard-page-view.css' => 'ed076e5a',
'rsrc/css/application/base/standard-page-view.css' => 'a374f94c',
'rsrc/css/application/chatlog/chatlog.css' => 'abdc76ee',
'rsrc/css/application/conduit/conduit-api.css' => 'ce2cfc41',
'rsrc/css/application/config/config-options.css' => '16c920ae',
@ -59,7 +59,7 @@ return array(
'rsrc/css/application/countdown/timer.css' => 'bff8012f',
'rsrc/css/application/daemon/bulk-job.css' => '73af99f5',
'rsrc/css/application/dashboard/dashboard.css' => '5a205b9d',
'rsrc/css/application/diff/diff-tree-view.css' => 'ce58c3d1',
'rsrc/css/application/diff/diff-tree-view.css' => '8f487a99',
'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d',
'rsrc/css/application/differential/add-comment.css' => '7e5900d9',
'rsrc/css/application/differential/changeset-view.css' => '489b6995',
@ -115,12 +115,11 @@ return array(
'rsrc/css/core/core.css' => '1b29ed61',
'rsrc/css/core/remarkup.css' => 'c286eaef',
'rsrc/css/core/syntax.css' => '220b85f9',
'rsrc/css/core/z-index.css' => '99c0f5eb',
'rsrc/css/core/z-index.css' => '612e9522',
'rsrc/css/diviner/diviner-shared.css' => '4bd263b0',
'rsrc/css/font/font-awesome.css' => '3883938a',
'rsrc/css/font/font-lato.css' => '23631304',
'rsrc/css/font/phui-font-icon-base.css' => 'd7994e06',
'rsrc/css/layout/phabricator-filetree-view.css' => '56cdd875',
'rsrc/css/layout/phabricator-source-code-view.css' => '03d7ac28',
'rsrc/css/phui/button/phui-button-bar.css' => 'a4aa75c4',
'rsrc/css/phui/button/phui-button-simple.css' => '1ff278aa',
@ -379,10 +378,10 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => 'a2ab19be',
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
'rsrc/js/application/diff/DiffChangeset.js' => 'ea6e377d',
'rsrc/js/application/diff/DiffChangesetList.js' => '5a351998',
'rsrc/js/application/diff/DiffChangeset.js' => '2a3101b1',
'rsrc/js/application/diff/DiffChangesetList.js' => '57035863',
'rsrc/js/application/diff/DiffInline.js' => '16e97ebc',
'rsrc/js/application/diff/DiffPathView.js' => '8337f4c7',
'rsrc/js/application/diff/DiffPathView.js' => 'c0ed32ce',
'rsrc/js/application/diff/DiffTreeView.js' => 'a5823e4d',
'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17',
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
@ -466,7 +465,6 @@ return array(
'rsrc/js/core/TextAreaUtils.js' => 'f340a484',
'rsrc/js/core/Title.js' => '43bc9360',
'rsrc/js/core/ToolTip.js' => '83754533',
'rsrc/js/core/behavior-active-nav.js' => '7353f43d',
'rsrc/js/core/behavior-audio-source.js' => '3dc5ad43',
'rsrc/js/core/behavior-autofocus.js' => '65bb0011',
'rsrc/js/core/behavior-badge-view.js' => '92cdd7b6',
@ -477,7 +475,6 @@ return array(
'rsrc/js/core/behavior-device.js' => '0cf79f45',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '7ad020a5',
'rsrc/js/core/behavior-fancy-datepicker.js' => '956f3eeb',
'rsrc/js/core/behavior-file-tree.js' => 'a61c2d11',
'rsrc/js/core/behavior-form.js' => '55d7b788',
'rsrc/js/core/behavior-gesture.js' => 'b58d1a2a',
'rsrc/js/core/behavior-global-drag-and-drop.js' => '1cab0e9a',
@ -492,7 +489,6 @@ return array(
'rsrc/js/core/behavior-more.js' => '506aa3f4',
'rsrc/js/core/behavior-object-selector.js' => '98ef467f',
'rsrc/js/core/behavior-oncopy.js' => 'ff7b3f22',
'rsrc/js/core/behavior-phabricator-nav.js' => 'f166c949',
'rsrc/js/core/behavior-phabricator-remarkup-assist.js' => '54262396',
'rsrc/js/core/behavior-read-only-warning.js' => 'b9109f8f',
'rsrc/js/core/behavior-redirect.js' => '407ee861',
@ -562,7 +558,7 @@ return array(
'conpherence-thread-manager' => 'aec8e38c',
'conpherence-transaction-css' => '3a3f5e7e',
'd3' => '9d068042',
'diff-tree-view-css' => 'ce58c3d1',
'diff-tree-view-css' => '8f487a99',
'differential-changeset-view-css' => '489b6995',
'differential-core-view-css' => '7300a73e',
'differential-revision-add-comment-css' => '7e5900d9',
@ -644,16 +640,13 @@ return array(
'javelin-behavior-maniphest-list-editor' => 'c687e867',
'javelin-behavior-owners-path-editor' => 'ff688a7a',
'javelin-behavior-passphrase-credential-control' => '48fe33d0',
'javelin-behavior-phabricator-active-nav' => '7353f43d',
'javelin-behavior-phabricator-autofocus' => '65bb0011',
'javelin-behavior-phabricator-clipboard-copy' => 'cf32921f',
'javelin-behavior-phabricator-file-tree' => 'a61c2d11',
'javelin-behavior-phabricator-gesture' => 'b58d1a2a',
'javelin-behavior-phabricator-gesture-example' => '242dedd0',
'javelin-behavior-phabricator-keyboard-pager' => '1325b731',
'javelin-behavior-phabricator-keyboard-shortcuts' => '42c44e8b',
'javelin-behavior-phabricator-line-linker' => '590e6527',
'javelin-behavior-phabricator-nav' => 'f166c949',
'javelin-behavior-phabricator-notification-example' => '29819b75',
'javelin-behavior-phabricator-object-selector' => '98ef467f',
'javelin-behavior-phabricator-oncopy' => 'ff7b3f22',
@ -782,10 +775,10 @@ return array(
'phabricator-darklog' => '3b869402',
'phabricator-darkmessage' => '26cd4b73',
'phabricator-dashboard-css' => '5a205b9d',
'phabricator-diff-changeset' => 'ea6e377d',
'phabricator-diff-changeset-list' => '5a351998',
'phabricator-diff-changeset' => '2a3101b1',
'phabricator-diff-changeset-list' => '57035863',
'phabricator-diff-inline' => '16e97ebc',
'phabricator-diff-path-view' => '8337f4c7',
'phabricator-diff-path-view' => 'c0ed32ce',
'phabricator-diff-tree-view' => 'a5823e4d',
'phabricator-drag-and-drop-file-upload' => '4370900d',
'phabricator-draggable-list' => '0169e425',
@ -793,12 +786,11 @@ return array(
'phabricator-favicon' => '7930776a',
'phabricator-feed-css' => 'd8b6e3f8',
'phabricator-file-upload' => 'ab85e184',
'phabricator-filetree-view-css' => '56cdd875',
'phabricator-flag-css' => '2b77be8d',
'phabricator-keyboard-shortcut' => '1a844c06',
'phabricator-keyboard-shortcut-manager' => '81debc48',
'phabricator-main-menu-view' => 'bcec20f0',
'phabricator-nav-view-css' => 'f8a0c1bf',
'phabricator-nav-view-css' => '423f92cc',
'phabricator-notification' => 'a9b91e3f',
'phabricator-notification-css' => '30240bd2',
'phabricator-notification-menu-css' => '4df1ee30',
@ -810,12 +802,12 @@ return array(
'phabricator-shaped-request' => 'abf88db8',
'phabricator-slowvote-css' => '1694baed',
'phabricator-source-code-view-css' => '03d7ac28',
'phabricator-standard-page-view' => 'ed076e5a',
'phabricator-standard-page-view' => 'a374f94c',
'phabricator-textareautils' => 'f340a484',
'phabricator-title' => '43bc9360',
'phabricator-tooltip' => '83754533',
'phabricator-ui-example-css' => 'b4795059',
'phabricator-zindex-css' => '99c0f5eb',
'phabricator-zindex-css' => '612e9522',
'phame-css' => 'bb442327',
'pholio-css' => '88ef5ef1',
'pholio-edit-css' => '4df55b3b',
@ -1163,6 +1155,18 @@ return array(
'javelin-stratcom',
'javelin-behavior',
),
'2a3101b1' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
'phabricator-diff-path-view',
),
'2a8b62d9' => array(
'multirow-row-manager',
'javelin-install',
@ -1432,6 +1436,11 @@ return array(
'javelin-stratcom',
'javelin-dom',
),
57035863 => array(
'javelin-install',
'phuix-button-view',
'phabricator-diff-tree-view',
),
'5793d835' => array(
'javelin-install',
'javelin-util',
@ -1472,11 +1481,6 @@ return array(
'javelin-dom',
'javelin-history',
),
'5a351998' => array(
'javelin-install',
'phuix-button-view',
'phabricator-diff-tree-view',
),
'5a6f6a06' => array(
'javelin-behavior',
'javelin-quicksand',
@ -1583,13 +1587,6 @@ return array(
'javelin-util',
'javelin-reactor-node-calmer',
),
'7353f43d' => array(
'javelin-behavior',
'javelin-stratcom',
'javelin-vector',
'javelin-dom',
'javelin-uri',
),
'73ecc1f8' => array(
'javelin-behavior',
'javelin-behavior-device',
@ -1657,9 +1654,6 @@ return array(
'javelin-dom',
'javelin-vector',
),
'8337f4c7' => array(
'javelin-dom',
),
83754533 => array(
'javelin-install',
'javelin-util',
@ -1878,11 +1872,6 @@ return array(
'a5823e4d' => array(
'javelin-dom',
),
'a61c2d11' => array(
'javelin-behavior',
'phabricator-keyboard-shortcut',
'javelin-stratcom',
),
'a9942052' => array(
'javelin-behavior',
'javelin-dom',
@ -2046,6 +2035,9 @@ return array(
'c03f2fb4' => array(
'javelin-install',
),
'c0ed32ce' => array(
'javelin-dom',
),
'c2c500a7' => array(
'javelin-install',
'javelin-dom',
@ -2161,18 +2153,6 @@ return array(
'javelin-install',
'javelin-event',
),
'ea6e377d' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
'phabricator-diff-path-view',
),
'ebe83a6b' => array(
'javelin-install',
),
@ -2187,16 +2167,6 @@ return array(
'javelin-dom',
'javelin-stratcom',
),
'f166c949' => array(
'javelin-behavior',
'javelin-behavior-device',
'javelin-stratcom',
'javelin-dom',
'javelin-magical-init',
'javelin-vector',
'javelin-request',
'javelin-util',
),
'f340a484' => array(
'javelin-install',
'javelin-dom',
@ -2377,8 +2347,6 @@ return array(
'javelin-behavior-aphlict-dropdown',
'javelin-behavior-history-install',
'javelin-behavior-phabricator-gesture',
'javelin-behavior-phabricator-active-nav',
'javelin-behavior-phabricator-nav',
'javelin-behavior-phabricator-remarkup-assist',
'phabricator-textareautils',
'phabricator-file-upload',
@ -2424,7 +2392,6 @@ return array(
'phabricator-content-source-view-css',
'inline-comment-summary-css',
'phui-inline-comment-view-css',
'phabricator-filetree-view-css',
),
'differential.pkg.js' => array(
'phabricator-drag-and-drop-file-upload',

View file

@ -54,8 +54,6 @@ return array(
'javelin-behavior-aphlict-dropdown',
'javelin-behavior-history-install',
'javelin-behavior-phabricator-gesture',
'javelin-behavior-phabricator-active-nav',
'javelin-behavior-phabricator-nav',
'javelin-behavior-phabricator-remarkup-assist',
'phabricator-textareautils',
'phabricator-file-upload',
@ -187,7 +185,6 @@ return array(
'phabricator-content-source-view-css',
'inline-comment-summary-css',
'phui-inline-comment-view-css',
'phabricator-filetree-view-css',
),
'differential.pkg.js' => array(
'phabricator-drag-and-drop-file-upload',

View file

@ -466,7 +466,6 @@ phutil_register_library_map(array(
'DifferentialChangeset' => 'applications/differential/storage/DifferentialChangeset.php',
'DifferentialChangesetDetailView' => 'applications/differential/view/DifferentialChangesetDetailView.php',
'DifferentialChangesetEngine' => 'applications/differential/engine/DifferentialChangesetEngine.php',
'DifferentialChangesetFileTreeSideNavBuilder' => 'applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php',
'DifferentialChangesetHTMLRenderer' => 'applications/differential/render/DifferentialChangesetHTMLRenderer.php',
'DifferentialChangesetListController' => 'applications/differential/controller/DifferentialChangesetListController.php',
'DifferentialChangesetListView' => 'applications/differential/view/DifferentialChangesetListView.php',
@ -4769,7 +4768,6 @@ phutil_register_library_map(array(
'PhabricatorSetupIssueView' => 'applications/config/view/PhabricatorSetupIssueView.php',
'PhabricatorShiftChartFunction' => 'applications/fact/chart/PhabricatorShiftChartFunction.php',
'PhabricatorShortSite' => 'aphront/site/PhabricatorShortSite.php',
'PhabricatorShowFiletreeSetting' => 'applications/settings/setting/PhabricatorShowFiletreeSetting.php',
'PhabricatorSignDocumentsUserLogType' => 'applications/people/userlog/PhabricatorSignDocumentsUserLogType.php',
'PhabricatorSimpleEditType' => 'applications/transactions/edittype/PhabricatorSimpleEditType.php',
'PhabricatorSinChartFunction' => 'applications/fact/chart/PhabricatorSinChartFunction.php',
@ -6517,7 +6515,6 @@ phutil_register_library_map(array(
),
'DifferentialChangesetDetailView' => 'AphrontView',
'DifferentialChangesetEngine' => 'Phobject',
'DifferentialChangesetFileTreeSideNavBuilder' => 'Phobject',
'DifferentialChangesetHTMLRenderer' => 'DifferentialChangesetRenderer',
'DifferentialChangesetListController' => 'DifferentialController',
'DifferentialChangesetListView' => 'AphrontView',
@ -11519,7 +11516,6 @@ phutil_register_library_map(array(
'PhabricatorSetupIssueView' => 'AphrontView',
'PhabricatorShiftChartFunction' => 'PhabricatorPureChartFunction',
'PhabricatorShortSite' => 'PhabricatorSite',
'PhabricatorShowFiletreeSetting' => 'PhabricatorSelectSetting',
'PhabricatorSignDocumentsUserLogType' => 'PhabricatorUserLogType',
'PhabricatorSimpleEditType' => 'PhabricatorEditType',
'PhabricatorSinChartFunction' => 'PhabricatorPureChartFunction',

View file

@ -193,7 +193,6 @@ final class DifferentialChangesetDetailView extends AphrontView {
'autoload' => $this->getAutoload(),
'displayPath' => hsprintf('%s', $display_parts),
'icon' => $display_icon,
'treeNodeID' => 'tree-node-'.$changeset->getAnchorName(),
'pathParts' => $path_parts,
'editorURI' => $this->getEditorURI(),

View file

@ -1,158 +0,0 @@
<?php
final class DifferentialChangesetFileTreeSideNavBuilder extends Phobject {
private $title;
private $baseURI;
private $anchorName;
private $collapsed = false;
private $width;
public function setAnchorName($anchor_name) {
$this->anchorName = $anchor_name;
return $this;
}
public function getAnchorName() {
return $this->anchorName;
}
public function setBaseURI(PhutilURI $base_uri) {
$this->baseURI = $base_uri;
return $this;
}
public function getBaseURI() {
return $this->baseURI;
}
public function setTitle($title) {
$this->title = $title;
return $this;
}
public function getTitle() {
return $this->title;
}
public function setCollapsed($collapsed) {
$this->collapsed = $collapsed;
return $this;
}
public function setWidth($width) {
$this->width = $width;
return $this;
}
public function build(array $changesets) {
assert_instances_of($changesets, 'DifferentialChangeset');
$nav = id(new AphrontSideNavFilterView())
->setBaseURI($this->getBaseURI())
->setFlexible(true)
->setCollapsed($this->collapsed)
->setWidth($this->width);
$anchor = $this->getAnchorName();
$tree = new PhutilFileTree();
foreach ($changesets as $changeset) {
try {
$tree->addPath($changeset->getFilename(), $changeset);
} catch (Exception $ex) {
// TODO: See T1702. When viewing the versus diff of diffs, we may
// have files with the same filename. For example, if you have a setup
// like this in SVN:
//
// a/
// README
// b/
// README
//
// ...and you run "arc diff" once from a/, and again from b/, you'll
// get two diffs with path README. However, in the versus diff view we
// will compute their absolute repository paths and detect that they
// aren't really the same file. This is correct, but causes us to
// throw when inserting them.
//
// We should probably compute the smallest unique path for each file
// and show these as "a/README" and "b/README" when diffed against
// one another. However, we get this wrong in a lot of places (the
// other TOC shows two "README" files, and we generate the same anchor
// hash for both) so I'm just stopping the bleeding until we can get
// a proper fix in place.
}
}
require_celerity_resource('phabricator-filetree-view-css');
$filetree = array();
$path = $tree;
while (($path = $path->getNextNode())) {
$data = $path->getData();
$classes = array();
$classes[] = 'phabricator-filetree-item';
$name = $path->getName();
$style = 'padding-left: '.(2 + (3 * $path->getDepth())).'px';
$href = null;
if ($data) {
$href = '#'.$data->getAnchorName();
$title = $name;
$icon = $data->newFileTreeIcon();
$classes[] = $data->getFileTreeClass();
$count = phutil_tag(
'span',
array(
'class' => 'filetree-progress-hint',
'id' => 'tree-node-'.$data->getAnchorName(),
));
} else {
$name .= '/';
$title = $path->getFullPath().'/';
$icon = id(new PHUIIconView())
->setIcon('fa-folder-open blue');
$count = null;
}
$name_element = phutil_tag(
'span',
array(
'class' => 'phabricator-filetree-name',
),
$name);
$filetree[] = javelin_tag(
$href ? 'a' : 'span',
array(
'href' => $href,
'style' => $style,
'title' => $title,
'class' => implode(' ', $classes),
),
array($count, $icon, $name_element));
}
$tree->destroy();
$filetree = phutil_tag(
'div',
array(
'class' => 'phabricator-filetree',
),
$filetree);
Javelin::initBehavior('phabricator-file-tree', array());
$nav->addLabel(pht('Changed Files'));
$nav->addCustomBlock($filetree);
$nav->setActive(true);
$nav->selectFilter(null);
return $nav;
}
}

View file

@ -457,26 +457,10 @@ final class DiffusionCommitController extends DiffusionController {
$commit,
$timeline);
$filetree_on = $viewer->compareUserSetting(
PhabricatorShowFiletreeSetting::SETTINGKEY,
PhabricatorShowFiletreeSetting::VALUE_ENABLE_FILETREE);
$nav = null;
if ($show_changesets && $filetree_on) {
$pref_collapse = PhabricatorFiletreeVisibleSetting::SETTINGKEY;
$collapsed = $viewer->getUserSetting($pref_collapse);
$pref_width = PhabricatorFiletreeWidthSetting::SETTINGKEY;
$width = $viewer->getUserSetting($pref_width);
$nav = id(new DifferentialChangesetFileTreeSideNavBuilder())
->setTitle($commit->getDisplayName())
->setBaseURI(new PhutilURI($commit->getURI()))
->build($changesets)
->setCrumbs($crumbs)
->setCollapsed((bool)$collapsed)
->setWidth((int)$width);
}
$filetree = id(new DifferentialFileTreeEngine())
->setViewer($viewer)
->setChangesets($changesets)
->setDisabled(!$show_changesets);
$description_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Description'))
@ -509,18 +493,20 @@ final class DiffusionCommitController extends DiffusionController {
$add_comment,
));
$main_content = array(
$crumbs,
$view,
);
$main_content = $filetree->newView($main_content);
if (!$filetree->getDisabled()) {
$change_list->setFormationView($main_content);
}
$page = $this->newPage()
->setTitle($commit->getDisplayName())
->setCrumbs($crumbs)
->setPageObjectPHIDS(array($commit->getPHID()))
->appendChild(
array(
$view,
));
if ($nav) {
$page->setNavigation($nav);
}
->appendChild($main_content);
return $page;

View file

@ -1,42 +0,0 @@
<?php
final class PhabricatorShowFiletreeSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'diff-filetree';
const VALUE_DISABLE_FILETREE = 0;
const VALUE_ENABLE_FILETREE = 1;
public function getSettingName() {
return pht('Show Filetree');
}
protected function getSettingOrder() {
return 300;
}
public function getSettingPanelKey() {
return PhabricatorDiffPreferencesSettingsPanel::PANELKEY;
}
protected function getControlInstructions() {
return pht(
'When viewing a revision or commit, you can enable a sidebar showing '.
'affected files. When this option is enabled, press {nav %s} to show '.
'or hide the sidebar.',
'f');
}
public function getSettingDefaultValue() {
return self::VALUE_DISABLE_FILETREE;
}
protected function getSelectOptions() {
return array(
self::VALUE_DISABLE_FILETREE => pht('Disable Filetree'),
self::VALUE_ENABLE_FILETREE => pht('Enable Filetree'),
);
}
}

View file

@ -20,9 +20,6 @@ final class AphrontSideNavFilterView extends AphrontView {
private $items = array();
private $baseURI;
private $selectedFilter = false;
private $flexible;
private $collapsed = false;
private $active;
private $menu;
private $crumbs;
private $classes = array();
@ -30,7 +27,6 @@ final class AphrontSideNavFilterView extends AphrontView {
private $mainID;
private $isProfileMenu;
private $footer = array();
private $width;
public function setMenuID($menu_id) {
$this->menuID = $menu_id;
@ -68,26 +64,6 @@ final class AphrontSideNavFilterView extends AphrontView {
return $this->isProfileMenu;
}
public function setActive($active) {
$this->active = $active;
return $this;
}
public function setFlexible($flexible) {
$this->flexible = $flexible;
return $this;
}
public function setCollapsed($collapsed) {
$this->collapsed = $collapsed;
return $this;
}
public function setWidth($width) {
$this->width = $width;
return $this;
}
public function getMenuView() {
return $this->menu;
}
@ -227,53 +203,18 @@ final class AphrontSideNavFilterView extends AphrontView {
$local_menu = null;
$main_id = $this->getMainID();
$width = $this->width;
if ($width) {
$width = min($width, 600);
$width = max($width, 150);
} else {
$width = null;
}
if ($width && !$this->collapsed) {
$width_drag_style = 'left: '.$width.'px';
$width_panel_style = 'width: '.$width.'px';
$width_margin_style = 'margin-left: '.($width + 7).'px';
} else {
$width_drag_style = null;
$width_panel_style = null;
$width_margin_style = null;
}
if ($this->flexible) {
$drag_id = celerity_generate_unique_node_id();
$flex_bar = phutil_tag(
'div',
array(
'class' => 'phabricator-nav-drag',
'id' => $drag_id,
'style' => $width_drag_style,
),
'');
} else {
$flex_bar = null;
}
$nav_menu = null;
if ($this->menu->getItems()) {
$local_id = celerity_generate_unique_node_id();
$background_id = celerity_generate_unique_node_id();
if (!$this->collapsed) {
$nav_classes[] = 'has-local-nav';
}
$nav_classes[] = 'has-local-nav';
$local_menu = phutil_tag(
'div',
array(
'class' => 'phabricator-nav-local phabricator-side-menu',
'id' => $local_id,
'style' => $width_panel_style,
),
$this->menu->setID($this->getMenuID()));
}
@ -284,34 +225,6 @@ final class AphrontSideNavFilterView extends AphrontView {
$nav_classes[] = 'has-crumbs';
}
if ($this->flexible) {
if (!$this->collapsed) {
$nav_classes[] = 'has-drag-nav';
} else {
$nav_classes[] = 'has-closed-nav';
}
Javelin::initBehavior(
'phabricator-nav',
array(
'mainID' => $main_id,
'localID' => $local_id,
'dragID' => $drag_id,
'contentID' => $content_id,
'backgroundID' => $background_id,
'collapsed' => $this->collapsed,
'width' => $width,
));
if ($this->active) {
Javelin::initBehavior(
'phabricator-active-nav',
array(
'localID' => $local_id,
));
}
}
$nav_classes = array_merge($nav_classes, $this->classes);
$menu = phutil_tag(
@ -322,13 +235,11 @@ final class AphrontSideNavFilterView extends AphrontView {
),
array(
$local_menu,
$flex_bar,
phutil_tag(
'div',
array(
'class' => 'phabricator-nav-content plb',
'id' => $content_id,
'style' => $width_margin_style,
),
array(
$crumbs,

View file

@ -2,19 +2,11 @@
* @provides phabricator-nav-view-css
*/
.jx-drag-col {
cursor: col-resize;
}
.device-desktop .has-closed-nav div.phabricator-nav-local,
.device-desktop .has-closed-nav div.phabricator-nav-drag,
.device .phui-navigation-shell div.phabricator-nav-local,
.device .phui-navigation-shell div.phabricator-nav-drag {
.device .phui-navigation-shell div.phabricator-nav-local {
display: none;
}
.device-desktop .has-local-nav .phabricator-nav-local,
.device-desktop .has-local-nav .phabricator-nav-drag {
.device-desktop .has-local-nav .phabricator-nav-local {
display: block;
}
@ -40,55 +32,11 @@
width: auto;
}
.phabricator-nav-drag {
position: fixed;
top: 0;
bottom: 0;
left: 310px;
width: 7px;
cursor: col-resize;
background: #f5f5f5;
border-style: solid;
border-width: 0 1px 0 1px;
border-color: #fff #999c9e #fff #999c9e;
box-shadow: inset -1px 0px 1px rgba({$alphablack}, 0.15);
background-image: url(/rsrc/image/divot.png);
background-position: center;
background-repeat: no-repeat;
}
.phabricator-nav-content {
overflow: hidden;
}
.device-desktop .phabricator-standard-page-body .has-drag-nav
.phabricator-nav-content {
margin-left: 317px;
}
.device-desktop .phabricator-standard-page-body .has-drag-nav
.phabricator-nav-local {
max-width: none;
}
.has-drag-nav ul.phui-list-view {
height: 100%;
overflow-y: auto;
overflow-x: hidden;
}
.device-desktop .phui-navigation-shell .has-drag-nav .phabricator-nav-local {
width: 310px;
padding: 0;
/* See PHI568. If we don't paint the background explicitly, the content can
render underneath it when scrolled horizontally. */
background: {$page.background};
}
.device-phone .phabricator-side-menu-home .phabricator-nav-content {
display: none;
}

View file

@ -81,10 +81,13 @@ body.white-background {
}
.keyboard-focus-focus-reticle {
background: rgba(255, 255, 211, 0.15);
position: absolute;
border: 1px solid {$yellow};
pointer-events: none;
box-sizing: border-box;
border-width: 0 6px 0 0;
border-style: solid;
border-color: {$yellow};
background: {$lightyellow};
}
a.handle-status-closed {

View file

@ -3,16 +3,19 @@
*/
.diff-tree-view {
margin: 4px;
margin: 0 4px;
}
.diff-tree-path {
position: relative;
height: 20px;
color: {$greytext};
line-height: 20px;
}
.diff-tree-path-indent {
position: relative;
}
.diff-tree-path-icon {
position: absolute;
width: 20px;
@ -22,7 +25,7 @@
.diff-tree-path-name {
margin-left: 24px;
margin-right: 24px;
margin-right: 44px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@ -45,3 +48,28 @@
background: {$lightblueborder};
transition: 0.1s;
}
.diff-tree-path-inlines {
display: none;
position: absolute;
right: 4px;
border-radius: 4px;
text-align: center;
top: 2px;
height: 16px;
line-height: 14px;
width: 36px;
font-size: {$smallerfontsize};
color: {$greytext};
}
.diff-tree-path-inlines-visible {
display: block;
background: {$lightblueborder};
}
.diff-tree-path-inlines-completed {
background: {$darkgreybackground};
color: {$lightgreytext};
opacity: 0.75;
}

View file

@ -64,10 +64,6 @@ div.phui-calendar-day-event {
z-index: 4;
}
.phabricator-nav-drag {
z-index: 4;
}
.conpherence-message-pane .conpherence-search-main {
z-index: 4;
}

View file

@ -1,91 +0,0 @@
/**
* @provides phabricator-filetree-view-css
*/
.phabricator-filetree {
padding: 4px 0;
}
/* NOTE: Until the whole side nav situation gets cleaned up, we need to be
highly specific in specifying selectors here, to override side nav styles.
*/
.phabricator-filetree .phabricator-filetree-item {
margin: 0;
padding: 0;
display: block;
border-left: 4px solid transparent;
}
.phabricator-filetree span.phabricator-filetree-icon {
background-repeat: no-repeat;
background-position: 0 2px;
width: 16px;
height: 20px;
padding: 0;
float: left;
}
.phabricator-filetree span.phabricator-filetree-name {
padding: 0;
margin-left: 4px;
font-size: 12px;
font-weight: normal;
line-height: 20px;
white-space: nowrap;
}
.phabricator-filetree span.phabricator-filetree-item
.phabricator-filetree-name {
color: {$darkbluetext};
}
.phabricator-filetree a.phabricator-filetree-item
.phabricator-filetree-name {
color: {$darkbluetext};
}
.phabricator-filetree a.phabricator-filetree-item:hover {
text-decoration: none;
background-color: {$hovergrey};
}
.phabricator-filetree .filetree-added {
background: {$sh-greenbackground};
}
.phabricator-filetree .filetree-deleted {
background: {$sh-redbackground};
}
.phabricator-filetree .filetree-movecopy {
background: {$sh-orangebackground};
}
.phabricator-filetree .phabricator-active-nav-focus {
background-color: {$hovergrey};
border-left: 4px solid {$sky};
}
.phabricator-filetree .filetree-progress-hint {
width: 24px;
margin-right: 6px;
display: inline-block;
padding: 0 4px;
border-radius: 4px;
font-size: smaller;
background: {$greybackground};
text-align: center;
opacity: 0.5;
}
.phabricator-filetree .filetree-comments-visible {
background: {$lightblue};
opacity: 0.75;
color: {$darkgreytext};
}
.phabricator-filetree .filetree-comments-completed {
background: {$darkgreybackground};
color: {$greytext};
}

View file

@ -67,7 +67,6 @@ JX.install('DiffChangeset', {
_changesetList: null,
_icon: null,
_treeNodeID: null,
_editorURI: null,
_editorConfigureURI: null,
@ -770,13 +769,6 @@ JX.install('DiffChangeset', {
},
redrawFileTree: function() {
var tree;
try {
tree = JX.$(this._treeNodeID);
} catch (e) {
return;
}
var inlines = this._inlines;
var done = [];
var undone = [];
@ -833,9 +825,12 @@ JX.install('DiffChangeset', {
is_completed = false;
}
JX.DOM.setContent(tree, hint);
JX.DOM.alterClass(tree, 'filetree-comments-visible', is_visible);
JX.DOM.alterClass(tree, 'filetree-comments-completed', is_completed);
var node = this.getPathView().getInlineNode();
JX.DOM.setContent(node, hint);
JX.DOM.alterClass(node, 'diff-tree-path-inlines-visible', is_visible);
JX.DOM.alterClass(node, 'diff-tree-path-inlines-completed', is_completed);
},
toggleVisibility: function() {

View file

@ -1177,14 +1177,15 @@ JX.install('DiffChangesetList', {
// space between the focused element and the outline.
var p = JX.Vector.getPos(node);
var s = JX.Vector.getAggregateScrollForNode(node);
var d = JX.Vector.getDim(node);
p.add(s).add(-4, -4).setPos(reticle);
p.add(s).add(d.x + 1, 0).setPos(reticle);
// Compute the size we need to extend to the full extent of the focused
// nodes.
JX.Vector.getPos(extended_node)
.add(-p.x, -p.y)
.add(JX.Vector.getDim(extended_node))
.add(8, 8)
.add(0, JX.Vector.getDim(extended_node).y)
.add(10, 0)
.setDim(reticle);
JX.DOM.getContentFrame().appendChild(reticle);

View file

@ -20,6 +20,7 @@ JX.install('DiffPathView', {
_indentNode: null,
_pathNode: null,
_changeset: null,
_inlineNode: null,
getNode: function() {
if (!this._node) {
@ -71,7 +72,7 @@ JX.install('DiffPathView', {
setDepth: function(depth) {
this._depth = depth;
this._getIndentNode().style.marginLeft = (8 * this._depth) + 'px';
this._getIndentNode().style.marginLeft = (6 * this._depth) + 'px';
return this;
},
@ -109,12 +110,17 @@ JX.install('DiffPathView', {
_getIndentNode: function() {
if (!this._indentNode) {
var attrs = {
className: 'diff-tree-path-indent'
};
var content = [
this.getInlineNode(),
this._getIconNode(),
this._getPathNode(),
];
this._indentNode = JX.$N('div', {}, content);
this._indentNode = JX.$N('div', attrs, content);
}
return this._indentNode;
@ -138,6 +144,16 @@ JX.install('DiffPathView', {
this._iconNode = JX.$N('div', attrs, this.getIcon().getNode());
}
return this._iconNode;
},
getInlineNode: function() {
if (!this._inlineNode) {
var attrs = {
className: 'diff-tree-path-inlines',
};
this._inlineNode = JX.$N('div', attrs, '-');
}
return this._inlineNode;
}
}

View file

@ -1,87 +0,0 @@
/**
* @provides javelin-behavior-phabricator-active-nav
* @requires javelin-behavior
* javelin-stratcom
* javelin-vector
* javelin-dom
* javelin-uri
*/
JX.behavior('phabricator-active-nav', function(config) {
var local = JX.$(config.localID);
/**
* Select the navigation item corresponding to a given anchor.
*/
var selectnav = function(anchor) {
var links = JX.DOM.scry(local, 'a');
var link;
var link_anchor;
var selected;
for (var ii = 0; ii < links.length; ii++) {
link = links[ii];
link_anchor = JX.$U(link.href).getFragment();
selected = (link_anchor == anchor);
JX.DOM.alterClass(
link,
'phabricator-active-nav-focus',
selected);
}
};
/**
* Identify the current anchor based on the document scroll position.
*/
var updateposition = function() {
// Find all the markers in the document.
var scroll_position = JX.Vector.getScroll().y;
var document_size = JX.Vector.getDocument();
var viewport_size = JX.Vector.getViewport();
// If we're scrolled all the way down, we always want to select the last
// anchor.
var is_at_bottom = (viewport_size.y + scroll_position >= document_size.y);
var markers = JX.DOM.scry(document.body, 'legend', 'marker');
// Sort the markers by Y position, descending.
var markinfo = [];
var ii;
for (ii = 0; ii < markers.length; ii++) {
markinfo.push({
marker: markers[ii],
position: JX.$V(markers[ii]).y - 15
});
}
markinfo.sort(function(u, v) { return (v.position - u.position); });
// Find the first marker above the current scroll position, or the first
// marker in the document if we're above all the markers.
var active = null;
for (ii = 0; ii < markinfo.length; ii++) {
active = markinfo[ii].marker;
if (markinfo[ii].position <= scroll_position) {
break;
}
if (is_at_bottom) {
break;
}
}
// If we get above the first marker, select it.
selectnav(active && JX.Stratcom.getData(active).anchor);
};
var pending = null;
var onviewportchange = function() {
pending && clearTimeout(pending);
pending = setTimeout(updateposition, 100);
};
JX.Stratcom.listen('scroll', null, onviewportchange);
JX.Stratcom.listen('resize', null, onviewportchange);
JX.Stratcom.listen('hashchange', null, onviewportchange);
});

View file

@ -1,17 +0,0 @@
/**
* @provides javelin-behavior-phabricator-file-tree
* @requires javelin-behavior
* phabricator-keyboard-shortcut
* javelin-stratcom
*/
JX.behavior('phabricator-file-tree', function() {
new JX.KeyboardShortcut('f', 'Toggle file tree.')
.setGroup('diff-vis')
.setHandler(function() {
JX.Stratcom.invoke('differential-filetree-toggle');
})
.register();
});

View file

@ -1,223 +0,0 @@
/**
* @provides javelin-behavior-phabricator-nav
* @requires javelin-behavior
* javelin-behavior-device
* javelin-stratcom
* javelin-dom
* javelin-magical-init
* javelin-vector
* javelin-request
* javelin-util
* @javelin
*/
JX.behavior('phabricator-nav', function(config) {
var content = JX.$(config.contentID);
var local = JX.$(config.localID);
var main = JX.$(config.mainID);
var drag = JX.$(config.dragID);
// - Flexible Navigation Column ------------------------------------------------
var dragging;
var track;
var collapsed = config.collapsed;
var narrowed;
var visible = null;
JX.enableDispatch(document.body, 'mousemove');
JX.DOM.listen(drag, 'mousedown', null, function(e) {
if (!e.isNormalMouseEvent()) {
return;
}
dragging = JX.$V(e);
// Show the "col-resize" cursor on the whole document while we're
// dragging, since the mouse will slip off the actual bar fairly often and
// we don't want it to flicker.
JX.DOM.alterClass(document.body, 'jx-drag-col', true);
track = [
{
element: local,
parameter: 'width',
start: JX.Vector.getDim(local).x,
width: JX.Vector.getDim(local).x,
minWidth: 1
},
{
element: drag,
parameter: 'left',
start: get_width()
},
{
element: content,
parameter: 'marginLeft',
start: parseInt(getComputedStyle(content).marginLeft, 10),
width: JX.Vector.getDim(content).x,
minWidth: 300,
minScale: -1
}
];
e.kill();
});
JX.Stratcom.listen('mousemove', null, function(e) {
if (!dragging) {
return;
}
var dx = JX.$V(e).x - dragging.x;
var panel;
var k;
for (k = 0; k < track.length; k++) {
panel = track[k];
if (!panel.minWidth) {
continue;
}
var new_width = panel.width + (dx * (panel.minScale || 1));
if (new_width < panel.minWidth) {
dx = (panel.minWidth - panel.width) * panel.minScale;
}
}
for (k = 0; k < track.length; k++) {
panel = track[k];
var v = (panel.start + (dx * (panel.scale || 1)));
panel.element.style[panel.parameter] = v + 'px';
}
});
JX.Stratcom.listen('mouseup', null, function() {
if (!dragging) {
return;
}
JX.DOM.alterClass(document.body, 'jx-drag-col', false);
dragging = false;
new JX.Request('/settings/adjust/', JX.bag)
.setData(
{
key: 'filetree.width',
value: get_width()
})
.send();
});
function get_width() {
// See PHI568. If the document has scrolled horizontally, the "x" position
// of the bar will be the actual width of the menu plus the horizontal
// scroll position (because the element is "position: fixed"). Subtract the
// document scroll position when saving the element width so that scrolling
// to the right and then toggling the filetree UI does not make it grow
// any wider.
return (JX.$V(drag).x - JX.Vector.getScroll().x);
}
function repaint() {
narrowed = !JX.Device.isDesktop();
var was_visible = visible;
visible = (!collapsed && !narrowed);
if (was_visible === visible) {
return;
}
if (!visible) {
savedrag();
}
JX.DOM.alterClass(main, 'has-local-nav', visible);
JX.DOM.alterClass(main, 'has-drag-nav', visible);
JX.DOM.alterClass(main, 'has-closed-nav', !visible);
if (visible) {
restoredrag();
}
}
var saved_width = config.width;
function savedrag() {
saved_width = get_width();
local.style.width = '';
drag.style.left = '';
content.style.marginLeft = '';
}
function restoredrag() {
if (!saved_width) {
return;
}
local.style.width = saved_width + 'px';
drag.style.left = saved_width + 'px';
content.style.marginLeft = (saved_width + JX.Vector.getDim(drag).x) + 'px';
}
JX.Stratcom.listen('differential-filetree-toggle', null, function() {
collapsed = !collapsed;
repaint();
new JX.Request('/settings/adjust/', JX.bag)
.setData({ key : 'nav-collapsed', value : (collapsed ? 1 : 0) })
.send();
// Invoke a resize event so page elements can redraw if they need to. One
// example is the selection reticles in Differential.
JX.Stratcom.invoke('resize');
});
// - Scroll --------------------------------------------------------------------
// When the user scrolls or resizes the window, anchor the menu to to the top
// of the navigation bar.
function onresize() {
repaint();
if (!visible) {
return;
}
// When the buoyant header is visible, move the menu down below it. This
// is a bit of a hack.
var banner_height = 0;
try {
var banner = JX.$('diff-banner');
banner_height = JX.Vector.getDim(banner).y;
} catch (error) {
// Ignore if there's no banner on the page.
}
local.style.top = Math.max(
0,
banner_height,
JX.$V(content).y - Math.max(0, JX.Vector.getScroll().y)) + 'px';
}
local.style.position = 'fixed';
local.style.bottom = 0;
local.style.left = 0;
JX.Stratcom.listen(['scroll', 'resize'], null, onresize);
repaint();
// - Navigation Reset ----------------------------------------------------------
JX.Stratcom.listen('phabricator-device-change', null, function() {
repaint();
});
});