Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffInline.js
Show All 18 Lines | members: { | ||||
_changesetID: null, | _changesetID: null, | ||||
_row: null, | _row: null, | ||||
_hidden: false, | _hidden: false, | ||||
_number: null, | _number: null, | ||||
_length: null, | _length: null, | ||||
_displaySide: null, | _displaySide: null, | ||||
_isNewFile: null, | _isNewFile: null, | ||||
_undoRow: null, | _undoRow: null, | ||||
_replyToCommentPHID: null, | |||||
_isDeleted: false, | _isDeleted: false, | ||||
_isInvisible: false, | _isInvisible: false, | ||||
_isLoading: false, | _isLoading: false, | ||||
bindToRow: function(row) { | bindToRow: function(row) { | ||||
this._row = row; | this._row = row; | ||||
Show All 26 Lines | bindToRow: function(row) { | ||||
(data.left != data.right); | (data.left != data.right); | ||||
this.setInvisible(false); | this.setInvisible(false); | ||||
return this; | return this; | ||||
}, | }, | ||||
bindToRange: function(data) { | bindToRange: function(data) { | ||||
this._id = null; | |||||
this._phid = null; | |||||
this._hidden = false; | |||||
this._displaySide = data.displaySide; | this._displaySide = data.displaySide; | ||||
this._number = data.number; | this._number = data.number; | ||||
this._length = data.length; | this._length = data.length; | ||||
this._isNewFile = data.isNewFile; | this._isNewFile = data.isNewFile; | ||||
this._changesetID = data.changesetID; | this._changesetID = data.changesetID; | ||||
// Insert the comment after any other comments which already appear on | |||||
// the same row. | |||||
var parent_row = JX.DOM.findAbove(data.target, 'tr'); | |||||
var target_row = parent_row.nextSibling; | |||||
while (target_row && JX.Stratcom.hasSigil(target_row, 'inline-row')) { | |||||
target_row = target_row.nextSibling; | |||||
} | |||||
var row = this._newRow(); | var row = this._newRow(); | ||||
JX.Stratcom.getData(row).inline = this; | parent_row.parentNode.insertBefore(row, target_row); | ||||
this._row = row; | |||||
this.setInvisible(true); | this.setInvisible(true); | ||||
// Insert the comment after any other comments which already appear on | return this; | ||||
// the same row. | }, | ||||
var parent_row = JX.DOM.findAbove(data.target, 'tr'); | |||||
bindToReply: function(inline) { | |||||
this._displaySide = inline._displaySide; | |||||
this._number = inline._number; | |||||
this._length = inline._length; | |||||
this._isNewFile = inline._isNewFile; | |||||
this._changesetID = inline._changesetID; | |||||
this._replyToCommentPHID = inline._phid; | |||||
// TODO: This should insert correctly into the thread, not just at the | |||||
// bottom. | |||||
var parent_row = inline._row; | |||||
var target_row = parent_row.nextSibling; | var target_row = parent_row.nextSibling; | ||||
while (target_row && JX.Stratcom.hasSigil(target_row, 'inline-row')) { | while (target_row && JX.Stratcom.hasSigil(target_row, 'inline-row')) { | ||||
target_row = target_row.nextSibling; | target_row = target_row.nextSibling; | ||||
} | } | ||||
var row = this._newRow(); | |||||
parent_row.parentNode.insertBefore(row, target_row); | parent_row.parentNode.insertBefore(row, target_row); | ||||
this.setInvisible(true); | |||||
return this; | return this; | ||||
}, | }, | ||||
_newRow: function() { | _newRow: function() { | ||||
var attributes = { | var attributes = { | ||||
sigil: 'inline-row' | sigil: 'inline-row' | ||||
}; | }; | ||||
return JX.$N('tr', attributes); | var row = JX.$N('tr', attributes); | ||||
JX.Stratcom.getData(row).inline = this; | |||||
this._row = row; | |||||
this._id = null; | |||||
this._phid = null; | |||||
this._hidden = false; | |||||
return row; | |||||
}, | }, | ||||
setHidden: function(hidden) { | setHidden: function(hidden) { | ||||
this._hidden = hidden; | this._hidden = hidden; | ||||
JX.DOM.alterClass(this._row, 'inline-hidden', this._hidden); | JX.DOM.alterClass(this._row, 'inline-hidden', this._hidden); | ||||
var op; | var op; | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | create: function() { | ||||
this.setLoading(true); | this.setLoading(true); | ||||
new JX.Request(uri, handler) | new JX.Request(uri, handler) | ||||
.setData(data) | .setData(data) | ||||
.send(); | .send(); | ||||
}, | }, | ||||
reply: function() { | |||||
var changeset = this.getChangeset(); | |||||
return changeset.newInlineReply(this); | |||||
}, | |||||
edit: function() { | edit: function() { | ||||
var uri = this._getInlineURI(); | var uri = this._getInlineURI(); | ||||
var handler = JX.bind(this, this._oneditresponse); | var handler = JX.bind(this, this._oneditresponse); | ||||
var data = this._newRequestData('edit'); | var data = this._newRequestData('edit'); | ||||
this.setLoading(true); | this.setLoading(true); | ||||
new JX.Request(uri, handler) | new JX.Request(uri, handler) | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | members: { | ||||
getID: function() { | getID: function() { | ||||
return this._id; | return this._id; | ||||
}, | }, | ||||
getChangesetID: function() { | getChangesetID: function() { | ||||
return this._changesetID; | return this._changesetID; | ||||
}, | }, | ||||
getReplyToCommentPHID: function() { | |||||
return this._replyToCommentPHID; | |||||
}, | |||||
setDeleted: function(deleted) { | setDeleted: function(deleted) { | ||||
this._isDeleted = deleted; | this._isDeleted = deleted; | ||||
this._redraw(); | this._redraw(); | ||||
return this; | return this; | ||||
}, | }, | ||||
setInvisible: function(invisible) { | setInvisible: function(invisible) { | ||||
this._isInvisible = invisible; | this._isInvisible = invisible; | ||||
Show All 12 Lines | _newRequestData: function(operation) { | ||||
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().getRenderer(), | renderer: this.getChangeset().getRenderer(), | ||||
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: '' | replyToCommentPHID: this.getReplyToCommentPHID() || '', | ||||
}; | }; | ||||
}, | }, | ||||
_oneditresponse: function(response) { | _oneditresponse: function(response) { | ||||
var rows = JX.$H(response).getNode(); | var rows = JX.$H(response).getNode(); | ||||
this._drawEditRows(rows); | this._drawEditRows(rows); | ||||
▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines |