mirror of https://github.com/perkeep/perkeep.git
Merge "ui: always reset blobcontainer children upon a search"
This commit is contained in:
commit
1eb2866d0f
|
@ -249,11 +249,11 @@ function(sigconf) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Show tagged
|
||||
* Search and show permanodes matching the specified criteria.
|
||||
* @param {string} sigconf
|
||||
* @param {string} attr
|
||||
* @param {string} value
|
||||
* @param {boolean} fuzzy
|
||||
* @param {boolean} fuzzy Noop because not supported yet.
|
||||
* @param {number} max max number of items in response.
|
||||
*/
|
||||
camlistore.BlobItemContainer.prototype.showWithAttr =
|
||||
|
@ -453,10 +453,10 @@ function() {
|
|||
* @private
|
||||
*/
|
||||
camlistore.BlobItemContainer.prototype.showRecentDone_ = function(result) {
|
||||
this.resetChildren_();
|
||||
if (!result || !result.recent) {
|
||||
return;
|
||||
}
|
||||
this.resetChildren_();
|
||||
for (var i = 0, n = result.recent.length; i < n; i++) {
|
||||
var blobRef = result.recent[i].blobref;
|
||||
var item = new camlistore.BlobItem(blobRef, result.meta);
|
||||
|
@ -469,6 +469,7 @@ camlistore.BlobItemContainer.prototype.showRecentDone_ = function(result) {
|
|||
* @private
|
||||
*/
|
||||
camlistore.BlobItemContainer.prototype.showWithAttrDone_ = function(result) {
|
||||
this.resetChildren_();
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
@ -477,7 +478,6 @@ camlistore.BlobItemContainer.prototype.showWithAttrDone_ = function(result) {
|
|||
if (!results || !meta) {
|
||||
return;
|
||||
}
|
||||
this.resetChildren_();
|
||||
for (var i = 0, n = results.length; i < n; i++) {
|
||||
var blobRef = results[i].permanode;
|
||||
var item = new camlistore.BlobItem(blobRef, meta);
|
||||
|
@ -491,6 +491,7 @@ camlistore.BlobItemContainer.prototype.showWithAttrDone_ = function(result) {
|
|||
*/
|
||||
camlistore.BlobItemContainer.prototype.findByBlobrefDone_ =
|
||||
function(permanode, result) {
|
||||
this.resetChildren_();
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
@ -498,7 +499,6 @@ function(permanode, result) {
|
|||
if (!meta || !meta[permanode]) {
|
||||
return;
|
||||
}
|
||||
this.resetChildren_();
|
||||
var item = new camlistore.BlobItem(permanode, meta);
|
||||
this.addChild(item, true);
|
||||
};
|
||||
|
|
|
@ -263,6 +263,9 @@ function(e) {
|
|||
e.preventDefault();
|
||||
|
||||
var searchText = goog.dom.getElement("searchText");
|
||||
if (!!searchText && searchText.value == "") {
|
||||
return;
|
||||
}
|
||||
searchText.disabled = true;
|
||||
var btnSearch = goog.dom.getElement("btnSearch");
|
||||
btnSearch.disabled = true;
|
||||
|
@ -274,13 +277,10 @@ function(e) {
|
|||
// search by tag
|
||||
attr = "tag";
|
||||
value = searchText.value.slice(this.searchPrefix_.TAG.length);
|
||||
// TODO(mpl): allow fuzzy option for tag search. How?
|
||||
// ":fuzzy" at the end of search string maybe?
|
||||
} else if (searchText.value.indexOf(this.searchPrefix_.TITLE) == 0) {
|
||||
// search by title
|
||||
attr = "title";
|
||||
value = searchText.value.slice(this.searchPrefix_.TITLE.length);
|
||||
// TODO(mpl): fuzzy search seems to be broken for title. investigate.
|
||||
} else if (searchText.value.indexOf(this.searchPrefix_.BLOBREF) == 0) {
|
||||
// or query directly by blobref (useful to get a permanode and set it
|
||||
// as the default collection)
|
||||
|
@ -292,6 +292,7 @@ function(e) {
|
|||
btnSearch.disabled = false;
|
||||
return;
|
||||
} else {
|
||||
// For when we support full text search again.
|
||||
attr = "";
|
||||
value = searchText.value;
|
||||
fuzzy = true;
|
||||
|
|
Loading…
Reference in New Issue