mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Add a motivational profile menu panel
Summary: Motivate your employees with inspirational quotes. A new quote every day! Test Plan: So inspirational. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D15026
This commit is contained in:
parent
22aebab1c1
commit
77447fc945
4 changed files with 171 additions and 4 deletions
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'core.pkg.css' => '30316566',
|
'core.pkg.css' => '3a97c8b9',
|
||||||
'core.pkg.js' => '1f5f365a',
|
'core.pkg.js' => '1f5f365a',
|
||||||
'darkconsole.pkg.js' => 'e7393ebb',
|
'darkconsole.pkg.js' => 'e7393ebb',
|
||||||
'differential.pkg.css' => '2de124c9',
|
'differential.pkg.css' => '2de124c9',
|
||||||
|
@ -143,7 +143,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-object-item-list-view.css' => '26c30d3f',
|
'rsrc/css/phui/phui-object-item-list-view.css' => '26c30d3f',
|
||||||
'rsrc/css/phui/phui-pager.css' => 'bea33d23',
|
'rsrc/css/phui/phui-pager.css' => 'bea33d23',
|
||||||
'rsrc/css/phui/phui-pinboard-view.css' => '2495140e',
|
'rsrc/css/phui/phui-pinboard-view.css' => '2495140e',
|
||||||
'rsrc/css/phui/phui-profile-menu.css' => '05546270',
|
'rsrc/css/phui/phui-profile-menu.css' => 'e8030bb3',
|
||||||
'rsrc/css/phui/phui-property-list-view.css' => '27b2849e',
|
'rsrc/css/phui/phui-property-list-view.css' => '27b2849e',
|
||||||
'rsrc/css/phui/phui-remarkup-preview.css' => '1a8f2591',
|
'rsrc/css/phui/phui-remarkup-preview.css' => '1a8f2591',
|
||||||
'rsrc/css/phui/phui-spacing.css' => '042804d6',
|
'rsrc/css/phui/phui-spacing.css' => '042804d6',
|
||||||
|
@ -822,7 +822,7 @@ return array(
|
||||||
'phui-object-item-list-view-css' => '26c30d3f',
|
'phui-object-item-list-view-css' => '26c30d3f',
|
||||||
'phui-pager-css' => 'bea33d23',
|
'phui-pager-css' => 'bea33d23',
|
||||||
'phui-pinboard-view-css' => '2495140e',
|
'phui-pinboard-view-css' => '2495140e',
|
||||||
'phui-profile-menu-css' => '05546270',
|
'phui-profile-menu-css' => 'e8030bb3',
|
||||||
'phui-property-list-view-css' => '27b2849e',
|
'phui-property-list-view-css' => '27b2849e',
|
||||||
'phui-remarkup-preview-css' => '1a8f2591',
|
'phui-remarkup-preview-css' => '1a8f2591',
|
||||||
'phui-spacing-css' => '042804d6',
|
'phui-spacing-css' => '042804d6',
|
||||||
|
|
|
@ -2552,6 +2552,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorMetaMTASendGridReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php',
|
'PhabricatorMetaMTASendGridReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php',
|
||||||
'PhabricatorMetaMTAWorker' => 'applications/metamta/PhabricatorMetaMTAWorker.php',
|
'PhabricatorMetaMTAWorker' => 'applications/metamta/PhabricatorMetaMTAWorker.php',
|
||||||
'PhabricatorMetronomicTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php',
|
'PhabricatorMetronomicTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php',
|
||||||
|
'PhabricatorMotivatorProfilePanel' => 'applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php',
|
||||||
'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php',
|
'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php',
|
||||||
'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php',
|
'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php',
|
||||||
'PhabricatorMultimeterApplication' => 'applications/multimeter/application/PhabricatorMultimeterApplication.php',
|
'PhabricatorMultimeterApplication' => 'applications/multimeter/application/PhabricatorMultimeterApplication.php',
|
||||||
|
@ -6863,6 +6864,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController',
|
'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController',
|
||||||
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
|
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
|
||||||
'PhabricatorMetronomicTriggerClock' => 'PhabricatorTriggerClock',
|
'PhabricatorMetronomicTriggerClock' => 'PhabricatorTriggerClock',
|
||||||
|
'PhabricatorMotivatorProfilePanel' => 'PhabricatorProfilePanel',
|
||||||
'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample',
|
'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample',
|
||||||
'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel',
|
'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorMultimeterApplication' => 'PhabricatorApplication',
|
'PhabricatorMultimeterApplication' => 'PhabricatorApplication',
|
||||||
|
|
|
@ -0,0 +1,151 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorMotivatorProfilePanel
|
||||||
|
extends PhabricatorProfilePanel {
|
||||||
|
|
||||||
|
const PANELKEY = 'motivator';
|
||||||
|
|
||||||
|
public function getPanelTypeIcon() {
|
||||||
|
return 'fa-coffee';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPanelTypeName() {
|
||||||
|
return pht('Motivator');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canAddToObject($object) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDisplayName(
|
||||||
|
PhabricatorProfilePanelConfiguration $config) {
|
||||||
|
|
||||||
|
$options = $this->getOptions();
|
||||||
|
$name = idx($options, $config->getPanelProperty('source'));
|
||||||
|
if ($name !== null) {
|
||||||
|
return pht('Motivator: %s', $name);
|
||||||
|
} else {
|
||||||
|
return pht('Motivator');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildEditEngineFields(
|
||||||
|
PhabricatorProfilePanelConfiguration $config) {
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorInstructionsEditField())
|
||||||
|
->setValue(
|
||||||
|
pht(
|
||||||
|
'Motivate your team with inspirational quotes from great minds. '.
|
||||||
|
'This panel shows a new quote every day.')),
|
||||||
|
id(new PhabricatorSelectEditField())
|
||||||
|
->setKey('source')
|
||||||
|
->setLabel(pht('Source'))
|
||||||
|
->setOptions($this->getOptions()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getOptions() {
|
||||||
|
return array(
|
||||||
|
'catfacts' => pht('Cat Facts'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newNavigationMenuItems(
|
||||||
|
PhabricatorProfilePanelConfiguration $config) {
|
||||||
|
|
||||||
|
$source = $config->getPanelProperty('source');
|
||||||
|
|
||||||
|
switch ($source) {
|
||||||
|
case 'catfacts':
|
||||||
|
default:
|
||||||
|
$facts = $this->getCatFacts();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fact = $this->selectFact($facts);
|
||||||
|
|
||||||
|
switch ($source) {
|
||||||
|
case 'catfacts':
|
||||||
|
default:
|
||||||
|
$fact = array(
|
||||||
|
id(new PHUIIconView())->setIconFont('fa-paw'),
|
||||||
|
' ',
|
||||||
|
$fact,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fact = phutil_tag(
|
||||||
|
'div',
|
||||||
|
array(
|
||||||
|
'class' => 'phui-motivator',
|
||||||
|
),
|
||||||
|
$fact);
|
||||||
|
|
||||||
|
$item = $this->newItem()
|
||||||
|
->appendChild($fact);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
$item,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCatFacts() {
|
||||||
|
return array(
|
||||||
|
pht('Cats purr when they are happy, upset, or asleep.'),
|
||||||
|
pht('The first cats evolved on the savanah about 8,000 years ago.'),
|
||||||
|
pht(
|
||||||
|
'Cats have a tail, two feet, between one and three ears, and two '.
|
||||||
|
'other feet.'),
|
||||||
|
pht('Cats use their keen sense of smell to avoid feeling empathy.'),
|
||||||
|
pht('The first cats evolved in swamps about 65 years ago.'),
|
||||||
|
pht(
|
||||||
|
'You can tell how warm a cat is by examining the coloration: cooler '.
|
||||||
|
'areas are darker.'),
|
||||||
|
pht(
|
||||||
|
'Cat tails are flexible because they contain thousands of tiny '.
|
||||||
|
'bones.'),
|
||||||
|
pht(
|
||||||
|
'A cattail is a wetland plant with an appearance that resembles '.
|
||||||
|
'the tail of a cat.'),
|
||||||
|
pht(
|
||||||
|
'Cats must eat a diet rich in fish to replace the tiny bones in '.
|
||||||
|
'their tails.'),
|
||||||
|
pht('Cats are stealthy predators and nearly invisible to radar.'),
|
||||||
|
pht(
|
||||||
|
'Cats use a special type of magnetism to help them land on their '.
|
||||||
|
'feet.'),
|
||||||
|
pht(
|
||||||
|
'A cat can run seven times faster than a human, but only for a '.
|
||||||
|
'short distance.'),
|
||||||
|
pht(
|
||||||
|
'The largest recorded cat was nearly 11 inches long from nose to '.
|
||||||
|
'tail.'),
|
||||||
|
pht(
|
||||||
|
'Not all cats can retract their claws, but most of them can.'),
|
||||||
|
pht(
|
||||||
|
'In the wild, cats and racooons sometimes hunt together in packs.'),
|
||||||
|
pht(
|
||||||
|
'The Spanish word for cat is "cato". The biggest cat is called '.
|
||||||
|
'"el cato".'),
|
||||||
|
pht(
|
||||||
|
'The Japanese word for cat is "kome", which is also the word for '.
|
||||||
|
'rice. Japanese cats love to eat rice, so the two are synonymous.'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function selectFact(array $facts) {
|
||||||
|
// This is a simple pseudorandom number generator that avoids touching
|
||||||
|
// srand(), because it would seed it to a highly predictable value. It
|
||||||
|
// selects a new fact every day.
|
||||||
|
|
||||||
|
$seed = ((int)date('Y') * 366) + (int)date('z');
|
||||||
|
for ($ii = 0; $ii < 32; $ii++) {
|
||||||
|
$seed = ((1664525 * $seed) + 1013904223) % (1 << 31);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $facts[$seed % count($facts)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -48,7 +48,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-profile-menu .phabricator-side-menu .phui-list-item-icon,
|
.phui-profile-menu .phabricator-side-menu .phui-list-item-icon,
|
||||||
.phui-profile-menu .phabricator-side-menu .phui-icon-view {
|
.phui-profile-menu .phabricator-side-menu
|
||||||
|
.phui-list-item-href .phui-icon-view {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 13px;
|
left: 13px;
|
||||||
top: 12px;
|
top: 12px;
|
||||||
|
@ -91,3 +92,16 @@
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.200);
|
border-bottom: 1px solid rgba(0, 0, 0, 0.200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phui-profile-menu .phabricator-side-menu .phui-motivator {
|
||||||
|
white-space: normal;
|
||||||
|
padding: 18px 15px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: {$menu.profile.text};
|
||||||
|
}
|
||||||
|
|
||||||
|
.phui-profile-menu .phabricator-side-menu .phui-motivator .phui-icon-view {
|
||||||
|
position: static;
|
||||||
|
font-size: 12px;
|
||||||
|
color: {$menu.profile.text};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue