Make debug log link focusable/selectable

Add button to open in a new tab. Stye as input group.

// FREEBIE
This commit is contained in:
lilia 2016-04-09 18:33:47 -07:00
parent 277ff11b3e
commit f3de290f7c
5 changed files with 102 additions and 13 deletions

View file

@ -5,6 +5,15 @@
'use strict';
window.Whisper = window.Whisper || {};
Whisper.DebugLogLinkView = Whisper.View.extend({
templateName: 'debug-log-link',
initialize: function(options) {
this.url = options.url;
},
render_attributes: function() {
return { url: this.url };
}
});
Whisper.DebugLogView = Whisper.View.extend({
templateName: 'debug-log',
className: 'debug-log modal',
@ -34,10 +43,13 @@
return;
}
console.post(log).then(function(url) {
var view = new Whisper.DebugLogLinkView({
url: url,
el: this.$('.result')
});
this.$('.loading').removeClass('loading');
var link = this.$('.result').find('a');
link.attr('href', url).text(url);
this.$('.result .hide').removeClass('hide');
view.render();
this.$('.link').focus().select();
}.bind(this));
this.$('.buttons, textarea').remove();
this.$('.result').addClass('loading');