Sha256: b08aeedb23c16dd20a637e8665a263b62f6891d4316b39b1fabc13094f46bff1

Contents?: true

Size: 1.11 KB

Versions: 30

Compression:

Stored size: 1.11 KB

Contents

module = angular.module('maestrano.components.mno-flash-msg',[])

#============================================
# Component 'Flash Msg'
#============================================
module.controller('MnoFlashMsgCtrl',[
  '$scope', 'MsgBus',
  ($scope, MsgBus) ->
    
    # Message bus connection
    $scope.errors = MsgBus.subscribe('errors')
    
    # Only show the flash message if
    # there are errors in the pipe
    $scope.isFlashShown = () ->
      $scope.errors().length > 0
    
    # Empty the errors array in the MsgBus
    $scope.closeFlash = () ->
      MsgBus.publish('errors',[])
    
])

module.directive('mnoFlashMsg', ['TemplatePath', (TemplatePath) ->
  return {
      restrict: 'A'
      scope: {}
      controller: 'MnoFlashMsgCtrl'
      template: '
      <div class="alert alert-error alert-top fade" ng-class="isFlashShown() && \'in\'">
        <button class="close" ng-click="closeFlash()">&times;</button>
        <strong>Snap! This action couldn\'t be performed.</strong>
        <ul>
          <li ng-repeat="error in errors()">
            {{error}}
          </li>
        </ul>
      </div>'
    }
])

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
mno-enterprise-frontend-3.4.0 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.3.3 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.3.2 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.2.1 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.3.1 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.3.0 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.2.0 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.1.4 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.0.7 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-2.0.9 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.1.3 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.0.6 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-2.0.8 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.1.2 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.0.5 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-2.0.7 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-2.0.6 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-2.0.5 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.1.1 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee
mno-enterprise-frontend-3.0.4 app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee