Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
| /** | /** | ||||
| * @provides phabricator-diff-changeset-list | * @provides phabricator-diff-changeset-list | ||||
| * @requires javelin-install | * @requires javelin-install | ||||
| * phabricator-scroll-objective-list | |||||
| * @javelin | * @javelin | ||||
| */ | */ | ||||
| JX.install('DiffChangesetList', { | JX.install('DiffChangesetList', { | ||||
| construct: function() { | construct: function() { | ||||
| this._changesets = []; | this._changesets = []; | ||||
| this._objectives = new JX.ScrollObjectiveList(); | |||||
| var onload = JX.bind(this, this._ifawake, this._onload); | var onload = JX.bind(this, this._ifawake, this._onload); | ||||
| JX.Stratcom.listen('click', 'differential-load', onload); | JX.Stratcom.listen('click', 'differential-load', onload); | ||||
| var onmore = JX.bind(this, this._ifawake, this._onmore); | var onmore = JX.bind(this, this._ifawake, this._onmore); | ||||
| JX.Stratcom.listen('click', 'show-more', onmore); | JX.Stratcom.listen('click', 'show-more', onmore); | ||||
| var onmenu = JX.bind(this, this._ifawake, this._onmenu); | var onmenu = JX.bind(this, this._ifawake, this._onmenu); | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | properties: { | ||||
| translations: null, | translations: null, | ||||
| inlineURI: null | inlineURI: null | ||||
| }, | }, | ||||
| members: { | members: { | ||||
| _initialized: false, | _initialized: false, | ||||
| _asleep: true, | _asleep: true, | ||||
| _changesets: null, | _changesets: null, | ||||
| _objectives: null, | |||||
| _cursorItem: null, | _cursorItem: null, | ||||
| _focusNode: null, | _focusNode: null, | ||||
| _focusStart: null, | _focusStart: null, | ||||
| _focusEnd: null, | _focusEnd: null, | ||||
| _hoverNode: null, | _hoverNode: null, | ||||
| _hoverInline: null, | _hoverInline: null, | ||||
| _hoverOrigin: null, | _hoverOrigin: null, | ||||
| _hoverTarget: null, | _hoverTarget: null, | ||||
| _rangeActive: false, | _rangeActive: false, | ||||
| _rangeOrigin: null, | _rangeOrigin: null, | ||||
| _rangeTarget: null, | _rangeTarget: null, | ||||
| _bannerNode: null, | _bannerNode: null, | ||||
| _showObjectives: false, | |||||
| sleep: function() { | sleep: function() { | ||||
| this._asleep = true; | this._asleep = true; | ||||
| this._redrawFocus(); | this._redrawFocus(); | ||||
| this._redrawSelection(); | this._redrawSelection(); | ||||
| this.resetHover(); | this.resetHover(); | ||||
| this._objectives.hide(); | |||||
| }, | }, | ||||
| wake: function() { | wake: function() { | ||||
| this._asleep = false; | this._asleep = false; | ||||
| this._redrawFocus(); | this._redrawFocus(); | ||||
| this._redrawSelection(); | this._redrawSelection(); | ||||
| if (this._showObjectives) { | |||||
| this._objectives.show(); | |||||
| } | |||||
| if (this._initialized) { | if (this._initialized) { | ||||
| return; | return; | ||||
| } | } | ||||
| this._initialized = true; | this._initialized = true; | ||||
| var pht = this.getTranslations(); | var pht = this.getTranslations(); | ||||
| var label; | var label; | ||||
| Show All 40 Lines | wake: function() { | ||||
| label = pht('Mark or unmark selected inline comment as done.'); | label = pht('Mark or unmark selected inline comment as done.'); | ||||
| this._installKey('w', label, this._onkeydone); | this._installKey('w', label, this._onkeydone); | ||||
| label = pht('Hide or show inline comment.'); | label = pht('Hide or show inline comment.'); | ||||
| this._installKey('q', label, this._onkeyhide); | this._installKey('q', label, this._onkeyhide); | ||||
| }, | }, | ||||
| setShowObjectives: function(show) { | |||||
| this._showObjectives = show; | |||||
| return this; | |||||
| }, | |||||
| isAsleep: function() { | isAsleep: function() { | ||||
| return this._asleep; | return this._asleep; | ||||
| }, | }, | ||||
| getObjectives: function() { | |||||
| return this._objectives; | |||||
| }, | |||||
| newChangesetForNode: function(node) { | newChangesetForNode: function(node) { | ||||
| var changeset = JX.DiffChangeset.getForNode(node); | var changeset = JX.DiffChangeset.getForNode(node); | ||||
| this._changesets.push(changeset); | this._changesets.push(changeset); | ||||
| changeset.setChangesetList(this); | changeset.setChangesetList(this); | ||||
| return changeset; | return changeset; | ||||
| }, | }, | ||||
| ▲ Show 20 Lines • Show All 311 Lines • ▼ Show 20 Lines | _getSelectionState: function() { | ||||
| return { | return { | ||||
| cursor: cursor, | cursor: cursor, | ||||
| items: items | items: items | ||||
| }; | }; | ||||
| }, | }, | ||||
| _setSelectionState: function(item, manager) { | _setSelectionState: function(item, manager) { | ||||
| // If we had an inline selected before, we need to update it after | |||||
| // changing our selection to clear the selected state. Then, update the | |||||
| // new one to add the selected state. | |||||
| var old_inline = this.getSelectedInline(); | |||||
| this._cursorItem = item; | this._cursorItem = item; | ||||
| this._redrawSelection(manager, true); | this._redrawSelection(manager, true); | ||||
| var new_inline = this.getSelectedInline(); | |||||
| if (old_inline) { | |||||
| old_inline.updateObjective(); | |||||
| } | |||||
| if (new_inline) { | |||||
| new_inline.updateObjective(); | |||||
| } | |||||
| return this; | return this; | ||||
| }, | }, | ||||
| _redrawSelection: function(manager, scroll) { | _redrawSelection: function(manager, scroll) { | ||||
| var cursor = this._cursorItem; | var cursor = this._cursorItem; | ||||
| if (!cursor) { | if (!cursor) { | ||||
| this.setFocus(null); | this.setFocus(null); | ||||
| return; | return; | ||||
| ▲ Show 20 Lines • Show All 840 Lines • Show Last 20 Lines | |||||