1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

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
This commit is contained in:
epriestley 2012-07-06 15:39:43 -07:00
parent 1b8ed98ddc
commit 18cfab0c36
4 changed files with 26 additions and 26 deletions

View file

@ -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',
);

View file

@ -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())

View file

@ -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 =
'<script type="text/javascript">'.
$framebust.
'window.__DEV__=1;'.
'</script>'.
$response->renderResourcesOfType('css').
'<style type="text/css">'.
'.PhabricatorMonospaced { font: '.$monospaced.'; }'.
'</style>'.
$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 .=
'<style type="text/css">'.
'.PhabricatorMonospaced { font: '.
$monospaced.
' !important; }'.
'</style>';
}
}
}
return $head;
}

View file

@ -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;