mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-12-21 23:08:54 -05:00
Make sure message count is updated everywhere
This commit is contained in:
parent
e1ee9eefc9
commit
c577f06ba0
@ -54,6 +54,7 @@ class MailCatcher
|
||||
type: "DELETE"
|
||||
success: =>
|
||||
@unselectMessage()
|
||||
@updateMessagesCount()
|
||||
error: ->
|
||||
alert "Error while clearing all messages."
|
||||
|
||||
@ -111,6 +112,7 @@ class MailCatcher
|
||||
@loadMessage switchTo
|
||||
else
|
||||
@unselectMessage()
|
||||
@updateMessagesCount()
|
||||
|
||||
error: ->
|
||||
alert "Error while removing message."
|
||||
@ -118,6 +120,7 @@ class MailCatcher
|
||||
|
||||
@refresh()
|
||||
@subscribe()
|
||||
@updateMessagesCount()
|
||||
|
||||
# Only here because Safari's Date parsing *sucks*
|
||||
# We throw away the timezone, but you could use it for something...
|
||||
@ -139,6 +142,10 @@ class MailCatcher
|
||||
messagesCount: ->
|
||||
$("#messages tr").length - 1
|
||||
|
||||
updateMessagesCount: ->
|
||||
title = $("head title")
|
||||
title.text(title.text().replace(/^\(\d*\)/, "(#{@messagesCount()})"))
|
||||
|
||||
tabs: ->
|
||||
$("#message ul").children(".tab")
|
||||
|
||||
@ -190,8 +197,7 @@ class MailCatcher
|
||||
.append($("<td/>").text(message.subject or "No subject").toggleClass("blank", !message.subject))
|
||||
.append($("<td/>").text(@formatDate(message.created_at)))
|
||||
.prependTo($("#messages tbody"))
|
||||
title = $('head title')
|
||||
title.text(title.text().replace(/^\(\d*\)/, "(#{@messagesCount()})"))
|
||||
@updateMessagesCount()
|
||||
|
||||
scrollToRow: (row) ->
|
||||
relativePosition = row.offset().top - $("#messages").offset().top
|
||||
|
Loading…
Reference in New Issue
Block a user