Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
| Show First 20 Lines • Show All 1,326 Lines • ▼ Show 20 Lines | _redrawBanner: function() { | ||||
| if (!changeset) { | if (!changeset) { | ||||
| JX.DOM.remove(node); | JX.DOM.remove(node); | ||||
| return; | return; | ||||
| } | } | ||||
| var changesets = this._changesets; | var changesets = this._changesets; | ||||
| var unsaved = []; | var unsaved = []; | ||||
| var unsubmitted = []; | var unsubmitted = []; | ||||
| var draft_done = []; | |||||
| var undone = []; | var undone = []; | ||||
| var done = []; | var done = []; | ||||
| for (var ii = 0; ii < changesets.length; ii++) { | for (var ii = 0; ii < changesets.length; ii++) { | ||||
| var inlines = changesets[ii].getInlines(); | var inlines = changesets[ii].getInlines(); | ||||
| for (var jj = 0; jj < inlines.length; jj++) { | for (var jj = 0; jj < inlines.length; jj++) { | ||||
| var inline = inlines[jj]; | var inline = inlines[jj]; | ||||
| if (inline.isDeleted()) { | if (inline.isDeleted()) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (inline.isSynthetic()) { | if (inline.isSynthetic()) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (inline.isEditing()) { | if (inline.isEditing()) { | ||||
| unsaved.push(inline); | unsaved.push(inline); | ||||
| } else if (!inline.getID()) { | } else if (!inline.getID()) { | ||||
| // These are new comments which have been cancelled, and do not | // These are new comments which have been cancelled, and do not | ||||
| // count as anything. | // count as anything. | ||||
| continue; | continue; | ||||
| } else if (inline.isDraft()) { | } else if (inline.isDraft()) { | ||||
| unsubmitted.push(inline); | unsubmitted.push(inline); | ||||
| } else if (!inline.isDone()) { | } else { | ||||
| // NOTE: Unlike other states, an inline may be marked with a | |||||
| // draft checkmark and still be a "done" or "undone" comment. | |||||
| if (inline.isDraftDone()) { | |||||
| draft_done.push(inline); | |||||
| } | |||||
| if (!inline.isDone()) { | |||||
| undone.push(inline); | undone.push(inline); | ||||
| } else { | } else { | ||||
| done.push(inline); | done.push(inline); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| JX.DOM.alterClass( | JX.DOM.alterClass( | ||||
| node, | node, | ||||
| 'diff-banner-has-unsaved', | 'diff-banner-has-unsaved', | ||||
| !!unsaved.length); | !!unsaved.length); | ||||
| JX.DOM.alterClass( | JX.DOM.alterClass( | ||||
| node, | node, | ||||
| 'diff-banner-has-unsubmitted', | 'diff-banner-has-unsubmitted', | ||||
| !!unsubmitted.length); | !!unsubmitted.length); | ||||
| JX.DOM.alterClass( | |||||
| node, | |||||
| 'diff-banner-has-draft-done', | |||||
| !!draft_done.length); | |||||
| var pht = this.getTranslations(); | var pht = this.getTranslations(); | ||||
| var unsaved_button = this._getUnsavedButton(); | var unsaved_button = this._getUnsavedButton(); | ||||
| var unsubmitted_button = this._getUnsubmittedButton(); | var unsubmitted_button = this._getUnsubmittedButton(); | ||||
| var done_button = this._getDoneButton(); | var done_button = this._getDoneButton(); | ||||
| if (unsaved.length) { | if (unsaved.length) { | ||||
| unsaved_button.setText(unsaved.length + ' ' + pht('Unsaved')); | unsaved_button.setText(unsaved.length + ' ' + pht('Unsaved')); | ||||
| JX.DOM.show(unsaved_button.getNode()); | JX.DOM.show(unsaved_button.getNode()); | ||||
| } else { | } else { | ||||
| JX.DOM.hide(unsaved_button.getNode()); | JX.DOM.hide(unsaved_button.getNode()); | ||||
| } | } | ||||
| if (unsubmitted.length) { | if (unsubmitted.length || draft_done.length) { | ||||
| unsubmitted_button.setText( | var any_draft_count = unsubmitted.length + draft_done.length; | ||||
| unsubmitted.length + ' ' + pht('Unsubmitted')); | |||||
| unsubmitted_button.setText(any_draft_count + ' ' + pht('Unsubmitted')); | |||||
| JX.DOM.show(unsubmitted_button.getNode()); | JX.DOM.show(unsubmitted_button.getNode()); | ||||
| } else { | } else { | ||||
| JX.DOM.hide(unsubmitted_button.getNode()); | JX.DOM.hide(unsubmitted_button.getNode()); | ||||
| } | } | ||||
| if (done.length || undone.length) { | if (done.length || undone.length) { | ||||
| // If you haven't marked any comments as "Done", we just show text | // If you haven't marked any comments as "Done", we just show text | ||||
| // like "3 Comments". If you've marked at least one done, we show | // like "3 Comments". If you've marked at least one done, we show | ||||
| ▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | |||||
| }, | }, | ||||
| _onunsubmittedclick: function(e) { | _onunsubmittedclick: function(e) { | ||||
| e.kill(); | e.kill(); | ||||
| var options = { | var options = { | ||||
| filter: 'comment', | filter: 'comment', | ||||
| wrap: true, | wrap: true, | ||||
| attribute: 'unsubmitted' | attribute: 'anyDraft' | ||||
| }; | }; | ||||
| this._onjumpkey(1, options); | this._onjumpkey(1, options); | ||||
| }, | }, | ||||
| _ondoneclick: function(e) { | _ondoneclick: function(e) { | ||||
| e.kill(); | e.kill(); | ||||
| ▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines | |||||