From 94c746e1d67fcee8b181e34581552df02e7837ff Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 17 Aug 2016 09:36:32 -0700 Subject: [PATCH] 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 --- resources/celerity/map.php | 2 + src/__phutil_library_map__.php | 12 ++ .../PhabricatorGuideApplication.php | 41 ++++++ .../controller/PhabricatorGuideController.php | 21 ++++ .../PhabricatorGuideInstallController.php | 46 +++++++ .../PhabricatorGuideQuickStartController.php | 46 +++++++ .../PhabricatorGuideWelcomeController.php | 46 +++++++ src/view/phui/PHUICMSView.php | 118 ++++++++++++++++++ webroot/rsrc/css/phui/phui-cms.css | 47 +++++++ 9 files changed, 379 insertions(+) create mode 100644 src/applications/guides/application/PhabricatorGuideApplication.php create mode 100644 src/applications/guides/controller/PhabricatorGuideController.php create mode 100644 src/applications/guides/controller/PhabricatorGuideInstallController.php create mode 100644 src/applications/guides/controller/PhabricatorGuideQuickStartController.php create mode 100644 src/applications/guides/controller/PhabricatorGuideWelcomeController.php create mode 100644 src/view/phui/PHUICMSView.php create mode 100644 webroot/rsrc/css/phui/phui-cms.css diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 65f36d734d..b45c7d3280 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -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', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index b5426ac82e..d98c735f08 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -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', diff --git a/src/applications/guides/application/PhabricatorGuideApplication.php b/src/applications/guides/application/PhabricatorGuideApplication.php new file mode 100644 index 0000000000..66f678489a --- /dev/null +++ b/src/applications/guides/application/PhabricatorGuideApplication.php @@ -0,0 +1,41 @@ + array( + '' => 'PhabricatorGuideWelcomeController', + 'install/' + => 'PhabricatorGuideInstallController', + 'quickstart/' + => 'PhabricatorGuideQuickStartController', + ), + ); + } + +} diff --git a/src/applications/guides/controller/PhabricatorGuideController.php b/src/applications/guides/controller/PhabricatorGuideController.php new file mode 100644 index 0000000000..5aac89ba00 --- /dev/null +++ b/src/applications/guides/controller/PhabricatorGuideController.php @@ -0,0 +1,21 @@ +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(); + } + +} diff --git a/src/applications/guides/controller/PhabricatorGuideInstallController.php b/src/applications/guides/controller/PhabricatorGuideInstallController.php new file mode 100644 index 0000000000..6781edaeac --- /dev/null +++ b/src/applications/guides/controller/PhabricatorGuideInstallController.php @@ -0,0 +1,46 @@ +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; + } +} diff --git a/src/applications/guides/controller/PhabricatorGuideQuickStartController.php b/src/applications/guides/controller/PhabricatorGuideQuickStartController.php new file mode 100644 index 0000000000..0b6d315642 --- /dev/null +++ b/src/applications/guides/controller/PhabricatorGuideQuickStartController.php @@ -0,0 +1,46 @@ +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; + } +} diff --git a/src/applications/guides/controller/PhabricatorGuideWelcomeController.php b/src/applications/guides/controller/PhabricatorGuideWelcomeController.php new file mode 100644 index 0000000000..62a1a57567 --- /dev/null +++ b/src/applications/guides/controller/PhabricatorGuideWelcomeController.php @@ -0,0 +1,46 @@ +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; + } +} diff --git a/src/view/phui/PHUICMSView.php b/src/view/phui/PHUICMSView.php new file mode 100644 index 0000000000..5898c8ee87 --- /dev/null +++ b/src/view/phui/PHUICMSView.php @@ -0,0 +1,118 @@ +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); + } +} diff --git a/webroot/rsrc/css/phui/phui-cms.css b/webroot/rsrc/css/phui/phui-cms.css new file mode 100644 index 0000000000..16b47c73ac --- /dev/null +++ b/webroot/rsrc/css/phui/phui-cms.css @@ -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; +}