summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-06-22 19:10:48 +0000
committerDamien F. Katz <damien@apache.org>2009-06-22 19:10:48 +0000
commite05e90e517a4ee6c5a710bf6b289a956b1363cd9 (patch)
tree8e137f546ee04ebeb98065a8532d32a05b5ade35 /share
parentc6b388eeeac6517eb649d8b8d04874902836a39e (diff)
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
Diffstat (limited to 'share')
-rw-r--r--share/www/database.html24
-rw-r--r--share/www/script/futon.browse.js7
-rw-r--r--share/www/style/layout.css7
3 files changed, 38 insertions, 0 deletions
diff --git a/share/www/database.html b/share/www/database.html
index fbc0a5d7..3a93ce0c 100644
--- a/share/www/database.html
+++ b/share/www/database.html
@@ -108,7 +108,26 @@ specific language governing permissions and limitations under the License.
$("#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 @@ specific language governing permissions and limitations under the License.
<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>
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js
index a360a343..e518c9ab 100644
--- a/share/www/script/futon.browse.js
+++ b/share/www/script/futon.browse.js
@@ -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) {
diff --git a/share/www/style/layout.css b/share/www/style/layout.css
index 7cf89e3b..d6e66d0a 100644
--- a/share/www/style/layout.css
+++ b/share/www/style/layout.css
@@ -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;