Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | wake: function() { | ||||
label = pht('Jump to next inline comment.'); | label = pht('Jump to next inline comment.'); | ||||
this._installJumpKey('n', label, 1, 'comment'); | this._installJumpKey('n', label, 1, 'comment'); | ||||
label = pht('Jump to previous inline comment.'); | label = pht('Jump to previous inline comment.'); | ||||
this._installJumpKey('p', label, -1, 'comment'); | this._installJumpKey('p', label, -1, 'comment'); | ||||
label = pht('Jump to the table of contents.'); | label = pht('Jump to the table of contents.'); | ||||
this._installKey('t', label, this._ontoc); | this._installKey('t', label, this._ontoc); | ||||
label = pht('Reply to selected inline comment.'); | |||||
this._installKey('r', label, this._onreply); | |||||
label = pht('Edit selected inline comment.'); | |||||
this._installKey('e', label, this._onedit); | |||||
}, | }, | ||||
isAsleep: function() { | isAsleep: function() { | ||||
return this._asleep; | return this._asleep; | ||||
}, | }, | ||||
newChangesetForNode: function(node) { | newChangesetForNode: function(node) { | ||||
var changeset = JX.DiffChangeset.getForNode(node); | var changeset = JX.DiffChangeset.getForNode(node); | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | _installJumpKey: function(key, label, delta, filter) { | ||||
return this._installKey(key, label, handler); | return this._installKey(key, label, handler); | ||||
}, | }, | ||||
_ontoc: function(manager) { | _ontoc: function(manager) { | ||||
var toc = JX.$('toc'); | var toc = JX.$('toc'); | ||||
manager.scrollTo(toc); | manager.scrollTo(toc); | ||||
}, | }, | ||||
_onreply: function(manager) { | |||||
var cursor = this._cursorItem; | |||||
if (cursor) { | |||||
if (cursor.type == 'comment') { | |||||
var inline = cursor.inline; | |||||
if (inline.canReply()) { | |||||
manager.focusOn(null); | |||||
inline.reply(); | |||||
return; | |||||
} | |||||
} | |||||
} | |||||
var pht = this.getTranslations(); | |||||
this._warnUser(pht('You must select a comment to reply to.')); | |||||
}, | |||||
_onedit: function(manager) { | |||||
var cursor = this._cursorItem; | |||||
if (cursor) { | |||||
if (cursor.type == 'comment') { | |||||
var inline = cursor.inline; | |||||
if (inline.canEdit()) { | |||||
manager.focusOn(null); | |||||
inline.edit(); | |||||
return; | |||||
} | |||||
} | |||||
} | |||||
var pht = this.getTranslations(); | |||||
this._warnUser(pht('You must select a comment to edit.')); | |||||
}, | |||||
_warnUser: function(message) { | |||||
new JX.Notification() | |||||
.setContent(message) | |||||
.alterClassName('jx-notification-alert', true) | |||||
.setDuration(1000) | |||||
.show(); | |||||
}, | |||||
_onjumpkey: function(delta, filter, manager) { | _onjumpkey: function(delta, filter, manager) { | ||||
var state = this._getSelectionState(); | var state = this._getSelectionState(); | ||||
var cursor = state.cursor; | var cursor = state.cursor; | ||||
var items = state.items; | var items = state.items; | ||||
// If there's currently no selection and the user tries to go back, | // If there's currently no selection and the user tries to go back, | ||||
// don't do anything. | // don't do anything. | ||||
▲ Show 20 Lines • Show All 333 Lines • ▼ Show 20 Lines | _onhidereveal: function(e, is_hide) { | ||||
e.kill(); | e.kill(); | ||||
var inline = this._getInlineForEvent(e); | var inline = this._getInlineForEvent(e); | ||||
inline.setHidden(is_hide); | inline.setHidden(is_hide); | ||||
}, | }, | ||||
_onaction: function(action, e) { | _onaction: function(action, e) { | ||||
// TODO: This can become a kill once things fully switch over.. | e.kill(); | ||||
e.prevent(); | |||||
var inline = this._getInlineForEvent(e); | var inline = this._getInlineForEvent(e); | ||||
var is_ref = false; | var is_ref = false; | ||||
// If we don't have a natural inline object, the user may have clicked | // If we don't have a natural inline object, the user may have clicked | ||||
// an action (like "Delete") inside a preview element at the bottom of | // an action (like "Delete") inside a preview element at the bottom of | ||||
// the page. | // the page. | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |