From b9308e4034edb0a87b45f044cac820edff147a4a Mon Sep 17 00:00:00 2001 From: David Huynh Date: Sat, 6 Mar 2010 23:34:27 +0000 Subject: [PATCH] Added option to apply and recluster in the facet based edit dialog. git-svn-id: http://google-refine.googlecode.com/svn/trunk@222 7d457c2a-affb-35e4-300a-418c747d4874 --- .../dialogs/facet-based-edit-dialog.js | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/scripts/dialogs/facet-based-edit-dialog.js b/src/main/webapp/scripts/dialogs/facet-based-edit-dialog.js index cdb064014..a646bc68b 100644 --- a/src/main/webapp/scripts/dialogs/facet-based-edit-dialog.js +++ b/src/main/webapp/scripts/dialogs/facet-based-edit-dialog.js @@ -95,8 +95,9 @@ FacetBasedEditDialog.prototype._createDialog = function() { //this._elmts.clusterButton.click(function() { self._cluster(); }); //this._elmts.unclusterButton.click(function() { self._uncluster(); }); - $('').text("OK").click(function() { self._onOK(); }).appendTo(footer); - $('').text("Cancel").click(function() { self._dismiss(); }).appendTo(footer); + $('').text("Apply & Re-Cluster").click(function() { self._onApplyReCluster(); }).appendTo(footer); + $('').text("Apply & Close").click(function() { self._onApplyClose(); }).appendTo(footer); + $('').text("Close").click(function() { self._dismiss(); }).appendTo(footer); this._level = DialogSystem.showDialog(frame); @@ -193,7 +194,21 @@ FacetBasedEditDialog.prototype._cluster = function() { ); } -FacetBasedEditDialog.prototype._onOK = function() { +FacetBasedEditDialog.prototype._onApplyClose = function() { + var self = this; + this._apply(function() { + self._dismiss(); + }); +}; + +FacetBasedEditDialog.prototype._onApplyReCluster = function() { + var self = this; + this._apply(function() { + self._cluster(); + }); +}; + +FacetBasedEditDialog.prototype._apply = function(onDone) { var edits = []; for (var i = 0; i < this._clusters.length; i++) { var cluster = this._clusters[i]; @@ -219,10 +234,14 @@ FacetBasedEditDialog.prototype._onOK = function() { expression: this._expression, edits: JSON.stringify(edits) }, - { cellsChanged: true } + { cellsChanged: true }, + { + onError: function(o) { + alert("Error: " + o.message); + }, + onDone: onDone + } ); - - this._dismiss(); } else { alert("You must check some Edit? checkboxes for your edits to be applied."); }