2012-08-02 14:07:21 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorApplicationLaunchView extends AphrontView {
|
|
|
|
|
|
|
|
private $application;
|
|
|
|
private $status;
|
|
|
|
|
|
|
|
public function setApplication(PhabricatorApplication $application) {
|
|
|
|
$this->application = $application;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setApplicationStatus(array $status) {
|
|
|
|
$this->status = $status;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
|
|
|
$application = $this->application;
|
|
|
|
|
|
|
|
require_celerity_resource('phabricator-application-launch-view-css');
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 13:37:28 -08:00
|
|
|
require_celerity_resource('sprite-apps-xlarge-css');
|
2012-08-02 14:07:21 -07:00
|
|
|
|
|
|
|
$content = array();
|
|
|
|
$content[] = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-application-launch-name',
|
|
|
|
),
|
|
|
|
phutil_escape_html($application->getName()));
|
|
|
|
$content[] = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-application-launch-description',
|
|
|
|
),
|
|
|
|
phutil_escape_html($application->getShortDescription()));
|
|
|
|
|
|
|
|
|
|
|
|
$count = 0;
|
2012-10-03 15:16:26 -07:00
|
|
|
$content[] = '<span class="phabricator-application-status-block">';
|
|
|
|
|
2012-08-02 14:07:21 -07:00
|
|
|
if ($this->status) {
|
|
|
|
foreach ($this->status as $status) {
|
|
|
|
$count += $status->getCount();
|
|
|
|
$content[] = $status;
|
|
|
|
}
|
2012-10-03 15:16:26 -07:00
|
|
|
} else {
|
|
|
|
$flavor = $application->getFlavorText();
|
|
|
|
if ($flavor !== null) {
|
|
|
|
$content[] = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-application-flavor-text',
|
|
|
|
),
|
|
|
|
phutil_escape_html($flavor));
|
|
|
|
}
|
2012-08-02 14:07:21 -07:00
|
|
|
}
|
|
|
|
|
2012-10-03 15:16:26 -07:00
|
|
|
$content[] = '</span>';
|
|
|
|
|
2012-08-02 14:07:21 -07:00
|
|
|
if ($count) {
|
|
|
|
$content[] = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-application-launch-attention',
|
|
|
|
),
|
|
|
|
phutil_escape_html($count));
|
|
|
|
}
|
|
|
|
|
2012-08-14 14:23:55 -07:00
|
|
|
$classes = array();
|
|
|
|
$classes[] = 'phabricator-application-launch-icon';
|
|
|
|
$styles = array();
|
|
|
|
|
|
|
|
if ($application->getIconURI()) {
|
|
|
|
$styles[] = 'background-image: url('.$application->getIconURI().')';
|
|
|
|
} else {
|
Use application icons for "Eye" menu and Crumbs
Summary:
Issues here:
- Need an application-sized "eye", or a "home" icon for "Phabricator Home".
- Some of the "apps_lb_2x" sliced images are the "_dark_" versions, not the light versions.
- If you slice an application-sized "logout" (power off) icon and application-sized "help" (questionmark in circle) icon I can replace the current menu icons and nearly get rid of "autosprite".
- To replace the icons on /applications/, the non-retina size is "4x", so we'd need "8x" for retina. Alternatively I can reduce the icon sizes by 50%.
- The "Help", "Settings" and "Logout" items currently have a "glowing" hover state, which needs a variant (or we can drop it).
- The /applications/ icons have a white hover state (or we can drop it).
- The 1x application (14x14) icons aren't used anywhere right now, should they be? Maybe in the feed in the future, etc?
- The "apps-2x" and "apps-large" sheets are the same image, but getting them to actually use the same file is a bit tricky, so I just left them separate for now.
Test Plan:
{F26698}
{F26699}
Reviewers: chad
Reviewed By: chad
CC: aran
Maniphest Tasks: T1960
Differential Revision: https://secure.phabricator.com/D4108
2012-12-07 13:37:28 -08:00
|
|
|
$icon = $application->getIconName();
|
|
|
|
$classes[] = 'sprite-apps-xlarge';
|
|
|
|
$classes[] = 'app-'.$icon.'-dark-xlarge';
|
2012-08-14 14:23:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
$icon = phutil_render_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
'style' => nonempty(implode('; ', $styles), null),
|
|
|
|
),
|
|
|
|
'');
|
|
|
|
|
2012-08-02 14:07:21 -07:00
|
|
|
return phutil_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-application-launch-container',
|
|
|
|
'href' => $application->getBaseURI(),
|
|
|
|
),
|
2012-08-14 14:23:55 -07:00
|
|
|
$icon.
|
2012-08-02 14:07:21 -07:00
|
|
|
$this->renderSingleView($content));
|
|
|
|
}
|
|
|
|
}
|