mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
2497e5b5ed
Summary: A copy of the Releeph release tool. Test Plan: Generally, click everything at least once. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin, AnhNhan Maniphest Tasks: T2094 Differential Revision: https://secure.phabricator.com/D4932
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
/**
|
|
* @provides javelin-behavior-releeph-preview-branch
|
|
* @requires javelin-behavior
|
|
* javelin-dom
|
|
* javelin-stratcom
|
|
* javelin-uri
|
|
* javelin-util
|
|
*/
|
|
|
|
JX.behavior('releeph-preview-branch', function(config) {
|
|
|
|
var uri = JX.$U(config.uri);
|
|
for (param_name in config.params.static) {
|
|
var value = config.params.static[param_name];
|
|
uri.setQueryParam(param_name, value);
|
|
}
|
|
|
|
var output = JX.$(config.outputID);
|
|
|
|
var dynamics = config.params.dynamic;
|
|
|
|
function renderPreview() {
|
|
for (param_name in dynamics) {
|
|
var node_id = dynamics[param_name];
|
|
var input = JX.$(node_id);
|
|
uri.setQueryParam(param_name, input.value);
|
|
}
|
|
var request = new JX.Request(uri, function(response) {
|
|
JX.DOM.setContent(output, JX.$H(response.markup));
|
|
});
|
|
request.send();
|
|
}
|
|
|
|
renderPreview();
|
|
|
|
for (ii in dynamics) {
|
|
var node_id = dynamics[ii];
|
|
var input = JX.$(node_id);
|
|
JX.DOM.listen(
|
|
input,
|
|
['keyup', 'click', 'change'],
|
|
null,
|
|
function(e) {
|
|
renderPreview();
|
|
}
|
|
);
|
|
}
|
|
|
|
});
|