NIHVIVO-2343 Combine the code for ProxyPanel and ProfilePanel. Remove unused code.
This commit is contained in:
parent
61b14bb1cd
commit
b87c811831
5 changed files with 130 additions and 273 deletions
|
@ -48,7 +48,7 @@ function itemElement(template, uri, label, classLabel, imageUrl, removeInfo) {
|
|||
this.removeInfo = removeInfo;
|
||||
|
||||
this.toString = function() {
|
||||
return "proxyInfoElement: " + content;
|
||||
return "itemElement: " + content;
|
||||
}
|
||||
|
||||
this.element = function() {
|
||||
|
@ -70,67 +70,6 @@ function itemElement(template, uri, label, classLabel, imageUrl, removeInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* proxyInfoElement
|
||||
* ----------------------------------------------------------------------------
|
||||
* Display information about an entity according to the template. The entity
|
||||
* can be either:
|
||||
* a profile -- Individual to be edited.
|
||||
* a proxy -- User Account to do the editing, optionally with info from a
|
||||
* profile associated with that individual.
|
||||
*
|
||||
* You provide:
|
||||
* template -- the HTML text that determines how the element should look.
|
||||
* uri, label, classLabel, imageUrl -- as described below
|
||||
* remove -- a function that we can call when the user clicks on the remove
|
||||
* link or button. We will pass a reference to this struct.
|
||||
* ----------------------------------------------------------------------------
|
||||
* The template must inlude a link or button with attribute templatePart="remove"
|
||||
*
|
||||
* The template may include tokens to be replaced, from the following:
|
||||
* %uri% -- the URI of the individual being displayed
|
||||
* %label& -- the label of the individual.
|
||||
* %classLabel% -- the label of the most specific class of the individual.
|
||||
* %imageUrl% -- the URL that will fetch the image of the individual,
|
||||
* or a placeholder image.
|
||||
* ----------------------------------------------------------------------------
|
||||
* This relies on magic names for the styles:
|
||||
* existingProxyItem -- for an item that was present when the page was loaded
|
||||
* newProxyItem -- for an item that was added since the page was loaded
|
||||
* removedProxyItem -- added to an item when the "remove" link is cheked.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
function proxyInfoElement(template, uri, label, classLabel, imageUrl, removeInfo) {
|
||||
var self = this;
|
||||
|
||||
this.uri = uri;
|
||||
this.label = label;
|
||||
this.classLabel = classLabel;
|
||||
this.imageUrl = (imageUrl) ? imageUrl : imageUrl="../images/placeholders/person.thumbnail.jpg";
|
||||
|
||||
this.toString = function() {
|
||||
return "proxyInfoElement: " + content;
|
||||
}
|
||||
|
||||
this.element = function() {
|
||||
var content = template.replace(/%uri%/g, this.uri)
|
||||
.replace(/%label%/g, this.label)
|
||||
.replace(/%classLabel%/g, this.classLabel)
|
||||
.replace(/%imageUrl%/g, this.imageUrl);
|
||||
|
||||
var element = $("<div class='proxyInfoElement' name='proxyInfoElement'>" + content + "</div>");
|
||||
|
||||
var removeLink = $("[templatePart='remove']", element).first();
|
||||
removeLink.click(function(event) {
|
||||
removeInfo(self);
|
||||
return false;
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* proxyAutoComplete
|
||||
|
@ -141,11 +80,11 @@ function proxyInfoElement(template, uri, label, classLabel, imageUrl, removeInfo
|
|||
* parms -- a map containing the URL of the AJAX controller, the query, and
|
||||
* the model selector.
|
||||
* excludedUris -- these URIs are always filtered out of the results.
|
||||
* getProxyInfos -- a function that will return an array of proxyInfoElements
|
||||
* getProxyInfos -- a function that will return an array of itemElements
|
||||
* that are already present in the list and so should be filtered out of
|
||||
* the autocomplete response.
|
||||
* addProxyInfo -- a function that we can call when an item is selected.
|
||||
* It will take the selection info, build a proxyInfoElement, and add
|
||||
* It will take the selection info, build an itemElement, and add
|
||||
* it to the panel.
|
||||
* reportSearchStatus -- a function that we can call when a search is done. It
|
||||
* will accept the length of the search term and the number of results,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue