Project

General

Profile

« Previous | Next » 

Revision 57326

ui

View differences:

organizations.js
67 67
	$scope.save = function() {
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
			alert('Organization saved !!!');
70
//			alert('Organization saved !!!');
71 71
			$location.url('/metadata/' + res.data[0]);
72 72
		}, function errorCallback(res) {
73 73
			alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
......
167 167
	$scope.save = function() {
168 168
		$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
169 169
		$http.post('/api/organizations/save', $scope.org).then(function successCallback(res) {
170
			alert('Organization updated !!!');
170
//			alert('Organization updated !!!');
171 171
			$route.reload();
172 172
		}, function errorCallback(res) {
173 173
			alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
......
185 185
	$scope.searchValue = '';
186 186
	$scope.searchOrgs = [];
187 187
	$scope.newRelType='';
188
	$scope.newRelation = {};
188 189
	
189 190
	$http.get('/api/vocabularies').then(function successCallback(res) {
190 191
		$scope.vocabularies = res.data;
......
198 199
		alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
199 200
	});
200 201
	
201
	$scope.addRelation = function(to) {
202
	$scope.prepareNewRelation = function(o) {
203
		$scope.newRelation = o;
204
	}
205
		
206
	$scope.addRelation = function() {
202 207
		$http.put('/api/organizations/relations', null, { 
203
			'params': { 'from': $scope.orgId, 'to': to, 'type': $scope.newRelType }
208
			'params': { 'from': $scope.orgId, 'to': $scope.newRelation.id, 'type': $scope.newRelType }
204 209
		}).then(function successCallback(res) {
205 210
			$scope.rels = res.data;
206 211
			$scope.newRelType = '';
207
			alert("Relation added !!!")
212
			$scope.newRelation = {};
213
//			alert("Relation added !!!")
208 214
		}, function errorCallback(res) {
209 215
			alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
210 216
		});
......
215 221
			'params': { 'from': $scope.orgId, 'to': to, 'type': type }
216 222
		}).then(function successCallback(res) {
217 223
			$scope.rels = res.data;
218
			alert("Relation deleted !!!")
224
//			alert("Relation deleted !!!")
219 225
		}, function errorCallback(res) {
220 226
			alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
221 227
		});

Also available in: Unified diff