Sha256: 8bb0fa4ba566124205559bbb05e31686d8b7dbe8cd3e3f556794357e4f6d885a

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

(function() {

  'use strict';

  var module = angular.module('herald.directives.status-button', [ 'ui.router' ]);

  module.controller('StatusButtonController', ['$state', '$scope', function($state, $scope) {

    $scope.$state = $state;

    $scope.navigate = function(route, idName, id) {
      var params = {};
      params[idName] = id;
      this.$state.go(route, params);
    };

  }]);

  module.directive('wsStatusButton', function() {
    return {
      restrict: 'E',
      scope: {
        status: '=',
        id: '=',
        idname: '=',
        route: '='
      },
      controller: 'StatusButtonController',
      templateUrl: 'components/directives/status-button.html'
    };
  });

  module.filter('colorizeStatus', function() {
    return function(input) {
      switch(input) {
        case 'unchanged': return 'success';
        case 'changed':   return 'info';
        case 'failed':    return 'danger';
        case 'pending':   return 'warning';
        default:          return 'default';
      }
    };
  });

  module.filter('iconizeStatus', function() {
    return function(input) {
      switch(input) {
        case 'unchanged': return 'ok';
        case 'changed':   return 'pencil';
        case 'failed':    return 'remove';
        case 'pending':   return 'asterisk';
        default:          return 'sign';
      }
    };
  });
})();

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-herald-0.8.1 lib/puppet-herald/public/components/directives/status-button.js
puppet-herald-0.8.0 lib/puppet-herald/public/components/directives/status-button.js