Permalink
Browse files

Namespaced the notifications.

  • Loading branch information...
1 parent 23b0d66 commit 39bee1305241a745b211b3a42178399f43fdeb9a Alex Kalderimis committed Mar 12, 2012
Showing with 11 additions and 11 deletions.
  1. +11 −11 Notifications.coffee
View
@@ -2,15 +2,14 @@
root = exports ? this
-root.bbgrowl ?= new Object()
+root.growlr ?= new Object()
-root.bbgrowl.NotificationContainer = NotificationContainer
-root.bbgrowl.Notification = Notification
+growlr = root.growlr
# Alias for convenience.
View = Backbone.View
-class NotificationContainer extends Backbone.View
+class growlr.NotificationContainer extends Backbone.View
tagName: "ul"
@@ -32,29 +31,30 @@ class NotificationContainer extends Backbone.View
# Sets the options as passed in.
# Starts listing for notification events
initialize: (options) ->
+ options ?= {}
_.defaults options, @defaults
- _.extend @, options
+ @settings = options
@render().mediator?.on @eventName, @notify
@
# Create a new notification.
notify: (options) ->
- _.defaults options, @ # Set the pre-set default values.
- @$el.append new Notification(options).render().el
+ _.defaults options, @settings
+ @$el.append new growlr.Notification(options).render().el
# Add the container element.
render: ->
@$el.appendTo 'body'
- @$el.addClass @classes
- if @extraClasses
- @$el.addClass @extraClasses
+ @$el.addClass @settings.classes
+ if @settings.extraClasses
+ @$el.addClass @settings.extraClasses
@$el.data view: "bbgrowl.NotificationContainer"
@
# The individual notification.
# ----------
-class Notification extends View
+class growlr.Notification extends View
# Element does not exist yet, but will be a `<li>`.
tagName: "li"

0 comments on commit 39bee13

Please sign in to comment.