mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 17:02:41 +01:00
bb4cf7d6b3
Summary: We currently have only an "Add reviewers" action, add "Add CCs". This can also be accomplished less-discoverably with mentions. Test Plan: Added reviewers and CCs to revisions. Toggled display between reviewers and CCs. Reviewed By: jungejason Reviewers: tomo, mroch, jsp, jungejason, aran, tuomaspelkonen CC: aran, jungejason Differential Revision: 521
51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-differential-add-reviewers-and-ccs
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-tokenizer
|
|
* javelin-typeahead
|
|
* javelin-typeahead-preloaded-source
|
|
*/
|
|
|
|
JX.behavior('differential-add-reviewers-and-ccs', function(config) {
|
|
|
|
function buildTokenizer(props) {
|
|
var root = JX.$(props.tokenizer);
|
|
var datasource = new JX.TypeaheadPreloadedSource(props.src);
|
|
|
|
var typeahead = new JX.Typeahead(root);
|
|
typeahead.setDatasource(datasource);
|
|
|
|
var tokenizer = new JX.Tokenizer(root);
|
|
tokenizer.setTypeahead(typeahead);
|
|
tokenizer.start();
|
|
|
|
return tokenizer;
|
|
}
|
|
|
|
var dynamic = {};
|
|
for (var k in config.dynamic) {
|
|
props = config.dynamic[k];
|
|
dynamic[k] = {
|
|
row : JX.$(props.row),
|
|
tokenizer : buildTokenizer(props)
|
|
};
|
|
}
|
|
|
|
JX.DOM.listen(
|
|
JX.$(config.select),
|
|
'change',
|
|
null,
|
|
function(e) {
|
|
var v = JX.$(config.select).value;
|
|
for (var k in dynamic) {
|
|
if (v == k) {
|
|
JX.DOM.show(dynamic[k].row);
|
|
dynamic[k].tokenizer.refresh();
|
|
} else {
|
|
JX.DOM.hide(dynamic[k].row);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|