Project

General

Profile

1
var module = angular.module('reposUI', ['ngGrid', 'ngRoute', 'repoControllers']);
2

    
3
module.config([
4
	'$routeProvider',
5
	function ($routeProvider) {
6
		$routeProvider
7
			.when('/browse', {templateUrl: '../resources/html/repoBrowse.html', controller: 'repoBrowseCtrl'})
8
			.when('/list/:param/:value', {templateUrl: '../resources/html/repoList.html', controller: 'repoListCtrl'})
9
			.otherwise({redirectTo: '/browse'});
10
	}
11
]);
12

    
13
module.directive('compileTemplate', function ($compile, $parse) {
14
	return {
15
		link: function (scope, element, attr) {
16
			var parsed = $parse(attr.ngBindHtml);
17

    
18
			function getStringValue() {
19
				return (parsed(scope) || '').toString();
20
			}
21

    
22
			//Recompile if the template changes
23
			scope.$watch(getStringValue, function () {
24
				$compile(element, null, -9999)(scope);  //The -9999 makes it skip directives so that we do not recompile ourselves
25
			});
26
		}
27
	}
28
});
29

    
30
module.directive('tooltip', function () {
31
	return {
32
		restrict: 'A',
33
		link: function (scope, element, attrs) {
34
			$(element).tooltip();
35
		}
36
	}
37
});
38

    
39
module.filter('sprintf', function () {
40
	function parse(str) {
41
		var args = [].slice.call(arguments, 1),
42
			i = 0;
43
		return str.replace(/%s/g, function () {
44
			return args[i++];
45
		});
46
	}
47

    
48
	return function (str) {
49
		return parse(str, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
50
	};
51
});
52

    
53
module.directive('ngApiMdstoreInfo', function () {
54
	return {
55
		restrict: 'E',
56
		scope: {
57
			'label': '@',
58
			'date': '=',
59
			'total': '=',
60
			'id': '='
61
		},
62
		templateUrl: '../resources/html/ngApiMdstoreInfo.html'
63
	}
64
});
65

    
66
module.directive('ngApiObjectstoreInfo', function () {
67
	return {
68
		restrict: 'E',
69
		scope: {
70
			'label': '@',
71
			'date': '=',
72
			'total': '=',
73
			'id': '='
74
		},
75
		templateUrl: '../resources/html/ngApiObjectstoreInfo.html'
76
	}
77
});
78

    
79
module.directive('ngRepoCountryCell', function () {
80
	return {
81
		restrict: 'E',
82
		templateUrl: '../resources/html/ngRepoCountryCell.html'
83
	}
84
});
85

    
86
module.directive('ngReponameCell', function () {
87
	return {
88
		restrict: 'E',
89
		templateUrl: '../resources/html/ngRepoNameCell.html'
90
	}
91
});
92

    
93
module.directive('ngAggrDateCell', function () {
94
	return {
95
		restrict: 'E',
96
		templateUrl: '../resources/html/ngAggrDateCell.html'
97
	}
98
});
99

    
100
module.directive('ngAggrTotalCell', function () {
101
	return {
102
		restrict: 'E',
103
		templateUrl: '../resources/html/ngAggrTotalCell.html'
104
	}
105
});
(3-3/3)