Revision 57334
Added by Michele Artini over 4 years ago
organizations.js | ||
---|---|---|
9 | 9 |
.when('/byCountry/:page/:size/:code*', { templateUrl: 'resources/html/list.html', controller: 'byCountryCtrl' }) |
10 | 10 |
.when('/types', { templateUrl: 'resources/html/browse.html', controller: 'typesCtrl' }) |
11 | 11 |
.when('/byType/:page/:size/:type*', { templateUrl: 'resources/html/list.html', controller: 'byTypeCtrl' }) |
12 |
.when('/metadata/:id', { templateUrl: 'resources/html/edit.html', controller: 'showMetadataCtrl' })
|
|
12 |
.when('/metadata/:msg/:id', { templateUrl: 'resources/html/edit.html', controller: 'showMetadataCtrl' })
|
|
13 | 13 |
.when('/relations/:id', { templateUrl: 'resources/html/relations.html', controller: 'showRelationsCtrl' }) |
14 | 14 |
.when('/similarities/:id', { templateUrl: 'resources/html/similarities.html', controller: 'showSimilaritiesCtrl' }) |
15 | 15 |
.otherwise({ redirectTo: '/search' }); |
... | ... | |
68 | 68 |
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; |
69 | 69 |
$http.post('/api/organizations/save', $scope.org).then(function successCallback(res) { |
70 | 70 |
// alert('Organization saved !!!'); |
71 |
$location.url('/metadata/' + res.data[0]); |
|
71 |
$location.url('/metadata/1/' + res.data[0]);
|
|
72 | 72 |
}, function errorCallback(res) { |
73 | 73 |
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')'); |
74 | 74 |
}); |
... | ... | |
85 | 85 |
$scope.basepath = '/searchResults'; |
86 | 86 |
$scope.fieldValue = decodeURIComponent($routeParams.text); |
87 | 87 |
|
88 |
$scope.orgs = [];
|
|
88 |
$scope.orgs = {};
|
|
89 | 89 |
|
90 | 90 |
$http.get('/api/organizations/search/' + $routeParams.page + '/' + $routeParams.size + '?q=' + $scope.fieldValue).then(function successCallback(res) { |
91 | 91 |
$scope.orgs = res.data; |
... | ... | |
147 | 147 |
}); |
148 | 148 |
|
149 | 149 |
|
150 |
orgsModule.controller('showMetadataCtrl', function ($scope, $http, $routeParams, $route) { |
|
150 |
orgsModule.controller('showMetadataCtrl', function ($scope, $http, $routeParams, $route, $location, $timeout) {
|
|
151 | 151 |
$scope.orgId = $routeParams.id; |
152 | 152 |
$scope.org = {}; |
153 | 153 |
$scope.vocabularies = {}; |
154 | 154 |
|
155 |
if ($routeParams.msg == 1) { |
|
156 |
$scope.message = 'New organization registered !!!'; |
|
157 |
} else if ($routeParams.msg == 2) { |
|
158 |
$scope.message = 'Organization updated !!!'; |
|
159 |
} else { |
|
160 |
$scope.message = ''; |
|
161 |
} |
|
162 |
|
|
163 |
$timeout(function() { $scope.message = ''; }, 3000) |
|
164 |
|
|
155 | 165 |
$http.get('/api/vocabularies').then(function successCallback(res) { |
156 | 166 |
$scope.vocabularies = res.data; |
157 | 167 |
|
... | ... | |
167 | 177 |
$scope.save = function() { |
168 | 178 |
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; |
169 | 179 |
$http.post('/api/organizations/save', $scope.org).then(function successCallback(res) { |
170 |
// alert('Organization updated !!!');
|
|
171 |
$route.reload();
|
|
180 |
if ($routeParams.msg == 2) { $route.reload(); }
|
|
181 |
else { $location.url('/metadata/2/' + res.data[0]); }
|
|
172 | 182 |
}, function errorCallback(res) { |
173 | 183 |
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')'); |
174 | 184 |
}); |
Also available in: Unified diff