Placed Radio buttons for Home Page Preferences Settings
Summary: Replaced AphrontFormSelectControl in PhabricatorSettingsPanelHomePreferences with AphrontFormRadioButtonControl :). Test Plan: By checking out Home page prefreces setting and playing around the values to see if it works ! Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin, chad, demo, AnhNhan Maniphest Tasks: T2340 Differential Revision: https://secure.phabricator.com/D5414
This commit is contained in:
committed by
epriestley
parent
c621da8e97
commit
a78b02e193
@@ -3271,6 +3271,15 @@ celerity_register_resource_map(array(
|
|||||||
),
|
),
|
||||||
'disk' => '/rsrc/css/application/search/search-results.css',
|
'disk' => '/rsrc/css/application/search/search-results.css',
|
||||||
),
|
),
|
||||||
|
'phabricator-settings-css' =>
|
||||||
|
array(
|
||||||
|
'uri' => '/res/fb9d017f/rsrc/css/application/settings/settings.css',
|
||||||
|
'type' => 'css',
|
||||||
|
'requires' =>
|
||||||
|
array(
|
||||||
|
),
|
||||||
|
'disk' => '/rsrc/css/application/settings/settings.css',
|
||||||
|
),
|
||||||
'phabricator-shaped-request' =>
|
'phabricator-shaped-request' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/fbdb92db/rsrc/js/application/core/ShapedRequest.js',
|
'uri' => '/res/fbdb92db/rsrc/js/application/core/ShapedRequest.js',
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ final class PhabricatorSettingsPanelHomePreferences
|
|||||||
$user = $request->getUser();
|
$user = $request->getUser();
|
||||||
$preferences = $user->loadPreferences();
|
$preferences = $user->loadPreferences();
|
||||||
|
|
||||||
|
require_celerity_resource('phabricator-settings-css');
|
||||||
|
|
||||||
$apps = PhabricatorApplication::getAllInstalledApplications();
|
$apps = PhabricatorApplication::getAllInstalledApplications();
|
||||||
$pref_tiles = PhabricatorUserPreferences::PREFERENCE_APP_TILES;
|
$pref_tiles = PhabricatorUserPreferences::PREFERENCE_APP_TILES;
|
||||||
$tiles = $preferences->getPreference($pref_tiles, array());
|
$tiles = $preferences->getPreference($pref_tiles, array());
|
||||||
@@ -53,7 +55,22 @@ final class PhabricatorSettingsPanelHomePreferences
|
|||||||
->setFlexible(true)
|
->setFlexible(true)
|
||||||
->setUser($user);
|
->setUser($user);
|
||||||
|
|
||||||
$apps = msort($apps, 'getName');
|
$group_map = PhabricatorApplication::getApplicationGroups();
|
||||||
|
|
||||||
|
$output = array();
|
||||||
|
|
||||||
|
$applications = PhabricatorApplication::getAllInstalledApplications();
|
||||||
|
|
||||||
|
$applications = mgroup($applications, 'getApplicationGroup');
|
||||||
|
|
||||||
|
$applications = array_select_keys(
|
||||||
|
$applications,
|
||||||
|
array_keys($group_map));
|
||||||
|
|
||||||
|
foreach ($applications as $group => $apps) {
|
||||||
|
$group_name = $group_map[$group];
|
||||||
|
$rows = array();
|
||||||
|
|
||||||
foreach ($apps as $app) {
|
foreach ($apps as $app) {
|
||||||
if (!$app->shouldAppearInLaunchView()) {
|
if (!$app->shouldAppearInLaunchView()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -64,6 +81,8 @@ final class PhabricatorSettingsPanelHomePreferences
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$default_name = PhabricatorApplication::getTileDisplayName($default);
|
$default_name = PhabricatorApplication::getTileDisplayName($default);
|
||||||
|
|
||||||
$hide = PhabricatorApplication::TILE_HIDE;
|
$hide = PhabricatorApplication::TILE_HIDE;
|
||||||
@@ -71,22 +90,108 @@ final class PhabricatorSettingsPanelHomePreferences
|
|||||||
$full = PhabricatorApplication::TILE_FULL;
|
$full = PhabricatorApplication::TILE_FULL;
|
||||||
|
|
||||||
$key = get_class($app);
|
$key = get_class($app);
|
||||||
// Won't pht() for dynamic string (Applcation Name)
|
|
||||||
$form->appendChild(
|
$default_radio_button_status =
|
||||||
id(new AphrontFormSelectControl())
|
(idx($tiles, $key, 'default') == 'default') ? 'checked' : null;
|
||||||
->setLabel($app->getName())
|
|
||||||
->setName('tile['.$key.']')
|
$hide_radio_button_status =
|
||||||
->setOptions(
|
(idx($tiles, $key, 'default') == $hide) ? 'checked' : null;
|
||||||
|
|
||||||
|
$show_radio_button_status =
|
||||||
|
(idx($tiles, $key, 'default') == $show) ? 'checked' : null;
|
||||||
|
|
||||||
|
$full_radio_button_status =
|
||||||
|
(idx($tiles, $key, 'default') == $full) ? 'checked' : null;
|
||||||
|
|
||||||
|
|
||||||
|
$default_radio_button = phutil_tag(
|
||||||
|
'input',
|
||||||
array(
|
array(
|
||||||
$hide => PhabricatorApplication::getTileDisplayName($hide),
|
'type' => 'radio',
|
||||||
'default' => pht('Use Default (%s)', $default_name),
|
'name' => 'tile['.$key.']',
|
||||||
$show => PhabricatorApplication::getTileDisplayName($show),
|
'value' => 'default',
|
||||||
$full => PhabricatorApplication::getTileDisplayName($full),
|
'checked' => $default_radio_button_status,
|
||||||
|
));
|
||||||
|
|
||||||
|
$hide_radio_button = phutil_tag(
|
||||||
|
'input',
|
||||||
|
array(
|
||||||
|
'type' => 'radio',
|
||||||
|
'name' => 'tile['.$key.']',
|
||||||
|
'value' => $hide,
|
||||||
|
'checked' => $hide_radio_button_status,
|
||||||
|
));
|
||||||
|
|
||||||
|
$show_radio_button = phutil_tag(
|
||||||
|
'input',
|
||||||
|
array(
|
||||||
|
'type' => 'radio',
|
||||||
|
'name' => 'tile['.$key.']',
|
||||||
|
'value' => $show,
|
||||||
|
'checked' => $show_radio_button_status,
|
||||||
|
));
|
||||||
|
|
||||||
|
$full_radio_button = phutil_tag(
|
||||||
|
'input',
|
||||||
|
array(
|
||||||
|
'type' => 'radio',
|
||||||
|
'name' => 'tile['.$key.']',
|
||||||
|
'value' => $full,
|
||||||
|
'checked' => $full_radio_button_status,
|
||||||
|
));
|
||||||
|
|
||||||
|
$app_column = hsprintf(
|
||||||
|
"<strong>%s</strong><br /><em> Default: %s</em>"
|
||||||
|
, $app->getName(), $default_name);
|
||||||
|
|
||||||
|
$rows[] = array(
|
||||||
|
$app_column,
|
||||||
|
$default_radio_button,
|
||||||
|
$hide_radio_button,
|
||||||
|
$show_radio_button,
|
||||||
|
$full_radio_button,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($rows)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = new AphrontTableView($rows);
|
||||||
|
|
||||||
|
$table
|
||||||
|
->setClassName('phabricator-settings-homepagetable')
|
||||||
|
->setHeaders(
|
||||||
|
array(
|
||||||
|
pht('Applications'),
|
||||||
|
pht('Default'),
|
||||||
|
pht('Hidden'),
|
||||||
|
pht('Small'),
|
||||||
|
pht('Large'),
|
||||||
))
|
))
|
||||||
->setValue(idx($tiles, $key, 'default')));
|
->setColumnClasses(
|
||||||
|
array(
|
||||||
|
'',
|
||||||
|
'fixed',
|
||||||
|
'fixed',
|
||||||
|
'fixed',
|
||||||
|
'fixed',
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
$panel = id(new AphrontPanelView())
|
||||||
|
->setHeader($group_name)
|
||||||
|
->addClass('phabricator-settings-panelview')
|
||||||
|
->appendChild($table)
|
||||||
|
->setNoBackground();
|
||||||
|
|
||||||
|
|
||||||
|
$output[] = $panel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$form
|
$form
|
||||||
|
->appendChild($output)
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->setValue(pht('Save Preferences')));
|
->setValue(pht('Save Preferences')));
|
||||||
|
|||||||
20
webroot/rsrc/css/application/settings/settings.css
Normal file
20
webroot/rsrc/css/application/settings/settings.css
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* @provides phabricator-settings-css
|
||||||
|
*/
|
||||||
|
|
||||||
|
.phabricator-settings-homepagetable {
|
||||||
|
width: 60% !important;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phabricator-settings-homepagetable td.fixed {
|
||||||
|
width: 24px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.phabricator-settings-panelview h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user