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

Move all ListFilter buttons into crumbs

Summary:
Maniphest and Owners still have green ListFilter buttons, which have looked awkward for a while and are extra-awkward after D4447. Move them into crumbs and remove the ability of ListFilter to support buttons.

The actual implementation can be simplified too now.

Test Plan: Looked at Owners, Maniphest. Clicked create buttons. Looked at UIExample.

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D4451
This commit is contained in:
epriestley 2013-01-15 15:38:05 -08:00
parent 668a818f3c
commit 55072a2640
9 changed files with 88 additions and 97 deletions

View file

@ -680,7 +680,7 @@ celerity_register_resource_map(array(
),
'aphront-list-filter-view-css' =>
array(
'uri' => '/res/7402821f/rsrc/css/aphront/list-filter-view.css',
'uri' => '/res/f6d419df/rsrc/css/aphront/list-filter-view.css',
'type' => 'css',
'requires' =>
array(
@ -2664,7 +2664,7 @@ celerity_register_resource_map(array(
),
'phabricator-nav-view-css' =>
array(
'uri' => '/res/8606cda1/rsrc/css/aphront/phabricator-nav-view.css',
'uri' => '/res/00ba5b11/rsrc/css/aphront/phabricator-nav-view.css',
'type' => 'css',
'requires' =>
array(
@ -3268,7 +3268,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'7a47e387' =>
'6d57aed2' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -3313,7 +3313,7 @@ celerity_register_resource_map(array(
37 => 'phabricator-object-item-list-view-css',
38 => 'global-drag-and-drop-css',
),
'uri' => '/res/pkg/7a47e387/core.pkg.css',
'uri' => '/res/pkg/6d57aed2/core.pkg.css',
'type' => 'css',
),
'b239ff06' =>
@ -3502,19 +3502,19 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => 'ac211174',
'aphront-crumbs-view-css' => '7a47e387',
'aphront-dialog-view-css' => '7a47e387',
'aphront-error-view-css' => '7a47e387',
'aphront-form-view-css' => '7a47e387',
'aphront-crumbs-view-css' => '6d57aed2',
'aphront-dialog-view-css' => '6d57aed2',
'aphront-error-view-css' => '6d57aed2',
'aphront-form-view-css' => '6d57aed2',
'aphront-headsup-action-list-view-css' => 'ec01d039',
'aphront-headsup-view-css' => '7a47e387',
'aphront-list-filter-view-css' => '7a47e387',
'aphront-pager-view-css' => '7a47e387',
'aphront-panel-view-css' => '7a47e387',
'aphront-table-view-css' => '7a47e387',
'aphront-tokenizer-control-css' => '7a47e387',
'aphront-tooltip-css' => '7a47e387',
'aphront-typeahead-control-css' => '7a47e387',
'aphront-headsup-view-css' => '6d57aed2',
'aphront-list-filter-view-css' => '6d57aed2',
'aphront-pager-view-css' => '6d57aed2',
'aphront-panel-view-css' => '6d57aed2',
'aphront-table-view-css' => '6d57aed2',
'aphront-tokenizer-control-css' => '6d57aed2',
'aphront-tooltip-css' => '6d57aed2',
'aphront-typeahead-control-css' => '6d57aed2',
'differential-changeset-view-css' => 'ec01d039',
'differential-core-view-css' => 'ec01d039',
'differential-inline-comment-editor' => 'bbd79ca2',
@ -3528,7 +3528,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => 'ec01d039',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '7a47e387',
'global-drag-and-drop-css' => '6d57aed2',
'inline-comment-summary-css' => 'ec01d039',
'javelin-aphlict' => 'b239ff06',
'javelin-behavior' => 'fbeded59',
@ -3597,49 +3597,49 @@ celerity_register_resource_map(array(
'javelin-util' => 'fbeded59',
'javelin-vector' => 'fbeded59',
'javelin-workflow' => 'fbeded59',
'lightbox-attachment-css' => '7a47e387',
'lightbox-attachment-css' => '6d57aed2',
'maniphest-task-summary-css' => 'ac211174',
'maniphest-transaction-detail-css' => 'ac211174',
'phabricator-app-buttons-css' => '7a47e387',
'phabricator-app-buttons-css' => '6d57aed2',
'phabricator-busy' => 'b239ff06',
'phabricator-content-source-view-css' => 'ec01d039',
'phabricator-core-buttons-css' => '7a47e387',
'phabricator-core-css' => '7a47e387',
'phabricator-crumbs-view-css' => '7a47e387',
'phabricator-directory-css' => '7a47e387',
'phabricator-core-buttons-css' => '6d57aed2',
'phabricator-core-css' => '6d57aed2',
'phabricator-crumbs-view-css' => '6d57aed2',
'phabricator-directory-css' => '6d57aed2',
'phabricator-drag-and-drop-file-upload' => 'bbd79ca2',
'phabricator-dropdown-menu' => 'b239ff06',
'phabricator-file-upload' => 'b239ff06',
'phabricator-filetree-view-css' => '7a47e387',
'phabricator-flag-css' => '7a47e387',
'phabricator-form-view-css' => '7a47e387',
'phabricator-header-view-css' => '7a47e387',
'phabricator-jump-nav' => '7a47e387',
'phabricator-filetree-view-css' => '6d57aed2',
'phabricator-flag-css' => '6d57aed2',
'phabricator-form-view-css' => '6d57aed2',
'phabricator-header-view-css' => '6d57aed2',
'phabricator-jump-nav' => '6d57aed2',
'phabricator-keyboard-shortcut' => 'b239ff06',
'phabricator-keyboard-shortcut-manager' => 'b239ff06',
'phabricator-main-menu-view' => '7a47e387',
'phabricator-main-menu-view' => '6d57aed2',
'phabricator-menu-item' => 'b239ff06',
'phabricator-nav-view-css' => '7a47e387',
'phabricator-nav-view-css' => '6d57aed2',
'phabricator-notification' => 'b239ff06',
'phabricator-notification-css' => '7a47e387',
'phabricator-notification-menu-css' => '7a47e387',
'phabricator-object-item-list-view-css' => '7a47e387',
'phabricator-notification-css' => '6d57aed2',
'phabricator-notification-menu-css' => '6d57aed2',
'phabricator-object-item-list-view-css' => '6d57aed2',
'phabricator-object-selector-css' => 'ec01d039',
'phabricator-paste-file-upload' => 'b239ff06',
'phabricator-prefab' => 'b239ff06',
'phabricator-project-tag-css' => 'ac211174',
'phabricator-remarkup-css' => '7a47e387',
'phabricator-remarkup-css' => '6d57aed2',
'phabricator-shaped-request' => 'bbd79ca2',
'phabricator-side-menu-view-css' => '7a47e387',
'phabricator-standard-page-view' => '7a47e387',
'phabricator-side-menu-view-css' => '6d57aed2',
'phabricator-standard-page-view' => '6d57aed2',
'phabricator-textareautils' => 'b239ff06',
'phabricator-tooltip' => 'b239ff06',
'phabricator-transaction-view-css' => '7a47e387',
'phabricator-zindex-css' => '7a47e387',
'sprite-apps-large-css' => '7a47e387',
'sprite-gradient-css' => '7a47e387',
'sprite-icon-css' => '7a47e387',
'sprite-menu-css' => '7a47e387',
'syntax-highlighting-css' => '7a47e387',
'phabricator-transaction-view-css' => '6d57aed2',
'phabricator-zindex-css' => '6d57aed2',
'sprite-apps-large-css' => '6d57aed2',
'sprite-gradient-css' => '6d57aed2',
'sprite-icon-css' => '6d57aed2',
'sprite-menu-css' => '6d57aed2',
'syntax-highlighting-css' => '6d57aed2',
),
));

View file

@ -281,15 +281,6 @@ final class ManiphestTaskListController extends ManiphestController {
}
$filter = new AphrontListFilterView();
$filter->addButton(
phutil_render_tag(
'a',
array(
'href' => (string)$create_uri,
'class' => 'green button',
),
'Create New Task'));
if (empty($key)) {
$filter->appendChild($form);
}
@ -400,10 +391,24 @@ final class ManiphestTaskListController extends ManiphestController {
$list_container->appendChild('</div>');
$nav->appendChild($list_container);
$title = pht('Task List');
$crumbs = $this->buildApplicationCrumbs($nav)
->addCrumb(
id(new PhabricatorCrumbView())
->setName($title))
->addAction(
id(new PhabricatorMenuItemView())
->setHref($this->getApplicationURI('/task/create/'))
->setName(pht('Create Task'))
->setIcon('create'));
$nav->setCrumbs($crumbs);
return $this->buildStandardPageResponse(
$nav,
array(
'title' => 'Task List',
'title' => $title,
));
}

View file

@ -23,6 +23,32 @@ abstract class PhabricatorOwnersController extends PhabricatorController {
$nav->appendChild($view);
$page->appendChild($nav);
$filter = $nav->getSelectedFilter();
switch ($filter) {
case 'view/owned':
case 'view/all':
$crumbs = $this->buildApplicationCrumbs();
if ($filter == 'view/owned') {
$title = pht('Owned Packages');
} else {
$title = pht('All Packages');
}
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName($title));
$crumbs->addAction(
id(new PhabricatorMenuItemView())
->setName(pht('Create Package'))
->setHref('/owners/new/')
->setIcon('create'));
$nav->setCrumbs($crumbs);
break;
}
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}

View file

@ -81,7 +81,7 @@ final class PhabricatorOwnersDetailController
$path_links = array();
foreach ($paths as $path) {
$repo = $repositories[$path->getRepositoryPHID()];
$repo = idx($repositories, $path->getRepositoryPHID());
if (!$repo) {
continue;
}

View file

@ -122,14 +122,6 @@ final class PhabricatorOwnersListController
$nodata);
$filter = new AphrontListFilterView();
$filter->addButton(
phutil_render_tag(
'a',
array(
'href' => '/owners/new/',
'class' => 'green button',
),
'Create New Package'));
$owners_search_value = array();
if ($request->getArr('owner')) {
@ -250,7 +242,7 @@ final class PhabricatorOwnersListController
$pkg_paths = idx($paths, $package->getID(), array());
foreach ($pkg_paths as $key => $path) {
$repo = $repositories[$path->getRepositoryPHID()];
$repo = idx($repositories, $path->getRepositoryPHID());
if ($repo) {
$href = DiffusionRequest::generateDiffusionURI(
array(

View file

@ -14,14 +14,6 @@ final class PhabricatorUIListFilterExample extends PhabricatorUIExample {
public function renderExample() {
$filter = new AphrontListFilterView();
$filter->addButton(
phutil_render_tag(
'a',
array(
'href' => '#',
'class' => 'button green',
),
'Create New Thing'));
$form = new AphrontFormView();
$form->setUser($this->getRequest()->getUser());

View file

@ -2,31 +2,14 @@
final class AphrontListFilterView extends AphrontView {
private $buttons = array();
public function addButton($button) {
$this->buttons[] = $button;
return $this;
}
public function render() {
require_celerity_resource('aphront-list-filter-view-css');
$buttons = null;
if ($this->buttons) {
$buttons =
'<td class="aphront-list-filter-view-buttons">'.
implode("\n", $this->buttons).
'</td>';
}
return
'<table class="aphront-list-filter-view">'.
'<tr>'.
'<td class="aphront-list-filter-view-controls">'.
$this->renderChildren().
'</td>'.
$buttons.
'</tr>'.
'</table>';
}

View file

@ -209,6 +209,8 @@ final class AphrontSideNavFilterView extends AphrontView {
}
if ($this->flexible) {
$nav_classes[] = 'has-drag-nav';
Javelin::initBehavior(
'phabricator-nav',
array(

View file

@ -9,15 +9,6 @@
margin-bottom: 1em;
}
.aphront-list-filter-view-buttons {
padding: 15px 20px;
}
.aphront-list-filter-view-buttons a.button {
width: 200px;
display: block;
}
.aphront-list-filter-view-controls {
width: 100%;
}