1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 09:20:58 +01:00

Display two numbers in launch view

Summary: Also don't display title if it's already written.

Test Plan: {F33604, size=full}

Reviewers: chad

Reviewed By: chad

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D5087
This commit is contained in:
vrana 2013-02-22 14:13:26 -08:00
parent c864a73ad2
commit 7d7fa11870
2 changed files with 18 additions and 8 deletions

View file

@ -32,7 +32,7 @@ final class PhabricatorApplicationFlags extends PhabricatorApplication {
->execute(); ->execute();
$count = count($flags); $count = count($flags);
$type = PhabricatorApplicationStatusView::TYPE_WARNING; $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
$status[] = id(new PhabricatorApplicationStatusView()) $status[] = id(new PhabricatorApplicationStatusView())
->setType($type) ->setType($type)
->setText(pht('%d Flagged Object(s)', $count)) ->setText(pht('%d Flagged Object(s)', $count))

View file

@ -56,21 +56,26 @@ final class PhabricatorApplicationLaunchView extends AphrontView {
$application->getShortDescription()); $application->getShortDescription());
} }
$count = 0; $counts = array();
$text = array(); $text = array();
if ($this->status) { if ($this->status) {
$info = PhabricatorApplicationStatusView::TYPE_INFO;
foreach ($this->status as $status) { foreach ($this->status as $status) {
if ($status->getType() != $info) { $type = $status->getType();
$count += $status->getCount(); $counts[$type] = idx($counts, $type, 0) + $status->getCount();
}
if ($status->getCount()) { if ($status->getCount()) {
$text[] = $status->getText(); $text[] = $status->getText();
} }
} }
} }
if ($count) { $attention = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
$warning = PhabricatorApplicationStatusView::TYPE_WARNING;
if (!empty($counts[$attention]) || !empty($counts[$warning])) {
$count = idx($counts, $attention, 0);
if (!empty($counts[$warning])) {
$count .= '/'.$counts[$warning];
}
Javelin::initBehavior('phabricator-tooltips'); Javelin::initBehavior('phabricator-tooltips');
$content[] = javelin_tag( $content[] = javelin_tag(
'span', 'span',
@ -134,12 +139,17 @@ final class PhabricatorApplicationLaunchView extends AphrontView {
$classes[] = 'application-tile-full'; $classes[] = 'application-tile-full';
} }
$title = null;
if ($application && !$this->fullWidth) {
$title = $application->getShortDescription();
}
$app_button = phutil_tag( $app_button = phutil_tag(
$application ? 'a' : 'div', $application ? 'a' : 'div',
array( array(
'class' => implode(' ', $classes), 'class' => implode(' ', $classes),
'href' => $application ? $application->getBaseURI() : null, 'href' => $application ? $application->getBaseURI() : null,
'title' => $application ? $application->getShortDescription() : null, 'title' => $title,
), ),
$this->renderSingleView( $this->renderSingleView(
array( array(