Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangeset.js
| Show First 20 Lines • Show All 397 Lines • ▼ Show 20 Lines | getSelectableItems: function() { | ||||
| items: [] | items: [] | ||||
| }; | }; | ||||
| blocks.push(block); | blocks.push(block); | ||||
| } | } | ||||
| block.items.push(rows[ii]); | block.items.push(rows[ii]); | ||||
| } | } | ||||
| var last_inline = null; | |||||
| var last_inline_item = null; | |||||
| for (ii = 0; ii < blocks.length; ii++) { | for (ii = 0; ii < blocks.length; ii++) { | ||||
| block = blocks[ii]; | block = blocks[ii]; | ||||
| if (block.type == 'change') { | if (block.type == 'change') { | ||||
| items.push({ | items.push({ | ||||
| type: block.type, | type: block.type, | ||||
| changeset: this, | changeset: this, | ||||
| target: block.items[0], | target: block.items[0], | ||||
| nodes: { | nodes: { | ||||
| begin: block.items[0], | begin: block.items[0], | ||||
| end: block.items[block.items.length - 1] | end: block.items[block.items.length - 1] | ||||
| } | } | ||||
| }); | }); | ||||
| } | } | ||||
| if (block.type == 'comment') { | if (block.type == 'comment') { | ||||
| for (var jj = 0; jj < block.items.length; jj++) { | for (var jj = 0; jj < block.items.length; jj++) { | ||||
| var inline = this.getInlineForRow(block.items[jj]); | var inline = this.getInlineForRow(block.items[jj]); | ||||
| items.push({ | // When comments are being edited, they have a hidden row with | ||||
| // the actual comment and then a visible row with the editor. | |||||
| // In this case, we only want to generate one item, but it should | |||||
| // use the editor as a scroll target. To accomplish this, check if | |||||
| // this row has the same inline as the previous row. If so, update | |||||
| // the last item to use this row's nodes. | |||||
| if (inline === last_inline) { | |||||
| last_inline_item.nodes.begin = block.items[jj]; | |||||
| last_inline_item.nodes.end = block.items[jj]; | |||||
| continue; | |||||
| } else { | |||||
| last_inline = inline; | |||||
| } | |||||
| last_inline_item = { | |||||
| type: block.type, | type: block.type, | ||||
| changeset: this, | changeset: this, | ||||
| target: inline, | target: inline, | ||||
| hidden: inline.isHidden(), | hidden: inline.isHidden(), | ||||
| deleted: !inline.getID() && !inline.isEditing(), | |||||
| nodes: { | nodes: { | ||||
| begin: block.items[jj], | begin: block.items[jj], | ||||
| end: block.items[jj] | end: block.items[jj] | ||||
| }, | |||||
| attributes: { | |||||
| unsaved: inline.isEditing() | |||||
| } | } | ||||
| }); | }; | ||||
| items.push(last_inline_item); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return items; | return items; | ||||
| }, | }, | ||||
| _getRowType: function(row) { | _getRowType: function(row) { | ||||
| ▲ Show 20 Lines • Show All 347 Lines • Show Last 20 Lines | |||||