Debug Log: Copy URL instead of open in browser

This commit is contained in:
Ken Powers 2020-05-04 15:20:01 -04:00 committed by Scott Nonnenberg
parent dc81bf2bba
commit 7bb7c0d1e1
7 changed files with 61 additions and 34 deletions

View file

@ -7,17 +7,33 @@
window.Whisper = window.Whisper || {};
Whisper.LinkedCopiedToast = Whisper.ToastView.extend({
render_attributes() {
return { toastMessage: i18n('debugLogLinkCopied') };
},
});
Whisper.DebugLogLinkView = Whisper.View.extend({
templateName: 'debug-log-link',
initialize(options) {
this.url = options.url;
},
events: {
'click .copy': 'copy',
},
render_attributes() {
return {
url: this.url,
reportIssue: i18n('reportIssue'),
debugLogCopy: i18n('debugLogCopy'),
debugLogCopyAlt: i18n('debugLogCopyAlt'),
};
},
copy(e) {
e.preventDefault();
window.copyText(e.currentTarget.href);
Whisper.ToastView.show(Whisper.LinkedCopiedToast, document.body);
},
});
Whisper.DebugLogView = Whisper.View.extend({
templateName: 'debug-log',