Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangeset.js
| Show All 33 Lines | construct : function(node) { | ||||
| this._editorURI = data.editorURI; | this._editorURI = data.editorURI; | ||||
| this._editorConfigureURI = data.editorConfigureURI; | this._editorConfigureURI = data.editorConfigureURI; | ||||
| this._pathIconIcon = data.pathIconIcon; | this._pathIconIcon = data.pathIconIcon; | ||||
| this._pathIconColor = data.pathIconColor; | this._pathIconColor = data.pathIconColor; | ||||
| this._isLowImportance = data.isLowImportance; | this._isLowImportance = data.isLowImportance; | ||||
| this._isOwned = data.isOwned; | this._isOwned = data.isOwned; | ||||
| this._isLoading = true; | |||||
| this._inlines = []; | this._inlines = []; | ||||
| if (data.changesetState) { | if (data.changesetState) { | ||||
| this._loadChangesetState(data.changesetState); | this._loadChangesetState(data.changesetState); | ||||
| } | } | ||||
| }, | }, | ||||
| Show All 26 Lines | members: { | ||||
| _editorURI: null, | _editorURI: null, | ||||
| _editorConfigureURI: null, | _editorConfigureURI: null, | ||||
| _pathView: null, | _pathView: null, | ||||
| _pathIconIcon: null, | _pathIconIcon: null, | ||||
| _pathIconColor: null, | _pathIconColor: null, | ||||
| _isLowImportance: null, | _isLowImportance: null, | ||||
| _isOwned: null, | _isOwned: null, | ||||
| _isHidden: null, | |||||
| getEditorURI: function() { | getEditorURI: function() { | ||||
| return this._editorURI; | return this._editorURI; | ||||
| }, | }, | ||||
| getEditorConfigureURI: function() { | getEditorConfigureURI: function() { | ||||
| return this._editorConfigureURI; | return this._editorConfigureURI; | ||||
| }, | }, | ||||
| ▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | members: { | ||||
| * loading. To load conditionally, use @{method:load}. | * loading. To load conditionally, use @{method:load}. | ||||
| * | * | ||||
| * @return this | * @return this | ||||
| */ | */ | ||||
| reload: function(state) { | reload: function(state) { | ||||
| this._loaded = true; | this._loaded = true; | ||||
| this._sequence++; | this._sequence++; | ||||
| var params = this._getViewParameters(state); | var workflow = this._newReloadWorkflow(state) | ||||
| var pht = this.getChangesetList().getTranslations(); | |||||
| var workflow = new JX.Workflow(this._renderURI, params) | |||||
| .setHandler(JX.bind(this, this._onresponse, this._sequence)); | .setHandler(JX.bind(this, this._onresponse, this._sequence)); | ||||
| this._startContentWorkflow(workflow); | this._startContentWorkflow(workflow); | ||||
| var pht = this.getChangesetList().getTranslations(); | |||||
| JX.DOM.setContent( | JX.DOM.setContent( | ||||
| this._getContentFrame(), | this._getContentFrame(), | ||||
| JX.$N( | JX.$N( | ||||
| 'div', | 'div', | ||||
| {className: 'differential-loading'}, | {className: 'differential-loading'}, | ||||
| pht('Loading...'))); | pht('Loading...'))); | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| _newReloadWorkflow: function(state) { | |||||
| var params = this._getViewParameters(state); | |||||
| return new JX.Workflow(this._renderURI, params); | |||||
| }, | |||||
| /** | /** | ||||
| * Load missing context in a changeset. | * Load missing context in a changeset. | ||||
| * | * | ||||
| * We do this when the user clicks "Show X Lines". We also expand all of | * We do this when the user clicks "Show X Lines". We also expand all of | ||||
| * the missing context when they "Show All Context". | * the missing context when they "Show All Context". | ||||
| * | * | ||||
| * @param string Line range specification, like "0-40/0-20". | * @param string Line range specification, like "0-40/0-20". | ||||
| * @param node Row where the context should be rendered after loading. | * @param node Row where the context should be rendered after loading. | ||||
| ▲ Show 20 Lines • Show All 401 Lines • ▼ Show 20 Lines | _loadChangesetState: function(state) { | ||||
| if (state.undoTemplates) { | if (state.undoTemplates) { | ||||
| this._undoTemplates = state.undoTemplates; | this._undoTemplates = state.undoTemplates; | ||||
| } | } | ||||
| this._rendererKey = state.rendererKey; | this._rendererKey = state.rendererKey; | ||||
| this._highlight = state.highlight; | this._highlight = state.highlight; | ||||
| this._characterEncoding = state.characterEncoding; | this._characterEncoding = state.characterEncoding; | ||||
| this._documentEngine = state.documentEngine; | this._documentEngine = state.documentEngine; | ||||
| this._isHidden = state.isHidden; | |||||
| var is_hidden = !this.isVisible(); | |||||
| if (this._isHidden != is_hidden) { | |||||
| this.setVisible(!this._isHidden); | |||||
| } | |||||
| this._isLoading = false; | |||||
| this.getPathView().setIsLoading(this._isLoading); | |||||
| }, | }, | ||||
| _getContentFrame: function() { | _getContentFrame: function() { | ||||
| return JX.DOM.find(this._node, 'div', 'changeset-view-content'); | return JX.DOM.find(this._node, 'div', 'changeset-view-content'); | ||||
| }, | }, | ||||
| _getRoutableKey: function() { | _getRoutableKey: function() { | ||||
| return 'changeset-view.' + this._ref + '.' + this._sequence; | return 'changeset-view.' + this._ref + '.' + this._sequence; | ||||
| ▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | redrawFileTree: function() { | ||||
| JX.DOM.setContent(node, hint); | JX.DOM.setContent(node, hint); | ||||
| JX.DOM.alterClass(node, 'diff-tree-path-inlines-visible', is_visible); | JX.DOM.alterClass(node, 'diff-tree-path-inlines-visible', is_visible); | ||||
| JX.DOM.alterClass(node, 'diff-tree-path-inlines-completed', is_completed); | JX.DOM.alterClass(node, 'diff-tree-path-inlines-completed', is_completed); | ||||
| }, | }, | ||||
| toggleVisibility: function() { | toggleVisibility: function() { | ||||
| this._visible = !this._visible; | this.setVisible(!this._visible); | ||||
| var attrs = { | |||||
| hidden: this.isVisible() ? 0 : 1, | |||||
| discard: 1 | |||||
| }; | |||||
| var workflow = this._newReloadWorkflow(attrs) | |||||
| .setHandler(JX.bag); | |||||
| this._startContentWorkflow(workflow); | |||||
| }, | |||||
| setVisible: function(visible) { | |||||
| this._visible = visible; | |||||
| var diff = JX.DOM.find(this._node, 'table', 'differential-diff'); | var diff = JX.DOM.find(this._node, 'table', 'differential-diff'); | ||||
| var undo = this._getUndoNode(); | var undo = this._getUndoNode(); | ||||
| if (this._visible) { | if (this._visible) { | ||||
| JX.DOM.show(diff); | JX.DOM.show(diff); | ||||
| JX.DOM.remove(undo); | JX.DOM.remove(undo); | ||||
| } else { | } else { | ||||
| JX.DOM.hide(diff); | JX.DOM.hide(diff); | ||||
| JX.DOM.appendContent(diff.parentNode, undo); | JX.DOM.appendContent(diff.parentNode, undo); | ||||
| } | } | ||||
| JX.Stratcom.invoke('resize'); | JX.Stratcom.invoke('resize'); | ||||
| this.getPathView().setIsHidden(!this._visible); | |||||
| }, | }, | ||||
| isVisible: function() { | isVisible: function() { | ||||
| return this._visible; | return this._visible; | ||||
| }, | }, | ||||
| _getUndoNode: function() { | _getUndoNode: function() { | ||||
| if (!this._undoNode) { | if (!this._undoNode) { | ||||
| Show All 32 Lines | members: { | ||||
| }, | }, | ||||
| getPathView: function() { | getPathView: function() { | ||||
| if (!this._pathView) { | if (!this._pathView) { | ||||
| var view = new JX.DiffPathView() | var view = new JX.DiffPathView() | ||||
| .setChangeset(this) | .setChangeset(this) | ||||
| .setPath(this._pathParts) | .setPath(this._pathParts) | ||||
| .setIsLowImportance(this._isLowImportance) | .setIsLowImportance(this._isLowImportance) | ||||
| .setIsOwned(this._isOwned); | .setIsOwned(this._isOwned) | ||||
| .setIsLoading(this._isLoading); | |||||
| view.getIcon() | view.getIcon() | ||||
| .setIcon(this._pathIconIcon) | .setIcon(this._pathIconIcon) | ||||
| .setColor(this._pathIconColor); | .setColor(this._pathIconColor); | ||||
| this._pathView = view; | this._pathView = view; | ||||
| } | } | ||||
| Show All 19 Lines | |||||