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

Add pattern search to diffusion home

Summary: Moves the method up to DiffusionController, so it can be more universally used. Also now center aligns tabs on mobile. Still todo, get search nicely toggled on mobile

Test Plan: Test mobile, desktop. Test search from home, from browse, and browsing a specific path.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D18432
This commit is contained in:
Chad Little 2017-08-15 14:14:08 -07:00
parent f4fdb92e13
commit 7bbd26427f
6 changed files with 79 additions and 54 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array(
'conpherence.pkg.css' => 'e68cf1fa',
'conpherence.pkg.js' => 'b5b51108',
'core.pkg.css' => '03047373',
'core.pkg.css' => 'dd8bcea0',
'core.pkg.js' => '5d80e0db',
'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '45951e9e',
@ -75,7 +75,7 @@ return array(
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
'rsrc/css/application/diffusion/diffusion.css' => 'dc8d51d0',
'rsrc/css/application/diffusion/diffusion.css' => '34d507b9',
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
'rsrc/css/application/flag/flag.css' => 'bba8f811',
@ -178,7 +178,7 @@ return array(
'rsrc/css/phui/phui-status.css' => 'd5263e49',
'rsrc/css/phui/phui-tag-view.css' => 'b4719c50',
'rsrc/css/phui/phui-timeline-view.css' => 'f21db7ca',
'rsrc/css/phui/phui-two-column-view.css' => 'ae38a939',
'rsrc/css/phui/phui-two-column-view.css' => '81b0f3ce',
'rsrc/css/phui/workboards/phui-workboard-color.css' => '783cdff5',
'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455',
'rsrc/css/phui/workboards/phui-workcard.css' => 'cca5fa92',
@ -570,7 +570,7 @@ return array(
'differential-revision-history-css' => '0e8eb855',
'differential-revision-list-css' => 'f3c47d33',
'differential-table-of-contents-css' => 'ae4b7a55',
'diffusion-css' => 'dc8d51d0',
'diffusion-css' => '34d507b9',
'diffusion-icons-css' => '0c15255e',
'diffusion-readme-css' => '419dd5b6',
'diffusion-repository-css' => 'ee6f20ec',
@ -874,7 +874,7 @@ return array(
'phui-tag-view-css' => 'b4719c50',
'phui-theme-css' => '9f261c6b',
'phui-timeline-view-css' => 'f21db7ca',
'phui-two-column-view-css' => 'ae38a939',
'phui-two-column-view-css' => '81b0f3ce',
'phui-workboard-color-css' => '783cdff5',
'phui-workboard-view-css' => '3bc85455',
'phui-workcard-view-css' => 'cca5fa92',

View file

@ -56,9 +56,10 @@ final class DiffusionBrowseController extends DiffusionController {
private function browseSearch() {
$drequest = $this->getDiffusionRequest();
$header = $this->buildHeaderView($drequest);
$path = nonempty(basename($drequest->getPath()), '/');
$search_results = $this->renderSearchResults();
$search_form = $this->renderSearchForm();
$search_form = $this->renderSearchForm($path);
$search_form = phutil_tag(
'div',
@ -1473,52 +1474,6 @@ final class DiffusionBrowseController extends DiffusionController {
return "{$summary}\n{$date} \xC2\xB7 {$author}";
}
protected function renderSearchForm() {
$drequest = $this->getDiffusionRequest();
$viewer = $this->getViewer();
switch ($drequest->getRepository()->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
return null;
}
$search_term = $this->getRequest()->getStr('grep');
require_celerity_resource('diffusion-icons-css');
require_celerity_resource('diffusion-css');
$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) {
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
$engine->setConfig('viewer', $this->getRequest()->getUser());
@ -1538,7 +1493,8 @@ final class DiffusionBrowseController extends DiffusionController {
$viewer = $this->getViewer();
$tag = $this->renderCommitHashTag($drequest);
$search = $this->renderSearchForm();
$path = nonempty(basename($drequest->getPath()), '/');
$search = $this->renderSearchForm($path);
$header = id(new PHUIHeaderView())
->setUser($viewer)

View file

@ -410,6 +410,58 @@ abstract class DiffusionController extends PhabricatorController {
->setContent($readme_corpus);
}
protected function renderSearchForm($path = '/') {
$drequest = $this->getDiffusionRequest();
$viewer = $this->getViewer();
switch ($drequest->getRepository()->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
return null;
}
$search_term = $this->getRequest()->getStr('grep');
require_celerity_resource('diffusion-icons-css');
require_celerity_resource('diffusion-css');
$href = $drequest->generateURI(array(
'action' => 'browse',
'path' => $path,
));
$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',
'action' => $href,
'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 buildTabsView($key) {
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();

View file

@ -300,6 +300,8 @@ final class DiffusionRepositoryController extends DiffusionController {
private function buildHeaderView(PhabricatorRepository $repository) {
$viewer = $this->getViewer();
$search = $this->renderSearchForm();
$header = id(new PHUIHeaderView())
->setHeader($repository->getName())
->setUser($viewer)
@ -307,6 +309,7 @@ final class DiffusionRepositoryController extends DiffusionController {
->setProfileHeader(true)
->setImage($repository->getProfileImageURI())
->setImageEditURL('/diffusion/picture/'.$repository->getID().'/')
->addActionItem($search)
->addClass('diffusion-profile-header');
if (!$repository->isTracked()) {

View file

@ -12,6 +12,10 @@
display: block;
}
.device-phone .diffusion-profile-header .phui-header-col1 {
display: none;
}
.diffusion-action-bar {
margin-bottom: 16px;
}
@ -145,7 +149,8 @@
padding-left: 12px;
}
.device-phone .diffusion-browse-header .diffusion-search-form-view {
.device-phone .diffusion-browse-header .diffusion-search-form-view,
.device-phone .diffusion-profile-header .diffusion-search-form-view {
display: none;
}

View file

@ -185,6 +185,15 @@
padding: 0 12px;
}
.device-phone .phui-two-column-tabs .phui-list-view.phui-list-tabbar {
text-align: center;
}
.device-phone .phui-two-column-tabs .phui-list-view.phui-list-tabbar > li {
float: none;
display: inline-block;
}
/* Info View */
.phui-two-column-view .phui-info-view {