mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Created a preference pane for DarkConsole, instead of link
Summary: Just removed the link and created a new field under preferences. Now the setting is under Display Preferences. Test Plan: Enablied/Disabled dark console to see if it works. Reviewers: epriestley Reviewed By: epriestley CC: irinav, aran, Korvin Maniphest Tasks: T2344 Differential Revision: https://secure.phabricator.com/D4549 Conflicts: src/view/page/PhabricatorStandardPageView.php
This commit is contained in:
parent
49679a6b79
commit
f919f000e7
6 changed files with 33 additions and 42 deletions
|
@ -26,19 +26,7 @@ final class DarkConsoleController extends PhabricatorController {
|
|||
return id(new AphrontAjaxResponse())->setDisableConsole(true);
|
||||
}
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) {
|
||||
$user->setConsoleEnabled(!$user->getConsoleEnabled());
|
||||
if ($user->getConsoleEnabled()) {
|
||||
$user->setConsoleVisible(true);
|
||||
}
|
||||
$user->save();
|
||||
if ($request->isAjax()) {
|
||||
return new AphrontRedirectResponse();
|
||||
} else {
|
||||
return id(new AphrontRedirectResponse())->setURI('/');
|
||||
}
|
||||
}
|
||||
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,9 +88,12 @@ abstract class PhabricatorController extends AphrontController {
|
|||
return $this->delegateToController($checker_controller);
|
||||
}
|
||||
|
||||
$preferences = $user->loadPreferences();
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) {
|
||||
if ($user->getConsoleEnabled() ||
|
||||
PhabricatorEnv::getEnvConfig('darkconsole.always-on')) {
|
||||
$dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE;
|
||||
if ($preferences->getPreference($dark_console) ||
|
||||
PhabricatorEnv::getEnvConfig('darkconsole.always-on')) {
|
||||
$console = new DarkConsoleCore();
|
||||
$request->getApplicationConfiguration()->setConsole($console);
|
||||
}
|
||||
|
|
|
@ -440,7 +440,8 @@ final class PhabricatorUser extends PhabricatorUserDAO implements PhutilPerson {
|
|||
$default_dict = array(
|
||||
PhabricatorUserPreferences::PREFERENCE_TITLES => 'glyph',
|
||||
PhabricatorUserPreferences::PREFERENCE_EDITOR => '',
|
||||
PhabricatorUserPreferences::PREFERENCE_MONOSPACED => '');
|
||||
PhabricatorUserPreferences::PREFERENCE_MONOSPACED => '',
|
||||
PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE => 0);
|
||||
|
||||
$preferences->setPreferences($default_dict);
|
||||
}
|
||||
|
|
|
@ -19,11 +19,13 @@ final class PhabricatorSettingsPanelDisplayPreferences
|
|||
$user = $request->getUser();
|
||||
$preferences = $user->loadPreferences();
|
||||
|
||||
$pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED;
|
||||
$pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR;
|
||||
$pref_multiedit = PhabricatorUserPreferences::PREFERENCE_MULTIEDIT;
|
||||
$pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES;
|
||||
$pref_symbols = PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS;
|
||||
$pref_monospaced = PhabricatorUserPreferences::PREFERENCE_MONOSPACED;
|
||||
$pref_dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE;
|
||||
$pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR;
|
||||
$pref_multiedit = PhabricatorUserPreferences::PREFERENCE_MULTIEDIT;
|
||||
$pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES;
|
||||
$pref_symbols =
|
||||
PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS;
|
||||
$pref_monospaced_textareas =
|
||||
PhabricatorUserPreferences::PREFERENCE_MONOSPACED_TEXTAREAS;
|
||||
|
||||
|
@ -45,6 +47,9 @@ final class PhabricatorSettingsPanelDisplayPreferences
|
|||
$preferences->setPreference(
|
||||
$pref_monospaced_textareas,
|
||||
$request->getStr($pref_monospaced_textareas));
|
||||
$preferences->setPreference(
|
||||
$pref_dark_console,
|
||||
$request->getBool($pref_dark_console));
|
||||
|
||||
$preferences->save();
|
||||
return id(new AphrontRedirectResponse())
|
||||
|
@ -75,6 +80,10 @@ EXAMPLE;
|
|||
if (!$pref_monospaced_textareas_value) {
|
||||
$pref_monospaced_textareas_value = 'disabled';
|
||||
}
|
||||
$pref_dark_console_value = $preferences->getPreference($pref_dark_console);
|
||||
if (!$pref_dark_console_value) {
|
||||
$pref_dark_console_value = 0;
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
|
@ -140,10 +149,20 @@ EXAMPLE;
|
|||
->addButton('enabled', 'Enabled',
|
||||
'Show all textareas using the monospaced font defined above.')
|
||||
->addButton('disabled', 'Disabled', null))
|
||||
->appendChild(
|
||||
id(new AphrontFormRadioButtonControl())
|
||||
->setLabel('Dark Console')
|
||||
->setName($pref_dark_console)
|
||||
->setValue($pref_dark_console_value ?
|
||||
$pref_dark_console_value : 0)
|
||||
->addButton(1, 'Enabled',
|
||||
'Enabling and using the built-in debugging console.')
|
||||
->addButton(0, 'Disabled', null))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Save Preferences'));
|
||||
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Display Preferences');
|
||||
$panel->appendChild($form);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
final class PhabricatorUserPreferences extends PhabricatorUserDAO {
|
||||
|
||||
const PREFERENCE_MONOSPACED = 'monospaced';
|
||||
const PREFERENCE_DARK_CONSOLE = 'dark_console';
|
||||
const PREFERENCE_EDITOR = 'editor';
|
||||
const PREFERENCE_MULTIEDIT = 'multiedit';
|
||||
const PREFERENCE_TITLES = 'titles';
|
||||
|
|
|
@ -370,27 +370,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
|
|||
|
||||
$foot_links = array();
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('darkconsole.enabled') &&
|
||||
!PhabricatorEnv::getEnvConfig('darkconsole.always-on')) {
|
||||
if ($console) {
|
||||
$link = javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/~/',
|
||||
'sigil' => 'workflow',
|
||||
),
|
||||
'Disable DarkConsole');
|
||||
} else {
|
||||
$link = javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/~/',
|
||||
'sigil' => 'workflow',
|
||||
),
|
||||
'Enable DarkConsole');
|
||||
}
|
||||
$foot_links[] = $link;
|
||||
}
|
||||
|
||||
$foot_links = implode(' · ', $foot_links);
|
||||
|
||||
|
|
Loading…
Reference in a new issue