mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-11-16 14:15:08 -05: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
|
haml :index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
delete '/' do
|
||||||
|
MailCatcher.quit!
|
||||||
|
status 204
|
||||||
|
end
|
||||||
|
|
||||||
get '/messages' do
|
get '/messages' do
|
||||||
if request.websocket?
|
if request.websocket?
|
||||||
request.websocket!(
|
request.websocket!(
|
||||||
@ -110,11 +115,6 @@ module MailCatcher
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/quit' do
|
|
||||||
MailCatcher.quit!
|
|
||||||
status 204
|
|
||||||
end
|
|
||||||
|
|
||||||
not_found do
|
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>"
|
"<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
|
end
|
||||||
|
@ -7,9 +7,13 @@ class MailCatcher
|
|||||||
@loadMessageBody $('#messages tr.selected').attr('data-message-id'), $(e.currentTarget).attr 'data-message-format'
|
@loadMessageBody $('#messages tr.selected').attr('data-message-id'), $(e.currentTarget).attr 'data-message-format'
|
||||||
|
|
||||||
$('nav.app .quit a').live 'click', (e) =>
|
$('nav.app .quit a').live 'click', (e) =>
|
||||||
if confirm "You will lose all your received messages.\n\nAre you sure you want to click?"
|
if confirm "You will lose all your received messages.\n\nAre you sure you want to quit?"
|
||||||
$.get '/quit'
|
$.ajax
|
||||||
|
type: 'DELETE'
|
||||||
|
success: ->
|
||||||
location.replace $('body > header h1 a').attr('href')
|
location.replace $('body > header h1 a').attr('href')
|
||||||
|
error: ->
|
||||||
|
alert 'Error while quitting.'
|
||||||
|
|
||||||
@refresh()
|
@refresh()
|
||||||
@subscribe()
|
@subscribe()
|
||||||
|
@ -10,9 +10,16 @@
|
|||||||
return this.loadMessageBody($('#messages tr.selected').attr('data-message-id'), $(e.currentTarget).attr('data-message-format'));
|
return this.loadMessageBody($('#messages tr.selected').attr('data-message-id'), $(e.currentTarget).attr('data-message-format'));
|
||||||
}, this));
|
}, this));
|
||||||
$('nav.app .quit a').live('click', __bind(function(e) {
|
$('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?")) {
|
if (confirm("You will lose all your received messages.\n\nAre you sure you want to quit?")) {
|
||||||
$.get('/quit');
|
return $.ajax({
|
||||||
|
type: 'DELETE',
|
||||||
|
success: function() {
|
||||||
return location.replace($('body > header h1 a').attr('href'));
|
return location.replace($('body > header h1 a').attr('href'));
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
return alert('Error while quitting.');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
Loading…
Reference in New Issue
Block a user