mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Move pattern search into Diffusion header
Summary: This is only on browse pages, but I think could be global (home) also. Moves it from a button, field, to just a field. Test Plan: Review search on desktop, mobile. {F5098886} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18428
This commit is contained in:
parent
37489865d4
commit
0a9ad6d5e7
3 changed files with 84 additions and 38 deletions
|
@ -75,7 +75,7 @@ return array(
|
||||||
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
|
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
|
||||||
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
|
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
|
||||||
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
|
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
|
||||||
'rsrc/css/application/diffusion/diffusion.css' => '59f4ac67',
|
'rsrc/css/application/diffusion/diffusion.css' => '8a6eb632',
|
||||||
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
|
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
|
||||||
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
|
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
|
||||||
'rsrc/css/application/flag/flag.css' => 'bba8f811',
|
'rsrc/css/application/flag/flag.css' => 'bba8f811',
|
||||||
|
@ -570,7 +570,7 @@ return array(
|
||||||
'differential-revision-history-css' => '0e8eb855',
|
'differential-revision-history-css' => '0e8eb855',
|
||||||
'differential-revision-list-css' => 'f3c47d33',
|
'differential-revision-list-css' => 'f3c47d33',
|
||||||
'differential-table-of-contents-css' => 'ae4b7a55',
|
'differential-table-of-contents-css' => 'ae4b7a55',
|
||||||
'diffusion-css' => '59f4ac67',
|
'diffusion-css' => '8a6eb632',
|
||||||
'diffusion-icons-css' => '0c15255e',
|
'diffusion-icons-css' => '0c15255e',
|
||||||
'diffusion-readme-css' => '419dd5b6',
|
'diffusion-readme-css' => '419dd5b6',
|
||||||
'diffusion-repository-css' => 'ee6f20ec',
|
'diffusion-repository-css' => 'ee6f20ec',
|
||||||
|
|
|
@ -22,8 +22,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
// list.
|
// list.
|
||||||
|
|
||||||
$grep = $request->getStr('grep');
|
$grep = $request->getStr('grep');
|
||||||
$find = $request->getStr('find');
|
if (strlen($grep)) {
|
||||||
if (strlen($grep) || strlen($find)) {
|
|
||||||
return $this->browseSearch();
|
return $this->browseSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,13 +57,15 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$header = $this->buildHeaderView($drequest);
|
$header = $this->buildHeaderView($drequest);
|
||||||
|
|
||||||
$search_form = $this->renderSearchForm();
|
|
||||||
$search_results = $this->renderSearchResults();
|
$search_results = $this->renderSearchResults();
|
||||||
|
$search_form = $this->renderSearchForm();
|
||||||
|
|
||||||
$search_form = id(new PHUIObjectBoxView())
|
$search_form = phutil_tag(
|
||||||
->setHeaderText(pht('Search'))
|
'div',
|
||||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
array(
|
||||||
->appendChild($search_form);
|
'class' => 'diffusion-mobile-search-form',
|
||||||
|
),
|
||||||
|
$search_form);
|
||||||
|
|
||||||
$crumbs = $this->buildCrumbs(
|
$crumbs = $this->buildCrumbs(
|
||||||
array(
|
array(
|
||||||
|
@ -329,8 +330,6 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
$header = $this->buildHeaderView($drequest);
|
$header = $this->buildHeaderView($drequest);
|
||||||
$header->setHeaderIcon('fa-folder-open');
|
$header->setHeaderIcon('fa-folder-open');
|
||||||
|
|
||||||
$search_form = $this->renderSearchForm();
|
|
||||||
|
|
||||||
$empty_result = null;
|
$empty_result = null;
|
||||||
$browse_panel = null;
|
$browse_panel = null;
|
||||||
$branch_panel = null;
|
$branch_panel = null;
|
||||||
|
@ -369,12 +368,6 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
->setTable($browse_table)
|
->setTable($browse_table)
|
||||||
->setPager($pager);
|
->setPager($pager);
|
||||||
|
|
||||||
$browse_panel->setShowHide(
|
|
||||||
array(pht('Show Search')),
|
|
||||||
pht('Hide Search'),
|
|
||||||
$search_form,
|
|
||||||
'#');
|
|
||||||
|
|
||||||
$path = $drequest->getPath();
|
$path = $drequest->getPath();
|
||||||
$is_branch = (!strlen($path) && $repository->supportsBranchComparison());
|
$is_branch = (!strlen($path) && $repository->supportsBranchComparison());
|
||||||
if ($is_branch) {
|
if ($is_branch) {
|
||||||
|
@ -1565,32 +1558,48 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
|
|
||||||
protected function renderSearchForm() {
|
protected function renderSearchForm() {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
$forms = array();
|
|
||||||
$form = id(new AphrontFormView())
|
|
||||||
->setUser($this->getViewer())
|
|
||||||
->setMethod('GET');
|
|
||||||
|
|
||||||
switch ($drequest->getRepository()->getVersionControlSystem()) {
|
switch ($drequest->getRepository()->getVersionControlSystem()) {
|
||||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||||
$forms[] = id(clone $form)
|
return null;
|
||||||
->appendChild(pht('Search is not available in Subversion.'));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$forms[] = id(clone $form)
|
|
||||||
->appendChild(
|
|
||||||
id(new AphrontFormTextWithSubmitControl())
|
|
||||||
->setLabel(pht('Pattern'))
|
|
||||||
->setSubmitLabel(pht('Grep File Content'))
|
|
||||||
->setName('grep')
|
|
||||||
->setValue($this->getRequest()->getStr('grep')));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$search_term = $this->getRequest()->getStr('grep');
|
||||||
require_celerity_resource('diffusion-icons-css');
|
require_celerity_resource('diffusion-icons-css');
|
||||||
$form_box = phutil_tag_div('diffusion-search-boxen', $forms);
|
require_celerity_resource('diffusion-css');
|
||||||
|
|
||||||
return $form_box;
|
$bar = javelin_tag(
|
||||||
|
'input',
|
||||||
|
array(
|
||||||
|
'type' => 'text',
|
||||||
|
'id' => 'diffusion-search-input',
|
||||||
|
'name' => 'grep',
|
||||||
|
'class' => 'diffusion-search-input',
|
||||||
|
'sigil' => 'diffusion-search-input',
|
||||||
|
'placeholder' => pht('Pattern Search'),
|
||||||
|
'value' => $search_term,
|
||||||
|
));
|
||||||
|
|
||||||
|
$form = phabricator_form(
|
||||||
|
$viewer,
|
||||||
|
array(
|
||||||
|
'method' => 'GET',
|
||||||
|
'sigil' => 'diffusion-search-form',
|
||||||
|
'class' => 'diffusion-search-form',
|
||||||
|
'id' => 'diffusion-search-form',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$bar,
|
||||||
|
));
|
||||||
|
|
||||||
|
$form_view = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'diffusion-search-form-view',
|
||||||
|
),
|
||||||
|
$form);
|
||||||
|
|
||||||
|
return $form_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function markupText($text) {
|
protected function markupText($text) {
|
||||||
|
@ -1612,11 +1621,14 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$tag = $this->renderCommitHashTag($drequest);
|
$tag = $this->renderCommitHashTag($drequest);
|
||||||
|
$search = $this->renderSearchForm();
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setHeader($this->renderPathLinks($drequest, $mode = 'browse'))
|
->setHeader($this->renderPathLinks($drequest, $mode = 'browse'))
|
||||||
->addTag($tag);
|
->addActionItem($search)
|
||||||
|
->addTag($tag)
|
||||||
|
->addClass('diffusion-browse-header');
|
||||||
|
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,40 @@
|
||||||
color: {$darkbluetext};
|
color: {$darkbluetext};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* - Search Input ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.diffusion-search-form-view {
|
||||||
|
width: 240px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diffusion-search-form-view .diffusion-search-input {
|
||||||
|
width: 240px;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-phone .diffusion-browse-header .diffusion-search-form-view {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diffusion-mobile-search-form {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-phone .diffusion-mobile-search-form {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-phone .diffusion-search-form-view {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-phone .diffusion-search-form-view .diffusion-search-input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* - Phone Style ------------------------------------------------------------*/
|
/* - Phone Style ------------------------------------------------------------*/
|
||||||
|
|
||||||
.device-phone.diffusion-history-view .phui-two-column-view
|
.device-phone.diffusion-history-view .phui-two-column-view
|
||||||
|
|
Loading…
Reference in a new issue