Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/differential/ChangesetViewManager.js
Show All 16 Lines | construct : function(node) { | ||||
this._node = node; | this._node = node; | ||||
var data = this._getNodeData(); | var data = this._getNodeData(); | ||||
this._renderURI = data.renderURI; | this._renderURI = data.renderURI; | ||||
this._ref = data.ref; | this._ref = data.ref; | ||||
this._whitespace = data.whitespace; | this._whitespace = data.whitespace; | ||||
this._renderer = data.renderer; | this._renderer = data.renderer; | ||||
this._highlight = data.highlight; | this._highlight = data.highlight; | ||||
this._encoding = data.encoding; | |||||
}, | }, | ||||
members: { | members: { | ||||
_node: null, | _node: null, | ||||
_loaded: false, | _loaded: false, | ||||
_sequence: 0, | _sequence: 0, | ||||
_stabilize: false, | _stabilize: false, | ||||
_renderURI: null, | _renderURI: null, | ||||
_ref: null, | _ref: null, | ||||
_whitespace: null, | _whitespace: null, | ||||
_renderer: null, | _renderer: null, | ||||
_highlight: null, | _highlight: null, | ||||
_encoding: null, | |||||
/** | /** | ||||
* Has the content of this changeset been loaded? | * Has the content of this changeset been loaded? | ||||
* | * | ||||
* This method returns `true` if a request has been fired, even if the | * This method returns `true` if a request has been fired, even if the | ||||
* response has not returned yet. | * response has not returned yet. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | members: { | ||||
reload: function() { | reload: function() { | ||||
this._loaded = true; | this._loaded = true; | ||||
this._sequence++; | this._sequence++; | ||||
var data = this._getNodeData(); | var data = this._getNodeData(); | ||||
var params = { | var params = { | ||||
ref: this._ref, | ref: this._ref, | ||||
whitespace: this._whitespace, | whitespace: this._whitespace || '', | ||||
renderer: this._getRenderer() | renderer: this.getRenderer() || '', | ||||
highlight: this._highlight || '', | |||||
encoding: this._encoding || '' | |||||
}; | }; | ||||
var workflow = new JX.Workflow(this._renderURI, params) | var workflow = new JX.Workflow(this._renderURI, params) | ||||
.setHandler(JX.bind(this, this._onresponse, this._sequence)); | .setHandler(JX.bind(this, this._onresponse, this._sequence)); | ||||
var routable = workflow.getRoutable(); | var routable = workflow.getRoutable(); | ||||
routable | routable | ||||
Show All 22 Lines | members: { | ||||
* with this method. Note that there may not be a current routable. | * with this method. Note that there may not be a current routable. | ||||
* | * | ||||
* @return JX.Routable|null Active routable, if one exists. | * @return JX.Routable|null Active routable, if one exists. | ||||
*/ | */ | ||||
getRoutable: function() { | getRoutable: function() { | ||||
return JX.Router.getInstance().getRoutableByKey(this._getRoutableKey()); | return JX.Router.getInstance().getRoutableByKey(this._getRoutableKey()); | ||||
}, | }, | ||||
setRenderer: function(renderer) { | |||||
this._renderer = renderer; | |||||
return this; | |||||
}, | |||||
getRenderer: function() { | |||||
if (this._renderer !== null) { | |||||
return this._renderer; | |||||
} | |||||
_getRenderer: function() { | |||||
// TODO: This is a big pile of TODOs. | // TODO: This is a big pile of TODOs. | ||||
// NOTE: If you load the page at one device resolution and then resize to | // NOTE: If you load the page at one device resolution and then resize to | ||||
// a different one we don't re-render the diffs, because it's a | // a different one we don't re-render the diffs, because it's a | ||||
// complicated mess and you could lose inline comments, cursor positions, | // complicated mess and you could lose inline comments, cursor positions, | ||||
// etc. | // etc. | ||||
var renderer = (JX.Device.getDevice() == 'desktop') ? '2up' : '1up'; | var renderer = (JX.Device.getDevice() == 'desktop') ? '2up' : '1up'; | ||||
// TODO: Once 1up works better, figure out when to show it. | // TODO: Once 1up works better, figure out when to show it. | ||||
renderer = '2up'; | renderer = '2up'; | ||||
return renderer; | return renderer; | ||||
}, | }, | ||||
setEncoding: function(encoding) { | |||||
this._encoding = encoding; | |||||
return this; | |||||
}, | |||||
getEncoding: function() { | |||||
return this._encoding; | |||||
}, | |||||
setHighlight: function(highlight) { | |||||
this._highlight = highlight; | |||||
return this; | |||||
}, | |||||
getHighlight: function() { | |||||
return this._highlight; | |||||
}, | |||||
_getNodeData: function() { | _getNodeData: function() { | ||||
return JX.Stratcom.getData(this._node); | return JX.Stratcom.getData(this._node); | ||||
}, | }, | ||||
_onresponse: function(sequence, response) { | _onresponse: function(sequence, response) { | ||||
if (sequence != this._sequence) { | if (sequence != this._sequence) { | ||||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |