Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/controller/DivinerBookController.php
| Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| if ($book->getRepositoryPHID()) { | if ($book->getRepositoryPHID()) { | ||||
| $header->addTag( | $header->addTag( | ||||
| id(new PHUITagView()) | id(new PHUITagView()) | ||||
| ->setType(PHUITagView::TYPE_STATE) | ->setType(PHUITagView::TYPE_STATE) | ||||
| ->setBackgroundColor(PHUITagView::COLOR_BLUE) | ->setBackgroundColor(PHUITagView::COLOR_BLUE) | ||||
| ->setName($book->getRepository()->getMonogram())); | ->setName($book->getRepository()->getMonogram())); | ||||
| } | } | ||||
| if ($book->getIsArchived()) { | |||||
| $header->setStatus('fa-ban', 'red', pht('Archived')); | |||||
| } else { | |||||
| $header->setStatus('fa-check', 'bluegrey', pht('Active')); | |||||
| } | |||||
| $document = new PHUIDocumentView(); | $document = new PHUIDocumentView(); | ||||
| $document->setHeader($header); | $document->setHeader($header); | ||||
| $document->addClass('diviner-view'); | $document->addClass('diviner-view'); | ||||
| $document->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS); | $document->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS); | ||||
| $atoms = id(new DivinerAtomQuery()) | $atoms = id(new DivinerAtomQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withBookPHIDs(array($book->getPHID())) | ->withBookPHIDs(array($book->getPHID())) | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | private function buildActionView( | ||||
| $action_view->addAction( | $action_view->addAction( | ||||
| id(new PhabricatorActionView()) | id(new PhabricatorActionView()) | ||||
| ->setName(pht('Edit Book')) | ->setName(pht('Edit Book')) | ||||
| ->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
| ->setHref('/book/'.$book->getName().'/edit/') | ->setHref('/book/'.$book->getName().'/edit/') | ||||
| ->setDisabled(!$can_edit)); | ->setDisabled(!$can_edit)); | ||||
| if ($book->getIsArchived()) { | |||||
| $action_view->addAction( | |||||
| id(new PhabricatorActionView()) | |||||
| ->setName(pht('Activate Book')) | |||||
| ->setIcon('fa-check') | |||||
| ->setHref('/book/'.$book->getName().'/archive/') | |||||
| ->setDisabled(!$can_edit) | |||||
| ->setWorkflow(true)); | |||||
| } else { | |||||
| $action_view->addAction( | |||||
| id(new PhabricatorActionView()) | |||||
| ->setName(pht('Archive Book')) | |||||
| ->setIcon('fa-ban') | |||||
| ->setHref('/book/'.$book->getName().'/archive/') | |||||
| ->setDisabled(!$can_edit) | |||||
| ->setWorkflow(true)); | |||||
| } | |||||
| return $action_view; | return $action_view; | ||||
| } | } | ||||
| } | } | ||||