From c451b2ded5801ee7343c21eacad5265824469490 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Sat, 16 Oct 2010 06:21:00 +0000 Subject: [PATCH] Re-laid out 'cell search for match' dialog so buttons wouldn't be obscured by suggest dropdown. Also added 'new' button. Made sure history widget is always scrolled to the 'done upto here' bar. git-svn-id: http://google-refine.googlecode.com/svn/trunk@1579 7d457c2a-affb-35e4-300a-418c747d4874 --- .../cell-recon-search-for-match.html | 20 ++++++++++++------ .../core/scripts/views/data-table/cell-ui.js | 21 ++++++++++++++----- .../core/scripts/widgets/history-widget.js | 20 +++++++++--------- .../modules/core/styles/project/sidebar.less | 1 + .../modules/core/styles/util/dialog.less | 1 - 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/main/webapp/modules/core/scripts/views/data-table/cell-recon-search-for-match.html b/main/webapp/modules/core/scripts/views/data-table/cell-recon-search-for-match.html index 5dcce5ee1..b5e89532f 100644 --- a/main/webapp/modules/core/scripts/views/data-table/cell-recon-search-for-match.html +++ b/main/webapp/modules/core/scripts/views/data-table/cell-recon-search-for-match.html @@ -1,18 +1,26 @@ -
+
Search for Match
-
- +
Search Freebase for topic to match
+ - + + + + + + + +
Search for "" Match other cells with same content
Match other cells with same content
Match this cell only
\ No newline at end of file diff --git a/main/webapp/modules/core/scripts/views/data-table/cell-ui.js b/main/webapp/modules/core/scripts/views/data-table/cell-ui.js index 3f8541dc8..ed0e52d4c 100644 --- a/main/webapp/modules/core/scripts/views/data-table/cell-ui.js +++ b/main/webapp/modules/core/scripts/views/data-table/cell-ui.js @@ -271,7 +271,7 @@ DataTableCellUI.prototype._searchForMatch = function(suggestOptions) { }).join(",") }; - if (elmts.checkSimilar[0].checked) { + if (elmts.radioSimilar[0].checked) { params.similarValue = self._cell.v; params.columnName = Refine.cellIndexToColumn(self._cellIndex).name; @@ -282,19 +282,30 @@ DataTableCellUI.prototype._searchForMatch = function(suggestOptions) { self._postProcessOneCell("recon-judge-one-cell", {}, params, true); } - - DialogSystem.dismissUntil(level - 1); + + dismiss(); } }; + var commitNew = function() { + if (elmts.radioSimilar[0].checked) { + self._doMatchNewTopicToSimilarCells(); + } else { + self._doMatchNewTopicToOneCell(); + } + dismiss(); + }; elmts.okButton.click(commit); - elmts.cancelButton.click(function() { DialogSystem.dismissUntil(level - 1); }); + elmts.newButton.click(commitNew); + elmts.cancelButton.click(dismiss); var level = DialogSystem.showDialog(frame); + var dismiss = function() { DialogSystem.dismissUntil(level - 1); }; + var suggestOptions2 = $.extend({ align: "left" }, suggestOptions || { all_types: true }); elmts.input .attr("value", this._cell.v) - .suggest(suggestOptions || { all_types: true }) + .suggest(suggestOptions2) .bind("fb-select", function(e, data) { match = data; commit(); diff --git a/main/webapp/modules/core/scripts/widgets/history-widget.js b/main/webapp/modules/core/scripts/widgets/history-widget.js index 2ccdc3ff4..6f3690489 100644 --- a/main/webapp/modules/core/scripts/widgets/history-widget.js +++ b/main/webapp/modules/core/scripts/widgets/history-widget.js @@ -7,9 +7,14 @@ function HistoryWidget(div, tabHeader) { HistoryWidget.prototype.resize = function() { var body = this._div.find(".history-panel-body"); var controls = this._div.find(".history-panel-controls"); - var bodyPaddings = body.outerHeight(true) - body.height(); + var nowDiv = this._div.find(".history-now"); - body.css("height", (this._div.height() - controls.outerHeight(true) - bodyPaddings) + "px"); + var bodyPaddings = body.outerHeight(true) - body.height(); + body.height((this._div.height() - controls.outerHeight(true) - bodyPaddings) + "px"); + body[0].scrollTop = + nowDiv[0].offsetTop + + nowDiv[0].offsetHeight - + body[0].offsetHeight; }; HistoryWidget.prototype.update = function(onDone) { @@ -54,7 +59,7 @@ HistoryWidget.prototype._render = function() { var elmts = DOM.bind(this._div); - var renderEntry = function(container, entry, lastDoneID, title) { + var renderEntry = function(container, index, entry, lastDoneID, title) { var a = $('').appendTo(container); a.addClass("history-entry").html(entry.description).attr("title", title).click(function(evt) { return self._onClickHistoryEntry(evt, entry, lastDoneID); @@ -68,7 +73,7 @@ HistoryWidget.prototype._render = function() { } else { for (var i = 0; i < this._data.past.length; i++) { var entry = this._data.past[i]; - renderEntry(elmts.pastDiv, entry, i === 0 ? 0 : this._data.past[i - 1].id, "Undo to here"); + renderEntry(elmts.pastDiv, i, entry, i === 0 ? 0 : this._data.past[i - 1].id, "Undo to here"); } } @@ -77,7 +82,7 @@ HistoryWidget.prototype._render = function() { } else { for (var i = 0; i < this._data.future.length; i++) { var entry = this._data.future[i]; - renderEntry(elmts.futureDiv, entry, entry.id, "Redo to here"); + renderEntry(elmts.futureDiv, this._data.past.length + i, entry, entry.id, "Redo to here"); } } @@ -90,11 +95,6 @@ HistoryWidget.prototype._render = function() { elmts.applyLink.click(function() { self._showApplyOperationsDialog(); }); this.resize(); - - elmts.bodyDiv[0].scrollTop = - elmts.nowDiv[0].offsetTop + - elmts.nowDiv[0].offsetHeight - - elmts.bodyDiv[0].offsetHeight; }; HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID) { diff --git a/main/webapp/modules/core/styles/project/sidebar.less b/main/webapp/modules/core/styles/project/sidebar.less index d900bb141..d7b5d6b9a 100644 --- a/main/webapp/modules/core/styles/project/sidebar.less +++ b/main/webapp/modules/core/styles/project/sidebar.less @@ -63,6 +63,7 @@ .history-panel-body { background: #fff; overflow: auto; + border-top: 1px solid @chrome_primary; } .history-panel-message { diff --git a/main/webapp/modules/core/styles/util/dialog.less b/main/webapp/modules/core/styles/util/dialog.less index b42e5e287..5603a6de8 100644 --- a/main/webapp/modules/core/styles/util/dialog.less +++ b/main/webapp/modules/core/styles/util/dialog.less @@ -49,7 +49,6 @@ } .dialog-footer button { - margin-left: 5px; } .dialog-busy-frame {