mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 17:02:41 +01:00
90364cafdc
Summary: Moves shared code from Differential and Maniphest comment previews into PhabricatorShapedRequest, and then implements Maniphest previews. This doesn't implement comment drafts, I'll follow up with that but it requires this and is completely separable. This also always shows the preview as "commented" rather than previewing the actual transaction. I'll follow up with that but I think it will require a little factoring and this is useful even without transaction details. I need to tweak the styling a bit too. Test Plan: Typed text in Maniphest and Differential. Toggled Differential action. Made comments. Reviewed By: rm Reviewers: rm, tuomaspelkonen, jungejason, aran CC: aran, rm Differential Revision: 258
29 lines
683 B
JavaScript
29 lines
683 B
JavaScript
/**
|
|
* @provides javelin-behavior-maniphest-transaction-preview
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-util
|
|
* phabricator-shaped-request
|
|
*/
|
|
|
|
JX.behavior('maniphest-transaction-preview', function(config) {
|
|
|
|
var comments = JX.$(config.comments);
|
|
|
|
var callback = function(r) {
|
|
JX.DOM.setContent(JX.$(config.preview), JX.$H(r));
|
|
};
|
|
|
|
var getdata = function() {
|
|
return {
|
|
comments : comments.value
|
|
};
|
|
}
|
|
|
|
var request = new JX.PhabricatorShapedRequest(config.uri, callback, getdata);
|
|
var trigger = JX.bind(request, request.trigger);
|
|
|
|
JX.DOM.listen(comments, 'keydown', null, trigger);
|
|
|
|
request.start();
|
|
});
|