Project

General

Profile

1
function common_init($scope, $http, $sce, $location) {
2
	$scope.currentRepoId = '';
3
	$scope.currentRepoName = '';
4
	$scope.currentRepo = '';
5
	
6
	$scope.go = function(path) {
7
		$location.path(path); 
8
	}
9
	
10
	$scope.showError = function(error) {
11
		show_notification("error", error);
12
	}
13
	
14
	$scope.showNotification = function(message) {
15
		show_notification("info", message);
16
	}
17
	
18
	$scope.showSpinner = function() {
19
		showSpinner();
20
	}
21

    
22
	$scope.hideSpinner = function() {
23
		hideSpinner();
24
	}
25
	
26
	initSpinner();
27
	
28
	$scope.showDetails = function(id, name) {
29
		$scope.showSpinner();
30

    
31
		$http.get('getRepoDetails.do?id=' + id)
32
        .success(
33
            function(data) {
34
            	$scope.currentRepoId = id;
35
            	$scope.currentRepoName = name;
36
            	$scope.currentRepo = data;
37
            	$scope.hideSpinner();
38
            	$('#repoDetailsModal').modal('show');
39
            }
40
        ).error(
41
            function() {
42
            	$scope.showError('Something really bad must have happened to our fellow hamster..');
43
            	$scope.hideSpinner();
44
            }
45
        );
46
	}
47
	
48
	$scope.resizeMainElement = function(elem) {
49
		var height = 0;
50
		var body = window.document.body;
51
		if (window.innerHeight) {
52
			height = window.innerHeight;
53
		} else if (body.parentElement.clientHeight) {
54
			height = body.parentElement.clientHeight;
55
		} else if (body && body.clientHeight) {
56
			height = body.clientHeight;
57
		}
58
		elem.style.height = ((height - elem.offsetTop - 80) + "px");
59
	}
60

    
61
	
62
}
(6-6/6)