1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-29 00:40:57 +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], var diff = e.getData().diff[0],
data = JX.Stratcom.getData(diff), data = JX.Stratcom.getData(diff);
undo;
if (data.hidden) { if (data.hidden) {
data.hidden = false; data.hidden = false;
JX.DOM.show(diff); JX.DOM.show(diff);
undo = JX.DOM.find(diff.parentNode, JX.DOM.remove(data.undo);
'div', data.undo = null;
'differential-collapse-undo-div');
JX.DOM.remove(undo);
} else { } else {
data.hidden = true; data.hidden = true;
data.undo = render_collapse_undo();
JX.DOM.hide(diff); JX.DOM.hide(diff);
undo = render_collapse_undo(); JX.DOM.listen(
JX.DOM.listen(undo, 'click', 'differential-collapse-undo', function(e) { data.undo,
e.kill(); 'click',
data.hidden = false; 'differential-collapse-undo',
JX.DOM.show(diff); function(e) {
JX.DOM.remove(undo); e.kill();
}); data.hidden = false;
JX.DOM.appendContent(diff.parentNode, undo); 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'); JX.Stratcom.invoke('differential-toggle-file-toggled');
}); });