mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
This flow broke a bit with transition to modal debug log. Restructure such that the loading class can be applied to an appropriate element inside the modal. Ensure that the input elements are hidden when submit is clicked, the result elements are shown when the log upload is completed. // FREEBIE
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
/*
|
|
* vim: ts=4:sw=4:expandtab
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
Whisper.DebugLogView = Whisper.View.extend({
|
|
templateName: 'debug-log',
|
|
className: 'debug-log modal',
|
|
initialize: function() {
|
|
this.render();
|
|
this.$('textarea').val(console.get());
|
|
},
|
|
events: {
|
|
'click .submit': 'submit',
|
|
'click .close': 'close'
|
|
},
|
|
render_attributes: {
|
|
title: i18n('submitDebugLog'),
|
|
cancel: i18n('cancel'),
|
|
submit: i18n('submit'),
|
|
close: i18n('gotIt'),
|
|
debugLogExplanation: i18n('debugLogExplanation')
|
|
},
|
|
close: function(e) {
|
|
e.preventDefault();
|
|
this.remove();
|
|
},
|
|
submit: function(e) {
|
|
e.preventDefault();
|
|
console.post(this.$('textarea').val()).then(function(url) {
|
|
this.$('.loading').removeClass('loading');
|
|
var link = this.$('.result').find('a');
|
|
link.attr('href', url).text(url);
|
|
this.$('.result .hide').removeClass('hide');
|
|
}.bind(this));
|
|
this.$('.buttons, textarea').remove();
|
|
this.$('.result').addClass('loading');
|
|
}
|
|
});
|
|
|
|
})();
|