Skip to content

Commit 972788b

Browse files
author
epriestley
committedDec 30, 2015
Give IconSetControl a meaningful disabled state
Summary: Ref T10004. This control doesn't disable visually or behaviorally, e.g. when locked in an EditEngine configuration. Test Plan: - Locked field for Projects. - Reviewed form in EditEngine. - Created/edited a project. - Swapped default. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10004 Differential Revision: https://secure.phabricator.com/D14911
1 parent 5ea5b0c commit 972788b

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed
 

‎resources/celerity/map.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@
465465
'rsrc/js/core/behavior-active-nav.js' => 'e379b58e',
466466
'rsrc/js/core/behavior-audio-source.js' => '59b251eb',
467467
'rsrc/js/core/behavior-autofocus.js' => '7319e029',
468-
'rsrc/js/core/behavior-choose-control.js' => 'dfaafb14',
468+
'rsrc/js/core/behavior-choose-control.js' => '8fee767e',
469469
'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2',
470470
'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae',
471471
'rsrc/js/core/behavior-device.js' => 'a205cf28',
@@ -571,7 +571,7 @@
571571
'javelin-behavior-audio-source' => '59b251eb',
572572
'javelin-behavior-audit-preview' => 'd835b03a',
573573
'javelin-behavior-bulk-job-reload' => 'edf8a145',
574-
'javelin-behavior-choose-control' => 'dfaafb14',
574+
'javelin-behavior-choose-control' => '8fee767e',
575575
'javelin-behavior-comment-actions' => 'b65559c0',
576576
'javelin-behavior-config-reorder-fields' => 'b6993408',
577577
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
@@ -1517,6 +1517,12 @@
15171517
'javelin-install',
15181518
'javelin-dom',
15191519
),
1520+
'8fee767e' => array(
1521+
'javelin-behavior',
1522+
'javelin-stratcom',
1523+
'javelin-dom',
1524+
'javelin-workflow',
1525+
),
15201526
'9007c197' => array(
15211527
'javelin-behavior',
15221528
'javelin-dom',
@@ -1909,12 +1915,6 @@
19091915
'df5e11d2' => array(
19101916
'javelin-install',
19111917
),
1912-
'dfaafb14' => array(
1913-
'javelin-behavior',
1914-
'javelin-stratcom',
1915-
'javelin-dom',
1916-
'javelin-workflow',
1917-
),
19181918
'e10f8e18' => array(
19191919
'javelin-behavior',
19201920
'javelin-dom',

‎src/applications/project/editor/PhabricatorProjectTransactionEditor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function applyCustomInternalTransaction(
102102
case PhabricatorProjectTransaction::TYPE_NAME:
103103
$name = $xaction->getNewValue();
104104
$object->setName($name);
105-
if ($this->getIsMilestone()) {
105+
if (!$this->getIsMilestone()) {
106106
$object->setPrimarySlug(PhabricatorSlug::normalizeProjectSlug($name));
107107
}
108108
return;

‎src/view/form/control/PHUIFormIconSetControl.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ protected function renderInput() {
2626
$input_id = celerity_generate_unique_node_id();
2727
$display_id = celerity_generate_unique_node_id();
2828

29+
$is_disabled = $this->getDisabled();
30+
31+
$classes = array();
32+
$classes[] = 'button';
33+
$classes[] = 'grey';
34+
35+
if ($is_disabled) {
36+
$classes[] = 'disabled';
37+
}
38+
2939
$button = javelin_tag(
3040
'a',
3141
array(
3242
'href' => '#',
33-
'class' => 'button grey',
43+
'class' => implode(' ', $classes),
3444
'sigil' => 'phui-form-iconset-button',
3545
),
3646
$set->getChooseButtonText());
@@ -79,6 +89,7 @@ protected function renderInput() {
7989
'input',
8090
array(
8191
'type' => 'hidden',
92+
'disabled' => ($is_disabled ? 'disabled' : null),
8293
'name' => $this->getName(),
8394
'value' => $this->getValue(),
8495
'id' => $input_id,

‎webroot/rsrc/js/core/behavior-choose-control.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@ JX.behavior('choose-control', function() {
1515
e.kill();
1616

1717
var data = e.getNodeData('phui-form-iconset');
18+
var input = JX.$(data.inputID);
19+
20+
if (input.disabled) {
21+
return;
22+
}
1823

1924
var params = {
20-
value: JX.$(data.inputID).value
25+
value: input.value
2126
};
2227

2328
new JX.Workflow(data.uri, params)
2429
.setHandler(function(r) {
25-
JX.$(data.inputID).value = r.value;
30+
input.value = r.value;
2631
JX.DOM.setContent(JX.$(data.displayID), JX.$H(r.display));
2732
})
2833
.start();

0 commit comments

Comments
 (0)
Failed to load comments.