From 18cfab0c36967d1b90e92d946a2c3c49d32ebd28 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 6 Jul 2012 15:39:43 -0700 Subject: [PATCH] Allow configuration of the default monospaced font style Summary: This is a fairly contentious default that we can easily move to configuration. Test Plan: Changed the default, changed my user setting, reverted my user setting, verified the "settings" page. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D2935 --- conf/default.conf.php | 5 +++ ...rUserPreferenceSettingsPanelController.php | 6 ++-- src/view/page/PhabricatorStandardPageView.php | 36 +++++++++---------- .../application/base/standard-page-view.css | 5 --- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/conf/default.conf.php b/conf/default.conf.php index c0a80ce958..e09b4dfc37 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -1154,4 +1154,9 @@ return array( '@\.arcconfig$@' => 'js', ), + // Set the default monospaced font style for users who haven't set a custom + // style. + 'style.monospace' => '10px "Menlo", "Consolas", "Monaco", monospace', + + ); diff --git a/src/applications/people/controller/settings/panels/PhabricatorUserPreferenceSettingsPanelController.php b/src/applications/people/controller/settings/panels/PhabricatorUserPreferenceSettingsPanelController.php index 1edd725ae1..f650a76008 100644 --- a/src/applications/people/controller/settings/panels/PhabricatorUserPreferenceSettingsPanelController.php +++ b/src/applications/people/controller/settings/panels/PhabricatorUserPreferenceSettingsPanelController.php @@ -59,6 +59,9 @@ EXAMPLE; ), 'User Guide: Configuring an External Editor'); + $font_default = PhabricatorEnv::getEnvConfig('style.monospace'); + $font_default = phutil_escape_html($font_default); + $form = id(new AphrontFormView()) ->setUser($user) ->setAction('/settings/page/preferences/') @@ -90,8 +93,7 @@ EXAMPLE; ->setName($pref_monospaced) ->setCaption( 'Overrides default fonts in tools like Differential. '. - '(Default: 10px "Menlo", "Consolas", "Monaco", '. - 'monospace)') + '(Default: '.$font_default.')') ->setValue($preferences->getPreference($pref_monospaced))) ->appendChild( id(new AphrontFormMarkupControl()) diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index cdc21e0dcb..ba4ef9fb33 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -209,33 +209,31 @@ final class PhabricatorStandardPageView extends AphrontPageView { } $response = CelerityAPI::getStaticResourceResponse(); + + $monospaced = PhabricatorEnv::getEnvConfig('style.monospace'); + + $request = $this->getRequest(); + if ($request) { + $user = $request->getUser(); + if ($user) { + $monospaced = nonempty( + $user->loadPreferences()->getPreference( + PhabricatorUserPreferences::PREFERENCE_MONOSPACED), + $monospaced); + } + } + $head = ''. $response->renderResourcesOfType('css'). + ''. $response->renderSingleResource('javelin-magical-init'); - $request = $this->getRequest(); - if ($request) { - $user = $request->getUser(); - if ($user) { - $monospaced = $user->loadPreferences()->getPreference( - PhabricatorUserPreferences::PREFERENCE_MONOSPACED - ); - - if (strlen($monospaced)) { - $head .= - ''; - } - } - } - return $head; } diff --git a/webroot/rsrc/css/application/base/standard-page-view.css b/webroot/rsrc/css/application/base/standard-page-view.css index 5793d5bac2..2861d69357 100644 --- a/webroot/rsrc/css/application/base/standard-page-view.css +++ b/webroot/rsrc/css/application/base/standard-page-view.css @@ -207,11 +207,6 @@ a.handle-disabled { background-image: url(/rsrc/image/icon/fatcow/bullet_black.png); } -.PhabricatorMonospaced { - font-family: "Menlo", "Consolas", "Monaco", monospace; - font-size: 10px; -} - .aphront-developer-error-callout { padding: 2em; background: #aa0000;