Page MenuHomePhabricator

D15026.diff
No OneTemporary

D15026.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -7,7 +7,7 @@
*/
return array(
'names' => array(
- 'core.pkg.css' => '30316566',
+ 'core.pkg.css' => '3a97c8b9',
'core.pkg.js' => '1f5f365a',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
@@ -143,7 +143,7 @@
'rsrc/css/phui/phui-object-item-list-view.css' => '26c30d3f',
'rsrc/css/phui/phui-pager.css' => 'bea33d23',
'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-remarkup-preview.css' => '1a8f2591',
'rsrc/css/phui/phui-spacing.css' => '042804d6',
@@ -822,7 +822,7 @@
'phui-object-item-list-view-css' => '26c30d3f',
'phui-pager-css' => 'bea33d23',
'phui-pinboard-view-css' => '2495140e',
- 'phui-profile-menu-css' => '05546270',
+ 'phui-profile-menu-css' => 'e8030bb3',
'phui-property-list-view-css' => '27b2849e',
'phui-remarkup-preview-css' => '1a8f2591',
'phui-spacing-css' => '042804d6',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2552,6 +2552,7 @@
'PhabricatorMetaMTASendGridReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php',
'PhabricatorMetaMTAWorker' => 'applications/metamta/PhabricatorMetaMTAWorker.php',
'PhabricatorMetronomicTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php',
+ 'PhabricatorMotivatorProfilePanel' => 'applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php',
'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php',
'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php',
'PhabricatorMultimeterApplication' => 'applications/multimeter/application/PhabricatorMultimeterApplication.php',
@@ -6863,6 +6864,7 @@
'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController',
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
'PhabricatorMetronomicTriggerClock' => 'PhabricatorTriggerClock',
+ 'PhabricatorMotivatorProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample',
'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorMultimeterApplication' => 'PhabricatorApplication',
diff --git a/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php b/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php
new file mode 100644
--- /dev/null
+++ b/src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php
@@ -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)];
+ }
+
+
+}
diff --git a/webroot/rsrc/css/phui/phui-profile-menu.css b/webroot/rsrc/css/phui/phui-profile-menu.css
--- a/webroot/rsrc/css/phui/phui-profile-menu.css
+++ b/webroot/rsrc/css/phui/phui-profile-menu.css
@@ -48,7 +48,8 @@
}
.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;
left: 13px;
top: 12px;
@@ -91,3 +92,16 @@
margin: 4px 0;
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};
+}

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 7:37 AM (3 w, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6290918
Default Alt Text
D15026.diff (8 KB)

Event Timeline