You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/js/views/seed_dialog_view.js

44 lines
984 B
JavaScript

/* global Whisper, i18n */
// eslint-disable-next-line func-names
(function() {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.SeedDialogView = Whisper.View.extend({
className: 'loki-dialog seed-dialog modal',
templateName: 'seed-dialog',
initialize(options = {}) {
this.okText = options.okText || i18n('ok');
this.copyText = options.copyText || i18n('copySeed');
this.seed = options.seed || '-';
this.render();
},
events: {
'click .ok': 'ok',
'click .copy-seed': 'copySeed',
},
render_attributes() {
return {
seed: this.seed,
ok: this.okText,
copyText: this.copyText,
};
},
ok() {
this.remove();
},
copySeed() {
window.clipboard.writeText(this.seed);
const toast = new Whisper.MessageToastView({
message: i18n('copiedMnemonic'),
});
toast.$el.appendTo(this.$el);
toast.render();
},
});
})();