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

AphrontListFilterView, for list filtering.

This commit is contained in:
epriestley 2011-04-03 15:50:06 -07:00
parent 3af9919e1c
commit 4993bb9a9b
14 changed files with 283 additions and 68 deletions

View file

@ -45,7 +45,7 @@ celerity_register_resource_map(array(
),
'aphront-form-view-css' =>
array(
'uri' => '/res/472d41b4/rsrc/css/aphront/form-view.css',
'uri' => '/res/82eca506/rsrc/css/aphront/form-view.css',
'type' => 'css',
'requires' =>
array(
@ -61,6 +61,15 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/css/aphront/headsup-action-list-view.css',
),
'aphront-list-filter-view-css' =>
array(
'uri' => '/res/89f641c5/rsrc/css/aphront/list-filter-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/list-filter-view.css',
),
'aphront-pager-view-css' =>
array(
'uri' => '/res/73ec8cd5/rsrc/css/aphront/pager-view.css',
@ -262,7 +271,7 @@ celerity_register_resource_map(array(
),
'maniphest-task-summary-css' =>
array(
'uri' => '/res/94d01e6f/rsrc/css/application/maniphest/task-summary.css',
'uri' => '/res/8dc6fb13/rsrc/css/application/maniphest/task-summary.css',
'type' => 'css',
'requires' =>
array(
@ -299,7 +308,7 @@ celerity_register_resource_map(array(
),
'phabricator-ui-example-css' =>
array(
'uri' => '/res/b2593f53/rsrc/css/application/uiexample/example.css',
'uri' => '/res/365a10f1/rsrc/css/application/uiexample/example.css',
'type' => 'css',
'requires' =>
array(
@ -589,7 +598,7 @@ celerity_register_resource_map(array(
), array (
'packages' =>
array (
'930fd839' =>
'ce1b9ed3' =>
array (
'name' => 'core.pkg.css',
'symbols' =>
@ -609,7 +618,7 @@ celerity_register_resource_map(array(
12 => 'phabricator-remarkup-css',
13 => 'syntax-highlighting-css',
),
'uri' => '/res/pkg/930fd839/core.pkg.css',
'uri' => '/res/pkg/ce1b9ed3/core.pkg.css',
'type' => 'css',
),
'76f3c1f8' =>
@ -656,20 +665,20 @@ celerity_register_resource_map(array(
),
'reverse' =>
array (
'phabricator-core-css' => '930fd839',
'phabricator-core-buttons-css' => '930fd839',
'phabricator-standard-page-view' => '930fd839',
'aphront-dialog-view-css' => '930fd839',
'aphront-form-view-css' => '930fd839',
'aphront-panel-view-css' => '930fd839',
'aphront-side-nav-view-css' => '930fd839',
'aphront-table-view-css' => '930fd839',
'aphront-crumbs-view-css' => '930fd839',
'aphront-tokenizer-control-css' => '930fd839',
'aphront-typeahead-control-css' => '930fd839',
'phabricator-directory-css' => '930fd839',
'phabricator-remarkup-css' => '930fd839',
'syntax-highlighting-css' => '930fd839',
'phabricator-core-css' => 'ce1b9ed3',
'phabricator-core-buttons-css' => 'ce1b9ed3',
'phabricator-standard-page-view' => 'ce1b9ed3',
'aphront-dialog-view-css' => 'ce1b9ed3',
'aphront-form-view-css' => 'ce1b9ed3',
'aphront-panel-view-css' => 'ce1b9ed3',
'aphront-side-nav-view-css' => 'ce1b9ed3',
'aphront-table-view-css' => 'ce1b9ed3',
'aphront-crumbs-view-css' => 'ce1b9ed3',
'aphront-tokenizer-control-css' => 'ce1b9ed3',
'aphront-typeahead-control-css' => 'ce1b9ed3',
'phabricator-directory-css' => 'ce1b9ed3',
'phabricator-remarkup-css' => 'ce1b9ed3',
'syntax-highlighting-css' => 'ce1b9ed3',
'differential-core-view-css' => '76f3c1f8',
'differential-changeset-view-css' => '76f3c1f8',
'differential-revision-detail-css' => '76f3c1f8',

View file

@ -34,10 +34,12 @@ phutil_register_library_map(array(
'AphrontFormSubmitControl' => 'view/form/control/submit',
'AphrontFormTextAreaControl' => 'view/form/control/textarea',
'AphrontFormTextControl' => 'view/form/control/text',
'AphrontFormToggleButtonsControl' => 'view/form/control/togglebuttons',
'AphrontFormTokenizerControl' => 'view/form/control/tokenizer',
'AphrontFormView' => 'view/form/base',
'AphrontHeadsupActionListView' => 'view/layout/headsup/actionlist',
'AphrontHeadsupActionView' => 'view/layout/headsup/action',
'AphrontListFilterView' => 'view/layout/listfilter',
'AphrontMySQLDatabaseConnection' => 'storage/connection/mysql',
'AphrontNullView' => 'view/null',
'AphrontPageView' => 'view/page/base',
@ -391,6 +393,7 @@ phutil_register_library_map(array(
'PhabricatorUIExample' => 'applications/uiexample/examples/base',
'PhabricatorUIExampleController' => 'applications/uiexample/controller/base',
'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/render',
'PhabricatorUIListFilterExample' => 'applications/uiexample/examples/listfilter',
'PhabricatorUIPagerExample' => 'applications/uiexample/examples/pager',
'PhabricatorUser' => 'applications/people/storage/user',
'PhabricatorUserDAO' => 'applications/people/storage/base',
@ -453,10 +456,12 @@ phutil_register_library_map(array(
'AphrontFormSubmitControl' => 'AphrontFormControl',
'AphrontFormTextAreaControl' => 'AphrontFormControl',
'AphrontFormTextControl' => 'AphrontFormControl',
'AphrontFormToggleButtonsControl' => 'AphrontFormControl',
'AphrontFormTokenizerControl' => 'AphrontFormControl',
'AphrontFormView' => 'AphrontView',
'AphrontHeadsupActionListView' => 'AphrontView',
'AphrontHeadsupActionView' => 'AphrontView',
'AphrontListFilterView' => 'AphrontView',
'AphrontMySQLDatabaseConnection' => 'AphrontDatabaseConnection',
'AphrontNullView' => 'AphrontView',
'AphrontPageView' => 'AphrontView',
@ -725,6 +730,7 @@ phutil_register_library_map(array(
'PhabricatorTypeaheadDatasourceController' => 'PhabricatorController',
'PhabricatorUIExampleController' => 'PhabricatorController',
'PhabricatorUIExampleRenderController' => 'PhabricatorUIExampleController',
'PhabricatorUIListFilterExample' => 'PhabricatorUIExample',
'PhabricatorUIPagerExample' => 'PhabricatorUIExample',
'PhabricatorUser' => 'PhabricatorUserDAO',
'PhabricatorUserDAO' => 'PhabricatorLiskDAO',

View file

@ -80,24 +80,34 @@ class ManiphestTaskListController extends ManiphestController {
'order' => $order,
));
require_celerity_resource('maniphest-task-summary-css');
$nav->appendChild(
'<div class="maniphest-basic-search-view">'.
'<div class="maniphest-basic-search-actions">'.
'<a href="/maniphest/task/create/" class="green button">'.
'Create New Task'.
'</a>'.
'</div>'.
'<div class="maniphest-basic-search-options">'.
'<table class="maniphest-basic-search-options-table">'.
'<tr><th>Status:</th><td>'.$status_links.'</td></tr>'.
'<tr><th>Group:</th><td>'.$group_links.'</td></tr>'.
'<tr><th>Order:</th><td>'.$order_links.'</td></tr>'.
'</table>'.
'</div>'.
'<div style="clear: both;"></div>'.
'</div>');
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild(
id(new AphrontFormToggleButtonsControl())
->setLabel('Status')
->setValue($status_links))
->appendChild(
id(new AphrontFormToggleButtonsControl())
->setLabel('Group')
->setValue($group_links))
->appendChild(
id(new AphrontFormToggleButtonsControl())
->setLabel('Order')
->setValue($order_links));
$filter = new AphrontListFilterView();
$filter->addButton(
phutil_render_tag(
'a',
array(
'href' => '/maniphest/task/create/',
'class' => 'green button',
),
'Create New Task'));
$filter->appendChild($form);
$nav->appendChild($filter);
$have_tasks = false;
foreach ($tasks as $group => $list) {
@ -107,6 +117,8 @@ class ManiphestTaskListController extends ManiphestController {
}
}
require_celerity_resource('maniphest-task-summary-css');
if (!$have_tasks) {
$nav->appendChild(
'<h1 class="maniphest-task-group-header">'.

View file

@ -13,6 +13,9 @@ phutil_require_module('phabricator', 'applications/maniphest/storage/task');
phutil_require_module('phabricator', 'applications/maniphest/view/tasklist');
phutil_require_module('phabricator', 'applications/phid/handle/data');
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'view/form/base');
phutil_require_module('phabricator', 'view/form/control/togglebuttons');
phutil_require_module('phabricator', 'view/layout/listfilter');
phutil_require_module('phabricator', 'view/layout/sidenav');
phutil_require_module('phutil', 'markup');

View file

@ -35,7 +35,7 @@ class PhabricatorUIExampleRenderController
$selected = null;
foreach ($classes as $class => $ignored) {
$classes[$class] = newv($class, array());
if ($this->class == $class) {
if ($this->class == $classes[$class]->getName()) {
$selected = $class;
}
}

View file

@ -0,0 +1,57 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorUIListFilterExample extends PhabricatorUIExample {
public function getName() {
return 'ListFilter';
}
public function getDescription() {
return 'Use <tt>AphrontListFilterView</tt> to layout controls for '.
'filtering and manipulating lists of objects.';
}
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());
$form
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Query'))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Search'));
$filter->appendChild($form);
return $filter;
}
}

View file

@ -0,0 +1,18 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/uiexample/examples/base');
phutil_require_module('phabricator', 'view/form/base');
phutil_require_module('phabricator', 'view/form/control/submit');
phutil_require_module('phabricator', 'view/layout/listfilter');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorUIListFilterExample.php');

View file

@ -0,0 +1,29 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class AphrontFormToggleButtonsControl extends AphrontFormControl {
protected function getCustomControlClass() {
return 'aphront-form-control-togglebuttons';
}
protected function renderInput() {
return $this->getValue();
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'view/form/control/base');
phutil_require_source('AphrontFormToggleButtonsControl.php');

View file

@ -0,0 +1,44 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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');
return
'<table class="aphront-list-filter-view">'.
'<tr>'.
'<td class="aphront-list-filter-view-controls">'.
$this->renderChildren().
'</td>'.
'<td class="aphront-list-filter-view-buttons">'.
implode("\n", $this->buttons).
'</td>'.
'</tr>'.
'</table>';
}
}

View file

@ -0,0 +1,13 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'infrastructure/celerity/api');
phutil_require_module('phabricator', 'view/base');
phutil_require_source('AphrontListFilterView.php');

View file

@ -24,6 +24,7 @@
width: 55%;
}
.aphront-form-error {
width: 23%;
float: right;
@ -84,6 +85,10 @@
font-size: 13px;
}
.aphront-form-control-togglebuttons .aphront-form-input {
padding-top: 5px;
}
table.aphront-form-control-checkbox-layout {
margin-top: 3px;
font-size: 13px;

View file

@ -0,0 +1,38 @@
/**
* @provides aphront-list-filter-view-css
*/
.aphront-list-filter-view {
background: #f6f6f6;
border-bottom: 1px solid #bbbbbb;
width: 100%;
}
.aphront-list-filter-view-buttons {
padding: 10px 20px;
}
.aphront-list-filter-view-buttons a.button {
width: 200px;
display: block;
}
.aphront-list-filter-view-controls {
width: 100%;
border-right: 1px solid #bbbbbb;
}
.aphront-list-filter-view-controls .aphront-form-view {
border-width: 0;
padding: 0 0 6px;
}
.aphront-list-filter-view-controls .aphront-form-view .aphront-form-label {
width: 12%;
}
.aphront-list-filter-view-controls .aphront-form-view .aphront-form-input {
width: 70%;
margin-left: 13%;
margin-right: 17%;
}

View file

@ -80,37 +80,6 @@
border-color: #0099ff;
}
.maniphest-basic-search-view {
background: #888888;
border-bottom: 1px solid #bbbbbb;
}
.maniphest-basic-search-actions {
float: right;
width: 200px;
padding: 10px;
}
.maniphest-basic-search-options {
margin-right: 225px;
background: #f0f0f0;
padding: 6px 0;
}
.maniphest-basic-search-options-table th {
padding: 6px 4px;
text-align: right;
width: 100px;
font-weight: bold;
color: #333333;
}
.maniphest-basic-search-options-table td {
padding: 6px 4px;
}
.maniphest-task-group-header {
font-size: 18px;
margin: 1.5em 14px 0;