mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +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:
parent
f4fdb92e13
commit
7bbd26427f
6 changed files with 79 additions and 54 deletions
|
@ -9,7 +9,7 @@ return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'conpherence.pkg.css' => 'e68cf1fa',
|
'conpherence.pkg.css' => 'e68cf1fa',
|
||||||
'conpherence.pkg.js' => 'b5b51108',
|
'conpherence.pkg.js' => 'b5b51108',
|
||||||
'core.pkg.css' => '03047373',
|
'core.pkg.css' => 'dd8bcea0',
|
||||||
'core.pkg.js' => '5d80e0db',
|
'core.pkg.js' => '5d80e0db',
|
||||||
'darkconsole.pkg.js' => '1f9a31bc',
|
'darkconsole.pkg.js' => '1f9a31bc',
|
||||||
'differential.pkg.css' => '45951e9e',
|
'differential.pkg.css' => '45951e9e',
|
||||||
|
@ -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' => 'dc8d51d0',
|
'rsrc/css/application/diffusion/diffusion.css' => '34d507b9',
|
||||||
'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',
|
||||||
|
@ -178,7 +178,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-status.css' => 'd5263e49',
|
'rsrc/css/phui/phui-status.css' => 'd5263e49',
|
||||||
'rsrc/css/phui/phui-tag-view.css' => 'b4719c50',
|
'rsrc/css/phui/phui-tag-view.css' => 'b4719c50',
|
||||||
'rsrc/css/phui/phui-timeline-view.css' => 'f21db7ca',
|
'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-color.css' => '783cdff5',
|
||||||
'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455',
|
'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455',
|
||||||
'rsrc/css/phui/workboards/phui-workcard.css' => 'cca5fa92',
|
'rsrc/css/phui/workboards/phui-workcard.css' => 'cca5fa92',
|
||||||
|
@ -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' => 'dc8d51d0',
|
'diffusion-css' => '34d507b9',
|
||||||
'diffusion-icons-css' => '0c15255e',
|
'diffusion-icons-css' => '0c15255e',
|
||||||
'diffusion-readme-css' => '419dd5b6',
|
'diffusion-readme-css' => '419dd5b6',
|
||||||
'diffusion-repository-css' => 'ee6f20ec',
|
'diffusion-repository-css' => 'ee6f20ec',
|
||||||
|
@ -874,7 +874,7 @@ return array(
|
||||||
'phui-tag-view-css' => 'b4719c50',
|
'phui-tag-view-css' => 'b4719c50',
|
||||||
'phui-theme-css' => '9f261c6b',
|
'phui-theme-css' => '9f261c6b',
|
||||||
'phui-timeline-view-css' => 'f21db7ca',
|
'phui-timeline-view-css' => 'f21db7ca',
|
||||||
'phui-two-column-view-css' => 'ae38a939',
|
'phui-two-column-view-css' => '81b0f3ce',
|
||||||
'phui-workboard-color-css' => '783cdff5',
|
'phui-workboard-color-css' => '783cdff5',
|
||||||
'phui-workboard-view-css' => '3bc85455',
|
'phui-workboard-view-css' => '3bc85455',
|
||||||
'phui-workcard-view-css' => 'cca5fa92',
|
'phui-workcard-view-css' => 'cca5fa92',
|
||||||
|
|
|
@ -56,9 +56,10 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
private function browseSearch() {
|
private function browseSearch() {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$header = $this->buildHeaderView($drequest);
|
$header = $this->buildHeaderView($drequest);
|
||||||
|
$path = nonempty(basename($drequest->getPath()), '/');
|
||||||
|
|
||||||
$search_results = $this->renderSearchResults();
|
$search_results = $this->renderSearchResults();
|
||||||
$search_form = $this->renderSearchForm();
|
$search_form = $this->renderSearchForm($path);
|
||||||
|
|
||||||
$search_form = phutil_tag(
|
$search_form = phutil_tag(
|
||||||
'div',
|
'div',
|
||||||
|
@ -1473,52 +1474,6 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
return "{$summary}\n{$date} \xC2\xB7 {$author}";
|
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) {
|
protected function markupText($text) {
|
||||||
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
|
||||||
$engine->setConfig('viewer', $this->getRequest()->getUser());
|
$engine->setConfig('viewer', $this->getRequest()->getUser());
|
||||||
|
@ -1538,7 +1493,8 @@ final class DiffusionBrowseController extends DiffusionController {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$tag = $this->renderCommitHashTag($drequest);
|
$tag = $this->renderCommitHashTag($drequest);
|
||||||
$search = $this->renderSearchForm();
|
$path = nonempty(basename($drequest->getPath()), '/');
|
||||||
|
$search = $this->renderSearchForm($path);
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
|
|
|
@ -410,6 +410,58 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
->setContent($readme_corpus);
|
->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) {
|
protected function buildTabsView($key) {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
|
@ -300,6 +300,8 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
|
|
||||||
private function buildHeaderView(PhabricatorRepository $repository) {
|
private function buildHeaderView(PhabricatorRepository $repository) {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
$search = $this->renderSearchForm();
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
$header = id(new PHUIHeaderView())
|
||||||
->setHeader($repository->getName())
|
->setHeader($repository->getName())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
|
@ -307,6 +309,7 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||||
->setProfileHeader(true)
|
->setProfileHeader(true)
|
||||||
->setImage($repository->getProfileImageURI())
|
->setImage($repository->getProfileImageURI())
|
||||||
->setImageEditURL('/diffusion/picture/'.$repository->getID().'/')
|
->setImageEditURL('/diffusion/picture/'.$repository->getID().'/')
|
||||||
|
->addActionItem($search)
|
||||||
->addClass('diffusion-profile-header');
|
->addClass('diffusion-profile-header');
|
||||||
|
|
||||||
if (!$repository->isTracked()) {
|
if (!$repository->isTracked()) {
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.device-phone .diffusion-profile-header .phui-header-col1 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.diffusion-action-bar {
|
.diffusion-action-bar {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +149,8 @@
|
||||||
padding-left: 12px;
|
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;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,15 @@
|
||||||
padding: 0 12px;
|
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 */
|
/* Info View */
|
||||||
|
|
||||||
.phui-two-column-view .phui-info-view {
|
.phui-two-column-view .phui-info-view {
|
||||||
|
|
Loading…
Reference in a new issue