Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialChangeset.php
| Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | public function attachDiff(DifferentialDiff $diff) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getDiff() { | public function getDiff() { | ||||
| return $this->assertAttached($this->diff); | return $this->assertAttached($this->diff); | ||||
| } | } | ||||
| public function newFileTreeIcon() { | public function newFileTreeIcon() { | ||||
| $file_type = $this->getFileType(); | $icon = $this->getPathIconIcon(); | ||||
| $change_type = $this->getChangeType(); | $color = $this->getPathIconColor(); | ||||
| return id(new PHUIIconView()) | |||||
| ->setIcon("{$icon} {$color}"); | |||||
| } | |||||
| public function getPathIconIcon() { | |||||
| return idx($this->getPathIconDetails(), 'icon'); | |||||
| } | |||||
| public function getPathIconColor() { | |||||
| return idx($this->getPathIconDetails(), 'color'); | |||||
| } | |||||
| private function getPathIconDetails() { | |||||
| $change_icons = array( | $change_icons = array( | ||||
| DifferentialChangeType::TYPE_DELETE => 'fa-file-o', | DifferentialChangeType::TYPE_DELETE => array( | ||||
| 'icon' => 'fa-times', | |||||
| 'color' => 'delete-color', | |||||
| ), | |||||
| DifferentialChangeType::TYPE_ADD => array( | |||||
| 'icon' => 'fa-plus', | |||||
| 'color' => 'create-color', | |||||
| ), | |||||
| DifferentialChangeType::TYPE_MOVE_AWAY => array( | |||||
| 'icon' => 'fa-circle-o', | |||||
| 'color' => 'grey', | |||||
| ), | |||||
| DifferentialChangeType::TYPE_MULTICOPY => array( | |||||
| 'icon' => 'fa-circle-o', | |||||
| 'color' => 'grey', | |||||
| ), | |||||
| DifferentialChangeType::TYPE_MOVE_HERE => array( | |||||
| 'icon' => 'fa-plus-circle', | |||||
| 'color' => 'create-color', | |||||
| ), | |||||
| DifferentialChangeType::TYPE_COPY_HERE => array( | |||||
| 'icon' => 'fa-plus-circle', | |||||
| 'color' => 'create-color', | |||||
| ), | |||||
| ); | ); | ||||
| $change_type = $this->getChangeType(); | |||||
| if (isset($change_icons[$change_type])) { | if (isset($change_icons[$change_type])) { | ||||
| $icon = $change_icons[$change_type]; | return $change_icons[$change_type]; | ||||
| } else { | |||||
| $icon = DifferentialChangeType::getIconForFileType($file_type); | |||||
| } | } | ||||
| $change_colors = array( | if ($this->isGeneratedChangeset()) { | ||||
| DifferentialChangeType::TYPE_ADD => 'green', | return array( | ||||
| DifferentialChangeType::TYPE_DELETE => 'red', | 'icon' => 'fa-cogs', | ||||
| DifferentialChangeType::TYPE_MOVE_AWAY => 'orange', | 'color' => 'grey', | ||||
| DifferentialChangeType::TYPE_MOVE_HERE => 'orange', | |||||
| DifferentialChangeType::TYPE_COPY_HERE => 'orange', | |||||
| DifferentialChangeType::TYPE_MULTICOPY => 'orange', | |||||
| ); | ); | ||||
| $color = idx($change_colors, $change_type, 'bluetext'); | |||||
| return id(new PHUIIconView()) | |||||
| ->setIcon($icon.' '.$color); | |||||
| } | } | ||||
| public function getFileTreeClass() { | $file_type = $this->getFileType(); | ||||
| switch ($this->getChangeType()) { | $icon = DifferentialChangeType::getIconForFileType($file_type); | ||||
| case DifferentialChangeType::TYPE_ADD: | |||||
| return 'filetree-added'; | |||||
| case DifferentialChangeType::TYPE_DELETE: | |||||
| return 'filetree-deleted'; | |||||
| case DifferentialChangeType::TYPE_MOVE_AWAY: | |||||
| case DifferentialChangeType::TYPE_MOVE_HERE: | |||||
| case DifferentialChangeType::TYPE_COPY_HERE: | |||||
| case DifferentialChangeType::TYPE_MULTICOPY: | |||||
| return 'filetree-movecopy'; | |||||
| } | |||||
| return null; | return array( | ||||
| 'icon' => $icon, | |||||
| 'color' => 'bluetext', | |||||
| ); | |||||
| } | } | ||||
| public function setChangesetMetadata($key, $value) { | public function setChangesetMetadata($key, $value) { | ||||
| if (!is_array($this->metadata)) { | if (!is_array($this->metadata)) { | ||||
| $this->metadata = array(); | $this->metadata = array(); | ||||
| } | } | ||||
| $this->metadata[$key] = $value; | $this->metadata[$key] = $value; | ||||
| ▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines | |||||