Fixed minor bug introduced in last change: recon candidates didn't get rendered at all.

Added "refresh" link for list facets.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@133 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-02-23 20:20:14 +00:00
parent 2eb3a67125
commit e449617960
3 changed files with 73 additions and 66 deletions

View File

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

View File

@ -255,7 +255,7 @@ DataTableView.prototype.render = function() {
td.innerHTML = "&nbsp;"; td.innerHTML = "&nbsp;";
} else { } else {
var cell = (column.cellIndex < cells.length) ? cells[column.cellIndex] : null; var cell = (column.cellIndex < cells.length) ? cells[column.cellIndex] : null;
new DataTableCellUI(this, cell, row.i, column.cellIndex, td); new DataTableCellUI(self, cell, row.i, column.cellIndex, td);
} }
} }
}; };

View File

@ -150,18 +150,24 @@ ListFacet.prototype.render = function() {
var footerDiv = $('<div></div>').addClass("facet-footer").appendTo(container); var footerDiv = $('<div></div>').addClass("facet-footer").appendTo(container);
if (this._options.sort == "name") { if (this._options.sort == "name") {
$('<a href="javascript:{}"></a>').addClass("action").text("re-sort choices by count").click(function() { $('<a href="javascript:{}"></a>').addClass("action").text("re-sort by count").click(function() {
self._options.sort = "count"; self._options.sort = "count";
self._reSortChoices(); self._reSortChoices();
self.render(); self.render();
}).appendTo(footerDiv); }).appendTo(footerDiv);
} else { } else {
$('<a href="javascript:{}"></a>').addClass("action").text("re-sort choices by name").click(function() { $('<a href="javascript:{}"></a>').addClass("action").text("re-sort by name").click(function() {
self._options.sort = "name"; self._options.sort = "name";
self._reSortChoices(); self._reSortChoices();
self.render(); self.render();
}).appendTo(footerDiv); }).appendTo(footerDiv);
} }
$('<span>').html(" &bull; ").appendTo(footerDiv);
$('<a href="javascript:{}"></a>').addClass("action").text("refresh").click(function() {
ui.browsingEngine.update();
}).appendTo(footerDiv);
} }
}; };