1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +01:00

Rough in Guides Application

Summary: Ref T11132, Ref T11478. Builds out a basic PHUICMSView and Guides Application, no content / modules.

Test Plan: Go to /guides/, see blank states for new guides.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T11132, T11478

Differential Revision: https://secure.phabricator.com/D16414
This commit is contained in:
Chad Little 2016-08-17 09:36:32 -07:00
parent 2c5b1dc20a
commit 94c746e1d6
9 changed files with 379 additions and 0 deletions

View file

@ -127,6 +127,7 @@ return array(
'rsrc/css/phui/phui-box.css' => '5c8387cf',
'rsrc/css/phui/phui-button.css' => '4a5fbe3d',
'rsrc/css/phui/phui-chart.css' => '6bf6f78e',
'rsrc/css/phui/phui-cms.css' => '33064557',
'rsrc/css/phui/phui-crumbs-view.css' => '9dac418c',
'rsrc/css/phui/phui-curtain-view.css' => '7148ae25',
'rsrc/css/phui/phui-document-pro.css' => 'dc3d46ed',
@ -832,6 +833,7 @@ return array(
'phui-calendar-list-css' => 'fcc9fb41',
'phui-calendar-month-css' => '8e10e92c',
'phui-chart-css' => '6bf6f78e',
'phui-cms-css' => '33064557',
'phui-crumbs-view-css' => '9dac418c',
'phui-curtain-view-css' => '7148ae25',
'phui-document-summary-view-css' => '9ca48bdf',

View file

@ -1597,6 +1597,7 @@ phutil_register_library_map(array(
'PHUIButtonBarView' => 'view/phui/PHUIButtonBarView.php',
'PHUIButtonExample' => 'applications/uiexample/examples/PHUIButtonExample.php',
'PHUIButtonView' => 'view/phui/PHUIButtonView.php',
'PHUICMSView' => 'view/phui/PHUICMSView.php',
'PHUICalendarDayView' => 'view/phui/calendar/PHUICalendarDayView.php',
'PHUICalendarListView' => 'view/phui/calendar/PHUICalendarListView.php',
'PHUICalendarMonthView' => 'view/phui/calendar/PHUICalendarMonthView.php',
@ -2629,6 +2630,11 @@ phutil_register_library_map(array(
'PhabricatorGlobalLock' => 'infrastructure/util/PhabricatorGlobalLock.php',
'PhabricatorGlobalUploadTargetView' => 'applications/files/view/PhabricatorGlobalUploadTargetView.php',
'PhabricatorGoogleAuthProvider' => 'applications/auth/provider/PhabricatorGoogleAuthProvider.php',
'PhabricatorGuideApplication' => 'applications/guides/application/PhabricatorGuideApplication.php',
'PhabricatorGuideController' => 'applications/guides/controller/PhabricatorGuideController.php',
'PhabricatorGuideInstallController' => 'applications/guides/controller/PhabricatorGuideInstallController.php',
'PhabricatorGuideQuickStartController' => 'applications/guides/controller/PhabricatorGuideQuickStartController.php',
'PhabricatorGuideWelcomeController' => 'applications/guides/controller/PhabricatorGuideWelcomeController.php',
'PhabricatorHTTPParameterTypeTableView' => 'applications/config/view/PhabricatorHTTPParameterTypeTableView.php',
'PhabricatorHandleList' => 'applications/phid/handle/pool/PhabricatorHandleList.php',
'PhabricatorHandleObjectSelectorDataView' => 'applications/phid/handle/view/PhabricatorHandleObjectSelectorDataView.php',
@ -6243,6 +6249,7 @@ phutil_register_library_map(array(
'PHUIButtonBarView' => 'AphrontTagView',
'PHUIButtonExample' => 'PhabricatorUIExample',
'PHUIButtonView' => 'AphrontTagView',
'PHUICMSView' => 'AphrontTagView',
'PHUICalendarDayView' => 'AphrontView',
'PHUICalendarListView' => 'AphrontTagView',
'PHUICalendarMonthView' => 'AphrontView',
@ -7429,6 +7436,11 @@ phutil_register_library_map(array(
'PhabricatorGlobalLock' => 'PhutilLock',
'PhabricatorGlobalUploadTargetView' => 'AphrontView',
'PhabricatorGoogleAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorGuideApplication' => 'PhabricatorApplication',
'PhabricatorGuideController' => 'PhabricatorController',
'PhabricatorGuideInstallController' => 'PhabricatorGuideController',
'PhabricatorGuideQuickStartController' => 'PhabricatorGuideController',
'PhabricatorGuideWelcomeController' => 'PhabricatorGuideController',
'PhabricatorHTTPParameterTypeTableView' => 'AphrontView',
'PhabricatorHandleList' => array(
'Phobject',

View file

@ -0,0 +1,41 @@
<?php
final class PhabricatorGuideApplication extends PhabricatorApplication {
public function getBaseURI() {
return '/guides/';
}
public function getName() {
return pht('Guides');
}
public function getShortDescription() {
return pht('Short Tutorials');
}
public function getIcon() {
return 'fa-map-o';
}
public function isPrototype() {
return true;
}
public function getApplicationGroup() {
return self::GROUP_UTILITIES;
}
public function getRoutes() {
return array(
'/guides/' => array(
'' => 'PhabricatorGuideWelcomeController',
'install/'
=> 'PhabricatorGuideInstallController',
'quickstart/'
=> 'PhabricatorGuideQuickStartController',
),
);
}
}

View file

@ -0,0 +1,21 @@
<?php
abstract class PhabricatorGuideController extends PhabricatorController {
public function buildSideNavView($filter = null, $for_app = false) {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$nav->addLabel(pht('Guides'));
$nav->addFilter('/', pht('Welcome'));
$nav->addFilter('install/', pht('Installation Guide'));
$nav->addFilter('quickstart/', pht('Quick Start Guide'));
return $nav;
}
public function buildApplicationMenu() {
return $this->buildSideNavView(null, true)->getMenu();
}
}

View file

@ -0,0 +1,46 @@
<?php
final class PhabricatorGuideInstallController
extends PhabricatorGuideController {
public function shouldAllowPublic() {
return false;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$title = pht('Installation Guide');
$nav = $this->buildSideNavView();
$nav->selectFilter('install/');
$header = id(new PHUIHeaderView())
->setHeader($title)
->setProfileHeader(true);
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(pht('Installation'));
$content = null;
$view = id(new PHUICMSView())
->setCrumbs($crumbs)
->setNavigation($nav)
->setHeader($header)
->setContent($content);
return $this->newPage()
->setTitle($title)
->addClass('phui-cms-body')
->appendChild($view);
}
private function getGuideContent() {
$guide = null;
return $guide;
}
}

View file

@ -0,0 +1,46 @@
<?php
final class PhabricatorGuideQuickStartController
extends PhabricatorGuideController {
public function shouldAllowPublic() {
return false;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$title = pht('Quick Start Guide');
$nav = $this->buildSideNavView();
$nav->selectFilter('quickstart/');
$header = id(new PHUIHeaderView())
->setHeader($title)
->setProfileHeader(true);
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(pht('Quick Start'));
$content = null;
$view = id(new PHUICMSView())
->setCrumbs($crumbs)
->setNavigation($nav)
->setHeader($header)
->setContent($content);
return $this->newPage()
->setTitle($title)
->addClass('phui-cms-body')
->appendChild($view);
}
private function getGuideContent() {
$guide = null;
return $guide;
}
}

View file

@ -0,0 +1,46 @@
<?php
final class PhabricatorGuideWelcomeController
extends PhabricatorGuideController {
public function shouldAllowPublic() {
return false;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$title = pht('Welcome to Phabricator');
$nav = $this->buildSideNavView();
$nav->selectFilter('/');
$header = id(new PHUIHeaderView())
->setHeader($title)
->setProfileHeader(true);
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(pht('Welcome'));
$content = null;
$view = id(new PHUICMSView())
->setCrumbs($crumbs)
->setNavigation($nav)
->setHeader($header)
->setContent($content);
return $this->newPage()
->setTitle($title)
->addClass('phui-cms-body')
->appendChild($view);
}
private function getGuideContent() {
$guide = null;
return $guide;
}
}

View file

@ -0,0 +1,118 @@
<?php
final class PHUICMSView extends AphrontTagView {
private $header;
private $nav;
private $crumbs;
private $content;
private $toc;
private $comments;
public function setHeader(PHUIHeaderView $header) {
$this->header = $header;
return $this;
}
public function setNavigation(AphrontSideNavFilterView $nav) {
$this->nav = $nav;
return $this;
}
public function setCrumbs(PHUICrumbsView $crumbs) {
$this->crumbs = $crumbs;
return $this;
}
public function setContent($content) {
$this->content = $content;
return $this;
}
public function setToc($toc) {
$this->toc = $toc;
return $this;
}
public function setComments($comments) {
$this->comments = $comments;
}
protected function getTagName() {
return 'div';
}
protected function getTagAttributes() {
require_celerity_resource('phui-cms-css');
$classes = array();
$classes[] = 'phui-cms-view';
if ($this->comments) {
$classes[] = 'phui-cms-has-comments';
}
return array(
'class' => implode(' ', $classes),
);
}
protected function getTagContent() {
$content = phutil_tag(
'div',
array(
'class' => 'phui-cms-page-content',
),
array(
$this->header,
$this->content,
));
$comments = null;
if ($this->comments) {
$comments = phutil_tag(
'div',
array(
'class' => 'phui-cms-comments',
),
array(
$this->comments,
));
}
$navigation = $this->nav;
$navigation->appendChild($content);
$navigation->appendChild($comments);
$page = phutil_tag(
'div',
array(
'class' => 'phui-cms-inner',
),
array(
$navigation,
));
$cms_view = phutil_tag(
'div',
array(
'class' => 'phui-cms-wrap',
),
array(
$this->crumbs,
$page,
));
$classes = array();
$classes[] = 'phui-cms-page';
return phutil_tag(
'div',
array(
'class' => implode(' ', $classes),
),
$cms_view);
}
}

View file

@ -0,0 +1,47 @@
/**
* @provides phui-cms-css
*/
.phui-cms-body {
background-color: #f0f0f2;
}
.phui-cms-view .phui-crumbs-view {
border-bottom: 1px solid {$thinblueborder};
}
.phui-cms-page {
max-width: 1140px;
margin: 0 auto;
background-color: #fff;
border-left: 1px solid {$lightblueborder};
border-right: 1px solid {$lightblueborder};
border-bottom: 1px solid {$lightblueborder};
margin-bottom: 20px;
}
.phui-cms-view .phui-basic-nav.phui-navigation-shell .phabricator-nav-local {
background-color: {$page.background};
width: 240px;
border-right: 1px solid {$thinblueborder};
}
.phui-cms-view .phabricator-nav-content {
padding: 0;
}
.phui-cms-view .phui-document-container {
border: none;
}
.phui-cms-view .phui-profile-header {
padding: 32px 20px;
border-bottom: 1px solid {$thinblueborder};
}
.phui-cms-view .phui-document-view.phui-document-view-pro {
width: auto;
padding: 32px 20px;
margin: 0;
}