mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
[Redesign] Add Show/Hide functions to PHUIObjectBoxView
Summary: Ref T8099, adds 'show/hide' functions to PHUIObjectBoxView, rolls them out in Application Search for trial. Test Plan: Test doing a couple searches in Projects, Audit, etc. Seems to work ok. Design might need more? {F437207} Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8099 Differential Revision: https://secure.phabricator.com/D13027
This commit is contained in:
parent
3d407732d6
commit
eab600762e
4 changed files with 89 additions and 29 deletions
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'core.pkg.css' => '9d77cbde',
|
'core.pkg.css' => '247930e0',
|
||||||
'core.pkg.js' => '9db3e620',
|
'core.pkg.js' => '9db3e620',
|
||||||
'darkconsole.pkg.js' => 'e7393ebb',
|
'darkconsole.pkg.js' => 'e7393ebb',
|
||||||
'differential.pkg.css' => 'bb338e4b',
|
'differential.pkg.css' => 'bb338e4b',
|
||||||
|
@ -140,7 +140,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
|
'rsrc/css/phui/phui-info-panel.css' => '27ea50a1',
|
||||||
'rsrc/css/phui/phui-info-view.css' => '33e54618',
|
'rsrc/css/phui/phui-info-view.css' => '33e54618',
|
||||||
'rsrc/css/phui/phui-list.css' => 'e448b6ba',
|
'rsrc/css/phui/phui-list.css' => 'e448b6ba',
|
||||||
'rsrc/css/phui/phui-object-box.css' => 'e3441f90',
|
'rsrc/css/phui/phui-object-box.css' => 'fc4b0f93',
|
||||||
'rsrc/css/phui/phui-object-item-list-view.css' => 'fef025d8',
|
'rsrc/css/phui/phui-object-item-list-view.css' => 'fef025d8',
|
||||||
'rsrc/css/phui/phui-pinboard-view.css' => '55b27bc3',
|
'rsrc/css/phui/phui-pinboard-view.css' => '55b27bc3',
|
||||||
'rsrc/css/phui/phui-property-list-view.css' => 'd2d143ea',
|
'rsrc/css/phui/phui-property-list-view.css' => 'd2d143ea',
|
||||||
|
@ -776,7 +776,7 @@ return array(
|
||||||
'phui-info-view-css' => '33e54618',
|
'phui-info-view-css' => '33e54618',
|
||||||
'phui-inline-comment-view-css' => '2174771a',
|
'phui-inline-comment-view-css' => '2174771a',
|
||||||
'phui-list-view-css' => 'e448b6ba',
|
'phui-list-view-css' => 'e448b6ba',
|
||||||
'phui-object-box-css' => 'e3441f90',
|
'phui-object-box-css' => 'fc4b0f93',
|
||||||
'phui-object-item-list-view-css' => 'fef025d8',
|
'phui-object-item-list-view-css' => 'fef025d8',
|
||||||
'phui-pinboard-view-css' => '55b27bc3',
|
'phui-pinboard-view-css' => '55b27bc3',
|
||||||
'phui-property-list-view-css' => 'd2d143ea',
|
'phui-property-list-view-css' => 'd2d143ea',
|
||||||
|
|
|
@ -174,32 +174,11 @@ final class PhabricatorApplicationSearchController
|
||||||
// we sort out T5307.
|
// we sort out T5307.
|
||||||
|
|
||||||
$form->appendChild($submit);
|
$form->appendChild($submit);
|
||||||
$filter_view = id(new AphrontListFilterView())->appendChild($form);
|
|
||||||
|
|
||||||
if ($run_query && $named_query) {
|
|
||||||
if ($named_query->getIsBuiltin()) {
|
|
||||||
$description = pht(
|
|
||||||
'Showing results for query "%s".',
|
|
||||||
$named_query->getQueryName());
|
|
||||||
} else {
|
|
||||||
$description = pht(
|
|
||||||
'Showing results for saved query "%s".',
|
|
||||||
$named_query->getQueryName());
|
|
||||||
}
|
|
||||||
|
|
||||||
$filter_view->setCollapsed(
|
|
||||||
pht('Edit Query...'),
|
|
||||||
pht('Hide Query'),
|
|
||||||
$description,
|
|
||||||
$this->getApplicationURI('query/advanced/?query='.$query_key));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getPreface()) {
|
if ($this->getPreface()) {
|
||||||
$nav->appendChild($this->getPreface());
|
$nav->appendChild($this->getPreface());
|
||||||
}
|
}
|
||||||
|
|
||||||
$nav->appendChild($filter_view);
|
|
||||||
|
|
||||||
if ($named_query) {
|
if ($named_query) {
|
||||||
$title = $named_query->getQueryName();
|
$title = $named_query->getQueryName();
|
||||||
} else {
|
} else {
|
||||||
|
@ -207,9 +186,8 @@ final class PhabricatorApplicationSearchController
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($run_query) {
|
if ($run_query) {
|
||||||
$nav->appendChild(
|
$anchor = id(new PhabricatorAnchorView())
|
||||||
$anchor = id(new PhabricatorAnchorView())
|
->setAnchorName('R');
|
||||||
->setAnchorName('R'));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$query = $engine->buildQueryFromSavedQuery($saved_query);
|
$query = $engine->buildQueryFromSavedQuery($saved_query);
|
||||||
|
@ -234,7 +212,14 @@ final class PhabricatorApplicationSearchController
|
||||||
}
|
}
|
||||||
|
|
||||||
$box = id(new PHUIObjectBoxView())
|
$box = id(new PHUIObjectBoxView())
|
||||||
->setHeaderText($title);
|
->setHeaderText($title)
|
||||||
|
->setAnchor($anchor);
|
||||||
|
|
||||||
|
$box->setShowHide(
|
||||||
|
pht('Edit Query'),
|
||||||
|
pht('Hide Query'),
|
||||||
|
$form,
|
||||||
|
$this->getApplicationURI('query/advanced/?query='.$query_key));
|
||||||
|
|
||||||
if ($list instanceof AphrontTableView) {
|
if ($list instanceof AphrontTableView) {
|
||||||
$box->setTable($list);
|
$box->setTable($list);
|
||||||
|
@ -246,7 +231,6 @@ final class PhabricatorApplicationSearchController
|
||||||
// TODO: This is a bit hacky.
|
// TODO: This is a bit hacky.
|
||||||
if ($list instanceof PHUIObjectItemListView) {
|
if ($list instanceof PHUIObjectItemListView) {
|
||||||
$list->setNoDataString(pht('No results found for this query.'));
|
$list->setNoDataString(pht('No results found for this query.'));
|
||||||
$list->setPager($pager);
|
|
||||||
} else {
|
} else {
|
||||||
if ($pager->willShowPagingControls()) {
|
if ($pager->willShowPagingControls()) {
|
||||||
$pager_box = id(new PHUIBoxView())
|
$pager_box = id(new PHUIBoxView())
|
||||||
|
|
|
@ -18,6 +18,12 @@ final class PHUIObjectBoxView extends AphrontView {
|
||||||
private $objectList;
|
private $objectList;
|
||||||
private $table;
|
private $table;
|
||||||
private $collapsed = false;
|
private $collapsed = false;
|
||||||
|
private $anchor;
|
||||||
|
|
||||||
|
private $showAction;
|
||||||
|
private $hideAction;
|
||||||
|
private $showHideHref;
|
||||||
|
private $showHideContent;
|
||||||
|
|
||||||
private $tabs = array();
|
private $tabs = array();
|
||||||
private $propertyLists = array();
|
private $propertyLists = array();
|
||||||
|
@ -162,6 +168,19 @@ final class PHUIObjectBoxView extends AphrontView {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setAnchor(PhabricatorAnchorView $anchor) {
|
||||||
|
$this->anchor = $anchor;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShowHide($show, $hide, $content, $href) {
|
||||||
|
$this->showAction = $show;
|
||||||
|
$this->hideAction = $hide;
|
||||||
|
$this->showHideContent = $content;
|
||||||
|
$this->showHideHref = $href;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setValidationException(
|
public function setValidationException(
|
||||||
PhabricatorApplicationTransactionValidationException $ex = null) {
|
PhabricatorApplicationTransactionValidationException $ex = null) {
|
||||||
$this->validationException = $ex;
|
$this->validationException = $ex;
|
||||||
|
@ -178,6 +197,55 @@ final class PHUIObjectBoxView extends AphrontView {
|
||||||
->setHeader($this->headerText);
|
->setHeader($this->headerText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$showhide = null;
|
||||||
|
if ($this->showAction !== null) {
|
||||||
|
Javelin::initBehavior('phabricator-reveal-content');
|
||||||
|
|
||||||
|
$hide_action_id = celerity_generate_unique_node_id();
|
||||||
|
$show_action_id = celerity_generate_unique_node_id();
|
||||||
|
$content_id = celerity_generate_unique_node_id();
|
||||||
|
|
||||||
|
$hide_action = id(new PHUIButtonView())
|
||||||
|
->setTag('a')
|
||||||
|
->addSigil('reveal-content')
|
||||||
|
->setID($hide_action_id)
|
||||||
|
->setHref($this->showHideHref)
|
||||||
|
->setMetaData(
|
||||||
|
array(
|
||||||
|
'hideIDs' => array($hide_action_id),
|
||||||
|
'showIDs' => array($content_id, $show_action_id),
|
||||||
|
))
|
||||||
|
->setText($this->showAction);
|
||||||
|
|
||||||
|
$show_action = id(new PHUIButtonView())
|
||||||
|
->setTag('a')
|
||||||
|
->addSigil('reveal-content')
|
||||||
|
->setStyle('display: none;')
|
||||||
|
->setHref('#')
|
||||||
|
->setID($show_action_id)
|
||||||
|
->setMetaData(
|
||||||
|
array(
|
||||||
|
'hideIDs' => array($content_id, $show_action_id),
|
||||||
|
'showIDs' => array($hide_action_id),
|
||||||
|
))
|
||||||
|
->setText($this->hideAction);
|
||||||
|
|
||||||
|
$header->addActionLink($hide_action);
|
||||||
|
$header->addActionLink($show_action);
|
||||||
|
|
||||||
|
$showhide = array(
|
||||||
|
phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-object-box-hidden-content',
|
||||||
|
'id' => $content_id,
|
||||||
|
'style' => 'display: none;',
|
||||||
|
),
|
||||||
|
$this->showHideContent),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->actionListID) {
|
if ($this->actionListID) {
|
||||||
$icon_id = celerity_generate_unique_node_id();
|
$icon_id = celerity_generate_unique_node_id();
|
||||||
$icon = id(new PHUIIconView())
|
$icon = id(new PHUIIconView())
|
||||||
|
@ -284,6 +352,7 @@ final class PHUIObjectBoxView extends AphrontView {
|
||||||
$content = id(new PHUIBoxView())
|
$content = id(new PHUIBoxView())
|
||||||
->appendChild(
|
->appendChild(
|
||||||
array(
|
array(
|
||||||
|
$this->anchor,
|
||||||
$header,
|
$header,
|
||||||
$this->infoView,
|
$this->infoView,
|
||||||
$this->formErrors,
|
$this->formErrors,
|
||||||
|
@ -292,6 +361,7 @@ final class PHUIObjectBoxView extends AphrontView {
|
||||||
$this->form,
|
$this->form,
|
||||||
$tabs,
|
$tabs,
|
||||||
$tab_lists,
|
$tab_lists,
|
||||||
|
$showhide,
|
||||||
$property_lists,
|
$property_lists,
|
||||||
$this->table,
|
$this->table,
|
||||||
$this->renderChildren(),
|
$this->renderChildren(),
|
||||||
|
|
|
@ -90,6 +90,12 @@ div.phui-object-box.phui-object-box-flush {
|
||||||
border-bottom-color: {$lightred};
|
border-bottom-color: {$lightred};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phui-object-box-hidden-content {
|
||||||
|
background: {$lightgreybackground};
|
||||||
|
border-bottom: 1px solid {$thinblueborder};
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
/* - Double Object Box Override --------------------------------------------- */
|
/* - Double Object Box Override --------------------------------------------- */
|
||||||
|
|
||||||
.phui-object-box .phui-object-box {
|
.phui-object-box .phui-object-box {
|
||||||
|
|
Loading…
Reference in a new issue