diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 67202eb7d1..35ffa85e1e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -100,7 +100,7 @@ return array( 'rsrc/css/application/releeph/releeph-preview-branch.css' => 'b7a6f4a5', 'rsrc/css/application/releeph/releeph-request-differential-create-dialog.css' => '8d8b92cd', 'rsrc/css/application/releeph/releeph-request-typeahead.css' => '667a48ae', - 'rsrc/css/application/search/search-results.css' => 'f240504c', + 'rsrc/css/application/search/search-results.css' => '559cc554', 'rsrc/css/application/slowvote/slowvote.css' => '266df6a1', 'rsrc/css/application/tokens/tokens.css' => '3d0f239e', 'rsrc/css/application/uiexample/example.css' => '528b19de', @@ -738,7 +738,7 @@ return array( 'phabricator-prefab' => '72da38cc', 'phabricator-profile-css' => '1a20dcbf', 'phabricator-remarkup-css' => '2dbff225', - 'phabricator-search-results-css' => 'f240504c', + 'phabricator-search-results-css' => '559cc554', 'phabricator-shaped-request' => '7cbe244b', 'phabricator-side-menu-view-css' => '7e8c6341', 'phabricator-slowvote-css' => '266df6a1', diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php index 5b1e79cc2f..0e13f9ffea 100644 --- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php +++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php @@ -251,33 +251,24 @@ final class PhabricatorSearchApplicationSearchEngine ->withPHIDs(mpull($results, 'getPHID')) ->execute(); - $output = array(); + $list = new PHUIObjectItemListView(); foreach ($results as $phid => $handle) { $view = id(new PhabricatorSearchResultView()) ->setHandle($handle) ->setQuery($query) - ->setObject(idx($objects, $phid)); - $output[] = $view->render(); + ->setObject(idx($objects, $phid)) + ->render(); + $list->addItem($view); } - $results = phutil_tag_div( - 'phabricator-search-result-list', - $output); + $results = $list; } else { - $results = phutil_tag_div( - 'phabricator-search-result-list', - phutil_tag( - 'p', - array('class' => 'phabricator-search-no-results'), - pht('No search results.'))); + $results = id(new PHUIInfoView()) + ->appendChild(pht('No results returned for that query.')) + ->setSeverity(PHUIInfoView::SEVERITY_NODATA); } - return id(new PHUIBoxView()) - ->addMargin(PHUI::MARGIN_LARGE) - ->addPadding(PHUI::PADDING_LARGE) - ->setBorder(true) - ->appendChild($results) - ->addClass('phabricator-search-result-box'); + return $results; } } diff --git a/src/applications/search/view/PhabricatorSearchResultView.php b/src/applications/search/view/PhabricatorSearchResultView.php index 94cbbfaf78..9586150b5e 100644 --- a/src/applications/search/view/PhabricatorSearchResultView.php +++ b/src/applications/search/view/PhabricatorSearchResultView.php @@ -27,53 +27,26 @@ final class PhabricatorSearchResultView extends AphrontView { return; } - $type_name = nonempty($handle->getTypeName(), 'Document'); - require_celerity_resource('phabricator-search-results-css'); - $link = phutil_tag( - 'a', - array( - 'href' => $handle->getURI(), - ), - PhabricatorEnv::getProductionURI($handle->getURI())); - - $img = $handle->getImageURI(); - - if ($img) { - $img = phutil_tag( - 'div', - array( - 'class' => 'result-image', - 'style' => "background-image: url('{$img}');", - ), - ''); - } + $type_name = nonempty($handle->getTypeName(), pht('Document')); $title = $this->emboldenQuery($handle->getFullName()); if ($handle->getStatus() == PhabricatorObjectHandleStatus::STATUS_CLOSED) { - $title = phutil_tag('del', array(), $title); } - return hsprintf( - '
'. - '%s'. - '
'. - '%s'. - '
%s · %s
'. - '
'. - '
'. - '
', - $img, - phutil_tag( - 'a', - array( - 'class' => 'result-name', - 'href' => $handle->getURI(), - ), - $title), - $type_name, - $link); + $item = id(new PHUIObjectItemView()) + ->setHeader($title) + ->setHref($handle->getURI()) + ->setImageURI($handle->getImageURI()) + ->addAttribute($type_name); + + if ($handle->getStatus() == PhabricatorObjectHandleStatus::STATUS_CLOSED) { + $item->setDisabled(true); + $item->addAttribute(pht('Closed')); + } + + return $item; } diff --git a/webroot/rsrc/css/application/search/search-results.css b/webroot/rsrc/css/application/search/search-results.css index a76004161d..3a501e5eac 100644 --- a/webroot/rsrc/css/application/search/search-results.css +++ b/webroot/rsrc/css/application/search/search-results.css @@ -2,36 +2,9 @@ * @provides phabricator-search-results-css */ -.phabricator-search-result { - margin: 4px 0 16px; -} - -.device-phone .phabricator-search-result-box .phui-box { - margin: 20px 0; -} - -.phabricator-search-result .result-image { - position: relative; - float: left; - width: 50px; - height: 50px; - margin-right: 10px; -} - -.phabricator-search-result .result-type { - margin-top: 4px; - word-break: break-word; -} - -.phabricator-search-result .result-name { - font-size: 16px; -} - -.search-results-pager .aphront-pager-view { - text-align: center; -} - -.phabricator-search-no-results { - color: {$lightgreytext}; - font-size: 18px; +.phui-object-item-link strong { + background-color: {$lightyellow}; + color: black; + padding: 0 4px; + border-radius: 3px; }