Added case sensitive and regex checkboxes to text search facets.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@337 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-03-22 23:01:53 +00:00
parent f5d270e35a
commit 6d8776953d
4 changed files with 40 additions and 22 deletions

View File

@ -40,27 +40,46 @@ TextSearchFacet.prototype.hasSelection = function() {
TextSearchFacet.prototype._initializeUI = function() { TextSearchFacet.prototype._initializeUI = function() {
var self = this; var self = this;
var container = this._div.empty(); this._div.empty().html(
'<div class="facet-title">' +
'<img bind="removeButton" src="images/close.png" title="Remove this facet" class="facet-choice-link" />' +
'<span>' + this._config.name + '</span>' +
'</div>' +
'<div class="facet-text-body"><div class="grid-layout layout-tightest layout-full"><table>' +
'<tr><td colspan="2"><div class="input-container"><input bind="input" /></div></td></tr>' +
'<tr><td width="1%"><input type="checkbox" bind="caseSensitiveCheckbox" /></td><td>case sensitive</td></tr>' +
'<tr><td width="1%"><input type="checkbox" bind="regexCheckbox" /></td><td>regular expression</td></tr>' +
'</table></div></div>'
);
var headerDiv = $('<div></div>').addClass("facet-title").appendTo(container); var elmts = DOM.bind(this._div);
$('<span></span>').text(this._config.name).appendTo(headerDiv);
var removeButton = $('<img>') if (this._config.caseSensitive) {
.attr("src", "images/close.png") elmts.caseSensitiveCheckbox.attr("checked", "true");
.attr("title", "Remove this facet") }
.addClass("facet-choice-link") if (this._config.mode == "regex") {
.click(function() { elmts.regexCheckbox.attr("checked", "true");
self._remove(); }
}).prependTo(headerDiv);
var bodyDiv = $('<div></div>').addClass("facet-text-body").appendTo(container); elmts.removeButton.click(function() { self._remove(); });
var input = $('<input />').appendTo(bodyDiv); elmts.caseSensitiveCheckbox.bind("change", function() {
input.keyup(function(evt) { self._config.caseSensitive = this.checked;
if (self._query != null && self._query.length > 0) {
self._scheduleUpdate();
}
});
elmts.regexCheckbox.bind("change", function() {
self._config.mode = this.checked ? "regex" : "text";
if (self._query != null && self._query.length > 0) {
self._scheduleUpdate();
}
});
elmts.input.keyup(function(evt) {
self._query = this.value; self._query = this.value;
self._scheduleUpdate(); self._scheduleUpdate();
}); }).focus();
input[0].focus();
}; };
TextSearchFacet.prototype.updateState = function(data) { TextSearchFacet.prototype.updateState = function(data) {

View File

@ -213,7 +213,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
ui.browsingEngine.addFacet( ui.browsingEngine.addFacet(
"text", "text",
{ {
"name" : self._column.name + " (regex)", "name" : self._column.name,
"columnName" : self._column.name, "columnName" : self._column.name,
"mode" : "regex", "mode" : "regex",
"caseSensitive" : true "caseSensitive" : true

View File

@ -1,3 +1,7 @@
body {
background: white;
}
#body { #body {
padding: 0; padding: 0;
margin: 0; margin: 0;

View File

@ -143,8 +143,3 @@ img.facet-choice-link {
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 5px; padding: 5px;
} }
.facet-text-body input {
width: 98%;
}