2014-05-13 23:08:21 +02:00
|
|
|
/**
|
|
|
|
* @provides javelin-behavior-diffusion-locate-file
|
|
|
|
* @requires javelin-behavior
|
|
|
|
* javelin-diffusion-locate-file-source
|
|
|
|
* javelin-dom
|
|
|
|
* javelin-typeahead
|
|
|
|
* javelin-uri
|
|
|
|
*/
|
|
|
|
|
|
|
|
JX.behavior('diffusion-locate-file', function(config) {
|
|
|
|
var control = JX.$(config.controlID);
|
|
|
|
var input = JX.$(config.inputID);
|
|
|
|
|
|
|
|
var datasource = new JX.DiffusionLocateFileSource(config.uri);
|
|
|
|
|
|
|
|
var typeahead = new JX.Typeahead(control, input);
|
|
|
|
typeahead.setDatasource(datasource);
|
|
|
|
|
|
|
|
typeahead.listen('choose', function(r) {
|
2024-01-19 11:04:54 +01:00
|
|
|
var browseURI = config.browseBaseURI + r.ref;
|
|
|
|
if (config.symbolicCommit) {
|
|
|
|
browseURI += ';' + config.symbolicCommit;
|
|
|
|
}
|
|
|
|
JX.$U(browseURI).go();
|
2014-05-13 23:08:21 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
var started = false;
|
|
|
|
JX.DOM.listen(input, 'click', null, function() {
|
|
|
|
if (!started) {
|
|
|
|
started = true;
|
|
|
|
typeahead.start();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|