Skip to content
Snippets Groups Projects
Commit 3be11992 authored by Mark M. Florida's avatar Mark M. Florida
Browse files

XNAT-4515: newly created PI can now be immediately edited

parent 8ee718bb
No related branches found
No related tags found
No related merge requests found
...@@ -131,13 +131,13 @@ var XNAT = getObject(XNAT); ...@@ -131,13 +131,13 @@ var XNAT = getObject(XNAT);
}; };
// return array of ids of selected investigators // return array of ids of selected investigators
Investigators.fn.getSelected = function(){ Investigators.fn.getSelected = function(i){
var self = this; var self = this;
this.selected = []; this.selected = [];
this.menu$.find(':selected').each(function(){ this.menu$.find(':selected').each(function(){
self.selected.push(this.value) self.selected.push(this.value)
}); });
return this.selected; return i || i === 0 ? this.selected[i] : this.selected;
}; };
// renders the <option> elements // renders the <option> elements
...@@ -326,6 +326,10 @@ var XNAT = getObject(XNAT); ...@@ -326,6 +326,10 @@ var XNAT = getObject(XNAT);
} }
// update the menu associated with the dialog // update the menu associated with the dialog
self.updateMenu([].concat(self.getSelected(), (!setPrimary ? selected : []))); self.updateMenu([].concat(self.getSelected(), (!setPrimary ? selected : [])));
// set the PI if editing/creating PI
if (setPrimary) {
investigators.primary = selected;
}
dialog.close(); dialog.close();
} }
}); });
......
...@@ -288,6 +288,7 @@ ...@@ -288,6 +288,7 @@
var editPrimary = spawn('a#edit-primary|href=#!', 'Edit Selected'); var editPrimary = spawn('a#edit-primary|href=#!', 'Edit Selected');
editPrimary.onclick = function(){ editPrimary.onclick = function(){
// investigators.primary = primaryMenu.getSelected(0);
if (investigators.primary !== 'NULL') { if (investigators.primary !== 'NULL') {
primaryMenu.dialog(investigators.primary) primaryMenu.dialog(investigators.primary)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment