2012-04-02 19:27:31 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group maniphest
|
|
|
|
*/
|
|
|
|
final class ManiphestTaskProjectsView extends ManiphestView {
|
|
|
|
|
|
|
|
private $handles;
|
|
|
|
|
|
|
|
public function setHandles(array $handles) {
|
2012-04-03 21:10:45 +02:00
|
|
|
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
2012-04-02 19:27:31 +02:00
|
|
|
$this->handles = $handles;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
|
|
|
require_celerity_resource('phabricator-project-tag-css');
|
|
|
|
|
|
|
|
|
|
|
|
$show = array_slice($this->handles, 0, 2);
|
|
|
|
|
|
|
|
$tags = array();
|
|
|
|
foreach ($show as $handle) {
|
2013-01-18 03:43:35 +01:00
|
|
|
$tags[] = phutil_tag(
|
2012-04-02 19:27:31 +02:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $handle->getURI(),
|
|
|
|
'class' => 'phabricator-project-tag',
|
|
|
|
),
|
2013-01-25 21:57:17 +01:00
|
|
|
phutil_utf8_shorten($handle->getName(), 24));
|
2012-04-02 19:27:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count($this->handles) > 2) {
|
|
|
|
require_celerity_resource('aphront-tooltip-css');
|
|
|
|
Javelin::initBehavior('phabricator-tooltips');
|
|
|
|
|
|
|
|
$all = array();
|
|
|
|
foreach ($this->handles as $handle) {
|
|
|
|
$all[] = $handle->getName();
|
|
|
|
}
|
|
|
|
|
2013-01-25 21:57:17 +01:00
|
|
|
$tags[] = javelin_tag(
|
2012-04-02 19:27:31 +02:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-project-tag',
|
|
|
|
'sigil' => 'has-tooltip',
|
|
|
|
'meta' => array(
|
2012-04-02 20:16:05 +02:00
|
|
|
'tip' => implode(', ', $all),
|
2012-04-02 19:27:31 +02:00
|
|
|
'size' => 200,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
"\xE2\x80\xA6");
|
|
|
|
}
|
|
|
|
|
2013-02-13 23:50:15 +01:00
|
|
|
return $this->renderSingleView($tags);
|
2012-04-02 19:27:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|