@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+84 -38
+2 -2
resources/celerity/map.php
··· 75 75 'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6', 76 76 'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec', 77 77 'rsrc/css/application/diffusion/diffusion-source.css' => '750add59', 78 - 'rsrc/css/application/diffusion/diffusion.css' => '59f4ac67', 78 + 'rsrc/css/application/diffusion/diffusion.css' => '8a6eb632', 79 79 'rsrc/css/application/feed/feed.css' => 'ecd4ec57', 80 80 'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948', 81 81 'rsrc/css/application/flag/flag.css' => 'bba8f811', ··· 570 570 'differential-revision-history-css' => '0e8eb855', 571 571 'differential-revision-list-css' => 'f3c47d33', 572 572 'differential-table-of-contents-css' => 'ae4b7a55', 573 - 'diffusion-css' => '59f4ac67', 573 + 'diffusion-css' => '8a6eb632', 574 574 'diffusion-icons-css' => '0c15255e', 575 575 'diffusion-readme-css' => '419dd5b6', 576 576 'diffusion-repository-css' => 'ee6f20ec',
+48 -36
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 22 22 // list. 23 23 24 24 $grep = $request->getStr('grep'); 25 - $find = $request->getStr('find'); 26 - if (strlen($grep) || strlen($find)) { 25 + if (strlen($grep)) { 27 26 return $this->browseSearch(); 28 27 } 29 28 ··· 58 57 $drequest = $this->getDiffusionRequest(); 59 58 $header = $this->buildHeaderView($drequest); 60 59 61 - $search_form = $this->renderSearchForm(); 62 60 $search_results = $this->renderSearchResults(); 61 + $search_form = $this->renderSearchForm(); 63 62 64 - $search_form = id(new PHUIObjectBoxView()) 65 - ->setHeaderText(pht('Search')) 66 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 67 - ->appendChild($search_form); 63 + $search_form = phutil_tag( 64 + 'div', 65 + array( 66 + 'class' => 'diffusion-mobile-search-form', 67 + ), 68 + $search_form); 68 69 69 70 $crumbs = $this->buildCrumbs( 70 71 array( ··· 329 330 $header = $this->buildHeaderView($drequest); 330 331 $header->setHeaderIcon('fa-folder-open'); 331 332 332 - $search_form = $this->renderSearchForm(); 333 - 334 333 $empty_result = null; 335 334 $browse_panel = null; 336 335 $branch_panel = null; ··· 368 367 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 369 368 ->setTable($browse_table) 370 369 ->setPager($pager); 371 - 372 - $browse_panel->setShowHide( 373 - array(pht('Show Search')), 374 - pht('Hide Search'), 375 - $search_form, 376 - '#'); 377 370 378 371 $path = $drequest->getPath(); 379 372 $is_branch = (!strlen($path) && $repository->supportsBranchComparison()); ··· 1565 1558 1566 1559 protected function renderSearchForm() { 1567 1560 $drequest = $this->getDiffusionRequest(); 1568 - 1569 - $forms = array(); 1570 - $form = id(new AphrontFormView()) 1571 - ->setUser($this->getViewer()) 1572 - ->setMethod('GET'); 1573 - 1561 + $viewer = $this->getViewer(); 1574 1562 switch ($drequest->getRepository()->getVersionControlSystem()) { 1575 1563 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 1576 - $forms[] = id(clone $form) 1577 - ->appendChild(pht('Search is not available in Subversion.')); 1578 - break; 1579 - default: 1580 - $forms[] = id(clone $form) 1581 - ->appendChild( 1582 - id(new AphrontFormTextWithSubmitControl()) 1583 - ->setLabel(pht('Pattern')) 1584 - ->setSubmitLabel(pht('Grep File Content')) 1585 - ->setName('grep') 1586 - ->setValue($this->getRequest()->getStr('grep'))); 1587 - break; 1564 + return null; 1588 1565 } 1589 1566 1567 + $search_term = $this->getRequest()->getStr('grep'); 1590 1568 require_celerity_resource('diffusion-icons-css'); 1591 - $form_box = phutil_tag_div('diffusion-search-boxen', $forms); 1569 + require_celerity_resource('diffusion-css'); 1570 + 1571 + $bar = javelin_tag( 1572 + 'input', 1573 + array( 1574 + 'type' => 'text', 1575 + 'id' => 'diffusion-search-input', 1576 + 'name' => 'grep', 1577 + 'class' => 'diffusion-search-input', 1578 + 'sigil' => 'diffusion-search-input', 1579 + 'placeholder' => pht('Pattern Search'), 1580 + 'value' => $search_term, 1581 + )); 1592 1582 1593 - return $form_box; 1583 + $form = phabricator_form( 1584 + $viewer, 1585 + array( 1586 + 'method' => 'GET', 1587 + 'sigil' => 'diffusion-search-form', 1588 + 'class' => 'diffusion-search-form', 1589 + 'id' => 'diffusion-search-form', 1590 + ), 1591 + array( 1592 + $bar, 1593 + )); 1594 + 1595 + $form_view = phutil_tag( 1596 + 'div', 1597 + array( 1598 + 'class' => 'diffusion-search-form-view', 1599 + ), 1600 + $form); 1601 + 1602 + return $form_view; 1594 1603 } 1595 1604 1596 1605 protected function markupText($text) { ··· 1612 1621 $viewer = $this->getViewer(); 1613 1622 1614 1623 $tag = $this->renderCommitHashTag($drequest); 1624 + $search = $this->renderSearchForm(); 1615 1625 1616 1626 $header = id(new PHUIHeaderView()) 1617 1627 ->setUser($viewer) 1618 1628 ->setHeader($this->renderPathLinks($drequest, $mode = 'browse')) 1619 - ->addTag($tag); 1629 + ->addActionItem($search) 1630 + ->addTag($tag) 1631 + ->addClass('diffusion-browse-header'); 1620 1632 1621 1633 return $header; 1622 1634 }
+34
webroot/rsrc/css/application/diffusion/diffusion.css
··· 122 122 color: {$darkbluetext}; 123 123 } 124 124 125 + /* - Search Input ------------------------------------------------------------*/ 126 + 127 + .diffusion-search-form-view { 128 + width: 240px; 129 + } 130 + 131 + .diffusion-search-form-view .diffusion-search-input { 132 + width: 240px; 133 + border-radius: 20px; 134 + padding-left: 12px; 135 + } 136 + 137 + .device-phone .diffusion-browse-header .diffusion-search-form-view { 138 + display: none; 139 + } 140 + 141 + .diffusion-mobile-search-form { 142 + display: none; 143 + } 144 + 145 + .device-phone .diffusion-mobile-search-form { 146 + display: block; 147 + } 148 + 149 + .device-phone .diffusion-search-form-view { 150 + width: 100%; 151 + margin-bottom: 20px; 152 + } 153 + 154 + .device-phone .diffusion-search-form-view .diffusion-search-input { 155 + width: 100%; 156 + } 157 + 158 + 125 159 /* - Phone Style ------------------------------------------------------------*/ 126 160 127 161 .device-phone.diffusion-history-view .phui-two-column-view