         layout:   'top'
         type:     data.type
         theme:    'noty_theme_twitter'
-        animateOpen: { 
+        animateOpen: {
           height: 'toggle'
           opacity: 0.85,
         },

        closeOnSelfOver:  false
      }
    )
  
  destroy: (e) ->
    e.preventDefault()
#    $(e.target).parents('.alert').remove();

class App.Notify extends Spine.Controller
  className: 'container'
  events:
    'click .alert': 'destroy'

  constructor: ->
    super

    App.Event.bind 'notify', (data) =>
      @render(data)

    App.Event.bind 'notify:removeall', =>
      @log 'notify:removeall', @
      @destroyAll()

    App.Event.bind 'notifyDesktop', (data) =>
      if !data['icon']
        data['icon'] = 'unknown'
      notify.createNotification( data.msg, data )

    # request desktop notification after login
    App.Event.bind 'auth', (data) ->
      if !_.isEmpty(data)
        notify.requestPermission()

