1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 10:22:42 +01:00
phorge-phorge/src/applications/maniphest/view/ManiphestTaskProjectsView.php
Chad Little 989c7748e9 Prompt to adding a project if none in Maniphest
Summary: Adds 'Add Project...' if no projects present on Maniphest items. Also - I can't seem to get a dialog to pop, what am I missing? Fixes T3308

Test Plan: Click add project, get edit form.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T3308

Differential Revision: https://secure.phabricator.com/D6121
2013-06-04 10:58:49 -07:00

69 lines
1.6 KiB
PHP

<?php
/**
* @group maniphest
*/
final class ManiphestTaskProjectsView extends ManiphestView {
private $handles;
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
return $this;
}
public function render() {
require_celerity_resource('phabricator-project-tag-css');
$show = array_slice($this->handles, 0, 2);
$tags = array();
if ($show) {
foreach ($show as $handle) {
$tags[] = phutil_tag(
'a',
array(
'href' => $handle->getURI(),
'class' => 'phabricator-project-tag',
),
phutil_utf8_shorten($handle->getName(), 24));
}
} else {
$tags[] = phutil_tag(
'a',
array(
'class' => 'phabricator-project-tag phabricator-project-tag-grey',
'href' => '/maniphest/view/all/?s&projects='.
ManiphestTaskOwner::PROJECT_NO_PROJECT
),
pht('No Project'));
}
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();
}
$tags[] = javelin_tag(
'span',
array(
'class' => 'phabricator-project-tag',
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => implode(', ', $all),
'size' => 200,
),
),
"\xE2\x80\xA6");
}
return $tags;
}
}