You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2014/07/17 19:14:13 UTC

[01/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/2158-changes-filter [created] b1121dbb9


add license header


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

Branch: refs/heads/2158-changes-filter
Commit: b1121dbb95bac358a4f9a8c39fbd11f42ca294db
Parents: 1275ec6
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 17:01:29 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/templates/changes_header.html | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b1121dbb/app/addons/documents/templates/changes_header.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes_header.html b/app/addons/documents/templates/changes_header.html
index 8fa18ac..54a50a8 100644
--- a/app/addons/documents/templates/changes_header.html
+++ b/app/addons/documents/templates/changes_header.html
@@ -1,3 +1,17 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+
 <div class="changes-header">
   <div class="pull-right js-filter"></div>
 </div>


[07/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
rename js-log-filter-form to js-filter-form


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

Branch: refs/heads/2158-changes-filter
Commit: cf9114d3035173f930e1a39ecae3ef68e5acab42
Parents: 263d328
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 15:31:07 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/fauxton/components.js           |  4 ++--
 app/addons/fauxton/templates/filter.html   |  2 +-
 app/addons/fauxton/tests/filterViewSpec.js | 10 +++++-----
 assets/less/fauxton.less                   |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/cf9114d3/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index de633f3..1853ece 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -371,10 +371,10 @@ function(app, FauxtonAPI, ace, spin) {
     },
 
     events: {
-      "submit .js-log-filter-form": "filterLogs"
+      "submit .js-filter-form": "filterItems"
     },
 
-    filterLogs: function (event) {
+    filterItems: function (event) {
       event.preventDefault();
       var $filter = this.$('input[name="filter"]'),
           filter = $.trim($filter.val());

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/cf9114d3/app/addons/fauxton/templates/filter.html
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/templates/filter.html b/app/addons/fauxton/templates/filter.html
index 7c3a33c..00d7fe1 100644
--- a/app/addons/fauxton/templates/filter.html
+++ b/app/addons/fauxton/templates/filter.html
@@ -12,7 +12,7 @@ License for the specific language governing permissions and limitations under
 the License.
 -->
 
-<form class="form-inline js-log-filter-form">
+<form class="form-inline js-filter-form">
   <fieldset>
     <input type="text" name="filter" placeholder="Type a filter">
     <button type="submit" class="btn">Filter</button>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/cf9114d3/app/addons/fauxton/tests/filterViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filterViewSpec.js b/app/addons/fauxton/tests/filterViewSpec.js
index 7bfd0a6..df75ca7 100644
--- a/app/addons/fauxton/tests/filterViewSpec.js
+++ b/app/addons/fauxton/tests/filterViewSpec.js
@@ -42,18 +42,18 @@ define([
 
     it('should add filter markup', function () {
       filterView.$('[name="filter"]').val('i was a lonely filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
 
       filterView.$('[name="filter"]').val('i am a filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
       assert.equal(2, filterView.$('.js-remove-filter').length);
     });
 
     it('should remove filter markup', function () {
       filterView.$('[name="filter"]').val('i was a lonely filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
       filterView.$('[name="filter"]').val('i am a filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
 
       filterView.$('.js-remove-filter').click();
 
@@ -62,7 +62,7 @@ define([
 
     it('should not add empty filters', function () {
       filterView.$('[name="filter"]').val('');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
       assert.equal(0, filterView.$('.js-remove-filter').length);
     });
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/cf9114d3/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less
index be517e6..68499ad 100644
--- a/assets/less/fauxton.less
+++ b/assets/less/fauxton.less
@@ -906,7 +906,7 @@ div.spinner {
   }
 }
 
-.js-log-filter-form {
+.js-filter-form {
   ul {
     margin-left: 0px;
   }


[03/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
remove sidebar filter, add header filter


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

Branch: refs/heads/2158-changes-filter
Commit: 5ca3f3cb288a59726ce14e9ff842c3a2fc3ee0e5
Parents: cf9114d
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 15:32:41 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/assets/less/documents.less |  14 +++
 app/addons/documents/routes.js                  |   5 +-
 app/addons/documents/templates/changes.html     | 106 ++++++++++---------
 .../documents/templates/changes_header.html     |   3 +
 .../documents/templates/changes_sidebar.html    |  18 ----
 app/addons/documents/views.js                   |  16 +--
 6 files changed, 82 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5ca3f3cb/app/addons/documents/assets/less/documents.less
----------------------------------------------------------------------
diff --git a/app/addons/documents/assets/less/documents.less b/app/addons/documents/assets/less/documents.less
index e62be30..6554d02 100644
--- a/app/addons/documents/assets/less/documents.less
+++ b/app/addons/documents/assets/less/documents.less
@@ -108,6 +108,20 @@ button.beautify {
   }
 }
 
+.changes-header {
+  padding-top: 30px;
+  height: 160px;
+  border-bottom: 1px solid #999999;
+  .label {
+    float: left;
+    margin-right: 5px;
+  }
+  .js-filter-form {
+    padding-right: 15px;
+    margin: 0;
+  }
+}
+
 #map-function, #reduce-function{
     width: 100%;
     font-size: 16px;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5ca3f3cb/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index bf62f0a..e080d54 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -453,7 +453,7 @@ function(app, FauxtonAPI, Documents, Databases, Components) {
   });
 
   var ChangesRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: "with_sidebar",
+    layout: "one_pane",
     selectedHeader: "Databases",
     crumbs: function () {
       return [
@@ -488,8 +488,7 @@ function(app, FauxtonAPI, Documents, Databases, Components) {
       this.filterView = new Components.FilterView({
         eventNamespace: "changes"
       });
-
-      this.sideBarView = this.setView("#sidebar-content", new Documents.Views.ChangesSidebar({
+      this.headerView = this.setView("#tabs", new Documents.Views.ChangesHeader({
         filterView: this.filterView
       }));
     },

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5ca3f3cb/app/addons/documents/templates/changes.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes.html b/app/addons/documents/templates/changes.html
index d038361..9ed1413 100644
--- a/app/addons/documents/templates/changes.html
+++ b/app/addons/documents/templates/changes.html
@@ -12,57 +12,61 @@ License for the specific language governing permissions and limitations under
 the License.
 -->
 
-<% _.each(changes, function (change) { %>
-  <div class="change-wrapper">
-    <div class="change-box">
-      <div class="row-fluid">
-        <div class="span2">
-          seq
-        </div>
-        <div class="span8 change-sequence">
-          <%= change.seq %>
-        </div>
-        <div class="span2 text-right">
-          <a class="js-copy" data-clipboard-text="<%= change.seq %>" data-bypass="true" href="#">
-            <i class="icon-share"></i>
-          </a>
-        </div>
-      </div>
-      <div class="row-fluid">
-        <div class="span2">
-          id
-        </div>
-        <div class="span8">
-          <% if (change.deleted) { %>
-            <%= change.id %>
-          <% } else { %>
-            <a href="#<%- database.url('app') %>/<%- safeURL(change.id) %>"><%= change.id %></a>
-          <% } %>    </div>
-        <div class="span2 text-right">
-          <a class="js-copy" data-clipboard-text="<%= change.id %>" data-bypass="true" href="#">
-            <i class="icon-share"></i>
-          </a>
-        </div>
-      </div>
-      <div class="row-fluid">
-        <div class="span2">
-          changes
-        </div>
-        <div class="span10">
-          <button class="js-toggle-json btn btn-small btn-primary" type="button">View JSON</button>
-        </div>
-      </div>
-      <div class="js-json-container">
-        <pre class="prettyprint"><%- JSON.stringify({changes: change.changes, doc: change.doc}, null, " ") %></pre>
-      </div>
-      <div class="row-fluid">
-        <div class="span2">
-          deleted
-        </div>
-        <div class="span10">
-          <%= change.deleted ? "True" : "False" %>
+<div class="changes">
+  <div class="items">
+    <% _.each(changes, function (change) { %>
+      <div class="change-wrapper">
+        <div class="change-box">
+          <div class="row-fluid">
+            <div class="span2">
+              seq
+            </div>
+            <div class="span8 change-sequence">
+              <%= change.seq %>
+            </div>
+            <div class="span2 text-right">
+              <a class="js-copy" data-clipboard-text="<%= change.seq %>" data-bypass="true" href="#">
+                <i class="icon-share"></i>
+              </a>
+            </div>
+          </div>
+          <div class="row-fluid">
+            <div class="span2">
+              id
+            </div>
+            <div class="span8">
+              <% if (change.deleted) { %>
+                <%= change.id %>
+              <% } else { %>
+                <a href="#<%- database.url('app') %>/<%- safeURL(change.id) %>"><%= change.id %></a>
+              <% } %>    </div>
+            <div class="span2 text-right">
+              <a class="js-copy" data-clipboard-text="<%= change.id %>" data-bypass="true" href="#">
+                <i class="icon-share"></i>
+              </a>
+            </div>
+          </div>
+          <div class="row-fluid">
+            <div class="span2">
+              changes
+            </div>
+            <div class="span10">
+              <button class="js-toggle-json btn btn-small btn-primary" type="button">View JSON</button>
+            </div>
+          </div>
+          <div class="js-json-container">
+            <pre class="prettyprint"><%- JSON.stringify({changes: change.changes, doc: change.doc}, null, " ") %></pre>
+          </div>
+          <div class="row-fluid">
+            <div class="span2">
+              deleted
+            </div>
+            <div class="span10">
+              <%= change.deleted ? "True" : "False" %>
+            </div>
+          </div>
         </div>
       </div>
-    </div>
+    <% }); %>
   </div>
-<% }); %>
+</div>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5ca3f3cb/app/addons/documents/templates/changes_header.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes_header.html b/app/addons/documents/templates/changes_header.html
new file mode 100644
index 0000000..8fa18ac
--- /dev/null
+++ b/app/addons/documents/templates/changes_header.html
@@ -0,0 +1,3 @@
+<div class="changes-header">
+  <div class="pull-right js-filter"></div>
+</div>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5ca3f3cb/app/addons/documents/templates/changes_sidebar.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes_sidebar.html b/app/addons/documents/templates/changes_sidebar.html
deleted file mode 100644
index 9f3d369..0000000
--- a/app/addons/documents/templates/changes_sidebar.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!--
-Licensed under the Apache License, Version 2.0 (the "License"); you may not
-use this file except in compliance with the License. You may obtain a copy of
-the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-License for the specific language governing permissions and limitations under
-the License.
--->
-
-<div class="sidebar-content" id="changes-sidebar">
-  <header>Changes Filter</header>
-  <div class="js-filter"></div>
-</div>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/5ca3f3cb/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index eb129f2..5095d0a 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -1920,6 +1920,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
 
   Views.Indexed = FauxtonAPI.View.extend({});
 
+  Views.ChangesHeader = FauxtonAPI.View.extend({
+    template: "addons/documents/templates/changes_header",
+
+    initialize: function () {
+      this.setView(".js-filter", this.filterView);
+    }
+  });
+
   Views.Changes = Components.FilteredView.extend({
     template: "addons/documents/templates/changes",
 
@@ -1972,14 +1980,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     }
   });
 
-  Views.ChangesSidebar = FauxtonAPI.View.extend({
-    template: "addons/documents/templates/changes_sidebar",
-
-    initialize: function (options) {
-      this.setView(".js-filter", options.filterView);
-    }
-  });
-
   Views.DdocInfo = FauxtonAPI.View.extend({
     template: "addons/documents/templates/ddoc_info",
 


[04/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
Fauxton: Implement a filter for changes

As code is duplicated, mode the filter to the component. Tthe filter
then can be overwritten if there anything special is needed.


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

Branch: refs/heads/2158-changes-filter
Commit: 8ff72f889bf9a07fd7a49568dd426978ab2769aa
Parents: 99665a1
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 8 21:26:36 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/routes.js                  |  4 ++-
 .../documents/templates/changes_sidebar.html    | 18 +++++++++++
 app/addons/documents/views.js                   | 26 +++++++++++++--
 app/addons/fauxton/templates/filter.html        |  2 +-
 app/core/base.js                                | 34 ++++++++++++++++++++
 5 files changed, 79 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8ff72f88/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index a21bdaa..a4a0baa 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -452,7 +452,7 @@ function(app, FauxtonAPI, Documents, Databases) {
   });
 
   var ChangesRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: "with_tabs",
+    layout: "with_sidebar",
     selectedHeader: "Databases",
     crumbs: function () {
       return [
@@ -478,6 +478,8 @@ function(app, FauxtonAPI, Documents, Databases) {
       this.setView("#dashboard-content", new Documents.Views.Changes({
         model: this.database
       }));
+
+      this.setView("#sidebar-content", new Documents.Views.ChangesSidebar());
     },
 
     apiUrl: function() {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8ff72f88/app/addons/documents/templates/changes_sidebar.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes_sidebar.html b/app/addons/documents/templates/changes_sidebar.html
new file mode 100644
index 0000000..9f3d369
--- /dev/null
+++ b/app/addons/documents/templates/changes_sidebar.html
@@ -0,0 +1,18 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+
+<div class="sidebar-content" id="changes-sidebar">
+  <header>Changes Filter</header>
+  <div class="js-filter"></div>
+</div>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8ff72f88/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 6ccb733..e035449 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -1920,12 +1920,18 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
 
   Views.Indexed = FauxtonAPI.View.extend({});
 
+  Views.ChangesEvents = {};
+  _.extend(Views.ChangesEvents, Backbone.Events);
+
   Views.Changes = FauxtonAPI.View.extend({
     template: "addons/documents/templates/changes",
 
     initialize: function () {
-      this.listenTo( this.model.changes, 'sync', this.render);
-      this.listenTo( this.model.changes, 'cachesync', this.render);
+      this.listenTo(this.model.changes, 'sync', this.render);
+      this.listenTo(this.model.changes, 'cachesync', this.render);
+
+      this.listenTo(Views.ChangesEvents, "changes:filter", this.filter);
+      this.listenTo(Views.ChangesEvents, "changes:remove", this.removeFilter);
     },
 
     events: {
@@ -1957,8 +1963,10 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     },
 
     serialize: function () {
+      var json = this.model.changes.toJSON(),
+          filteredData = this.createFilteredData(json);
       return {
-        changes: this.model.changes.toJSON(),
+        changes: filteredData,
         database: this.model
       };
     },
@@ -1970,6 +1978,18 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     }
   });
 
+  Views.ChangesSidebar = FauxtonAPI.View.extend({
+    template: "addons/documents/templates/changes_sidebar",
+
+    initialize: function (options) {
+
+      this.setView(".js-filter", new Components.FilterView({
+        eventListener: Views.ChangesEvents,
+        eventNamespace: "changes"
+      }));
+    }
+  });
+
   Views.DdocInfo = FauxtonAPI.View.extend({
     template: "addons/documents/templates/ddoc_info",
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8ff72f88/app/addons/fauxton/templates/filter.html
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/templates/filter.html b/app/addons/fauxton/templates/filter.html
index d7930fc..7c3a33c 100644
--- a/app/addons/fauxton/templates/filter.html
+++ b/app/addons/fauxton/templates/filter.html
@@ -14,7 +14,7 @@ the License.
 
 <form class="form-inline js-log-filter-form">
   <fieldset>
-    <input type="text" name="filter" placeholder="Type a filter to sort the logs by">
+    <input type="text" name="filter" placeholder="Type a filter">
     <button type="submit" class="btn">Filter</button>
     <span class="help-block"> <h6> Eg. debug or <1.4.1> or any regex </h6> </span>
   </fieldset>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/8ff72f88/app/core/base.js
----------------------------------------------------------------------
diff --git a/app/core/base.js b/app/core/base.js
index 15499b3..3425ca1 100644
--- a/app/core/base.js
+++ b/app/core/base.js
@@ -62,9 +62,43 @@ function(Backbone, LayoutManager) {
     manage: true,
     disableLoader: false,
 
+    filters: [],
+
     forceRender: function () {
       this.hasRendered = false;
+    },
+
+    filter: function (filter) {
+      this.filters.push(filter);
+      this.render();
+    },
+
+    createFilteredData: function (json) {
+      var that = this;
+
+      return _.reduce(this.filters, function (elements, filter) {
+
+        return _.filter(elements, function (element) {
+          var match = false;
+
+          _.each(element, function (value) {
+            if (new RegExp(filter).test(value.toString())) {
+              match = true;
+            }
+          });
+          return match;
+        });
+
+
+      }, json, this);
+
+    },
+
+    removeFilter: function (filter) {
+      this.filters.splice(this.filters.indexOf(filter), 1);
+      this.render();
     }
+
   });
 
   var caching = {


[02/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
we can add tooltips to a filter


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

Branch: refs/heads/2158-changes-filter
Commit: 65a4a3fbd9090344a50bc2898367586e3fcd459e
Parents: b254d84
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 15:44:38 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/fauxton/components.js           | 13 +++++++++++++
 app/addons/fauxton/templates/filter.html   |  4 ++++
 app/addons/fauxton/tests/filterViewSpec.js | 13 +++++++++++++
 3 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/65a4a3fb/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 2ff90b6..7f81144 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -368,12 +368,19 @@ function(app, FauxtonAPI, ace, spin) {
 
     initialize: function (options) {
       this.eventNamespace = options.eventNamespace;
+      this.tooltipText = options.tooltipText;
     },
 
     events: {
       "submit .js-filter-form": "filterItems"
     },
 
+    serialize: function () {
+      return {
+        tooltipText: this.tooltipText
+      };
+    },
+
     filterItems: function (event) {
       event.preventDefault();
       var $filter = this.$('input[name="filter"]'),
@@ -391,6 +398,12 @@ function(app, FauxtonAPI, ace, spin) {
       })).render();
 
       $filter.val('');
+    },
+
+    afterRender: function () {
+      if (this.tooltipText) {
+        this.$el.find(".js-filter-tooltip").tooltip();
+      }
     }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/65a4a3fb/app/addons/fauxton/templates/filter.html
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/templates/filter.html b/app/addons/fauxton/templates/filter.html
index 8e2a37e..f7bc7c7 100644
--- a/app/addons/fauxton/templates/filter.html
+++ b/app/addons/fauxton/templates/filter.html
@@ -18,6 +18,10 @@ the License.
     <button type="submit" class="btn btn-primary">Filter</button>
     <div class="help-block">
       <strong> Eg. debug or <1.4.1> or any regex </strong>
+      <% if (tooltipText) { %>
+        <i class="js-filter-tooltip icon icon-question-sign" data-toggle="tooltip"
+          title="" data-original-title="<%- tooltipText %>"></i>
+      <% } %>
     </div>
   </fieldset>
 </form>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/65a4a3fb/app/addons/fauxton/tests/filterViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filterViewSpec.js b/app/addons/fauxton/tests/filterViewSpec.js
index df75ca7..1eefa05 100644
--- a/app/addons/fauxton/tests/filterViewSpec.js
+++ b/app/addons/fauxton/tests/filterViewSpec.js
@@ -65,5 +65,18 @@ define([
       filterView.$('.js-filter-form').submit();
       assert.equal(0, filterView.$('.js-remove-filter').length);
     });
+
+    it('should not add tooltips by default', function () {
+      assert.equal(0, filterView.$('.js-filter-tooltip').length);
+    });
+
+    it('should add tooltips when a text for it is defined', function () {
+      filterView = new Components.FilterView({
+        eventNamespace: 'mynamespace',
+        tooltipText: 'ente ente'
+      });
+      viewSandbox.renderView(filterView);
+      assert.equal(1, filterView.$('.js-filter-tooltip').length);
+    });
   });
 });


[06/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
make filtering case insensitive


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

Branch: refs/heads/2158-changes-filter
Commit: f53e55b1652c462c46d94f2147089cf04621e0dd
Parents: 5ca3f3c
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 15:36:09 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/fauxton/components.js             |  2 +-
 app/addons/fauxton/tests/filteredViewSpec.js | 41 +++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f53e55b1/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 1853ece..2ff90b6 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -351,7 +351,7 @@ function(app, FauxtonAPI, ace, spin) {
           var match = false;
 
           _.each(element, function (value) {
-            if (new RegExp(filter).test(value.toString())) {
+            if (new RegExp(filter, 'i').test(value.toString())) {
               match = true;
             }
           });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f53e55b1/app/addons/fauxton/tests/filteredViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filteredViewSpec.js b/app/addons/fauxton/tests/filteredViewSpec.js
new file mode 100644
index 0000000..c24d439
--- /dev/null
+++ b/app/addons/fauxton/tests/filteredViewSpec.js
@@ -0,0 +1,41 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+       'app',
+       'addons/fauxton/components',
+       'testUtils'
+], function (app, Components, testUtils) {
+  var assert = testUtils.assert;
+
+  describe('FilteredView', function () {
+    var filteredView;
+
+
+    beforeEach(function () {
+      filteredView = new Components.FilteredView();
+    });
+
+    afterEach(function () {
+    });
+
+    it('should be case insensitive', function () {
+      filteredView.filters = ['ente'];
+      var res = filteredView.createFilteredData([
+        {id: 'LALA', bar: 'ENTE'},
+        {id: '1', bar: '1', deleted: true},
+        {id: '2', bar: '2'}
+      ]);
+      assert.equal(res.length, 1);
+    });
+  });
+});


[08/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
use strong tag instead of a h6, change button to primary button color (red)


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

Branch: refs/heads/2158-changes-filter
Commit: 477debe42247f887da36d4f0ec3251a9c2f4805c
Parents: f53e55b
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 15:40:14 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/fauxton/templates/filter.html | 6 ++++--
 assets/less/fauxton.less                 | 9 +++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/477debe4/app/addons/fauxton/templates/filter.html
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/templates/filter.html b/app/addons/fauxton/templates/filter.html
index 00d7fe1..8e2a37e 100644
--- a/app/addons/fauxton/templates/filter.html
+++ b/app/addons/fauxton/templates/filter.html
@@ -15,8 +15,10 @@ the License.
 <form class="form-inline js-filter-form">
   <fieldset>
     <input type="text" name="filter" placeholder="Type a filter">
-    <button type="submit" class="btn">Filter</button>
-    <span class="help-block"> <h6> Eg. debug or <1.4.1> or any regex </h6> </span>
+    <button type="submit" class="btn btn-primary">Filter</button>
+    <div class="help-block">
+      <strong> Eg. debug or <1.4.1> or any regex </strong>
+    </div>
   </fieldset>
 </form>
 <ul class="filter-list"></ul>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/477debe4/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less
index 68499ad..deb9239 100644
--- a/assets/less/fauxton.less
+++ b/assets/less/fauxton.less
@@ -907,6 +907,15 @@ div.spinner {
 }
 
 .js-filter-form {
+  .help-block {
+    padding: 5px 0 5px 0;
+  }
+  .icon {
+    font-size: 16px;
+  }
+}
+
+.js-filter {
   ul {
     margin-left: 0px;
   }


[05/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
review


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

Branch: refs/heads/2158-changes-filter
Commit: 263d328dace3756a5bec0eb59a241ba6e8187898
Parents: 8ff72f8
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Fri May 16 20:44:15 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/routes.js             | 30 +++++++++++++++++++---
 app/addons/documents/views.js              | 14 ++--------
 app/addons/fauxton/components.js           | 33 +++++++++++++++++++-----
 app/addons/fauxton/tests/filterViewSpec.js | 28 ++++----------------
 app/core/base.js                           | 34 -------------------------
 5 files changed, 59 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/263d328d/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index a4a0baa..bf62f0a 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -17,10 +17,11 @@ define([
 
        // Modules
        "addons/documents/views",
-       "addons/databases/base"
+       "addons/databases/base",
+       "addons/fauxton/components"
 ],
 
-function(app, FauxtonAPI, Documents, Databases) {
+function(app, FauxtonAPI, Documents, Databases, Components) {
 
   var DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
     layout: "one_pane",
@@ -465,6 +466,11 @@ function(app, FauxtonAPI, Documents, Databases) {
       "database/:database/_changes(:params)": "changes"
     },
 
+    events: {
+      "route:changesFilterAdd": "addFilter",
+      "route:changesFilterRemove": "removeFilter"
+    },
+
     initialize: function (route, masterLayout, options) {
       this.databaseName = options[0];
       this.database = new Databases.Model({id: this.databaseName});
@@ -475,11 +481,27 @@ function(app, FauxtonAPI, Documents, Databases) {
     },
 
     changes: function (event) {
-      this.setView("#dashboard-content", new Documents.Views.Changes({
+      this.dashboardView = this.setView("#dashboard-content", new Documents.Views.Changes({
         model: this.database
       }));
 
-      this.setView("#sidebar-content", new Documents.Views.ChangesSidebar());
+      this.filterView = new Components.FilterView({
+        eventNamespace: "changes"
+      });
+
+      this.sideBarView = this.setView("#sidebar-content", new Documents.Views.ChangesSidebar({
+        filterView: this.filterView
+      }));
+    },
+
+    addFilter: function (filter) {
+      this.dashboardView.filters.push(filter);
+      this.dashboardView.render();
+    },
+
+    removeFilter: function (filter) {
+      this.dashboardView.filters.splice(this.dashboardView.filters.indexOf(filter), 1);
+      this.dashboardView.render();
     },
 
     apiUrl: function() {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/263d328d/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index e035449..eb129f2 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -1920,18 +1920,12 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
 
   Views.Indexed = FauxtonAPI.View.extend({});
 
-  Views.ChangesEvents = {};
-  _.extend(Views.ChangesEvents, Backbone.Events);
-
-  Views.Changes = FauxtonAPI.View.extend({
+  Views.Changes = Components.FilteredView.extend({
     template: "addons/documents/templates/changes",
 
     initialize: function () {
       this.listenTo(this.model.changes, 'sync', this.render);
       this.listenTo(this.model.changes, 'cachesync', this.render);
-
-      this.listenTo(Views.ChangesEvents, "changes:filter", this.filter);
-      this.listenTo(Views.ChangesEvents, "changes:remove", this.removeFilter);
     },
 
     events: {
@@ -1982,11 +1976,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     template: "addons/documents/templates/changes_sidebar",
 
     initialize: function (options) {
-
-      this.setView(".js-filter", new Components.FilterView({
-        eventListener: Views.ChangesEvents,
-        eventNamespace: "changes"
-      }));
+      this.setView(".js-filter", options.filterView);
     }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/263d328d/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 79a9320..de633f3 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -339,11 +339,34 @@ function(app, FauxtonAPI, ace, spin) {
     }
   });
 
+  Components.FilteredView = FauxtonAPI.View.extend({
+    filters: [],
+
+    createFilteredData: function (json) {
+      var that = this;
+
+      return _.reduce(this.filters, function (elements, filter) {
+
+        return _.filter(elements, function (element) {
+          var match = false;
+
+          _.each(element, function (value) {
+            if (new RegExp(filter).test(value.toString())) {
+              match = true;
+            }
+          });
+          return match;
+        });
+
+
+      }, json, this);
+    }
+  });
+
   Components.FilterView = FauxtonAPI.View.extend({
     template: "addons/fauxton/templates/filter",
 
     initialize: function (options) {
-      this.eventListener = options.eventListener;
       this.eventNamespace = options.eventNamespace;
     },
 
@@ -360,17 +383,15 @@ function(app, FauxtonAPI, ace, spin) {
         return;
       }
 
-      this.eventListener.trigger(this.eventNamespace + ":filter", filter);
+      FauxtonAPI.triggerRouteEvent(this.eventNamespace + "FilterAdd", filter);
 
       this.insertView(".filter-list", new Components.FilterItemView({
         filter: filter,
-        eventListener: this.eventListener,
         eventNamespace: this.eventNamespace
       })).render();
 
       $filter.val('');
     }
-
   });
 
   Components.FilterItemView = FauxtonAPI.View.extend({
@@ -379,7 +400,6 @@ function(app, FauxtonAPI, ace, spin) {
 
     initialize: function (options) {
       this.filter = options.filter;
-      this.eventListener = options.eventListener;
       this.eventNamespace = options.eventNamespace;
     },
 
@@ -395,8 +415,7 @@ function(app, FauxtonAPI, ace, spin) {
 
     removeFilter: function (event) {
       event.preventDefault();
-
-      this.eventListener.trigger(this.eventNamespace + ":remove", this.filter);
+      FauxtonAPI.triggerRouteEvent(this.eventNamespace + "FilterRemove", this.filter);
       this.remove();
     }
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/263d328d/app/addons/fauxton/tests/filterViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filterViewSpec.js b/app/addons/fauxton/tests/filterViewSpec.js
index fec970d..7bfd0a6 100644
--- a/app/addons/fauxton/tests/filterViewSpec.js
+++ b/app/addons/fauxton/tests/filterViewSpec.js
@@ -17,18 +17,18 @@ define([
        'api'
 ], function (app, Components, testUtils, FauxtonAPI) {
   var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox,
-      myEvents = {};
-
-  _.extend(myEvents, Backbone.Events);
+      ViewSandbox = testUtils.ViewSandbox;
 
   describe('FilterView', function () {
     var viewSandbox,
         filterView;
 
+    if (!FauxtonAPI.router.triggerRouteEvent) {
+      FauxtonAPI.router.triggerRouteEvent = function () {};
+    }
+
     beforeEach(function () {
       filterView = new Components.FilterView({
-        eventListener: myEvents,
         eventNamespace: 'mynamespace'
       });
 
@@ -40,24 +40,6 @@ define([
       viewSandbox.remove();
     });
 
-    it('should trigger an event on add', function () {
-      filterView.$('[name="filter"]').val('i am a lonely filter');
-      myEvents.listenToOnce(myEvents, 'ente:filter', function (msg) {
-        assert.equal('i am a lonely filter', msg);
-      });
-      filterView.$('.js-log-filter-form').submit();
-    });
-
-    it('should trigger an event on remove', function () {
-      myEvents.listenToOnce(myEvents, 'mynamespace:filter', function (msg) {
-        assert.equal('i am a lonely filter', msg);
-      });
-
-      filterView.$('[name="filter"]').val('i am a lonely filter');
-      filterView.$('.js-log-filter-form').submit();
-      filterView.$('.js-remove-filter').click();
-    });
-
     it('should add filter markup', function () {
       filterView.$('[name="filter"]').val('i was a lonely filter');
       filterView.$('.js-log-filter-form').submit();

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/263d328d/app/core/base.js
----------------------------------------------------------------------
diff --git a/app/core/base.js b/app/core/base.js
index 3425ca1..15499b3 100644
--- a/app/core/base.js
+++ b/app/core/base.js
@@ -62,43 +62,9 @@ function(Backbone, LayoutManager) {
     manage: true,
     disableLoader: false,
 
-    filters: [],
-
     forceRender: function () {
       this.hasRendered = false;
-    },
-
-    filter: function (filter) {
-      this.filters.push(filter);
-      this.render();
-    },
-
-    createFilteredData: function (json) {
-      var that = this;
-
-      return _.reduce(this.filters, function (elements, filter) {
-
-        return _.filter(elements, function (element) {
-          var match = false;
-
-          _.each(element, function (value) {
-            if (new RegExp(filter).test(value.toString())) {
-              match = true;
-            }
-          });
-          return match;
-        });
-
-
-      }, json, this);
-
-    },
-
-    removeFilter: function (filter) {
-      this.filters.splice(this.filters.indexOf(filter), 1);
-      this.render();
     }
-
   });
 
   var caching = {


[09/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
make deleted documents searchable

they are missing an explicit deleted flag


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

Branch: refs/heads/2158-changes-filter
Commit: 1275ec6d6b87f323b1ad92b5861b3c7abcb21feb
Parents: 65a4a3f
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 16:33:12 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/tests/viewsSpec.js | 25 ++++++++++++++++++++++++-
 app/addons/documents/views.js           | 25 +++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1275ec6d/app/addons/documents/tests/viewsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/viewsSpec.js b/app/addons/documents/tests/viewsSpec.js
index 8bc1397..6eaf802 100644
--- a/app/addons/documents/tests/viewsSpec.js
+++ b/app/addons/documents/tests/viewsSpec.js
@@ -11,8 +11,9 @@
 // the License.
 define([
         'addons/documents/views',
+        'addons/databases/base',
         'testUtils'
-], function (Views, testUtils) {
+], function (Views, Databases, testUtils) {
   var assert = testUtils.assert;
 
   describe('DocumentsViews', function () {
@@ -20,4 +21,26 @@ define([
       assert.equal(typeof Views.Views.Changes, 'function');
     });
   });
+
+  describe('Changes', function () {
+    var filteredView;
+    beforeEach(function () {
+      var database = new Databases.Model({id: 'bla'});
+      database.buildChanges({descending: 'true', limit: '100', include_docs: 'true'} );
+      filteredView = new Views.Views.Changes({
+        model: database
+      });
+    });
+
+    it('filter false in case of deleted documents in the changes feed', function () {
+      filteredView.filters = [false];
+      var res = filteredView.createFilteredData([
+        {id: 'LALA', bar: 'ENTE'},
+        {id: '1', bar: '1', deleted: true},
+        {id: '2', bar: '2'}
+      ]);
+
+      assert.equal(res.length, 2);
+    });
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1275ec6d/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 5095d0a..d769150 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -1967,12 +1967,37 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
     serialize: function () {
       var json = this.model.changes.toJSON(),
           filteredData = this.createFilteredData(json);
+
       return {
         changes: filteredData,
         database: this.model
       };
     },
 
+    createFilteredData: function (json) {
+      var that = this;
+
+      return _.reduce(this.filters, function (elements, filter) {
+
+        return _.filter(elements, function (element) {
+          var match = false;
+
+          // make deleted searchable
+          if (!element.deleted) {
+            element.deleted = false;
+          }
+          _.each(element, function (value) {
+            if (new RegExp(filter, 'i').test(value.toString())) {
+              match = true;
+            }
+          });
+          return match;
+        });
+
+
+      }, json, this);
+    },
+
     afterRender: function(){
       prettyPrint();
       ZeroClipboard.config({ moviePath: "/assets/js/plugins/zeroclipboard/ZeroClipboard.swf" });


[10/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db

Posted by ro...@apache.org.
change <%= to <%- as <%= is not needed


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

Branch: refs/heads/2158-changes-filter
Commit: b254d84c4d8a6ebc26efdf9c10b6924ff1656254
Parents: 477debe
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Thu May 29 15:43:42 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/templates/changes.html | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b254d84c/app/addons/documents/templates/changes.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes.html b/app/addons/documents/templates/changes.html
index 9ed1413..fd4da0e 100644
--- a/app/addons/documents/templates/changes.html
+++ b/app/addons/documents/templates/changes.html
@@ -22,7 +22,7 @@ the License.
               seq
             </div>
             <div class="span8 change-sequence">
-              <%= change.seq %>
+              <%- change.seq %>
             </div>
             <div class="span2 text-right">
               <a class="js-copy" data-clipboard-text="<%= change.seq %>" data-bypass="true" href="#">
@@ -36,9 +36,9 @@ the License.
             </div>
             <div class="span8">
               <% if (change.deleted) { %>
-                <%= change.id %>
+                <%- change.id %>
               <% } else { %>
-                <a href="#<%- database.url('app') %>/<%- safeURL(change.id) %>"><%= change.id %></a>
+                <a href="#<%- database.url('app') %>/<%- safeURL(change.id) %>"><%- change.id %></a>
               <% } %>    </div>
             <div class="span2 text-right">
               <a class="js-copy" data-clipboard-text="<%= change.id %>" data-bypass="true" href="#">
@@ -62,7 +62,7 @@ the License.
               deleted
             </div>
             <div class="span10">
-              <%= change.deleted ? "True" : "False" %>
+              <%- change.deleted ? "True" : "False" %>
             </div>
           </div>
         </div>