1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-08 22:01:03 +01:00

Allow disabling editing multiple files at once

Summary: Resolves T2095.

Test Plan:
Saved it, button disappeared.
Saved it back, button appeared.

Reviewers: epriestley, aran

Reviewed By: epriestley

CC: Korvin

Maniphest Tasks: T2095

Differential Revision: https://secure.phabricator.com/D4071
This commit is contained in:
vrana 2012-12-03 15:51:18 -08:00
parent 3645dc2dd9
commit bff795d848
4 changed files with 28 additions and 1 deletions

View file

@ -181,7 +181,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$editor_link = null;
if ($paths && $this->user) {
$editor_link = $this->user->loadEditorLink(
implode(' ', $paths),
$paths,
1, // line number
$this->repository->getCallsign());
if ($editor_link) {

View file

@ -450,6 +450,19 @@ final class PhabricatorUser extends PhabricatorUserDAO implements PhutilPerson {
public function loadEditorLink($path, $line, $callsign) {
$editor = $this->loadPreferences()->getPreference(
PhabricatorUserPreferences::PREFERENCE_EDITOR);
if (is_array($path)) {
$multiedit = $this->loadPreferences()->getPreference(
PhabricatorUserPreferences::PREFERENCE_MULTIEDIT);
switch ($multiedit) {
case '':
$path = implode(' ', $path);
break;
case 'disable':
return null;
}
}
if ($editor) {
return strtr($editor, array(
'%%' => '%',

View file

@ -21,6 +21,7 @@ final class PhabricatorSettingsPanelDisplayPreferences
$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_textareas =
@ -34,6 +35,9 @@ final class PhabricatorSettingsPanelDisplayPreferences
$preferences->setPreference($pref_titles, $request->getStr($pref_titles));
$preferences->setPreference($pref_editor, $request->getStr($pref_editor));
$preferences->setPreference(
$pref_multiedit,
$request->getStr($pref_multiedit));
$preferences->setPreference(
$pref_symbols,
$request->getStr($pref_symbols));
@ -96,6 +100,15 @@ EXAMPLE;
'callsign, %% by literal %. '.
"For documentation, see {$editor_doc_link}.")
->setValue($preferences->getPreference($pref_editor)))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Edit Multiple Files')
->setName($pref_multiedit)
->setOptions(array(
'' => 'Supported (paths separated by spaces)',
'disable' => 'Not Supported',
))
->setValue($preferences->getPreference($pref_multiedit)))
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Monospaced Font')

View file

@ -4,6 +4,7 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
const PREFERENCE_MONOSPACED = 'monospaced';
const PREFERENCE_EDITOR = 'editor';
const PREFERENCE_MULTIEDIT = 'multiedit';
const PREFERENCE_TITLES = 'titles';
const PREFERENCE_MONOSPACED_TEXTAREAS = 'monospaced-textareas';