Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Added 'Jump to Document' in the database.htmlscreen. Would like maybe…
… to see in the future about making it limit input to only existing doc ids, and perhaps only show on the 'All documents' view.

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@787354 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Damien F. Katz committed Jun 22, 2009
1 parent a3f53d4 commit 7e1ebae4e8172537bba9cb44c52012d7dad2ac3d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
@@ -108,7 +108,26 @@
$("#toolbar button.add").click(page.addDocument);
$("#toolbar button.compact").click(page.compactDatabase);
$("#toolbar button.delete").click(page.deleteDatabase);

$('#jumpto input').suggest(function(text, callback) {
page.db.allDocs({
limit: 10, startkey: text, endkey: text + 'zzz',
success: function(docs) {
var matches = [];
for (var i = 0; i < docs.rows.length; i++) {
if (docs.rows[i].id.indexOf(text) == 0) {
matches[i] = docs.rows[i].id;
}
}
callback(matches);
}
});
});

$("#jumpto input").keypress(page.jumpToDocument);

});

</script>
</head>

@@ -126,6 +145,11 @@ <h1>
<option value="_temp_view">Temporary view…</option>
</select></label>
</div>
<div id="jumpto">
<label>Jump to document:
<input type="text" name="docid" />
</label>
</div>
<ul id="toolbar">
<li><button class="add">Create Document …</button></li>
<li><button class="compact">Compact Database</button></li>
@@ -466,6 +466,13 @@
}
}

this.jumpToDocument = function(e) {
if (e.which == 13) {
var docid = $('#jumpto input').val();
location.href = 'document.html?' + encodeURIComponent(db.name) + '/' + encodeDocId(docid);
}
}

this.updateDocumentListing = function(options) {
if (options === undefined) options = {};
if (options.limit === undefined) {
@@ -274,6 +274,13 @@ ul.suggest-dropdown li.selected { cursor: pointer; background: Highlight;
visibility: hidden;
}

/* Document quick jump */

#jumpto { float: right; padding: 5px 10px 5px 5px; line-height: 16px;
font-weight: bold; color: #666; font-size: 90%; }

#jumpto input { font-size: 90%; }

/* View selector */

#switch { color: #666; float: right; font-size: 90%; font-weight: bold;

0 comments on commit 7e1ebae

Please sign in to comment.