Skip to content

Commit

Permalink
Remove notification level after hiding. Fixes #200
Browse files Browse the repository at this point in the history
    Not sure if hide() could ever be triggered without triggering show() first,
    but set the level default inside hide() just in case.
  • Loading branch information
jaredhirsch committed Oct 2, 2013
1 parent e769c51 commit 47f56d7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/notification.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class Annotator.Notification extends Delegator
#
# Returns itself.
show: (message, status=Annotator.Notification.INFO) =>
@currentStatus = status
$(@element)
.addClass(@options.classes.show)
.addClass(@options.classes[status])
.addClass(@options.classes[@currentStatus])
.html(Util.escape(message || ""))

setTimeout this.hide, 5000
Expand All @@ -70,7 +71,10 @@ class Annotator.Notification extends Delegator
#
# Returns itself.
hide: =>
$(@element).removeClass(@options.classes.show)
@currentStatus ?= Annotator.Notification.INFO
$(@element)
.removeClass(@options.classes.show)
.removeClass(@options.classes[@currentStatus])
this

# Constants for controlling the display of the notification. Each constant
Expand Down

0 comments on commit 47f56d7

Please sign in to comment.