Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
| Show All 20 Lines | construct: function() { | ||||
| JX.Stratcom.listen('click', 'differential-view-options', onmenu); | JX.Stratcom.listen('click', 'differential-view-options', onmenu); | ||||
| var oncollapse = JX.bind(this, this._ifawake, this._oncollapse, true); | var oncollapse = JX.bind(this, this._ifawake, this._oncollapse, true); | ||||
| JX.Stratcom.listen('click', 'hide-inline', oncollapse); | JX.Stratcom.listen('click', 'hide-inline', oncollapse); | ||||
| var onexpand = JX.bind(this, this._ifawake, this._oncollapse, false); | var onexpand = JX.bind(this, this._ifawake, this._oncollapse, false); | ||||
| JX.Stratcom.listen('click', 'reveal-inline', onexpand); | JX.Stratcom.listen('click', 'reveal-inline', onexpand); | ||||
| var onedit = JX.bind(this, this._ifawake, this._onaction, 'edit'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-edit'], | |||||
| onedit); | |||||
| var ondone = JX.bind(this, this._ifawake, this._onaction, 'done'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-done'], | |||||
| ondone); | |||||
| var ondelete = JX.bind(this, this._ifawake, this._onaction, 'delete'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-delete'], | |||||
| ondelete); | |||||
| var onreply = JX.bind(this, this._ifawake, this._onaction, 'reply'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-reply'], | |||||
| onreply); | |||||
| var onresize = JX.bind(this, this._ifawake, this._onresize); | var onresize = JX.bind(this, this._ifawake, this._onresize); | ||||
| JX.Stratcom.listen('resize', null, onresize); | JX.Stratcom.listen('resize', null, onresize); | ||||
| var onscroll = JX.bind(this, this._ifawake, this._onscroll); | var onscroll = JX.bind(this, this._ifawake, this._onscroll); | ||||
| JX.Stratcom.listen('scroll', null, onscroll); | JX.Stratcom.listen('scroll', null, onscroll); | ||||
| var onselect = JX.bind(this, this._ifawake, this._onselect); | var onselect = JX.bind(this, this._ifawake, this._onselect); | ||||
| JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
| Show All 19 Lines | JX.Stratcom.listen( | ||||
| ['differential-changeset', 'tag:td'], | ['differential-changeset', 'tag:td'], | ||||
| onrangemove); | onrangemove); | ||||
| var onrangeup = JX.bind(this, this._ifawake, this._onrangeup); | var onrangeup = JX.bind(this, this._ifawake, this._onrangeup); | ||||
| JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
| 'mouseup', | 'mouseup', | ||||
| null, | null, | ||||
| onrangeup); | onrangeup); | ||||
| this._setupInlineCommentListeners(); | |||||
| }, | }, | ||||
| properties: { | properties: { | ||||
| translations: null, | translations: null, | ||||
| inlineURI: null, | inlineURI: null, | ||||
| inlineListURI: null, | inlineListURI: null, | ||||
| isStandalone: false, | isStandalone: false, | ||||
| formationView: null | formationView: null | ||||
| ▲ Show 20 Lines • Show All 1,062 Lines • ▼ Show 20 Lines | selectInline: function(inline) { | ||||
| for (var ii = 0; ii < items.length; ii++) { | for (var ii = 0; ii < items.length; ii++) { | ||||
| item = items[ii]; | item = items[ii]; | ||||
| if (item.target === inline) { | if (item.target === inline) { | ||||
| this._setSelectionState(item, false); | this._setSelectionState(item, false); | ||||
| } | } | ||||
| } | } | ||||
| }, | }, | ||||
| _onaction: function(action, e) { | |||||
| e.kill(); | |||||
| var inline = this._getInlineForEvent(e); | |||||
| var is_ref = false; | |||||
| // If we don't have a natural inline object, the user may have clicked | |||||
| // an action (like "Delete") inside a preview element at the bottom of | |||||
| // the page. | |||||
| // If they did, try to find an associated normal inline to act on, and | |||||
| // pretend they clicked that instead. This makes the overall state of | |||||
| // the page more consistent. | |||||
| // However, there may be no normal inline (for example, because it is | |||||
| // on a version of the diff which is not visible). In this case, we | |||||
| // act by reference. | |||||
| if (inline === null) { | |||||
| var data = e.getNodeData('differential-inline-comment'); | |||||
| inline = this.getInlineByID(data.id); | |||||
| if (inline) { | |||||
| is_ref = true; | |||||
| } else { | |||||
| switch (action) { | |||||
| case 'delete': | |||||
| this._deleteInlineByID(data.id); | |||||
| return; | |||||
| } | |||||
| } | |||||
| } | |||||
| // TODO: For normal operations, highlight the inline range here. | |||||
| switch (action) { | |||||
| case 'edit': | |||||
| inline.edit(); | |||||
| break; | |||||
| case 'done': | |||||
| inline.toggleDone(); | |||||
| break; | |||||
| case 'delete': | |||||
| inline.delete(is_ref); | |||||
| break; | |||||
| case 'reply': | |||||
| inline.reply(); | |||||
| break; | |||||
| } | |||||
| }, | |||||
| redrawPreview: function() { | redrawPreview: function() { | ||||
| // TODO: This isn't the cleanest way to find the preview form, but | // TODO: This isn't the cleanest way to find the preview form, but | ||||
| // rendering no longer has direct access to it. | // rendering no longer has direct access to it. | ||||
| var forms = JX.DOM.scry(document.body, 'form', 'transaction-append'); | var forms = JX.DOM.scry(document.body, 'form', 'transaction-append'); | ||||
| if (forms.length) { | if (forms.length) { | ||||
| JX.DOM.invoke(forms[0], 'shouldRefresh'); | JX.DOM.invoke(forms[0], 'shouldRefresh'); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 909 Lines • ▼ Show 20 Lines | _redrawFiletree : function() { | ||||
| var filetree = formation.getColumn(0); | var filetree = formation.getColumn(0); | ||||
| var flank = filetree.getFlank(); | var flank = filetree.getFlank(); | ||||
| var flank_body = flank.getBodyNode(); | var flank_body = flank.getBodyNode(); | ||||
| var tree = this._getTreeView(); | var tree = this._getTreeView(); | ||||
| JX.DOM.setContent(flank_body, tree.getNode()); | JX.DOM.setContent(flank_body, tree.getNode()); | ||||
| }, | |||||
| _setupInlineCommentListeners: function() { | |||||
| var onsave = JX.bind(this, this._onInlineEvent, 'save'); | |||||
| JX.Stratcom.listen( | |||||
| ['submit', 'didSyntheticSubmit'], | |||||
| 'inline-edit-form', | |||||
| onsave); | |||||
| var oncancel = JX.bind(this, this._onInlineEvent, 'cancel'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| 'inline-edit-cancel', | |||||
| oncancel); | |||||
| var onundo = JX.bind(this, this._onInlineEvent, 'undo'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| 'differential-inline-comment-undo', | |||||
| onundo); | |||||
| var onedit = JX.bind(this, this._onInlineEvent, 'edit'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-edit'], | |||||
| onedit); | |||||
| var ondone = JX.bind(this, this._onInlineEvent, 'done'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-done'], | |||||
| ondone); | |||||
| var ondelete = JX.bind(this, this._onInlineEvent, 'delete'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-delete'], | |||||
| ondelete); | |||||
| var onreply = JX.bind(this, this._onInlineEvent, 'reply'); | |||||
| JX.Stratcom.listen( | |||||
| 'click', | |||||
| ['differential-inline-comment', 'differential-inline-reply'], | |||||
| onreply); | |||||
| }, | |||||
| _onInlineEvent: function(action, e) { | |||||
| if (this.isAsleep()) { | |||||
| return; | |||||
| } | |||||
| e.kill(); | |||||
| var inline = this._getInlineForEvent(e); | |||||
| var is_ref = false; | |||||
| // If we don't have a natural inline object, the user may have clicked | |||||
| // an action (like "Delete") inside a preview element at the bottom of | |||||
| // the page. | |||||
| // If they did, try to find an associated normal inline to act on, and | |||||
| // pretend they clicked that instead. This makes the overall state of | |||||
| // the page more consistent. | |||||
| // However, there may be no normal inline (for example, because it is | |||||
| // on a version of the diff which is not visible). In this case, we | |||||
| // act by reference. | |||||
| if (inline === null) { | |||||
| var data = e.getNodeData('differential-inline-comment'); | |||||
| inline = this.getInlineByID(data.id); | |||||
| if (inline) { | |||||
| is_ref = true; | |||||
| } else { | |||||
| switch (action) { | |||||
| case 'delete': | |||||
| this._deleteInlineByID(data.id); | |||||
| return; | |||||
| } | |||||
| } | |||||
| } | |||||
| // TODO: For normal operations, highlight the inline range here. | |||||
| switch (action) { | |||||
| case 'save': | |||||
| inline.save(e.getTarget()); | |||||
| break; | |||||
| case 'cancel': | |||||
| inline.cancel(); | |||||
| break; | |||||
| case 'undo': | |||||
| inline.undo(); | |||||
| break; | |||||
| case 'edit': | |||||
| inline.edit(); | |||||
| break; | |||||
| case 'done': | |||||
| inline.toggleDone(); | |||||
| break; | |||||
| case 'delete': | |||||
| inline.delete(is_ref); | |||||
| break; | |||||
| case 'reply': | |||||
| inline.reply(); | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| }); | }); | ||||