1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 16:30:59 +01:00

Better JS for Differential File Collapsing Undo

Summary: take epriestley's feedback 'cuz its good

Test Plan: collapse, expand, use undo like a rockstar. observe proper behavior

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Maniphest Tasks: T2258

Differential Revision: https://secure.phabricator.com/D6748
This commit is contained in:
Bob Trahan 2013-08-13 16:14:26 -07:00
parent d8a1e7e15f
commit 3f9a4d42f7

View file

@ -18,26 +18,28 @@ JX.behavior('differential-toggle-files', function(config) {
}
var diff = e.getData().diff[0],
data = JX.Stratcom.getData(diff),
undo;
data = JX.Stratcom.getData(diff);
if (data.hidden) {
data.hidden = false;
JX.DOM.show(diff);
undo = JX.DOM.find(diff.parentNode,
'div',
'differential-collapse-undo-div');
JX.DOM.remove(undo);
JX.DOM.remove(data.undo);
data.undo = null;
} else {
data.hidden = true;
data.undo = render_collapse_undo();
JX.DOM.hide(diff);
undo = render_collapse_undo();
JX.DOM.listen(undo, 'click', 'differential-collapse-undo', function(e) {
e.kill();
data.hidden = false;
JX.DOM.show(diff);
JX.DOM.remove(undo);
});
JX.DOM.appendContent(diff.parentNode, undo);
JX.DOM.listen(
data.undo,
'click',
'differential-collapse-undo',
function(e) {
e.kill();
data.hidden = false;
JX.DOM.show(diff);
JX.DOM.remove(data.undo);
data.undo = null;
});
JX.DOM.appendContent(diff.parentNode, data.undo);
}
JX.Stratcom.invoke('differential-toggle-file-toggled');
});