phorge/webroot/rsrc/js/application/differential/behavior-accept-with-errors.js
tuomaspelkonen 501c001520 Added a big warning if reviewer is about to accept a diff with lint or unit
errors.

Summary:
Make sure reviewers know what they are doing.

Test Plan:
Tested with different diffs that had lint and unit problems.

Reviewed By: epriestley
Reviewers: epriestley, jungejason
CC: grglr, aran, epriestley, tuomaspelkonen
Differential Revision: 432
2011-06-13 11:49:31 -07:00

29 lines
655 B
JavaScript

/**
* @provides javelin-behavior-differential-accept-with-errors
* @requires javelin-behavior
* javelin-dom
*/
JX.behavior('differential-accept-with-errors', function(config) {
function toggleWarning(control) {
if (control) {
JX.DOM.hide(JX.$(control));
JX.DOM.listen(
JX.$(config.select),
'change',
null,
function(e) {
if (JX.$(config.select).value == 'accept') {
JX.DOM.show(JX.$(control));
} else {
JX.DOM.hide(JX.$(control));
}
});
}
}
toggleWarning(config.unit_warning);
toggleWarning(config.lint_warning);
});