Add UI for submitting debug logs

Fixes #343

// FREEBIE
This commit is contained in:
lilia 2015-09-15 23:28:00 -07:00
parent 9809894fd2
commit 90e9216e19
5 changed files with 137 additions and 4 deletions

View file

@ -0,0 +1,35 @@
/*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.DebugLogView = Whisper.View.extend({
templateName: 'debug-log',
className: 'debug-log',
initialize: function() {
this.render();
this.$('textarea').val(console.get());
},
events: {
'submit': 'submit',
'click .close': 'close'
},
close: function(e) {
e.preventDefault();
this.remove();
},
submit: function(e) {
e.preventDefault();
console.post(this.$('textarea').val()).then(function(url) {
this.$el.removeClass('loading');
var link = this.$('.result').show().find('a');
link.attr('href', url).text(url);
}.bind(this));
this.$('form').remove();
this.$el.addClass('loading');
}
});
})();

View file

@ -71,7 +71,7 @@
});
Whisper.InboxView = Whisper.View.extend({
template: $('#two-column').html(),
templateName: 'two-column',
className: 'inbox',
initialize: function (options) {
this.render();
@ -105,6 +105,9 @@
}).$el.appendTo(this.$('#header'));
},
events: {
'click': 'closeMenu',
'click .hamburger': 'toggleMenu',
'click .show-debug-log': 'showDebugLog',
'click .fab': 'showCompose',
'select .gutter .contact': 'openConversation'
},
@ -121,6 +124,18 @@
},
hideCompose: function() {
this.newConversationView.$el.remove();
},
toggleMenu: function() {
this.$('.global-menu .menu-list').toggle();
},
showDebugLog: function() {
this.$('.debug-log').remove();
new Whisper.DebugLogView().$el.appendTo(this.el);
},
closeMenu: function(e) {
if (e && !$(e.target).hasClass('hamburger')) {
this.$('.global-menu .menu-list').hide();
}
}
});
});