mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-11-16 06:05:02 -05:00
extracted unselectMessage
This commit is contained in:
parent
2e35d0cc9d
commit
b3a4e86a48
@ -42,9 +42,7 @@ class MailCatcher
|
|||||||
url: '/messages'
|
url: '/messages'
|
||||||
type: 'DELETE'
|
type: 'DELETE'
|
||||||
success: ->
|
success: ->
|
||||||
$('#messages tbody, #message .metadata dd').empty()
|
@unselectMessage()
|
||||||
$('#message .metadata .attachments').hide()
|
|
||||||
$('#message iframe').attr 'src', 'about:blank'
|
|
||||||
error: ->
|
error: ->
|
||||||
alert 'Error while quitting.'
|
alert 'Error while quitting.'
|
||||||
|
|
||||||
@ -101,9 +99,7 @@ class MailCatcher
|
|||||||
if switchTo
|
if switchTo
|
||||||
@loadMessage switchTo
|
@loadMessage switchTo
|
||||||
else
|
else
|
||||||
$('#message .metadata dd').empty()
|
@unselectMessage()
|
||||||
$('#message .metadata .attachments').hide()
|
|
||||||
$('#message iframe').attr 'src', 'about:blank'
|
|
||||||
|
|
||||||
error: ->
|
error: ->
|
||||||
alert 'Error while removing message.'
|
alert 'Error while removing message.'
|
||||||
@ -193,6 +189,12 @@ class MailCatcher
|
|||||||
if overflow > 0
|
if overflow > 0
|
||||||
$('#messages').scrollTop($('#messages').scrollTop() + overflow + 20)
|
$('#messages').scrollTop($('#messages').scrollTop() + overflow + 20)
|
||||||
|
|
||||||
|
unselectMessage: ->
|
||||||
|
$('#messages tbody, #message .metadata dd').empty()
|
||||||
|
$('#message .metadata .attachments').hide()
|
||||||
|
$('#message iframe').attr 'src', 'about:blank'
|
||||||
|
null
|
||||||
|
|
||||||
loadMessage: (id) ->
|
loadMessage: (id) ->
|
||||||
id = id.id if id?.id?
|
id = id.id if id?.id?
|
||||||
id ||= $('#messages tr.selected').attr 'data-message-id'
|
id ||= $('#messages tr.selected').attr 'data-message-id'
|
||||||
|
@ -62,9 +62,7 @@
|
|||||||
url: '/messages',
|
url: '/messages',
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
success: function() {
|
success: function() {
|
||||||
$('#messages tbody, #message .metadata dd').empty();
|
return this.unselectMessage();
|
||||||
$('#message .metadata .attachments').hide();
|
|
||||||
return $('#message iframe').attr('src', 'about:blank');
|
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
return alert('Error while quitting.');
|
return alert('Error while quitting.');
|
||||||
@ -133,9 +131,7 @@
|
|||||||
if (switchTo) {
|
if (switchTo) {
|
||||||
return _this.loadMessage(switchTo);
|
return _this.loadMessage(switchTo);
|
||||||
} else {
|
} else {
|
||||||
$('#message .metadata dd').empty();
|
return _this.unselectMessage();
|
||||||
$('#message .metadata .attachments').hide();
|
|
||||||
return $('#message iframe').attr('src', 'about:blank');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
@ -260,6 +256,13 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MailCatcher.prototype.unselectMessage = function() {
|
||||||
|
$('#messages tbody, #message .metadata dd').empty();
|
||||||
|
$('#message .metadata .attachments').hide();
|
||||||
|
$('#message iframe').attr('src', 'about:blank');
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
MailCatcher.prototype.loadMessage = function(id) {
|
MailCatcher.prototype.loadMessage = function(id) {
|
||||||
var messageRow,
|
var messageRow,
|
||||||
_this = this;
|
_this = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user