From ad6e8c2e0c23c076461ca48d49afaf65ec686cf2 Mon Sep 17 00:00:00 2001 From: Stefano Mazzocchi Date: Tue, 16 Mar 2010 06:53:08 +0000 Subject: [PATCH] add the ability to browse the values of a particular cluster git-svn-id: http://google-refine.googlecode.com/svn/trunk@304 7d457c2a-affb-35e4-300a-418c747d4874 --- .../scripts/dialogs/clustering-dialog.js | 43 ++++++++++++++++++- .../styles/dialogs/clustering-dialog.css | 15 ++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/scripts/dialogs/clustering-dialog.js b/src/main/webapp/scripts/dialogs/clustering-dialog.js index e839e23d3..d3257bb93 100644 --- a/src/main/webapp/scripts/dialogs/clustering-dialog.js +++ b/src/main/webapp/scripts/dialogs/clustering-dialog.js @@ -154,6 +154,20 @@ ClusteringDialog.prototype._renderTable = function(clusters) { $(tr.insertCell(0)).text(cluster.choices.length); $(tr.insertCell(1)).text(cluster.rowCount); + + var facet = { + "c": { + "type":"list", + "name": self._columnName, + "columnName": self._columnName, + "expression":"value" + }, + "o":{ + "sort":"name" + }, + "s":[ + ] + }; var ul = $(''); var choices = cluster.choices; @@ -169,9 +183,36 @@ ClusteringDialog.prototype._renderTable = function(clusters) { }).appendTo(li); $('').text("(" + choice.c + " rows)").addClass("clustering-dialog-entry-count").appendTo(li); rowCount += choice.c; + facet.s[c] = { + "v": { + "v":choice.v, + "l":choice.v + } + }; li.appendTo(ul); } - $(tr.insertCell(2)).append(ul); + + var params = [ + "project=" + escape(theProject.id), + "ui=" + escape(JSON.stringify({ + "facets" : [ facet ] + })) + ]; + var url = "project.html?" + params.join("&"); + + var div = $('
').addClass("clustering-dialog-value-focus"); + + var browseLink = $('Browse this cluster') + .addClass("clustering-dialog-browse-focus") + .attr("href",url) + .css("visibility","hidden") + .appendTo(div); + + $(tr.insertCell(2)) + .mouseenter(function() { browseLink.css("visibility", "visible"); }) + .mouseleave(function() { browseLink.css("visibility", "hidden"); }) + .append(ul) + .append(div); var editCheck = $('') .change(function() { diff --git a/src/main/webapp/styles/dialogs/clustering-dialog.css b/src/main/webapp/styles/dialogs/clustering-dialog.css index 285f1c755..d02d6a349 100644 --- a/src/main/webapp/styles/dialogs/clustering-dialog.css +++ b/src/main/webapp/styles/dialogs/clustering-dialog.css @@ -35,6 +35,10 @@ table.clustering-dialog-entry-table a { text-decoration: none; } +table.clustering-dialog-entry-table ul { + margin: 1em 0em 0em 0em; +} + table.clustering-dialog-entry-table a:hover { text-decoration: underline } @@ -69,4 +73,13 @@ table.clustering-dialog-entry-table a:hover { .clustering-dialog-facet-selection { text-align: center; color: #888; -} \ No newline at end of file +} + +.clustering-dialog-value-focus { + text-align: right; + font-size: 80%; +} +.clustering-dialog-value-focus a { + text-decoration: none; + visibility: hidden; +}