Display facet's expression separately from title, so that later we can let the user edit the expression.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@514 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-21 07:21:05 +00:00
parent f4e7630357
commit c05272e1ed
4 changed files with 30 additions and 16 deletions

View File

@ -110,6 +110,7 @@ ListFacet.prototype._initializeUI = function() {
'<img src="images/close.png" title="Remove this facet" class="facet-choice-link" bind="removeButton"/>' +
'<span bind="titleSpan"></span>' +
'</div>' +
'<div class="facet-expression" bind="expressionDiv"></div>' +
'<div class="facet-status" bind="statusDiv" style="display:none;"><div class="grid-layout layout-tightest layout-full">' +
'<table><tr>' +
'<td bind="choiceCountContainer"></td>' +
@ -132,6 +133,7 @@ ListFacet.prototype._initializeUI = function() {
this._elmts = DOM.bind(this._div);
this._elmts.titleSpan.text(this._config.name);
this._elmts.expressionDiv.text(this._config.expression);
this._elmts.removeButton.click(function() { self._remove(); });
this._elmts.resetButton.click(function() { self._reset(); });
@ -173,6 +175,9 @@ ListFacet.prototype._update = function(resetScroll) {
}
this._elmts.bodyDiv.empty();
if (!("scroll" in this._options) || this._options.scroll) {
this._elmts.bodyDiv.resizable();
}
if (!this._data) {
this._elmts.statusDiv.hide();

View File

@ -102,6 +102,7 @@ RangeFacet.prototype._initializeUI = function() {
'<a href="javascript:{}" class="facet-choice-link" bind="resetButton">reset</a>' +
'<span bind="facetTitle"></span>' +
'</div>' +
'<div class="facet-expression" bind="expressionDiv"></div>' +
'<div class="facet-range-body">' +
'<div class="facet-range-message" bind="messageDiv">Loading...</div>' +
'<div class="facet-range-slider" bind="sliderWidgetDiv">' +
@ -114,6 +115,8 @@ RangeFacet.prototype._initializeUI = function() {
this._elmts = DOM.bind(this._div);
this._elmts.facetTitle.text(this._config.name);
this._elmts.expressionDiv.text(this._config.expression);
this._elmts.resetButton.click(function() {
self.reset();
self._updateRest();

View File

@ -112,7 +112,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.name + " value.split(' ')",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "value.split(' ')"
}
@ -126,7 +126,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": value.log()",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "value.log()",
"mode" : "range"
@ -140,7 +140,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": log(max(1, value))",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "log(max(1, value))",
"mode" : "range"
@ -155,7 +155,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": value.length()",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "value.length()",
"mode" : "range"
@ -169,7 +169,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": value.length().log()",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "value.length().log()",
"mode" : "range"
@ -183,7 +183,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": value.unicode()",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "value.unicode()",
"mode" : "range"
@ -198,7 +198,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.name + ": Error?",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "isError(value)"
}
@ -211,7 +211,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.name + ": Blank?",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "isBlank(value)"
}
@ -418,7 +418,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.name + ": judgment",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "cell.recon.judgment",
"omitError" : true
@ -436,7 +436,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": best candidate's score",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "cell.recon.best.score",
"mode" : "range"
@ -452,7 +452,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.name + ": best candidate's type match",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "cell.recon.features.typeMatch",
"omitError" : true
@ -469,7 +469,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.name + ": best candidate's name match",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "cell.recon.features.nameMatch",
"omitError" : true
@ -487,7 +487,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": best candidate's name edit distance",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "cell.recon.features.nameLevenshtein",
"mode" : "range"
@ -503,7 +503,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"range",
{
"name" : self._column.name + ": best candidate's name word similarity",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "cell.recon.features.nameWordDistance",
"mode" : "range"
@ -520,7 +520,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.name + ": best candidate's types",
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : "cell.recon.best.type",
"omitError" : true
@ -541,7 +541,7 @@ DataTableColumnHeaderUI.prototype._doFilterByExpressionPrompt = function(express
expression,
function(expression) {
var config = {
"name" : self._column.name + ": " + expression,
"name" : self._column.name,
"columnName" : self._column.name,
"expression" : expression
};

View File

@ -51,6 +51,12 @@ li.facet-container {
font-weight: bold;
cursor: move;
}
.facet-expression {
padding: 3px 5px;
font-family: monospace;
font-size: 11px;
background: #eee;
}
.facet-status {
font-size: 90%;