Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/view/PHUIDiffTableOfContentsListView.php
| <?php | <?php | ||||
| final class PHUIDiffTableOfContentsListView extends AphrontView { | final class PHUIDiffTableOfContentsListView extends AphrontView { | ||||
| private $items = array(); | private $items = array(); | ||||
| public function addItem(PHUIDiffTableOfContentsItemView $item) { | public function addItem(PHUIDiffTableOfContentsItemView $item) { | ||||
| $this->items[] = $item; | $this->items[] = $item; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function render() { | public function render() { | ||||
| $this->requireResource('differential-core-view-css'); | $this->requireResource('differential-core-view-css'); | ||||
| $this->requireResource('differential-table-of-contents-css'); | $this->requireResource('differential-table-of-contents-css'); | ||||
| $this->requireResource('phui-text-css'); | $this->requireResource('phui-text-css'); | ||||
| Javelin::initBehavior('phabricator-tooltips'); | |||||
| $items = $this->items; | $items = $this->items; | ||||
| $rows = array(); | $rows = array(); | ||||
| foreach ($items as $item) { | foreach ($items as $item) { | ||||
| $rows[] = $item->render(); | $rows[] = $item->render(); | ||||
| } | } | ||||
| // If no item has any coverage information, just hide the coverage columns. | |||||
| $any_coverage = false; | |||||
| foreach ($items as $item) { | |||||
| if (strlen($item->getCoverage())) { | |||||
| $any_coverage = true; | |||||
| } | |||||
| } | |||||
| $reveal_link = javelin_tag( | $reveal_link = javelin_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'sigil' => 'differential-reveal-all', | 'sigil' => 'differential-reveal-all', | ||||
| 'mustcapture' => true, | 'mustcapture' => true, | ||||
| 'class' => 'button differential-toc-reveal-all', | 'class' => 'button differential-toc-reveal-all', | ||||
| ), | ), | ||||
| pht('Show All Context')); | pht('Show All Context')); | ||||
| Show All 19 Lines | $table = id(new AphrontTableView($rows)) | ||||
| array( | array( | ||||
| 'differential-toc-char center', | 'differential-toc-char center', | ||||
| 'differential-toc-prop center', | 'differential-toc-prop center', | ||||
| 'differential-toc-ftype center', | 'differential-toc-ftype center', | ||||
| 'differential-toc-file wide', | 'differential-toc-file wide', | ||||
| 'differential-toc-cov', | 'differential-toc-cov', | ||||
| 'differential-toc-cov', | 'differential-toc-cov', | ||||
| )) | )) | ||||
| ->setColumnVisibility( | |||||
| array( | |||||
| true, | |||||
| true, | |||||
| true, | |||||
| true, | |||||
| $any_coverage, | |||||
| $any_coverage, | |||||
| )) | |||||
| ->setDeviceVisibility( | ->setDeviceVisibility( | ||||
| array( | array( | ||||
| true, | true, | ||||
| true, | true, | ||||
| true, | true, | ||||
| true, | true, | ||||
| false, | false, | ||||
| false, | false, | ||||
| Show All 14 Lines | |||||