Made choice count in list facet into a link that lets you copy off the choices and their counts as TSV.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@613 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
f37d24e04a
commit
066fed7f3d
@ -126,7 +126,7 @@ ListFacet.prototype._initializeUI = function() {
|
|||||||
'<div class="facet-expression" bind="expressionDiv"></div>' +
|
'<div class="facet-expression" bind="expressionDiv"></div>' +
|
||||||
'<div class="facet-controls" bind="controlsDiv" style="display:none;"><div class="grid-layout layout-tightest layout-full">' +
|
'<div class="facet-controls" bind="controlsDiv" style="display:none;"><div class="grid-layout layout-tightest layout-full">' +
|
||||||
'<table><tr>' +
|
'<table><tr>' +
|
||||||
'<td><span bind="choiceCountContainer"></span> <span bind="sortGroup">sorted by ' +
|
'<td><a bind="choiceCountContainer" class="action" href="javascript:{}"></a> <span bind="sortGroup">sorted by ' +
|
||||||
'<input bind="sortByNameLink" type="radio" id="' + facet_id + '-name-sort" name="radio" checked="checked" /><label for="' + facet_id + '-name-sort">name</label>' +
|
'<input bind="sortByNameLink" type="radio" id="' + facet_id + '-name-sort" name="radio" checked="checked" /><label for="' + facet_id + '-name-sort">name</label>' +
|
||||||
'<input bind="sortByCountLink" type="radio" id="' + facet_id + '-count-sort" name="radio" /><label for="' + facet_id + '-count-sort">count</label>' +
|
'<input bind="sortByCountLink" type="radio" id="' + facet_id + '-count-sort" name="radio" /><label for="' + facet_id + '-count-sort">count</label>' +
|
||||||
'</span></td>' +
|
'</span></td>' +
|
||||||
@ -148,6 +148,7 @@ ListFacet.prototype._initializeUI = function() {
|
|||||||
this._elmts.resetButton.click(function() { self._reset(); });
|
this._elmts.resetButton.click(function() { self._reset(); });
|
||||||
this._elmts.invertButton.click(function() { self._invert(); });
|
this._elmts.invertButton.click(function() { self._invert(); });
|
||||||
|
|
||||||
|
this._elmts.choiceCountContainer.click(function() { self._copyChoices(); });
|
||||||
this._elmts.sortByCountLink.click(function() {
|
this._elmts.sortByCountLink.click(function() {
|
||||||
if (self._options.sort != "count") {
|
if (self._options.sort != "count") {
|
||||||
self._options.sort = "count";
|
self._options.sort = "count";
|
||||||
@ -182,6 +183,42 @@ ListFacet.prototype._initializeUI = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ListFacet.prototype._copyChoices = function() {
|
||||||
|
var self = this;
|
||||||
|
var frame = DialogSystem.createDialog();
|
||||||
|
frame.width("600px");
|
||||||
|
|
||||||
|
var header = $('<div></div>').addClass("dialog-header").text("Copy Facet Choices").appendTo(frame);
|
||||||
|
var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
|
||||||
|
var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame);
|
||||||
|
|
||||||
|
body.html('<textarea wrap="off" bind="textarea" style="display: block; width: 100%; height: 400px;" />');
|
||||||
|
var elmts = DOM.bind(body);
|
||||||
|
|
||||||
|
$('<button></button>').text("Done").click(function() {
|
||||||
|
DialogSystem.dismissUntil(level - 1);
|
||||||
|
}).appendTo(footer);
|
||||||
|
|
||||||
|
var lines = [];
|
||||||
|
for (var i = 0; i < this._data.choices.length; i++) {
|
||||||
|
var choice = this._data.choices[i];
|
||||||
|
lines.push(choice.v.l + "\t" + choice.c);
|
||||||
|
}
|
||||||
|
if (this._blankChoice) {
|
||||||
|
lines.push("(blank)\t" + this._blankChoice.c);
|
||||||
|
}
|
||||||
|
if (this._errorChoice) {
|
||||||
|
lines.push("(error)\t" + this._errorChoice.c);
|
||||||
|
}
|
||||||
|
|
||||||
|
var level = DialogSystem.showDialog(frame);
|
||||||
|
|
||||||
|
var textarea = elmts.textarea[0];
|
||||||
|
textarea.value = lines.join("\n");
|
||||||
|
textarea.focus();
|
||||||
|
textarea.select();
|
||||||
|
};
|
||||||
|
|
||||||
ListFacet.prototype._update = function(resetScroll) {
|
ListFacet.prototype._update = function(resetScroll) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user