Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PHUIDocumentViewPro extends AphrontTagView {
|
|
|
|
|
|
|
|
private $header;
|
|
|
|
private $bookname;
|
|
|
|
private $bookdescription;
|
|
|
|
private $fluid;
|
|
|
|
private $toc;
|
2015-12-31 22:08:33 +01:00
|
|
|
private $foot;
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
|
|
|
|
public function setHeader(PHUIHeaderView $header) {
|
|
|
|
$header->setTall(true);
|
|
|
|
$this->header = $header;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setBook($name, $description) {
|
|
|
|
$this->bookname = $name;
|
|
|
|
$this->bookdescription = $description;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setFluid($fluid) {
|
|
|
|
$this->fluid = $fluid;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-11-22 22:10:41 +01:00
|
|
|
public function setToc($toc) {
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
$this->toc = $toc;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-12-31 22:08:33 +01:00
|
|
|
public function setFoot($foot) {
|
|
|
|
$this->foot = $foot;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
protected function getTagAttributes() {
|
|
|
|
$classes = array();
|
|
|
|
|
2015-11-28 05:40:02 +01:00
|
|
|
$classes[] = 'phui-document-container';
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
if ($this->fluid) {
|
|
|
|
$classes[] = 'phui-document-fluid';
|
|
|
|
}
|
2015-12-31 22:08:33 +01:00
|
|
|
if ($this->foot) {
|
|
|
|
$classes[] = 'document-has-foot';
|
|
|
|
}
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
|
|
|
|
return array(
|
2015-11-28 05:40:02 +01:00
|
|
|
'class' => implode(' ', $classes),
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagContent() {
|
|
|
|
require_celerity_resource('phui-document-view-css');
|
|
|
|
require_celerity_resource('phui-document-view-pro-css');
|
|
|
|
Javelin::initBehavior('phabricator-reveal-content');
|
|
|
|
|
|
|
|
$classes = array();
|
|
|
|
$classes[] = 'phui-document-view';
|
|
|
|
$classes[] = 'phui-document-view-pro';
|
|
|
|
|
|
|
|
$book = null;
|
|
|
|
if ($this->bookname) {
|
|
|
|
$book = pht('%s (%s)', $this->bookname, $this->bookdescription);
|
|
|
|
}
|
|
|
|
|
|
|
|
$main_content = $this->renderChildren();
|
|
|
|
|
|
|
|
if ($book) {
|
|
|
|
$this->header->setSubheader($book);
|
|
|
|
}
|
|
|
|
|
|
|
|
$table_of_contents = null;
|
|
|
|
if ($this->toc) {
|
|
|
|
$toc = array();
|
|
|
|
$toc_id = celerity_generate_unique_node_id();
|
|
|
|
$toc[] = id(new PHUIButtonView())
|
|
|
|
->setTag('a')
|
|
|
|
->setIconFont('fa-align-left')
|
|
|
|
->setColor(PHUIButtonView::SIMPLE)
|
|
|
|
->addClass('phui-document-toc')
|
|
|
|
->addSigil('jx-toggle-class')
|
|
|
|
->setMetaData(array(
|
|
|
|
'map' => array(
|
|
|
|
$toc_id => 'phui-document-toc-open',
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$toc[] = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-list-sidenav phui-document-toc-list',
|
|
|
|
),
|
|
|
|
$this->toc);
|
|
|
|
|
|
|
|
$table_of_contents = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-document-toc-container',
|
|
|
|
'id' => $toc_id,
|
|
|
|
),
|
|
|
|
$toc);
|
|
|
|
}
|
|
|
|
|
2015-12-31 22:08:33 +01:00
|
|
|
$foot_content = null;
|
|
|
|
if ($this->foot) {
|
|
|
|
$foot_content = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-document-foot-content',
|
|
|
|
),
|
|
|
|
$this->foot);
|
|
|
|
}
|
|
|
|
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
$content_inner = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-document-inner',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$table_of_contents,
|
|
|
|
$this->header,
|
|
|
|
$main_content,
|
2015-12-31 22:08:33 +01:00
|
|
|
$foot_content,
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
));
|
|
|
|
|
|
|
|
$content = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-document-content',
|
|
|
|
),
|
|
|
|
$content_inner);
|
|
|
|
|
2015-11-28 05:40:02 +01:00
|
|
|
return phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
),
|
|
|
|
$content);
|
Redesign Diviner
Summary:
This implements `PHUIDocumentViewPro` which should move to be the base for all documents (Phame, Phriction, Legalpad, Diviner). Overall this feels really good to me, but I'd like to roll it out into Diviner specifically first to work through the issues and then move into other apps and drop `PHUIDocumentView` once everything is converted. Some features are:
- White Background, no border on page
- Table of Contents is move to hidden menu (more space for documentation)
- Property List sits under the document
Some design decisions above are in anticipation of Phriction v3 and Unbeta Phame, specifically commenting and maybe some cool new Remarkup text layout options for Phame.
Test Plan:
Went through tons of pages on Diviner on Desktop, Tablet, Mobile. Bounce back to Phriction to make sure DocumentView CSS changes actually look better there.
{F930518}
{F930519}
{F930520}
{F930521}
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: tycho.tatitscheff, joshuaspence, Korvin
Differential Revision: https://secure.phabricator.com/D14374
2015-11-01 17:56:46 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|