Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/application/diff/DiffChangesetList.js
Show All 14 Lines | construct: function() { | ||||
JX.Stratcom.listen('click', 'differential-load', onload); | JX.Stratcom.listen('click', 'differential-load', onload); | ||||
var onmore = JX.bind(this, this._ifawake, this._onmore); | var onmore = JX.bind(this, this._ifawake, this._onmore); | ||||
JX.Stratcom.listen('click', 'show-more', onmore); | JX.Stratcom.listen('click', 'show-more', onmore); | ||||
var onmenu = JX.bind(this, this._ifawake, this._onmenu); | var onmenu = JX.bind(this, this._ifawake, this._onmenu); | ||||
JX.Stratcom.listen('click', 'differential-view-options', onmenu); | JX.Stratcom.listen('click', 'differential-view-options', onmenu); | ||||
var oncollapse = JX.bind(this, this._ifawake, this._oncollapse, true); | |||||
JX.Stratcom.listen('click', 'hide-inline', oncollapse); | |||||
var onexpand = JX.bind(this, this._ifawake, this._oncollapse, false); | var onexpand = JX.bind(this, this._ifawake, this._oncollapse, false); | ||||
JX.Stratcom.listen('click', 'reveal-inline', onexpand); | JX.Stratcom.listen('click', 'reveal-inline', onexpand); | ||||
var onresize = JX.bind(this, this._ifawake, this._onresize); | var onresize = JX.bind(this, this._ifawake, this._onresize); | ||||
JX.Stratcom.listen('resize', null, onresize); | JX.Stratcom.listen('resize', null, onresize); | ||||
var onscroll = JX.bind(this, this._ifawake, this._onscroll); | var onscroll = JX.bind(this, this._ifawake, this._onscroll); | ||||
JX.Stratcom.listen('scroll', null, onscroll); | JX.Stratcom.listen('scroll', null, onscroll); | ||||
▲ Show 20 Lines • Show All 297 Lines • ▼ Show 20 Lines | members: { | ||||
_onkeyreply: function(is_quote) { | _onkeyreply: function(is_quote) { | ||||
var cursor = this._cursorItem; | var cursor = this._cursorItem; | ||||
if (cursor) { | if (cursor) { | ||||
if (cursor.type == 'comment') { | if (cursor.type == 'comment') { | ||||
var inline = cursor.target; | var inline = cursor.target; | ||||
if (inline.canReply()) { | if (inline.canReply()) { | ||||
this.setFocus(null); | this.setFocus(null); | ||||
inline.reply(true); | |||||
var text; | |||||
if (is_quote) { | |||||
text = inline.getRawText(); | |||||
text = '> ' + text.replace(/\n/g, '\n> ') + '\n\n'; | |||||
} else { | |||||
text = ''; | |||||
} | |||||
inline.reply(text); | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
// If the keyboard cursor is selecting a range of lines, we may have | // If the keyboard cursor is selecting a range of lines, we may have | ||||
// a mixture of old and new changes on the selected rows. It is not | // a mixture of old and new changes on the selected rows. It is not | ||||
// entirely unambiguous what the user means when they say they want | // entirely unambiguous what the user means when they say they want | ||||
// to reply to this, but we use this logic: reply on the new file if | // to reply to this, but we use this logic: reply on the new file if | ||||
▲ Show 20 Lines • Show All 1,732 Lines • ▼ Show 20 Lines | _setupInlineCommentListeners: function() { | ||||
oncancel); | oncancel); | ||||
var onundo = JX.bind(this, this._onInlineEvent, 'undo'); | var onundo = JX.bind(this, this._onInlineEvent, 'undo'); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
'click', | 'click', | ||||
'differential-inline-comment-undo', | 'differential-inline-comment-undo', | ||||
onundo); | onundo); | ||||
var onedit = JX.bind(this, this._onInlineEvent, 'edit'); | |||||
JX.Stratcom.listen( | |||||
'click', | |||||
['differential-inline-comment', 'differential-inline-edit'], | |||||
onedit); | |||||
var ondone = JX.bind(this, this._onInlineEvent, 'done'); | var ondone = JX.bind(this, this._onInlineEvent, 'done'); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
'click', | 'click', | ||||
['differential-inline-comment', 'differential-inline-done'], | ['differential-inline-comment', 'differential-inline-done'], | ||||
ondone); | ondone); | ||||
var ondelete = JX.bind(this, this._onInlineEvent, 'delete'); | var ondelete = JX.bind(this, this._onInlineEvent, 'delete'); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
'click', | 'click', | ||||
['differential-inline-comment', 'differential-inline-delete'], | ['differential-inline-comment', 'differential-inline-delete'], | ||||
ondelete); | ondelete); | ||||
var onreply = JX.bind(this, this._onInlineEvent, 'reply'); | var onmenu = JX.bind(this, this._onInlineEvent, 'menu'); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
'click', | 'click', | ||||
['differential-inline-comment', 'differential-inline-reply'], | ['differential-inline-comment', 'inline-action-dropdown'], | ||||
onreply); | onmenu); | ||||
var ondraft = JX.bind(this, this._onInlineEvent, 'draft'); | var ondraft = JX.bind(this, this._onInlineEvent, 'draft'); | ||||
JX.Stratcom.listen( | JX.Stratcom.listen( | ||||
'keydown', | 'keydown', | ||||
['differential-inline-comment', 'tag:textarea'], | ['differential-inline-comment', 'tag:textarea'], | ||||
ondraft); | ondraft); | ||||
var on_preview_view = JX.bind(this, this._onPreviewEvent, 'view'); | var on_preview_view = JX.bind(this, this._onPreviewEvent, 'view'); | ||||
Show All 23 Lines | _onPreviewEvent: function(action, e) { | ||||
} | } | ||||
}, | }, | ||||
_onInlineEvent: function(action, e) { | _onInlineEvent: function(action, e) { | ||||
if (this.isAsleep()) { | if (this.isAsleep()) { | ||||
return; | return; | ||||
} | } | ||||
if (action !== 'draft') { | if (action !== 'draft' && action !== 'menu') { | ||||
e.kill(); | e.kill(); | ||||
} | } | ||||
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 | ||||
Show All 28 Lines | _onInlineEvent: function(action, e) { | ||||
inline.save(e.getTarget()); | inline.save(e.getTarget()); | ||||
break; | break; | ||||
case 'cancel': | case 'cancel': | ||||
inline.cancel(); | inline.cancel(); | ||||
break; | break; | ||||
case 'undo': | case 'undo': | ||||
inline.undo(); | inline.undo(); | ||||
break; | break; | ||||
case 'edit': | |||||
inline.edit(); | |||||
break; | |||||
case 'done': | case 'done': | ||||
inline.toggleDone(); | inline.toggleDone(); | ||||
break; | break; | ||||
case 'delete': | case 'delete': | ||||
inline.delete(is_ref); | inline.delete(is_ref); | ||||
break; | break; | ||||
case 'reply': | |||||
inline.reply(); | |||||
break; | |||||
case 'draft': | case 'draft': | ||||
inline.triggerDraft(); | inline.triggerDraft(); | ||||
break; | break; | ||||
case 'menu': | |||||
var node = e.getNode('inline-action-dropdown'); | |||||
inline.activateMenu(node, e); | |||||
break; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
}); | }); |