Differential D12944 Diff 31181 src/applications/phriction/controller/PhrictionDocumentController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/controller/PhrictionDocumentController.php
| Show First 20 Lines • Show All 385 Lines • ▼ Show 20 Lines | foreach ($grandchildren_dicts as $slug => $ignored) { | ||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||
| $children_dicts = isort($children_dicts, 'title'); | $children_dicts = isort($children_dicts, 'title'); | ||||
| $list = array(); | $list = array(); | ||||
| foreach ($children_dicts as $child) { | foreach ($children_dicts as $child) { | ||||
| $list[] = hsprintf('<li>'); | $list[] = hsprintf('<li class="remarkup-list-item">'); | ||||
| $list[] = $this->renderChildDocumentLink($child); | $list[] = $this->renderChildDocumentLink($child); | ||||
| $grand = idx($grandchildren_dicts, $child['slug'], array()); | $grand = idx($grandchildren_dicts, $child['slug'], array()); | ||||
| if ($grand) { | if ($grand) { | ||||
| $list[] = hsprintf('<ul>'); | $list[] = hsprintf('<ul class="remarkup-list">'); | ||||
| foreach ($grand as $grandchild) { | foreach ($grand as $grandchild) { | ||||
| $list[] = hsprintf('<li>'); | $list[] = hsprintf('<li class="remarkup-list-item">'); | ||||
| $list[] = $this->renderChildDocumentLink($grandchild); | $list[] = $this->renderChildDocumentLink($grandchild); | ||||
| $list[] = hsprintf('</li>'); | $list[] = hsprintf('</li>'); | ||||
| } | } | ||||
| $list[] = hsprintf('</ul>'); | $list[] = hsprintf('</ul>'); | ||||
| } | } | ||||
| $list[] = hsprintf('</li>'); | $list[] = hsprintf('</li>'); | ||||
| } | } | ||||
| if ($more_children) { | if ($more_children) { | ||||
| $list[] = phutil_tag('li', array(), pht('More...')); | $list[] = phutil_tag( | ||||
| 'li', | |||||
| array( | |||||
| 'class' => 'remarkup-list-item', | |||||
| ), | |||||
| pht('More...')); | |||||
| } | } | ||||
| $content = array( | $header = id(new PHUIHeaderView()) | ||||
| phutil_tag( | ->setHeader(pht('Document Hierarchy')); | ||||
| return id(new PHUIDocumentView()) | |||||
| ->setHeader($header) | |||||
| ->appendChild(phutil_tag( | |||||
| 'div', | 'div', | ||||
| array( | array( | ||||
| 'class' => 'phriction-children-header '. | 'class' => 'phabricator-remarkup', | ||||
| 'sprite-gradient gradient-lightblue-header', | |||||
| ), | ), | ||||
| pht('Document Hierarchy')), | |||||
| phutil_tag( | phutil_tag( | ||||
| 'div', | 'ul', | ||||
| array( | array( | ||||
| 'class' => 'phriction-children', | 'class' => 'remarkup-list', | ||||
| ), | ), | ||||
| phutil_tag('ul', array(), $list)), | $list))); | ||||
| ); | |||||
| return id(new PHUIDocumentView()) | |||||
| ->appendChild($content); | |||||
| } | } | ||||
| private function renderChildDocumentLink(array $info) { | private function renderChildDocumentLink(array $info) { | ||||
| $title = nonempty($info['title'], pht('(Untitled Document)')); | $title = nonempty($info['title'], pht('(Untitled Document)')); | ||||
| $item = phutil_tag( | $item = phutil_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'href' => PhrictionDocument::getSlugURI($info['slug']), | 'href' => PhrictionDocument::getSlugURI($info['slug']), | ||||
| Show All 15 Lines | |||||