diff --git a/src/main/webapp/scripts/project/data-table-cell-ui.js b/src/main/webapp/scripts/project/data-table-cell-ui.js index 7038a6851..55b0ab503 100644 --- a/src/main/webapp/scripts/project/data-table-cell-ui.js +++ b/src/main/webapp/scripts/project/data-table-cell-ui.js @@ -50,73 +50,74 @@ DataTableCellUI.prototype._render = function() { }); } else { $(divContent).html(cell.v); - $(' ').appendTo(divContent); - var ul = $('
').addClass("data-table-recon-candidates").appendTo(divContent); - if (this._dataTableView._showRecon && "c" in r && r.c.length > 0) { - var candidates = r.c; - var renderCandidate = function(candidate, index) { - var li = $('').addClass("data-table-recon-candidate").appendTo(ul); + if (this._dataTableView._showRecon) { + var ul = $('').addClass("data-table-recon-candidates").appendTo(divContent); + if ("c" in r && r.c.length > 0) { + var candidates = r.c; + var renderCandidate = function(candidate, index) { + var li = $('').addClass("data-table-recon-candidate").appendTo(ul); + + $(' ') + .addClass("data-table-recon-match-similar") + .attr("title", "Match this topic to this cell and other cells with the same content") + .appendTo(li).click(function(evt) { + self._doMatchTopicToSimilarCells(candidate); + }); + + $(' ') + .addClass("data-table-recon-match") + .attr("title", "Match this topic to this cell") + .appendTo(li).click(function(evt) { + self._doMatchTopicToOneCell(candidate); + }); + + $('') + .addClass("data-table-recon-topic") + .attr("href", "http://www.freebase.com/view" + candidate.id) + .attr("target", "_blank") + .click(function(evt) { + self._previewCandidateTopic(candidate.id, this); + evt.preventDefault(); + return false; + }) + .text(candidate.name) + .appendTo(li); + + $('').addClass("data-table-recon-score").text("(" + Math.round(candidate.score) + ")").appendTo(li); + }; - $(' ') - .addClass("data-table-recon-match-similar") - .attr("title", "Match this topic to this cell and other cells with the same content") - .appendTo(li).click(function(evt) { - self._doMatchTopicToSimilarCells(candidate); - }); - - $(' ') - .addClass("data-table-recon-match") - .attr("title", "Match this topic to this cell") - .appendTo(li).click(function(evt) { - self._doMatchTopicToOneCell(candidate); - }); - - $('') - .addClass("data-table-recon-topic") - .attr("href", "http://www.freebase.com/view" + candidate.id) - .attr("target", "_blank") - .click(function(evt) { - self._previewCandidateTopic(candidate.id, this); - evt.preventDefault(); - return false; - }) - .text(candidate.name) - .appendTo(li); - - $('').addClass("data-table-recon-score").text("(" + Math.round(candidate.score) + ")").appendTo(li); - }; - - for (var i = 0; i < candidates.length; i++) { - renderCandidate(candidates[i], i); + for (var i = 0; i < candidates.length; i++) { + renderCandidate(candidates[i], i); + } } + + var liNew = $('').addClass("data-table-recon-candidate").appendTo(ul); + $(' ') + .addClass("data-table-recon-match-similar") + .attr("title", "Create a new topic for this cell and other cells with the same content") + .appendTo(liNew).click(function(evt) { + self._doMatchNewTopicToSimilarCells(); + }); + + $(' ') + .addClass("data-table-recon-match") + .attr("title", "Create a new topic for this cell") + .appendTo(liNew).click(function(evt) { + self._doMatchNewTopicToOneCell(); + }); + + $('').text("(New topic)").appendTo(liNew); + + $('') + .addClass("data-table-recon-search") + .click(function(evt) { + self._searchForMatch(); + return false; + }) + .text("search for match") + .appendTo($('