Restore bulk edit support for remarkup fields (description, add comment)

Summary:
Depends on D18866. Ref T13025. Fixes T12415. This makes the old "Add Comment" action work, and adds support for a new "Set description to" action (possibly, I could imagine "append description" being useful some day, maybe).

The implementation is just a `<textarea />`, not a whole fancy remarkup box with `[Bold] [Italic] ...` buttons, preview, typeaheads, etc. It would be nice to enrich this eventually but doing the rendering in pure JS is currently very involved.

This requires a little bit of gymnastics to get the transaction populated properly, and adds some extra validation since we need some code there anyway.

Test Plan:
  - Changed the description of a task via bulk editor.
  - Added a comment to a task via bulk editor.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025, T12415

Differential Revision: https://secure.phabricator.com/D18867
This commit is contained in:
epriestley
2018-01-11 09:48:33 -08:00
parent bf1ac701c3
commit 687fada5af
12 changed files with 132 additions and 11 deletions

View File

@@ -57,6 +57,9 @@ JX.install('PHUIXFormControl', {
case 'text':
input = this._newText(spec);
break;
case 'remarkup':
input = this._newRemarkup(spec);
break;
default:
// TODO: Default or better error?
JX.$E('Bad Input Type');
@@ -312,6 +315,28 @@ JX.install('PHUIXFormControl', {
};
},
_newRemarkup: function(spec) {
var attrs = {};
// We could imagine a world where this renders a full remarkup control
// with all the hint buttons and client behaviors, but today much of that
// behavior is defined server-side and thus this isn't a world we
// currently live in.
var node = JX.$N('textarea', attrs);
node.value = spec.value || '';
return {
node: node,
get: function() {
return node.value;
},
set: function(value) {
node.value = value;
}
};
},
_newOptgroups: function(spec) {
var value = spec.value || null;