2012-12-11 23:59:27 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* NOTE: you probably want {@class:ArcanistDifferentialRevisionStatus}.
|
|
|
|
* This class just contains a mapping for color within the Differential
|
|
|
|
* application.
|
|
|
|
*/
|
|
|
|
|
|
|
|
final class DifferentialRevisionStatus {
|
|
|
|
|
2013-09-24 17:42:04 +02:00
|
|
|
const COLOR_STATUS_DEFAULT = 'status';
|
|
|
|
const COLOR_STATUS_DARK = 'status-dark';
|
|
|
|
const COLOR_STATUS_GREEN = 'status-green';
|
|
|
|
const COLOR_STATUS_RED = 'status-red';
|
|
|
|
|
|
|
|
public static function getRevisionStatusColor($status) {
|
|
|
|
$default = self::COLOR_STATUS_DEFAULT;
|
2012-12-11 23:59:27 +01:00
|
|
|
|
|
|
|
$map = array(
|
|
|
|
ArcanistDifferentialRevisionStatus::NEEDS_REVIEW =>
|
2013-09-24 17:42:04 +02:00
|
|
|
self::COLOR_STATUS_DEFAULT,
|
2012-12-11 23:59:27 +01:00
|
|
|
ArcanistDifferentialRevisionStatus::NEEDS_REVISION =>
|
2013-09-24 17:42:04 +02:00
|
|
|
self::COLOR_STATUS_RED,
|
2012-12-11 23:59:27 +01:00
|
|
|
ArcanistDifferentialRevisionStatus::ACCEPTED =>
|
2013-09-24 17:42:04 +02:00
|
|
|
self::COLOR_STATUS_GREEN,
|
2012-12-11 23:59:27 +01:00
|
|
|
ArcanistDifferentialRevisionStatus::CLOSED =>
|
2013-09-24 17:42:04 +02:00
|
|
|
self::COLOR_STATUS_DARK,
|
2012-12-11 23:59:27 +01:00
|
|
|
ArcanistDifferentialRevisionStatus::ABANDONED =>
|
2013-09-24 17:42:04 +02:00
|
|
|
self::COLOR_STATUS_DARK,
|
2012-12-11 23:59:27 +01:00
|
|
|
);
|
|
|
|
return idx($map, $status, $default);
|
|
|
|
}
|
2013-09-24 17:42:04 +02:00
|
|
|
|
|
|
|
public static function getRevisionStatusIcon($status) {
|
|
|
|
$default = 'oh-open';
|
|
|
|
|
|
|
|
$map = array(
|
|
|
|
ArcanistDifferentialRevisionStatus::NEEDS_REVIEW =>
|
|
|
|
'oh-open',
|
|
|
|
ArcanistDifferentialRevisionStatus::NEEDS_REVISION =>
|
|
|
|
'oh-open-red',
|
|
|
|
ArcanistDifferentialRevisionStatus::ACCEPTED =>
|
|
|
|
'oh-open-green',
|
|
|
|
ArcanistDifferentialRevisionStatus::CLOSED =>
|
|
|
|
'oh-closed-dark',
|
|
|
|
ArcanistDifferentialRevisionStatus::ABANDONED =>
|
|
|
|
'oh-closed-dark',
|
|
|
|
);
|
|
|
|
return idx($map, $status, $default);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function renderFullDescription($status) {
|
|
|
|
$color = self::getRevisionStatusColor($status);
|
|
|
|
$status_name =
|
|
|
|
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
|
|
|
|
|
|
|
|
$img = id(new PHUIIconView())
|
|
|
|
->setSpriteSheet(PHUIIconView::SPRITE_STATUS)
|
|
|
|
->setSpriteIcon(self::getRevisionStatusIcon($status));
|
|
|
|
|
|
|
|
$tag = phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-header-'.$color,
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$img,
|
|
|
|
$status_name,
|
|
|
|
));
|
|
|
|
|
|
|
|
return $tag;
|
|
|
|
}
|
2012-12-11 23:59:27 +01:00
|
|
|
}
|