From 3d0c6e4865d4a0ddd764da533a327faf76e0cb32 Mon Sep 17 00:00:00 2001
From: Roberto Sánchez <roberto.sanchez@curisit.net>
Date: Fri, 10 Jan 2014 18:50:52 +0000
Subject: [PATCH] #394 feature - Catalog module finished in beta - Security and Error management are not completed
---
securis/src/main/resources/static/js/catalogs.js | 35 ++++++++++++-----------------------
1 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/securis/src/main/resources/static/js/catalogs.js b/securis/src/main/resources/static/js/catalogs.js
index 6b854fe..cde7a57 100644
--- a/securis/src/main/resources/static/js/catalogs.js
+++ b/securis/src/main/resources/static/js/catalogs.js
@@ -11,24 +11,15 @@
var resources = {
application : $resource('/application/:appId', {
appId : '@id'
- }, {
- update : {
- method : "PUT"
- }
}),
user : $resource('/user/:userId', {
- userId : '@id'
- }, {
- update : {
- method : "PUT"
- }
+ userId : '@username'
+ }),
+ organization : $resource('/organization/:orgId', {
+ orgId : '@id'
}),
licensetype : $resource('/licensetype/:licenseTypeId', {
licenseTypeId : '@id'
- }, {
- update : {
- method : "PUT"
- }
})
}
@@ -96,8 +87,8 @@
this.getFFF = this.getFirstFocusableField = function() {
if (!_current) throw new Error('There is no current catalog selected');
- for(var i = i; i < _current.fields.length; i++)
- if (f.readOnly) return f.name;
+ for(var i = 0; i < _current.fields.length; i++)
+ if (!_current.fields[i].readOnly) return _current.fields[i].name;
return null;
}
@@ -135,10 +126,7 @@
if (!_current) throw new Error('There is no current catalog selected');
var resource = this.getResource();
- if (data.id && data.id !== '')
- return resource.update(data, _success, _fail);
- else
- return resource.save(data, _success, _fail);
+ return resource.save(data, _success, _fail);
}
this.remove = function(data) {
return this.getResource().remove({}, data, _success, _fail)
@@ -165,18 +153,19 @@
console.log('promises: ' + promises.length + ' ')
console.log(promises)
$q.all(promises).then(function() {
- console.log('ALL promises OK :::::::::::::::::::::::::::: ')
for (var k in refs) {
- var pk = that.getPk(that.getMetadata(k))
- console.log('PK for '+k+' is ' + pk);
+ var pk = that.getPk(that.getMetadata(that.getField(k).resource))
+ console.log('PK field for ' + k + ' is ' + pk)
var comboData = []
refs[k].forEach(function(row) {
comboData.push({
id: row[pk],
- label: row.label || row.name || row.code
+ label: row.label || row.name || row.code || row.first_name + ' ' + row.last_name
});
})
refs[k] = comboData;
+ console.log('Ready for combo for ' + k)
+ console.log(comboData);
}
})
--
Gitblit v1.3.2