diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -123,6 +123,7 @@ 'rsrc/css/phui/phui-action-list.css' => 'c5eba19d', 'rsrc/css/phui/phui-action-panel.css' => '91c7b835', 'rsrc/css/phui/phui-badge.css' => 'f25c3476', + 'rsrc/css/phui/phui-big-info-view.css' => '86cf0dd3', 'rsrc/css/phui/phui-box.css' => 'a5bb366d', 'rsrc/css/phui/phui-button.css' => '16020a60', 'rsrc/css/phui/phui-crumbs-view.css' => '414406b5', @@ -791,6 +792,7 @@ 'phriction-document-css' => 'd1861e06', 'phui-action-panel-css' => '91c7b835', 'phui-badge-view-css' => 'f25c3476', + 'phui-big-info-view-css' => '86cf0dd3', 'phui-box-css' => 'a5bb366d', 'phui-button-css' => '16020a60', 'phui-calendar-css' => 'ccabe893', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1444,6 +1444,7 @@ 'PHUIBadgeExample' => 'applications/uiexample/examples/PHUIBadgeExample.php', 'PHUIBadgeMiniView' => 'view/phui/PHUIBadgeMiniView.php', 'PHUIBadgeView' => 'view/phui/PHUIBadgeView.php', + 'PHUIBigInfoView' => 'view/phui/PHUIBigInfoView.php', 'PHUIBoxExample' => 'applications/uiexample/examples/PHUIBoxExample.php', 'PHUIBoxView' => 'view/phui/PHUIBoxView.php', 'PHUIButtonBarExample' => 'applications/uiexample/examples/PHUIButtonBarExample.php', @@ -5503,6 +5504,7 @@ 'PHUIBadgeExample' => 'PhabricatorUIExample', 'PHUIBadgeMiniView' => 'AphrontTagView', 'PHUIBadgeView' => 'AphrontTagView', + 'PHUIBigInfoView' => 'AphrontTagView', 'PHUIBoxExample' => 'PhabricatorUIExample', 'PHUIBoxView' => 'AphrontTagView', 'PHUIButtonBarExample' => 'PhabricatorUIExample', diff --git a/src/applications/badges/query/PhabricatorBadgesSearchEngine.php b/src/applications/badges/query/PhabricatorBadgesSearchEngine.php --- a/src/applications/badges/query/PhabricatorBadgesSearchEngine.php +++ b/src/applications/badges/query/PhabricatorBadgesSearchEngine.php @@ -140,4 +140,24 @@ } + protected function getNewUserBody() { + $create_button = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Create a Badge')) + ->setHref('/badges/create/') + ->setColor(PHUIButtonView::GREEN); + + $icon = $this->getApplication()->getFontIcon(); + $app_name = $this->getApplication()->getName(); + $view = id(new PHUIBigInfoView()) + ->setIcon($icon) + ->setTitle(pht('Welcome to %s', $app_name)) + ->setDescription( + pht('Badges let you award and distinguish special users '. + 'throughout your instance.')) + ->addAction($create_button); + + return $view; + } + } diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php --- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php +++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php @@ -1355,19 +1355,13 @@ } final public function renderNewUserView() { - $head = $this->getNewUserHeader(); $body = $this->getNewUserBody(); - if (!strlen($head) && !strlen($body)) { + if (!$body) { return null; } - $viewer = $this->requireViewer(); - - return id(new PHUIBoxView()) - ->addMargin(PHUI::MARGIN_LARGE) - ->appendChild($head) - ->appendChild(new PHUIRemarkupView($viewer, $body)); + return $body; } protected function getNewUserHeader() { diff --git a/src/view/phui/PHUIBigInfoView.php b/src/view/phui/PHUIBigInfoView.php new file mode 100644 --- /dev/null +++ b/src/view/phui/PHUIBigInfoView.php @@ -0,0 +1,95 @@ +icon = $icon; + return $this; + } + + public function setTitle($title) { + $this->title = $title; + return $this; + } + + public function setDescription($description) { + $this->description = $description; + return $this; + } + + public function addAction(PHUIButtonView $button) { + $this->actions[] = $button; + return $this; + } + + protected function getTagName() { + return 'div'; + } + + protected function getTagAttributes() { + $classes = array(); + $classes[] = 'phui-big-info-view'; + + return array( + 'class' => implode(' ', $classes), + ); + } + + protected function getTagContent() { + require_celerity_resource('phui-big-info-view-css'); + + $icon = id(new PHUIIconView()) + ->setIconFont($this->icon) + ->addClass('phui-big-info-icon'); + + $icon = phutil_tag( + 'div', + array( + 'class' => 'phui-big-info-icon-container', + ), + $icon); + + $title = phutil_tag( + 'div', + array( + 'class' => 'phui-big-info-title', + ), + $this->title); + + $description = phutil_tag( + 'div', + array( + 'class' => 'phui-big-info-description', + ), + $this->description); + + $buttons = array(); + foreach ($this->actions as $button) { + $buttons[] = phutil_tag( + 'div', + array( + 'class' => 'phui-big-info-button', + ), + $button); + } + + $actions = null; + if ($buttons) { + $actions = phutil_tag( + 'div', + array( + 'class' => 'phui-big-info-actions', + ), + $buttons); + } + + return array($icon, $title, $description, $actions); + + } + +} diff --git a/webroot/rsrc/css/phui/phui-big-info-view.css b/webroot/rsrc/css/phui/phui-big-info-view.css new file mode 100644 --- /dev/null +++ b/webroot/rsrc/css/phui/phui-big-info-view.css @@ -0,0 +1,29 @@ +/** + * @provides phui-big-info-view-css + */ + +.phui-big-info-view { + padding: 64px 32px; + margin: 16px 4px; + background-color: {$sh-greybackground}; + text-align: center; +} + +.phui-big-info-icon { + font-size: 48px; +} + +.phui-big-info-title { + font-size: 18px; + padding: 4px; + font-weight: bold; +} + +.phui-big-info-description { + font-size: {$biggerfontsize}; + padding: 4px; +} + +.phui-big-info-actions { + padding: 24px 0 0; +}