When rendering recon candidates and matches, check for freebase ID on the recon object's identifier space, not the service's identifier space. This lets matches added by the "extend data" operation to be rendered properly as links.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1058 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-07-01 02:29:27 +00:00
parent a1ae492a4d
commit b47ada4dca

View File

@ -67,12 +67,10 @@ DataTableCellUI.prototype._render = function() {
.attr("target", "_blank") .attr("target", "_blank")
.appendTo(divContent); .appendTo(divContent);
if (service) { if (service && (service.view) && (service.view.url)) {
if ((service.view) && (service.view.url)) { a.attr("href", service.view.url.replace("{{id}}", match.id));
a.attr("href", service.view.url.replace("{{id}}", match.id)); } else if (ReconciliationManager.isFreebaseId(r.identifierSpace)) {
} else if (ReconciliationManager.isFreebaseId(service.identifierSpace)) { a.attr("href", "http://www.freebase.com/view" + match.id);
a.attr("href", "http://www.freebase.com/view" + match.id);
}
} }
$('<span> </span>').appendTo(divContent); $('<span> </span>').appendTo(divContent);
@ -113,29 +111,26 @@ DataTableCellUI.prototype._render = function() {
.text(candidate.name) .text(candidate.name)
.appendTo(li); .appendTo(li);
if (service) { if ((service) && (service.view) && (service.view.url)) {
if ((service.view) && (service.view.url)) { a.attr("href", service.view.url.replace("{{id}}", candidate.id));
a.attr("href", service.view.url.replace("{{id}}", candidate.id)); } else if (ReconciliationManager.isFreebaseId(r.identifierSpace)) {
} else if (ReconciliationManager.isFreebaseId(service.identifierSpace)) { a.attr("href", "http://www.freebase.com/view" + candidate.id);
a.attr("href", "http://www.freebase.com/view" + candidate.id); }
}
var preview = null; var preview = null;
if (service.preview) { if ((service) && (service.preview)) {
preview = service.preview; preview = service.preview;
} else if (ReconciliationManager.isFreebaseId(service.identifierSpace)) { } else if (ReconciliationManager.isFreebaseId(r.identifierSpace)) {
preview = DataTableCellUI.topicBlockPreview; preview = DataTableCellUI.topicBlockPreview;
} }
if (preview) {
if (preview) { a.click(function(evt) {
a.click(function(evt) { if (!evt.metaKey && !evt.ctrlKey) {
if (!evt.metaKey && !evt.ctrlKey) { self._previewCandidateTopic(candidate, this, preview);
self._previewCandidateTopic(candidate, this, preview); evt.preventDefault();
evt.preventDefault(); return false;
return false; }
} });
});
}
} }
var score; var score;
@ -169,27 +164,24 @@ DataTableCellUI.prototype._render = function() {
$('<span>').text("(New topic)").appendTo(liNew); $('<span>').text("(New topic)").appendTo(liNew);
if (service) { var suggestOptions;
var suggestOptions; var addSuggest = false;
var addSuggest = false; if ((service) && (service.suggest) && (service.suggest.entity)) {
suggestOptions = service.suggest.entity;
addSuggest = true;
} else if (ReconciliationManager.isFreebaseId(r.identifierSpace)) {
addSuggest = true;
}
if ((service.suggest) && (service.suggest.entity)) { if (addSuggest) {
suggestOptions = service.suggest.entity; $('<a href="javascript:{}"></a>')
addSuggest = true; .addClass("data-table-recon-search")
} else if (ReconciliationManager.isFreebaseId(service.identifierSpace)) { .click(function(evt) {
addSuggest = true; self._searchForMatch(suggestOptions);
} return false;
})
if (addSuggest) { .text("search for match")
$('<a href="javascript:{}"></a>') .appendTo($('<div>').appendTo(divContent));
.addClass("data-table-recon-search")
.click(function(evt) {
self._searchForMatch(suggestOptions);
return false;
})
.text("search for match")
.appendTo($('<div>').appendTo(divContent));
}
} }
} }
} }