You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2014/12/10 11:25:10 UTC

fauxton commit: updated refs/heads/master to 3d2180f

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 42cdf6886 -> 3d2180f6d


Fix string modal and add database filter

This fixes the regex check for the string modal in the code editor. The
string modal button now works again.

It also adds a filter function to the typeahead database view so that we
can filter the databases that are returned


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

Branch: refs/heads/master
Commit: 3d2180f6d6cb8a5913aaa2881e235efe8d5af87c
Parents: 42cdf68
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Dec 10 11:20:46 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Dec 10 12:24:50 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/views-doceditor.js | 2 +-
 app/addons/fauxton/components.js        | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d2180f6/app/addons/documents/views-doceditor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js
index 0260134..1eca318 100644
--- a/app/addons/documents/views-doceditor.js
+++ b/app/addons/documents/views-doceditor.js
@@ -239,7 +239,7 @@ function (app, FauxtonAPI, Components, Documents, Databases, resizeColumns, pret
       /* one JS(ON) string can't span more than one line - we edit one string, so ensure we don't select several lines */
       if (selStart >=0 && selEnd >= 0 && selStart === selEnd && this.editor.isRowExpanded(selStart)) {
         var editLine = this.editor.getLine(selStart),
-            editMatch = editLine.match(/^([ \t]*)('[a-zA-Z0-9_]*': )?('.*',?[ \t]*)$/);
+            editMatch = editLine.match(/^([ \t]*)(["|'][a-zA-Z0-9_]*["|']: )?(["|'].*["|'],?[ \t]*)$/);
 
         if (editMatch) {
           return editMatch;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3d2180f6/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 312f19b..9e2f78e 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -572,10 +572,14 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
   Components.DbSearchTypeahead = Components.Typeahead.extend({
     initialize: function (options) {
       this.dbLimit = options.dbLimit || 30;
+      if (options.filter) { 
+        this.resultFilter = options.resultFilter;
+      }
       _.bindAll(this);
     },
     source: function(query, process) {
       query = encodeURIComponent(query);
+      var resultFilter = this.resultFilter;
       var url = [
         app.host,
         "/_all_dbs?startkey=%22",
@@ -594,6 +598,9 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
         url: url,
         dataType: 'json',
         success: function(data) {
+          if (resultFilter) {
+            data = resultFilter(data);
+          }
           process(data);
         }
       });