Sha256: 4fc3c508a2e74e9a9029d18d3b3c0b65c919552e63b897eece22baa8a59acab2

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

angular.module('EssayApp.directives').directive("notificationField", ['$timeout', ($timeout) ->
  restrict: 'A'
  scope: true
  require: "?ngModel"
  link: (scope, element, attrs, ngModel) ->    
    fn = () ->
      ngModel.$modelValue

    init = ->
      defaults =
        show: 'slideDown'
        hide: 'slideUp'
        timeout: 5000
      options = $.extend defaults, angular.fromJson(attrs.notification)

      $.each attrs.notificationField.split(' '), (index, field)->
        scope.notifications[field] = ->
          $(element)[options.show]()
          $timeout(
            ->
              $(element)[options.hide]()
            , options.timeout)
    init()

])

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/assets/javascripts/app/directives/notification_field.js.coffee