mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-17 18:21:11 +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:
parent
1b8ed98ddc
commit
18cfab0c36
4 changed files with 26 additions and 26 deletions
|
@ -1154,4 +1154,9 @@ return array(
|
||||||
'@\.arcconfig$@' => 'js',
|
'@\.arcconfig$@' => 'js',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// Set the default monospaced font style for users who haven't set a custom
|
||||||
|
// style.
|
||||||
|
'style.monospace' => '10px "Menlo", "Consolas", "Monaco", monospace',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -59,6 +59,9 @@ EXAMPLE;
|
||||||
),
|
),
|
||||||
'User Guide: Configuring an External Editor');
|
'User Guide: Configuring an External Editor');
|
||||||
|
|
||||||
|
$font_default = PhabricatorEnv::getEnvConfig('style.monospace');
|
||||||
|
$font_default = phutil_escape_html($font_default);
|
||||||
|
|
||||||
$form = id(new AphrontFormView())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setAction('/settings/page/preferences/')
|
->setAction('/settings/page/preferences/')
|
||||||
|
@ -90,8 +93,7 @@ EXAMPLE;
|
||||||
->setName($pref_monospaced)
|
->setName($pref_monospaced)
|
||||||
->setCaption(
|
->setCaption(
|
||||||
'Overrides default fonts in tools like Differential. '.
|
'Overrides default fonts in tools like Differential. '.
|
||||||
'(Default: 10px "Menlo", "Consolas", "Monaco", '.
|
'(Default: '.$font_default.')')
|
||||||
'monospace)')
|
|
||||||
->setValue($preferences->getPreference($pref_monospaced)))
|
->setValue($preferences->getPreference($pref_monospaced)))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormMarkupControl())
|
id(new AphrontFormMarkupControl())
|
||||||
|
|
|
@ -209,33 +209,31 @@ final class PhabricatorStandardPageView extends AphrontPageView {
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = CelerityAPI::getStaticResourceResponse();
|
$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 =
|
$head =
|
||||||
'<script type="text/javascript">'.
|
'<script type="text/javascript">'.
|
||||||
$framebust.
|
$framebust.
|
||||||
'window.__DEV__=1;'.
|
'window.__DEV__=1;'.
|
||||||
'</script>'.
|
'</script>'.
|
||||||
$response->renderResourcesOfType('css').
|
$response->renderResourcesOfType('css').
|
||||||
|
'<style type="text/css">'.
|
||||||
|
'.PhabricatorMonospaced { font: '.$monospaced.'; }'.
|
||||||
|
'</style>'.
|
||||||
$response->renderSingleResource('javelin-magical-init');
|
$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;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,11 +207,6 @@ a.handle-disabled {
|
||||||
background-image: url(/rsrc/image/icon/fatcow/bullet_black.png);
|
background-image: url(/rsrc/image/icon/fatcow/bullet_black.png);
|
||||||
}
|
}
|
||||||
|
|
||||||
.PhabricatorMonospaced {
|
|
||||||
font-family: "Menlo", "Consolas", "Monaco", monospace;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aphront-developer-error-callout {
|
.aphront-developer-error-callout {
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
background: #aa0000;
|
background: #aa0000;
|
||||||
|
|
Loading…
Reference in a new issue