1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Highlight the currently selected policy in the policy dropdown control thing

Summary: Ref T603. Make this a little easier to use by highlighting the current value.

Test Plan: See screenshot.

Reviewers: chad, btrahan

Reviewed By: chad

CC: chad, aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D7289
This commit is contained in:
epriestley 2013-10-12 17:08:35 -07:00
parent 5af031ec9b
commit 130a15b51b
5 changed files with 111 additions and 94 deletions

View file

@ -2267,7 +2267,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-policy-control' =>
array(
'uri' => '/res/afc2c3fc/rsrc/js/application/policy/behavior-policy-control.js',
'uri' => '/res/f43ba427/rsrc/js/application/policy/behavior-policy-control.js',
'type' => 'js',
'requires' =>
array(
@ -3285,7 +3285,7 @@ celerity_register_resource_map(array(
),
'phabricator-menu-item' =>
array(
'uri' => '/res/2add4594/rsrc/js/core/DropdownMenuItem.js',
'uri' => '/res/345d4168/rsrc/js/core/DropdownMenuItem.js',
'type' => 'js',
'requires' =>
array(
@ -3756,7 +3756,7 @@ celerity_register_resource_map(array(
),
'phui-button-css' =>
array(
'uri' => '/res/c18af87b/rsrc/css/phui/phui-button.css',
'uri' => '/res/3be4ec80/rsrc/css/phui/phui-button.css',
'type' => 'css',
'requires' =>
array(
@ -4234,7 +4234,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'a4d97d37' =>
'1f32154b' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -4283,10 +4283,10 @@ celerity_register_resource_map(array(
41 => 'phabricator-tag-view-css',
42 => 'phui-list-view-css',
),
'uri' => '/res/pkg/a4d97d37/core.pkg.css',
'uri' => '/res/pkg/1f32154b/core.pkg.css',
'type' => 'css',
),
'4e506e2b' =>
'8fafb027' =>
array(
'name' => 'core.pkg.js',
'symbols' =>
@ -4331,7 +4331,7 @@ celerity_register_resource_map(array(
37 => 'javelin-color',
38 => 'javelin-fx',
),
'uri' => '/res/pkg/4e506e2b/core.pkg.js',
'uri' => '/res/pkg/8fafb027/core.pkg.js',
'type' => 'js',
),
'4ccfeb47' =>
@ -4475,15 +4475,15 @@ celerity_register_resource_map(array(
),
'reverse' =>
array(
'aphront-dialog-view-css' => 'a4d97d37',
'aphront-error-view-css' => 'a4d97d37',
'aphront-list-filter-view-css' => 'a4d97d37',
'aphront-pager-view-css' => 'a4d97d37',
'aphront-panel-view-css' => 'a4d97d37',
'aphront-table-view-css' => 'a4d97d37',
'aphront-tokenizer-control-css' => 'a4d97d37',
'aphront-tooltip-css' => 'a4d97d37',
'aphront-typeahead-control-css' => 'a4d97d37',
'aphront-dialog-view-css' => '1f32154b',
'aphront-error-view-css' => '1f32154b',
'aphront-list-filter-view-css' => '1f32154b',
'aphront-pager-view-css' => '1f32154b',
'aphront-panel-view-css' => '1f32154b',
'aphront-table-view-css' => '1f32154b',
'aphront-tokenizer-control-css' => '1f32154b',
'aphront-tooltip-css' => '1f32154b',
'aphront-typeahead-control-css' => '1f32154b',
'differential-changeset-view-css' => '4dc2311c',
'differential-core-view-css' => '4dc2311c',
'differential-inline-comment-editor' => '5e9e5c4e',
@ -4497,18 +4497,18 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => '4dc2311c',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => 'a4d97d37',
'global-drag-and-drop-css' => '1f32154b',
'inline-comment-summary-css' => '4dc2311c',
'javelin-aphlict' => '4e506e2b',
'javelin-aphlict' => '8fafb027',
'javelin-behavior' => '9564fa17',
'javelin-behavior-aphlict-dropdown' => '4e506e2b',
'javelin-behavior-aphlict-listen' => '4e506e2b',
'javelin-behavior-aphront-basic-tokenizer' => '4e506e2b',
'javelin-behavior-aphlict-dropdown' => '8fafb027',
'javelin-behavior-aphlict-listen' => '8fafb027',
'javelin-behavior-aphront-basic-tokenizer' => '8fafb027',
'javelin-behavior-aphront-drag-and-drop-textarea' => '5e9e5c4e',
'javelin-behavior-aphront-form-disable-on-submit' => '4e506e2b',
'javelin-behavior-aphront-form-disable-on-submit' => '8fafb027',
'javelin-behavior-audit-preview' => '96909266',
'javelin-behavior-dark-console' => '4ccfeb47',
'javelin-behavior-device' => '4e506e2b',
'javelin-behavior-device' => '8fafb027',
'javelin-behavior-differential-accept-with-errors' => '5e9e5c4e',
'javelin-behavior-differential-add-reviewers-and-ccs' => '5e9e5c4e',
'javelin-behavior-differential-comment-jump' => '5e9e5c4e',
@ -4524,37 +4524,37 @@ celerity_register_resource_map(array(
'javelin-behavior-diffusion-commit-graph' => '96909266',
'javelin-behavior-diffusion-pull-lastmodified' => '96909266',
'javelin-behavior-error-log' => '4ccfeb47',
'javelin-behavior-global-drag-and-drop' => '4e506e2b',
'javelin-behavior-history-install' => '4e506e2b',
'javelin-behavior-konami' => '4e506e2b',
'javelin-behavior-lightbox-attachments' => '4e506e2b',
'javelin-behavior-global-drag-and-drop' => '8fafb027',
'javelin-behavior-history-install' => '8fafb027',
'javelin-behavior-konami' => '8fafb027',
'javelin-behavior-lightbox-attachments' => '8fafb027',
'javelin-behavior-load-blame' => '5e9e5c4e',
'javelin-behavior-maniphest-batch-selector' => '0a694954',
'javelin-behavior-maniphest-subpriority-editor' => '0a694954',
'javelin-behavior-maniphest-transaction-controls' => '0a694954',
'javelin-behavior-maniphest-transaction-expand' => '0a694954',
'javelin-behavior-maniphest-transaction-preview' => '0a694954',
'javelin-behavior-phabricator-active-nav' => '4e506e2b',
'javelin-behavior-phabricator-autofocus' => '4e506e2b',
'javelin-behavior-phabricator-gesture' => '4e506e2b',
'javelin-behavior-phabricator-hovercards' => '4e506e2b',
'javelin-behavior-phabricator-keyboard-shortcuts' => '4e506e2b',
'javelin-behavior-phabricator-nav' => '4e506e2b',
'javelin-behavior-phabricator-active-nav' => '8fafb027',
'javelin-behavior-phabricator-autofocus' => '8fafb027',
'javelin-behavior-phabricator-gesture' => '8fafb027',
'javelin-behavior-phabricator-hovercards' => '8fafb027',
'javelin-behavior-phabricator-keyboard-shortcuts' => '8fafb027',
'javelin-behavior-phabricator-nav' => '8fafb027',
'javelin-behavior-phabricator-object-selector' => '5e9e5c4e',
'javelin-behavior-phabricator-oncopy' => '4e506e2b',
'javelin-behavior-phabricator-remarkup-assist' => '4e506e2b',
'javelin-behavior-phabricator-reveal-content' => '4e506e2b',
'javelin-behavior-phabricator-search-typeahead' => '4e506e2b',
'javelin-behavior-phabricator-tooltips' => '4e506e2b',
'javelin-behavior-phabricator-watch-anchor' => '4e506e2b',
'javelin-behavior-refresh-csrf' => '4e506e2b',
'javelin-behavior-phabricator-oncopy' => '8fafb027',
'javelin-behavior-phabricator-remarkup-assist' => '8fafb027',
'javelin-behavior-phabricator-reveal-content' => '8fafb027',
'javelin-behavior-phabricator-search-typeahead' => '8fafb027',
'javelin-behavior-phabricator-tooltips' => '8fafb027',
'javelin-behavior-phabricator-watch-anchor' => '8fafb027',
'javelin-behavior-refresh-csrf' => '8fafb027',
'javelin-behavior-repository-crossreference' => '5e9e5c4e',
'javelin-behavior-toggle-class' => '4e506e2b',
'javelin-behavior-workflow' => '4e506e2b',
'javelin-color' => '4e506e2b',
'javelin-behavior-toggle-class' => '8fafb027',
'javelin-behavior-workflow' => '8fafb027',
'javelin-color' => '8fafb027',
'javelin-dom' => '9564fa17',
'javelin-event' => '9564fa17',
'javelin-fx' => '4e506e2b',
'javelin-fx' => '8fafb027',
'javelin-history' => '9564fa17',
'javelin-install' => '9564fa17',
'javelin-json' => '9564fa17',
@ -4572,56 +4572,56 @@ celerity_register_resource_map(array(
'javelin-util' => '9564fa17',
'javelin-vector' => '9564fa17',
'javelin-workflow' => '9564fa17',
'lightbox-attachment-css' => 'a4d97d37',
'lightbox-attachment-css' => '1f32154b',
'maniphest-task-summary-css' => '49898640',
'phabricator-action-list-view-css' => 'a4d97d37',
'phabricator-application-launch-view-css' => 'a4d97d37',
'phabricator-busy' => '4e506e2b',
'phabricator-action-list-view-css' => '1f32154b',
'phabricator-application-launch-view-css' => '1f32154b',
'phabricator-busy' => '8fafb027',
'phabricator-content-source-view-css' => '4dc2311c',
'phabricator-core-css' => 'a4d97d37',
'phabricator-crumbs-view-css' => 'a4d97d37',
'phabricator-core-css' => '1f32154b',
'phabricator-crumbs-view-css' => '1f32154b',
'phabricator-drag-and-drop-file-upload' => '5e9e5c4e',
'phabricator-dropdown-menu' => '4e506e2b',
'phabricator-file-upload' => '4e506e2b',
'phabricator-filetree-view-css' => 'a4d97d37',
'phabricator-flag-css' => 'a4d97d37',
'phabricator-hovercard' => '4e506e2b',
'phabricator-jump-nav' => 'a4d97d37',
'phabricator-keyboard-shortcut' => '4e506e2b',
'phabricator-keyboard-shortcut-manager' => '4e506e2b',
'phabricator-main-menu-view' => 'a4d97d37',
'phabricator-menu-item' => '4e506e2b',
'phabricator-nav-view-css' => 'a4d97d37',
'phabricator-notification' => '4e506e2b',
'phabricator-notification-css' => 'a4d97d37',
'phabricator-notification-menu-css' => 'a4d97d37',
'phabricator-dropdown-menu' => '8fafb027',
'phabricator-file-upload' => '8fafb027',
'phabricator-filetree-view-css' => '1f32154b',
'phabricator-flag-css' => '1f32154b',
'phabricator-hovercard' => '8fafb027',
'phabricator-jump-nav' => '1f32154b',
'phabricator-keyboard-shortcut' => '8fafb027',
'phabricator-keyboard-shortcut-manager' => '8fafb027',
'phabricator-main-menu-view' => '1f32154b',
'phabricator-menu-item' => '8fafb027',
'phabricator-nav-view-css' => '1f32154b',
'phabricator-notification' => '8fafb027',
'phabricator-notification-css' => '1f32154b',
'phabricator-notification-menu-css' => '1f32154b',
'phabricator-object-selector-css' => '4dc2311c',
'phabricator-phtize' => '4e506e2b',
'phabricator-prefab' => '4e506e2b',
'phabricator-phtize' => '8fafb027',
'phabricator-prefab' => '8fafb027',
'phabricator-project-tag-css' => '49898640',
'phabricator-remarkup-css' => 'a4d97d37',
'phabricator-remarkup-css' => '1f32154b',
'phabricator-shaped-request' => '5e9e5c4e',
'phabricator-side-menu-view-css' => 'a4d97d37',
'phabricator-standard-page-view' => 'a4d97d37',
'phabricator-tag-view-css' => 'a4d97d37',
'phabricator-textareautils' => '4e506e2b',
'phabricator-tooltip' => '4e506e2b',
'phabricator-transaction-view-css' => 'a4d97d37',
'phabricator-zindex-css' => 'a4d97d37',
'phui-button-css' => 'a4d97d37',
'phui-form-css' => 'a4d97d37',
'phui-form-view-css' => 'a4d97d37',
'phui-header-view-css' => 'a4d97d37',
'phui-icon-view-css' => 'a4d97d37',
'phui-list-view-css' => 'a4d97d37',
'phui-object-item-list-view-css' => 'a4d97d37',
'phui-property-list-view-css' => 'a4d97d37',
'phui-spacing-css' => 'a4d97d37',
'sprite-apps-large-css' => 'a4d97d37',
'sprite-gradient-css' => 'a4d97d37',
'sprite-icons-css' => 'a4d97d37',
'sprite-menu-css' => 'a4d97d37',
'sprite-status-css' => 'a4d97d37',
'syntax-highlighting-css' => 'a4d97d37',
'phabricator-side-menu-view-css' => '1f32154b',
'phabricator-standard-page-view' => '1f32154b',
'phabricator-tag-view-css' => '1f32154b',
'phabricator-textareautils' => '8fafb027',
'phabricator-tooltip' => '8fafb027',
'phabricator-transaction-view-css' => '1f32154b',
'phabricator-zindex-css' => '1f32154b',
'phui-button-css' => '1f32154b',
'phui-form-css' => '1f32154b',
'phui-form-view-css' => '1f32154b',
'phui-header-view-css' => '1f32154b',
'phui-icon-view-css' => '1f32154b',
'phui-list-view-css' => '1f32154b',
'phui-object-item-list-view-css' => '1f32154b',
'phui-property-list-view-css' => '1f32154b',
'phui-spacing-css' => '1f32154b',
'sprite-apps-large-css' => '1f32154b',
'sprite-gradient-css' => '1f32154b',
'sprite-icons-css' => '1f32154b',
'sprite-menu-css' => '1f32154b',
'sprite-status-css' => '1f32154b',
'syntax-highlighting-css' => '1f32154b',
),
));

View file

@ -120,6 +120,7 @@ final class AphrontFormPolicyControl extends AphrontFormControl {
'order' => $order,
'icons' => $icons,
'labels' => $labels,
'value' => $this->getValue(),
));
$selected = $flat_options[$this->getValue()];

View file

@ -192,6 +192,10 @@ a.policy-control span.phui-icon-view {
left: 7px;
}
.dropdown-menu-frame .phabricator-menu-item-selected {
background: {$lightblue};
}
.dropdown-menu-frame a:hover {
background: #005588;
background-image: linear-gradient(to bottom, #3b86c4, #2b628f);

View file

@ -10,6 +10,7 @@
JX.behavior('policy-control', function(config) {
var control = JX.$(config.controlID);
var input = JX.$(config.inputID);
var value = config.value;
var menu = new JX.PhabricatorDropdownMenu(control)
.setWidth(260);
@ -39,8 +40,13 @@ JX.behavior('policy-control', function(config) {
JX.DOM.find(control, 'span', 'policy-label'),
render);
input.value = phid;
value = phid;
}, phid, render));
if (phid == value) {
item.setSelected(true);
}
menu.addItem(item);
}
}

View file

@ -17,10 +17,15 @@ JX.install('PhabricatorMenuItem', {
_action : null,
render : function() {
var attrs = {
href: this.getHref(),
meta: { item: this },
className: this.getSelected() ? 'phabricator-menu-item-selected' : null
};
if (this.getDisabled()) {
return JX.$N('span', this.getName());
return JX.$N('span', attrs, this.getName());
} else {
var attrs = { href : this.getHref(), meta : { item : this } };
return JX.$N('a', attrs, this.getName());
}
},
@ -31,9 +36,10 @@ JX.install('PhabricatorMenuItem', {
},
properties : {
name : '',
href : '',
disabled : false
name: '',
href: '',
disabled: false,
selected: false
}
});