Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffInline.js
| Show All 27 Lines | members: { | ||||
| _isLoading: false, | _isLoading: false, | ||||
| _changeset: null, | _changeset: null, | ||||
| _objective: null, | _objective: null, | ||||
| _isDraft: null, | _isDraft: null, | ||||
| _isFixed: null, | _isFixed: null, | ||||
| _isEditing: false, | _isEditing: false, | ||||
| _isNew: false, | |||||
| bindToRow: function(row) { | bindToRow: function(row) { | ||||
| this._row = row; | this._row = row; | ||||
| this._objective.setAnchor(this._row); | this._objective.setAnchor(this._row); | ||||
| var row_data = JX.Stratcom.getData(row); | var row_data = JX.Stratcom.getData(row); | ||||
| row_data.inline = this; | row_data.inline = this; | ||||
| this._hidden = row_data.hidden || false; | this._hidden = row_data.hidden || false; | ||||
| Show All 24 Lines | bindToRow: function(row) { | ||||
| this._replyToCommentPHID = data.replyToCommentPHID; | this._replyToCommentPHID = data.replyToCommentPHID; | ||||
| this._isDraft = data.isDraft; | this._isDraft = data.isDraft; | ||||
| this._isFixed = data.isFixed; | this._isFixed = data.isFixed; | ||||
| this._isGhost = data.isGhost; | this._isGhost = data.isGhost; | ||||
| this._changesetID = data.changesetID; | this._changesetID = data.changesetID; | ||||
| this._isNew = false; | |||||
| this.setInvisible(false); | this.setInvisible(false); | ||||
| this.updateObjective(); | this.updateObjective(); | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| bindToRange: function(data) { | bindToRange: function(data) { | ||||
| this._displaySide = data.displaySide; | this._displaySide = data.displaySide; | ||||
| this._number = parseInt(data.number, 10); | this._number = parseInt(data.number, 10); | ||||
| this._length = parseInt(data.length, 10); | this._length = parseInt(data.length, 10); | ||||
| this._isNewFile = data.isNewFile; | this._isNewFile = data.isNewFile; | ||||
| this._changesetID = data.changesetID; | this._changesetID = data.changesetID; | ||||
| this._isNew = true; | |||||
| // Insert the comment after any other comments which already appear on | // Insert the comment after any other comments which already appear on | ||||
| // the same row. | // the same row. | ||||
| var parent_row = JX.DOM.findAbove(data.target, 'tr'); | var parent_row = JX.DOM.findAbove(data.target, 'tr'); | ||||
| 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(); | var row = this._newRow(); | ||||
| parent_row.parentNode.insertBefore(row, target_row); | parent_row.parentNode.insertBefore(row, target_row); | ||||
| this.setInvisible(true); | this.setInvisible(true); | ||||
| return this; | return this; | ||||
| }, | }, | ||||
| 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._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 72 Lines • ▼ Show 20 Lines | members: { | ||||
| updateObjective: function() { | updateObjective: function() { | ||||
| var objective = this._objective; | var objective = this._objective; | ||||
| if (this.isHidden() || this._isDeleted) { | if (this.isHidden() || this._isDeleted) { | ||||
| objective.hide(); | objective.hide(); | ||||
| return; | return; | ||||
| } | } | ||||
| // If this is a new comment which we aren't editing, don't show anything: | |||||
| // the use started a comment or reply, then cancelled it. | |||||
| if (this._isNew && !this._isEditing) { | |||||
| objective.hide(); | |||||
| return; | |||||
| } | |||||
| var changeset = this.getChangeset(); | var changeset = this.getChangeset(); | ||||
| if (!changeset.isVisible()) { | if (!changeset.isVisible()) { | ||||
| objective.hide(); | objective.hide(); | ||||
| return; | return; | ||||
| } | } | ||||
| var pht = changeset.getChangesetList().getTranslations(); | var pht = changeset.getChangesetList().getTranslations(); | ||||
| ▲ Show 20 Lines • Show All 562 Lines • Show Last 20 Lines | |||||