couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject git commit: updated refs/heads/master to 4ed8a8a
Date Thu, 26 Dec 2013 15:27:59 GMT
Updated Branches:
  refs/heads/master acde720fc -> 4ed8a8ad1


Search for invalid database name or doc id throws error


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4ed8a8ad
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4ed8a8ad
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4ed8a8ad

Branch: refs/heads/master
Commit: 4ed8a8ad1b48a456015543a770907806b1e1709b
Parents: acde720
Author: suelockwood <deathbear@apache.org>
Authored: Thu Dec 26 10:27:17 2013 -0500
Committer: suelockwood <deathbear@apache.org>
Committed: Thu Dec 26 10:27:44 2013 -0500

----------------------------------------------------------------------
 src/fauxton/app/modules/databases/views.js    | 24 +++++++++++++---------
 src/fauxton/app/templates/databases/list.html |  9 ++++----
 src/fauxton/assets/less/fauxton.less          |  9 +++++---
 3 files changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/4ed8a8ad/src/fauxton/app/modules/databases/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/modules/databases/views.js
index 0b4e0b0..dbeb475 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -42,8 +42,7 @@ function(app, Components, FauxtonAPI, Databases) {
     template: "templates/databases/list",
     events: {
       "click button.all": "selectAll",
-      "submit form.database-search": "switchDatabase",
-      "click label.fonticon-search": "switchDatabase"
+      "submit form#jump-to-db": "switchDatabase"
     },
 
     initialize: function(options) {
@@ -72,18 +71,23 @@ function(app, Components, FauxtonAPI, Databases) {
     switchDatabase: function(event, selectedName) {
       event && event.preventDefault();
 
-      var dbname = this.$el.find("input.search-query").val();
+      var dbname = this.$el.find("[name='search-query']").val().trim();
 
       if (selectedName) {
         dbname = selectedName;
       }
 
-      if (dbname) {
-        // TODO: switch to using a model, or Databases.databaseUrl()
-        // Neither of which are in scope right now
-        // var db = new Database.Model({id: dbname});
-        var url = ["/database/", app.mixins.safeURLName(dbname), "/_all_docs?limit=" + Databases.DocLimit].join('');
-        FauxtonAPI.navigate(url);
+      if (dbname && this.collection.where({"id":app.mixins.safeURLName(dbname)}).length
> 0){
+          // TODO: switch to using a model, or Databases.databaseUrl()
+          // Neither of which are in scope right now
+          // var db = new Database.Model({id: dbname});
+          var url = ["/database/", app.mixins.safeURLName(dbname), "/_all_docs?limit=" +
Databases.DocLimit].join('');
+          FauxtonAPI.navigate(url);
+      } else {
+        FauxtonAPI.addNotification({
+          msg: 'Database does not exist.',
+          type: 'error'
+        });
       }
     },
 
@@ -123,7 +127,7 @@ function(app, Components, FauxtonAPI, Databases) {
       var that = this;
       this.dbSearchTypeahead = new Components.DbSearchTypeahead({
         dbLimit: this.dbLimit,
-        el: "input.search-query",
+        el: "input.search-autocomplete",
         onUpdate: function (item) {
           that.switchDatabase(null, item);
         }

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4ed8a8ad/src/fauxton/app/templates/databases/list.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/databases/list.html b/src/fauxton/app/templates/databases/list.html
index 2e5d78d..3e73294 100644
--- a/src/fauxton/app/templates/databases/list.html
+++ b/src/fauxton/app/templates/databases/list.html
@@ -14,11 +14,12 @@ the License.
 
 <div class="result-tools" style="">
   <div id="newButton" class="pull-left"></div>
-  <form class="navbar-form pull-right database-search">
-    <label class="fonticon-search">
-      <input type="text" class="search-query" placeholder="Search by database name">
-    </label>
+  <form id="jump-to-db" class="navbar-form pull-right input-append database-search">
+    <input type="text" name="search-query" placeholder="Database name"></input>
+    <button class="fonticon-search btn button red " type="submit"></button>
   </form>
+
+
 </div>
 <table class="databases table table-striped">
   <thead>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/4ed8a8ad/src/fauxton/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/fauxton.less b/src/fauxton/assets/less/fauxton.less
index 22594d8..510c3c1 100644
--- a/src/fauxton/assets/less/fauxton.less
+++ b/src/fauxton/assets/less/fauxton.less
@@ -503,9 +503,10 @@ footer#mainFooter{
 }
 
 .navbar-form.pull-right.database-search {
-  margin-right: 36px;
+  margin: -10px 50px 12px 0;
+  padding: 11px;
     input[type=text]{
-      margin-top: -4px;
+      margin-top: 0px;
     }
 }
 
@@ -981,7 +982,9 @@ div.spinner {
   }
 }
 
-#jump-to-doc {
+#jump-to-doc,
+#jump-to-db
+ {
   width: auto;
   float:right;
   button{


Mime
View raw message