lib/puppet-herald/public/components/directives/status-button.js in puppet-herald-0.2.0 vs lib/puppet-herald/public/components/directives/status-button.js in puppet-herald-0.8.0
- old
+ new
@@ -1,30 +1,30 @@
(function() {
'use strict';
- var module = angular.module('herald.directives.status-button', [
+ var module = angular.module('herald.directives.status-button', [ 'ui.router' ]);
- ]);
+ module.controller('StatusButtonController', ['$state', '$scope', function($state, $scope) {
- module.controller('StatusButtonController', ['$location', '$scope', function($location, $scope) {
+ $scope.$state = $state;
- $scope.$location = $location;
-
- $scope.navigate = function(route, id) {
- var target = route.replace(':id', id);
- this.$location.path(target);
+ $scope.navigate = function(route, idName, id) {
+ var params = {};
+ params[idName] = id;
+ this.$state.go(route, params);
};
}]);
- module.directive('ngStatusButton', function() {
+ module.directive('wsStatusButton', function() {
return {
restrict: 'E',
scope: {
status: '=',
id: '=',
+ idname: '=',
route: '='
},
controller: 'StatusButtonController',
templateUrl: 'components/directives/status-button.html'
};
@@ -37,11 +37,11 @@
case 'changed': return 'info';
case 'failed': return 'danger';
case 'pending': return 'warning';
default: return 'default';
}
- }
+ };
});
module.filter('iconizeStatus', function() {
return function(input) {
switch(input) {
@@ -49,8 +49,8 @@
case 'changed': return 'pencil';
case 'failed': return 'remove';
case 'pending': return 'asterisk';
default: return 'sign';
}
- }
+ };
});
})();
\ No newline at end of file