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 {
$(divContent).html(cell.v);
$('<span> </span>').appendTo(divContent);
var ul = $('<div></div>').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 = $('<div></div>').addClass("data-table-recon-candidate").appendTo(ul);
if (this._dataTableView._showRecon) {
var ul = $('<div></div>').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 = $('<div></div>').addClass("data-table-recon-candidate").appendTo(ul);
$('<a href="javascript:{}">&nbsp;</a>')
.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);
});
$('<a href="javascript:{}">&nbsp;</a>')
.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);
});
$('<a href="javascript:{}">&nbsp;</a>')
.addClass("data-table-recon-match")
.attr("title", "Match this topic to this cell")
.appendTo(li).click(function(evt) {
self._doMatchTopicToOneCell(candidate);
});
$('<a href="javascript:{}">&nbsp;</a>')
.addClass("data-table-recon-match")
.attr("title", "Match this topic to this cell")
.appendTo(li).click(function(evt) {
self._doMatchTopicToOneCell(candidate);
});
$('<a></a>')
.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);
$('<a></a>')
.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);
$('<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++) {
renderCandidate(candidates[i], i);
for (var i = 0; i < candidates.length; 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;";
} else {
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);
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._reSortChoices();
self.render();
}).appendTo(footerDiv);
} 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._reSortChoices();
self.render();
}).appendTo(footerDiv);
}
$('<span>').html(" &bull; ").appendTo(footerDiv);
$('<a href="javascript:{}"></a>').addClass("action").text("refresh").click(function() {
ui.browsingEngine.update();
}).appendTo(footerDiv);
}
};