Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffInline.js
| Show All 15 Lines | members: { | ||||
| _row: null, | _row: null, | ||||
| _number: null, | _number: null, | ||||
| _length: null, | _length: null, | ||||
| _displaySide: null, | _displaySide: null, | ||||
| _isNewFile: null, | _isNewFile: null, | ||||
| _replyToCommentPHID: null, | _replyToCommentPHID: null, | ||||
| _originalText: null, | _originalText: null, | ||||
| _snippet: null, | _snippet: null, | ||||
| _documentEngineKey: null, | |||||
| _isDeleted: false, | _isDeleted: false, | ||||
| _isInvisible: false, | _isInvisible: false, | ||||
| _isLoading: false, | _isLoading: false, | ||||
| _changeset: null, | _changeset: null, | ||||
| _isCollapsed: false, | _isCollapsed: false, | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | bindToRow: function(row) { | ||||
| this._isFixed = data.isFixed; | this._isFixed = data.isFixed; | ||||
| this._isGhost = data.isGhost; | this._isGhost = data.isGhost; | ||||
| this._isSynthetic = data.isSynthetic; | this._isSynthetic = data.isSynthetic; | ||||
| this._isDraftDone = data.isDraftDone; | this._isDraftDone = data.isDraftDone; | ||||
| this._changesetID = data.changesetID; | this._changesetID = data.changesetID; | ||||
| this._isNew = false; | this._isNew = false; | ||||
| this._snippet = data.snippet; | this._snippet = data.snippet; | ||||
| this._documentEngineKey = data.documentEngineKey; | |||||
| this._isEditing = data.isEditing; | this._isEditing = data.isEditing; | ||||
| if (this._isEditing) { | if (this._isEditing) { | ||||
| // NOTE: The "original" shipped down in the DOM may reflect a draft | // NOTE: The "original" shipped down in the DOM may reflect a draft | ||||
| // which we're currently editing. This flow is a little clumsy, but | // which we're currently editing. This flow is a little clumsy, but | ||||
| // reasonable until some future change moves away from "send down | // reasonable until some future change moves away from "send down | ||||
| // the inline, then immediately click edit". | // the inline, then immediately click edit". | ||||
| ▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | members: { | ||||
| bindToReply: function(inline) { | bindToReply: function(inline) { | ||||
| this._displaySide = inline._displaySide; | this._displaySide = inline._displaySide; | ||||
| this._number = inline._number; | this._number = inline._number; | ||||
| this._length = inline._length; | this._length = inline._length; | ||||
| this._isNewFile = inline._isNewFile; | this._isNewFile = inline._isNewFile; | ||||
| this._changesetID = inline._changesetID; | this._changesetID = inline._changesetID; | ||||
| this._isNew = true; | this._isNew = true; | ||||
| this._documentEngineKey = inline._documentEngineKey; | |||||
| this._replyToCommentPHID = inline._phid; | this._replyToCommentPHID = inline._phid; | ||||
| var changeset = this.getChangeset(); | var changeset = this.getChangeset(); | ||||
| // We're going to figure out where in the document to position the new | // We're going to figure out where in the document to position the new | ||||
| // inline. Normally, it goes after any existing inline rows (so if | // inline. Normally, it goes after any existing inline rows (so if | ||||
| // several inlines reply to the same line, they appear in chronological | // several inlines reply to the same line, they appear in chronological | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | _ondone: function(response) { | ||||
| this._isFixed = response.isChecked; | this._isFixed = response.isChecked; | ||||
| this._isDraftDone = !!response.draftState; | this._isDraftDone = !!response.draftState; | ||||
| this._didUpdate(); | this._didUpdate(); | ||||
| }, | }, | ||||
| create: function(text) { | create: function(text) { | ||||
| var changeset = this.getChangeset(); | |||||
| if (!this._documentEngineKey) { | |||||
| this._documentEngineKey = changeset.getResponseDocumentEngineKey(); | |||||
| } | |||||
| var uri = this._getInlineURI(); | var uri = this._getInlineURI(); | ||||
| var handler = JX.bind(this, this._oncreateresponse); | var handler = JX.bind(this, this._oncreateresponse); | ||||
| var data = this._newRequestData('new', text); | var data = this._newRequestData('new', text); | ||||
| this.setLoading(true); | this.setLoading(true); | ||||
| new JX.Request(uri, handler) | new JX.Request(uri, handler) | ||||
| .setData(data) | .setData(data) | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | _newRequestData: function(operation, text) { | ||||
| op: operation, | op: operation, | ||||
| id: this._id, | id: this._id, | ||||
| on_right: ((this.getDisplaySide() == 'right') ? 1 : 0), | on_right: ((this.getDisplaySide() == 'right') ? 1 : 0), | ||||
| renderer: this.getChangeset().getRendererKey(), | renderer: this.getChangeset().getRendererKey(), | ||||
| number: this.getLineNumber(), | number: this.getLineNumber(), | ||||
| length: this.getLineLength(), | length: this.getLineLength(), | ||||
| is_new: this.isNewFile(), | is_new: this.isNewFile(), | ||||
| changesetID: this.getChangesetID(), | changesetID: this.getChangesetID(), | ||||
| replyToCommentPHID: this.getReplyToCommentPHID() || '', | replyToCommentPHID: this.getReplyToCommentPHID(), | ||||
| text: text || '' | text: text || null, | ||||
| documentEngineKey: this._documentEngineKey, | |||||
| }; | }; | ||||
| }, | }, | ||||
| _oneditresponse: function(response) { | _oneditresponse: function(response) { | ||||
| var rows = JX.$H(response.view).getNode(); | var rows = JX.$H(response.view).getNode(); | ||||
| this._readInlineState(response.inline); | this._readInlineState(response.inline); | ||||
| this._drawEditRows(rows); | this._drawEditRows(rows); | ||||
| ▲ Show 20 Lines • Show All 360 Lines • Show Last 20 Lines | |||||