mirror of
https://github.com/moparisthebest/mailcatcher
synced 2025-03-11 15:00:01 -04:00
Quit via "DELETE /" - this seems more elegant, somehow.
This commit is contained in:
parent
803a569ac8
commit
06f2238ef3
@ -17,6 +17,11 @@ module MailCatcher
|
||||
haml :index
|
||||
end
|
||||
|
||||
delete '/' do
|
||||
MailCatcher.quit!
|
||||
status 204
|
||||
end
|
||||
|
||||
get '/messages' do
|
||||
if request.websocket?
|
||||
request.websocket!(
|
||||
@ -110,11 +115,6 @@ module MailCatcher
|
||||
end
|
||||
end
|
||||
|
||||
get '/quit' do
|
||||
MailCatcher.quit!
|
||||
status 204
|
||||
end
|
||||
|
||||
not_found do
|
||||
"<html><body><h1>No Dice</h1><p>The message you were looking for does not exist, or doesn't have content of this type.</p></body></html>"
|
||||
end
|
||||
|
@ -5,12 +5,16 @@ class MailCatcher
|
||||
|
||||
$('#message .views .tab').live 'click', (e) =>
|
||||
@loadMessageBody $('#messages tr.selected').attr('data-message-id'), $(e.currentTarget).attr 'data-message-format'
|
||||
|
||||
$('nav.app .quit a').live 'click', (e) =>
|
||||
if confirm "You will lose all your received messages.\n\nAre you sure you want to click?"
|
||||
$.get '/quit'
|
||||
location.replace $('body > header h1 a').attr('href')
|
||||
|
||||
$('nav.app .quit a').live 'click', (e) =>
|
||||
if confirm "You will lose all your received messages.\n\nAre you sure you want to quit?"
|
||||
$.ajax
|
||||
type: 'DELETE'
|
||||
success: ->
|
||||
location.replace $('body > header h1 a').attr('href')
|
||||
error: ->
|
||||
alert 'Error while quitting.'
|
||||
|
||||
@refresh()
|
||||
@subscribe()
|
||||
|
||||
|
@ -10,9 +10,16 @@
|
||||
return this.loadMessageBody($('#messages tr.selected').attr('data-message-id'), $(e.currentTarget).attr('data-message-format'));
|
||||
}, this));
|
||||
$('nav.app .quit a').live('click', __bind(function(e) {
|
||||
if (confirm("You will lose all your received messages.\n\nAre you sure you want to click?")) {
|
||||
$.get('/quit');
|
||||
return location.replace($('body > header h1 a').attr('href'));
|
||||
if (confirm("You will lose all your received messages.\n\nAre you sure you want to quit?")) {
|
||||
return $.ajax({
|
||||
type: 'DELETE',
|
||||
success: function() {
|
||||
return location.replace($('body > header h1 a').attr('href'));
|
||||
},
|
||||
error: function() {
|
||||
return alert('Error while quitting.');
|
||||
}
|
||||
});
|
||||
}
|
||||
}, this));
|
||||
this.refresh();
|
||||
|
Loading…
x
Reference in New Issue
Block a user