1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-02 18:08:26 +01:00
phorge-phorge/src/applications/meta/view/PhabricatorApplicationLaunchView.php
epriestley 298604c9d3 Rename "beta" to "prototype" and document support policy
Summary:
Fixes T6084. Changes:

  - Rename `phabricator.show-beta-applications` to `phabricator.show-prototypes`, to reinforce that these include early-development applications.
  - Migrate the config setting.
  - Add an explicit "no support" banner to the config page.
  - Rename "Beta" to "Prototype" in the UI.
  - Use "bomb" icon instead of "half star" icon.
  - Document prototype applications in more detail.
  - Explicitly document that we do not support these applications.

Test Plan:
  - Ran migration.
  - Resolved "obsolete config" issue.
  - Viewed config setting.
  - Browsed prototypes in Applications app.
  - Viewed documentation.

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley, hach-que

Maniphest Tasks: T6084

Differential Revision: https://secure.phabricator.com/D10493
2014-09-17 18:25:57 -07:00

135 lines
3.5 KiB
PHP

<?php
final class PhabricatorApplicationLaunchView extends AphrontTagView {
private $application;
private $status;
public function setApplication(PhabricatorApplication $application) {
$this->application = $application;
return $this;
}
public function setApplicationStatus(array $status) {
$this->status = $status;
return $this;
}
protected function getTagName() {
return $this->application ? 'a' : 'div';
}
protected function getTagAttributes() {
$application = $this->application;
return array(
'class' => array('phabricator-application-launch-container'),
'href' => $application ? $application->getBaseURI() : null,
);
}
protected function getTagContent() {
$application = $this->application;
require_celerity_resource('phabricator-application-launch-view-css');
require_celerity_resource('sprite-apps-large-css');
$content = array();
$icon = null;
if ($application) {
$content[] = phutil_tag(
'span',
array(
'class' => 'phabricator-application-launch-name',
),
$application->getName());
$content[] = phutil_tag(
'span',
array(
'class' => 'phabricator-application-launch-description',
),
$application->getShortDescription());
$counts = array();
$text = array();
if ($this->status) {
foreach ($this->status as $status) {
$type = $status->getType();
$counts[$type] = idx($counts, $type, 0) + $status->getCount();
if ($status->getCount()) {
$text[] = $status->getText();
}
}
}
$attention = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
$warning = PhabricatorApplicationStatusView::TYPE_WARNING;
if (!empty($counts[$attention]) || !empty($counts[$warning])) {
$count = idx($counts, $attention, 0);
$count1 = $count2 = '';
if ($count > 0) {
$count1 = phutil_tag(
'span',
array(
'class' => 'phabricator-application-attention-count',
),
$count);
}
if (!empty($counts[$warning])) {
$count2 = phutil_tag(
'span',
array(
'class' => 'phabricator-application-warning-count',
),
$counts[$warning]);
}
if (nonempty($count1) && nonempty($count2)) {
$numbers = array($count1, ' / ', $count2);
} else {
$numbers = array($count1, $count2);
}
Javelin::initBehavior('phabricator-tooltips');
$content[] = javelin_tag(
'span',
array(
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => implode("\n", $text),
'size' => 240,
),
'class' => 'phabricator-application-launch-attention',
),
$numbers);
}
$classes = array();
$classes[] = 'phabricator-application-launch-icon';
$styles = array();
if ($application->getIconURI()) {
$styles[] = 'background-image: url('.$application->getIconURI().')';
} else {
$icon = $application->getIconName();
$classes[] = 'sprite-apps-large';
$classes[] = 'apps-'.$icon.'-dark-large';
}
$icon = phutil_tag(
'span',
array(
'class' => implode(' ', $classes),
'style' => nonempty(implode('; ', $styles), null),
),
'');
}
return array(
$icon,
$content,
);
}
}