mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Basic NUX blank states
Summary: Implement in Badges Test Plan: Test with nux=true. {F1033431} Reviewers: epriestley Reviewed By: epriestley Subscribers: johnny-bit, Korvin Differential Revision: https://secure.phabricator.com/D14833
This commit is contained in:
parent
006321cce7
commit
c6f3a03209
6 changed files with 150 additions and 8 deletions
|
@ -123,6 +123,7 @@ return array(
|
|||
'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 @@ return array(
|
|||
'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',
|
||||
|
|
|
@ -1444,6 +1444,7 @@ phutil_register_library_map(array(
|
|||
'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 @@ phutil_register_library_map(array(
|
|||
'PHUIBadgeExample' => 'PhabricatorUIExample',
|
||||
'PHUIBadgeMiniView' => 'AphrontTagView',
|
||||
'PHUIBadgeView' => 'AphrontTagView',
|
||||
'PHUIBigInfoView' => 'AphrontTagView',
|
||||
'PHUIBoxExample' => 'PhabricatorUIExample',
|
||||
'PHUIBoxView' => 'AphrontTagView',
|
||||
'PHUIButtonBarExample' => 'PhabricatorUIExample',
|
||||
|
|
|
@ -140,4 +140,24 @@ final class PhabricatorBadgesSearchEngine
|
|||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1355,19 +1355,13 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
|
|||
}
|
||||
|
||||
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() {
|
||||
|
|
95
src/view/phui/PHUIBigInfoView.php
Normal file
95
src/view/phui/PHUIBigInfoView.php
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
final class PHUIBigInfoView extends AphrontTagView {
|
||||
|
||||
private $icon;
|
||||
private $title;
|
||||
private $description;
|
||||
private $actions = array();
|
||||
|
||||
public function setIcon($icon) {
|
||||
$this->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);
|
||||
|
||||
}
|
||||
|
||||
}
|
29
webroot/rsrc/css/phui/phui-big-info-view.css
Normal file
29
webroot/rsrc/css/phui/phui-big-info-view.css
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue