couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [2/4] fauxton commit: updated refs/heads/master to bfdbf11
Date Thu, 14 Jan 2016 08:38:40 GMT
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx b/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
index 0589c7a..1e05692 100644
--- a/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
+++ b/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
@@ -26,6 +26,8 @@ define([
   var assert = utils.assert;
   var TestUtils = React.addons.TestUtils;
   var store = Stores.indexResultsStore;
+  var createDocColumn = documentTestHelper.createDocColumn;
+  var createMangoIndexDocColumn = documentTestHelper.createMangoIndexDocColumn;
 
   describe('Index Results', function () {
     var container, instance;
@@ -44,7 +46,7 @@ define([
       it('renders a default text', function () {
         IndexResultsActions.newResultsList({
           collection: [],
-          deleteable: true
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
         IndexResultsActions.resultsListReset();
 
@@ -55,11 +57,22 @@ define([
 
       it('you can change the default text', function () {
         IndexResultsActions.newResultsList({
-          collection: [],
-          deleteable: true,
+          collection: {
+            forEach: function () {},
+            filter: function () { return []; },
+            fetch: function () {
+              return {
+                then: function (cb) {
+                  cb();
+                }
+              };
+            }
+          },
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
           textEmptyIndex: 'I <3 Hamburg'
         });
 
+
         instance = TestUtils.renderIntoDocument(<Views.List />, container);
         var $el = $(instance.getDOMNode());
         assert.equal($el.text(), 'I <3 Hamburg');
@@ -84,16 +97,13 @@ define([
         store.reset();
       });
 
-      var createDocColumn = documentTestHelper.createDocColumn;
-      var createMangoIndexDocColumn = documentTestHelper.createMangoIndexDocColumn;
-
-
       it('does not render checkboxes for elements with just the special index (Mango Index List)', function () {
         IndexResultsActions.sendMessageNewResultList({
-          collection: createMangoIndexDocColumn([{foo: 'testId1', type: 'special'}])
+          collection: createMangoIndexDocColumn([{foo: 'testId1', type: 'special'}]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
 
-        store.enableTableView();
+        store.toggleTableView({enable: true});
 
         IndexResultsActions.resultsListReset();
 
@@ -104,7 +114,7 @@ define([
 
         var $el = $(instance.getDOMNode());
 
-        assert.ok($el.find('.tableview-header-el-checkbox').length === 0);
+        assert.ok($el.find('.tableview-checkbox-cell input').length === 0);
       });
 
       it('renders checkboxes for elements with more than just the the special index (Mango Index List)', function () {
@@ -120,10 +130,11 @@ define([
             name: 'biene',
             type: 'special',
             def: {fields: [{_id: 'desc'}]}
-          }])
+          }]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
 
-        store.enableTableView();
+        store.toggleTableView({enable: true});
 
         IndexResultsActions.resultsListReset();
 
@@ -134,7 +145,7 @@ define([
 
         var $el = $(instance.getDOMNode());
 
-        assert.ok($el.find('.tableview-header-el-checkbox').length > 0);
+        assert.ok($el.find('.tableview-checkbox-cell input').length > 0);
       });
 
       it('does not render checkboxes for elements with no id in a table (usual docs)', function () {
@@ -144,10 +155,11 @@ define([
             name: 'biene',
             type: 'special',
             def: {fields: [{_id: 'desc'}]}
-          }])
+          }]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
 
-        store.enableTableView();
+        store.toggleTableView({enable: true});
 
         IndexResultsActions.resultsListReset();
 
@@ -158,15 +170,16 @@ define([
 
         var $el = $(instance.getDOMNode());
 
-        assert.ok($el.find('.tableview-header-el-checkbox').length === 0);
+        assert.ok($el.find('.tableview-checkbox-cell input').length === 0);
       });
 
       it('does not render checkboxes for elements with no rev in a table (usual docs)', function () {
         IndexResultsActions.sendMessageNewResultList({
-          collection: createDocColumn([{id: '1', foo: 'testId1'}, {id: '1', bar: 'testId1'}])
+          collection: createDocColumn([{id: '1', foo: 'testId1'}, {id: '1', bar: 'testId1'}]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
 
-        store.enableTableView();
+        store.toggleTableView({enable: true});
 
         IndexResultsActions.resultsListReset();
 
@@ -177,15 +190,16 @@ define([
 
         var $el = $(instance.getDOMNode());
 
-        assert.ok($el.find('.tableview-header-el-checkbox').length === 0);
+        assert.ok($el.find('.tableview-checkbox-cell input').length === 0);
       });
 
       it('renders checkboxes for elements with an id and rev in a table (usual docs)', function () {
         IndexResultsActions.sendMessageNewResultList({
-          collection: createDocColumn([{id: '1', foo: 'testId1', rev: 'foo'}, {bar: 'testId1', rev: 'foo'}])
+          collection: createDocColumn([{id: '1', foo: 'testId1', rev: 'foo'}, {bar: 'testId1', rev: 'foo'}]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
 
-        store.enableTableView();
+        store.toggleTableView({enable: true});
 
         IndexResultsActions.resultsListReset();
 
@@ -196,17 +210,18 @@ define([
 
         var $el = $(instance.getDOMNode());
 
-        assert.ok($el.find('.tableview-checkbox-cell').length > 0);
+        assert.ok($el.find('.tableview-checkbox-cell input').length > 0);
       });
 
       it('renders checkboxes for elements with an id and rev in a json view (usual docs)', function () {
         IndexResultsActions.sendMessageNewResultList({
-          collection: createDocColumn([{id: '1', emma: 'testId1', rev: 'foo'}, {bar: 'testId1'}])
+          collection: createDocColumn([{id: '1', emma: 'testId1', rev: 'foo'}, {bar: 'testId1'}]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
 
         IndexResultsActions.resultsListReset();
 
-        store.disableTableView();
+        store.toggleTableView({enable: false});
 
         instance = TestUtils.renderIntoDocument(
           <Views.List />,
@@ -219,12 +234,13 @@ define([
 
       it('does not render checkboxes for elements with that are not deletable in a json view (usual docs)', function () {
         IndexResultsActions.sendMessageNewResultList({
-          collection: createDocColumn([{foo: 'testId1', rev: 'foo'}, {bar: 'testId1'}])
+          collection: createDocColumn([{foo: 'testId1', rev: 'foo'}, {bar: 'testId1'}]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
         });
 
         IndexResultsActions.resultsListReset();
 
-        store.disableTableView();
+        store.toggleTableView({enable: false});
 
         instance = TestUtils.renderIntoDocument(
           <Views.List />,
@@ -238,6 +254,27 @@ define([
 
     });
 
+    describe('wrapped autocomplete', function () {
+      it('renders a filter icon if no text given', function () {
+
+        var elements = ['min_weight', 'max_weight'];
+
+        instance = TestUtils.renderIntoDocument(
+          <Views.WrappedAutocomplete selectedField="ente" />,
+          container
+        );
+
+        var $el = $(instance.getDOMNode());
+
+        assert.equal($el.find('.icon-filter').length, 0);
+
+        var node = $el.find('input')[0];
+        node.value = '';
+        TestUtils.Simulate.change(node);
+        assert.equal($el.find('.icon-filter').length, 1);
+      });
+    });
+
     describe('loading', function () {
       beforeEach(function () {
         container = document.createElement('div');

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/index-results/tests/index-results.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/tests/index-results.storesSpec.js b/app/addons/documents/index-results/tests/index-results.storesSpec.js
index dec5d50..1ad2999 100644
--- a/app/addons/documents/index-results/tests/index-results.storesSpec.js
+++ b/app/addons/documents/index-results/tests/index-results.storesSpec.js
@@ -14,7 +14,7 @@ define([
   'api',
   'addons/documents/index-results/stores',
   'addons/documents/index-results/actiontypes',
-  'addons/documents/shared-resources',
+  'addons/documents/resources',
   'addons/documents/tests/document-test-helper',
 
   'testUtils'
@@ -30,7 +30,7 @@ define([
   describe('Index Results Store', function () {
     beforeEach(function () {
       store = new Stores.IndexResultsStore();
-      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+      store.dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
       store.reset();
       opts = {
         params: {limit: 10, skip: 0},
@@ -38,19 +38,60 @@ define([
           safeID: function () { return '1';}
         }
       };
+
+      store.newResults({
+        collection: createDocColumn([
+          {_id: 'testId5', _rev: '1', 'value': 'one'},
+          {_id: 'testId6', _rev: '1', 'value': 'one'}
+        ]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: '1' })
+      });
     });
 
     afterEach(function () {
-      FauxtonAPI.dispatcher.unregister(dispatchToken);
+      FauxtonAPI.dispatcher.unregister(store.dispatchToken);
     });
 
 
     it('hasResults returns true for collection', function () {
-      store._collection = [1, 2, 3];
+      store.newResults({
+        collection: createDocColumn([
+          {_id: 'testId5', _rev: '1', 'value': 'one'},
+          {_id: 'testId6', _rev: '1', 'value': 'one'}
+        ]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: '1' })
+      });
 
       assert.ok(store.hasResults());
     });
 
+    it('can sort 2 dimensional arrays by the first value', function () {
+      var a = [
+        [20, 5],
+        [1, 2],
+        [3, 4]
+      ];
+      var res = store.sortByTwoFields(a);
+
+      assert.equal(a[0][0], 20);
+      assert.equal(a[1][0], 3);
+      assert.equal(a[2][0], 1);
+    });
+
+    it('can sort 2 dimensional arrays by the second value if multiple appear', function () {
+      var a = [
+        [1, "z"],
+        [1, "g"],
+        [1, "a"]
+      ];
+      var res = store.sortByTwoFields(a);
+
+      assert.equal(a[0][1], 'a');
+      assert.equal(a[1][1], 'g');
+      assert.equal(a[2][1], 'z');
+    });
+
+
     it('hasResults returns false for empty collection', function () {
       store._collection = [];
 
@@ -58,7 +99,11 @@ define([
     });
 
     it('getResults has correct doc format', function () {
-      store._collection = new Documents.AllDocs([{_id: 'testId'}], opts);
+      store.newResults({
+        collection: createDocColumn([
+          {_id: 'testId', _rev: '1', 'value': 'one'},
+        ])
+      });
 
       var doc = store.getResults().results[0];
       assert.equal(doc.id, 'testId');
@@ -115,31 +160,42 @@ define([
       assert.deepEqual(res[0], {"_rev": "1", "ente": "gans", "fuchs": "hase"});
     });
 
-    it('normalizes different content from include_docs disabled', function () {
+    it('returns the fields that occure the most without id and rev', function () {
       var doclist = [
-        {id: 'testId2', foo: 'one'},
-        {id: 'testId3', foo: 'two'}
+        {_rev: '1', _id: '1', id: 'testId2', foo: 'one'},
+        {_rev: '1', _id: '1', id: 'testId3', foo: 'two'}
       ];
 
-      var res = store.normalizeTableData(doclist);
-      assert.deepEqual(doclist, res);
+      var res = store.getPrioritizedFields(doclist, 10);
+      assert.deepEqual(res, ['foo']);
     });
 
-    it('finds out if we have at least one editable/deleteable doc', function () {
+    it('sorts the fields that occure the most', function () {
       var doclist = [
-        {id: 'testId2', foo: 'one', isDeletable: true},
-        {id: 'testId3', foo: 'two'}
+        {id: 'testId2', foo: 'one'},
+
+        {id: 'testId3', bar: 'two'},
+        {id: 'testId3', bar: 'two'},
+        {id: 'testId3', baz: 'two'},
+        {id: 'testId3', baz: 'two'}
       ];
 
-      assert.ok(store.getHasDeletableDoc(doclist));
+      var res = store.getPrioritizedFields(doclist, 10);
+      assert.deepEqual(res, ['bar', 'baz', 'foo']);
+    });
 
-      doclist = [
-        {foo: 'one'},
-        {foo: 'two'}
-      ];
+    it('limits the fields that occure the most', function () {
+      var doclist = [
+        {id: 'testId2', foo: 'one'},
 
-      assert.notOk(store.getHasDeletableDoc(doclist));
+        {id: 'testId3', bar: 'two'},
+        {id: 'testId3', bar: 'two'},
+        {id: 'testId3', baz: 'two'},
+        {id: 'testId3', baz: 'two'}
+      ];
 
+      var res = store.getPrioritizedFields(doclist, 2);
+      assert.deepEqual(res, ['bar', 'baz']);
     });
 
     it('if the collection is empty, no docs should be selected', function () {
@@ -148,7 +204,23 @@ define([
       assert.notOk(store.areAllDocumentsSelected());
     });
 
-    it('special mango docs are not selectable', function () {
+    it('if the collection changes, not all docs should be selected', function () {
+      store._collection = createDocColumn([
+        {_id: 'testId1', _rev: '1', 'value': 'one'},
+        {_id: 'testId2', _rev: '1', 'value': 'one'}
+      ]);
+
+      store.selectAllDocuments();
+
+      store._collection = createDocColumn([
+        {_id: 'testId5', _rev: '1', 'value': 'one'},
+        {_id: 'testId6', _rev: '1', 'value': 'one'}
+      ]);
+
+      assert.notOk(store.areAllDocumentsSelected());
+    });
+
+    it('special mango docs are not selectable, but all should be selected', function () {
       store._collection = createMangoIndexDocColumn([
         {ddoc: 'testId1', type: 'special', def: {fields: [{_id: 'desc'}]}},
         {ddoc: 'testId2', blubb: 'ba', type: 'json', def: {fields: [{_id: 'desc'}]}}
@@ -159,26 +231,14 @@ define([
       assert.ok(store.areAllDocumentsSelected());
     });
 
-  });
-
-  describe('canSelectAll', function () {
-
     it('returns true for selected docs less than collection', function () {
-      store._collection = new Documents.AllDocs([{_id: 'testId1'}, {_id: 'testId2'}], opts);
+      store._collection = createDocColumn([
+        {_id: 'testId1', _rev: 'foo'},
+        {_id: 'testId2', _rev: 'foo'}
+      ]);
 
       store._selectedItems = {'testId1': true};
-      assert.ok(store.canSelectAll());
-    });
-
-    it('returns false for selected docs same as collection', function () {
-      store._collection = new Documents.AllDocs([{_id: 'testId1'}, {_id: 'testId2'}], opts);
-
-      store._selectedItems = {
-        'testId1': true,
-        'testId2': true
-      };
-
-      assert.notOk(store.canSelectAll());
+      assert.notOk(store.areAllDocumentsSelected());
     });
 
     it('returns true even with _all_docs (mango)', function () {
@@ -193,73 +253,77 @@ define([
         'testId2': true
       };
 
-      assert.notOk(store.canSelectAll());
-    });
-  });
-
-  describe('canDeselectAll', function () {
-
-    it('returns true for selected docs', function () {
-      store._selectedItems = {'testId1': true};
-      assert.ok(store.canDeselectAll());
+      assert.ok(store.areAllDocumentsSelected());
     });
 
-    it('returns false for no selected docs', function () {
-      store._selectedItems = {};
-
-      assert.notOk(store.canDeselectAll());
-    });
+    it('does not count multiple fields in the prioritzed table', function () {
+      store.newResults({
+        collection: createDocColumn([
+          {a: '1', 'value': 'one', b: '1'},
+          {a: '1', 'value': 'one', b: '1'},
+          {a: '1', 'value': 'one', b: '1'}
+        ])
+      });
 
-  });
+      store.getResults();
 
-  describe('getDocContent', function () {
+      store.toggleTableView({enable: true});
+      store.getResults();
 
-    it('returns full doc if not collapsed', function () {
-      store._collection = new Documents.AllDocs([{_id: 'testId1', 'value': 'one'}], opts);
+      store.changeTableViewFields({index: 0, newSelectedRow: 'value'});
 
-      var doc = store._collection.first();
-      var result = store.getDocContent(doc);
+      var stub = sinon.stub(store, 'isIncludeDocsEnabled');
+      stub.returns(true);
 
-      assert.equal(JSON.parse(result).value, 'one');
+      assert.deepEqual(store.getDisplayCountForTableView(), { shown: 2, allFieldCount: 3 });
     });
 
-    it('returns just the revision as content if collapsed', function () {
-      store._collection = new Documents.AllDocs([{_id: 'testId1', _rev: 'a', 'value': 'one'}], opts);
+    it('id and rev count as one field, because of the combined metadata field', function () {
+      store.newResults({
+        collection: createDocColumn([
+          {_id: 'foo1', _rev: 'bar', a: '1', 'value': 'one', b: '1'},
+          {_id: 'foo2', _rev: 'bar', a: '1', 'value': 'one', b: '1'},
+          {_id: 'foo3', _rev: 'bar', a: '1', 'value': 'one', b: '1'}
+        ]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: '1' })
+      });
 
-      var doc = store._collection.first();
-      store._allCollapsed = true;
-      var result = store.getDocContent(doc);
+      store.toggleTableView({enable: true});
 
-      assert.deepEqual({"rev": "a"}, JSON.parse(result));
-    });
+      var stub = sinon.stub(store, 'isIncludeDocsEnabled');
+      stub.returns(true);
+      store.getResults();
 
-  });
-
-  describe('#selectDoc', function () {
+      assert.deepEqual(store.getDisplayCountForTableView(), { shown: 4, allFieldCount: 4 });
+    });
 
-    it('selects doc if not already selected', function () {
-      store._selectedItems = {};
-      store.selectDoc('id');
+    it('selectDoc selects doc if not already selected', function () {
+      store._collection = new createDocColumn([
+        {_id: 'id', _rev: '1', 'value': 'one'},
+        {_id: 'testId6', _rev: '1', 'value': 'one'}
+      ]);
+      store.selectDoc({_id: 'id', _rev: '1'});
       assert.equal(store.getSelectedItemsLength(), 1);
     });
 
-    it('deselects doc if already selected', function () {
-      store._selectedItems = {'id': true};
-      store.selectDoc('id');
+    it('selectDoc deselects doc if already selected', function () {
+      store.selectDoc({_id: 'id', _rev: '1'});
+      store._collection = new createDocColumn([
+        {_id: 'id', _rev: '1', 'value': 'one'},
+        {_id: 'testId6', _rev: '1', 'value': 'one'}
+      ]);
+      store.selectDoc({_id: 'id', _rev: '1'});
       assert.equal(store.getSelectedItemsLength(), 0);
     });
-  });
-
-  describe('#selectAllDocuments', function () {
 
-    it('selects all documents', function () {
+    it('selectDoc selects all documents', function () {
       store._collection = createDocColumn([{_id: 'testId1', _rev: '1', 'value': 'one'}]);
 
       store.selectAllDocuments();
-      assert.ok(store.getSelectedItems().testId1);
+      assert.ok(store._bulkDeleteDocCollection.get('testId1'));
     });
 
-    it('does not select all documents if rev is missing', function () {
+    it('selectDoc does not select all documents if rev is missing', function () {
       store._collection = createDocColumn([{_id: 'testId1', 'value': 'one'}]);
 
       store.selectAllDocuments();
@@ -267,47 +331,27 @@ define([
     });
 
   });
-
   describe('toggleSelectAllDocuments', function () {
 
     it('deselects all documents', function () {
       store._collection = new Documents.AllDocs([{_id: 'testId1', _rev: '1', 'value': 'one'}], opts);
 
       store.selectAllDocuments();
-      assert.ok(store.getSelectedItems().testId1);
+      assert.ok(store._bulkDeleteDocCollection.get('testId1'));
       store.toggleSelectAllDocuments();
       assert.equal(store.getSelectedItemsLength(), 0);
     });
 
-    it('deselects all documents', function () {
+    it('deselects all documents with toggleSelectAllDocuments', function () {
       store.reset();
       store._collection = new Documents.AllDocs([{_id: 'testId1', _rev: '1', 'value': 'one'}], opts);
 
-      assert.equal(Object.keys(store.getSelectedItems()).length, 0);
+      assert.equal(store._bulkDeleteDocCollection.length, 0);
       store.toggleSelectAllDocuments();
       assert.equal(store.getSelectedItemsLength(), 1);
     });
   });
 
-  describe('#createBulkDeleteFromSelected', function () {
-
-    it('correctly creates BulkDeleteDocCollection', function () {
-      store._collection = new Documents.AllDocs([{_id: 'testId1'}, {_id: 'testId2'}], opts);
-
-      store._bulkDeleteDocCollection = Documents.BulkDeleteDocCollection;
-
-      store._selectedItems = {
-        'testId1': true,
-        'testId2': true
-      };
-
-      var bulkDelete = store.createBulkDeleteFromSelected();
-
-      assert.equal(bulkDelete.length, 2);
-      assert.ok(bulkDelete.at(0).get('_deleted'));
-    });
-  });
-
   describe('#getMangoDoc', function () {
     beforeEach(function () {
       store = new Stores.IndexResultsStore();
@@ -437,4 +481,265 @@ define([
       assert.equal(store.isDeletable({}), false);
     });
   });
+
+  describe('Index Pagination', function () {
+
+    beforeEach(function () {
+      store = new Stores.IndexResultsStore();
+      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+    });
+
+    afterEach(function () {
+      FauxtonAPI.dispatcher.unregister(dispatchToken);
+    });
+
+    describe('#collectionChanged', function () {
+      var collection;
+      beforeEach(function () {
+        collection = new Documents.AllDocs([{id:1}, {id: 2}], {
+          params: {},
+          database: {
+            safeID: function () { return '1';}
+          }
+        });
+        store.reset();
+        store.newResults({
+          collection: collection
+        });
+      });
+
+      it('sets total rows correctly', function () {
+        assert.equal(store.getTotalRows(), 2);
+      });
+    });
+
+    describe('canShowPrevious', function () {
+      it('cannot show previous if disabled', function () {
+        store._enabled = false;
+        assert.notOk(store.canShowPrevious());
+      });
+
+      it('can show if collection can show', function () {
+        store._enabled = true;
+        store._collection = new Backbone.Collection();
+        store._collection.hasPrevious = function () { return true;};
+        assert.ok(store.canShowPrevious());
+      });
+
+    });
+
+    describe('canShowNext', function () {
+      it('cannot show next if disabled', function () {
+        store._enabled = false;
+        assert.notOk(store.canShowNext());
+      });
+
+      it('cannot show if pageStart and perPage greater than docLimit', function () {
+        store._enabled = true;
+        store._docLimit = 10;
+        store._perPage = 20;
+
+        assert.notOk(store.canShowNext());
+      });
+
+      it('can show if collection can show', function () {
+        store._enabled = true;
+        store._docLimit = 100000;
+        store.reset();
+        store._collection = new Backbone.Collection();
+        store._collection.hasNext = function () { return true;};
+        assert.ok(store.canShowNext());
+      });
+    });
+
+    describe('paginateNext', function () {
+      beforeEach(function () {
+        store.reset();
+
+        store.newResults({
+          collection: new Documents.AllDocs(null, {
+            params: {},
+            database: {
+              safeID: function () { return '1';}
+            }
+          })
+        });
+        store.setPerPage(20);
+      });
+
+      it('should increment page number', function () {
+        store.paginateNext();
+
+        assert.equal(store.getCurrentPage(), 2);
+      });
+
+      it('should increment page start', function () {
+        store.paginateNext();
+
+        assert.equal(store.getPageStart(), 21);
+      });
+
+      it('should set correct page end', function () {
+        store._collection.length = 20;
+        store.paginateNext();
+
+        assert.equal(store.getPageEnd(), 40);
+      });
+
+      it('should set collection pageSize', function () {
+        store.paginateNext();
+
+        assert.equal(store.getCollection().paging.pageSize, 20);
+      });
+    });
+
+    describe('paginatePrevious', function () {
+      beforeEach(function () {
+        store.resetPagination();
+        store._collection = new Documents.AllDocs(null, {
+          params: {},
+          database: {
+            safeID: function () { return '1';}
+          }
+        });
+      });
+
+      it('should decrement page number', function () {
+        store.paginateNext();
+        store.paginatePrevious();
+
+        assert.equal(store.getCurrentPage(), 1);
+      });
+
+      it('should decrement page start', function () {
+        store.paginateNext();
+        store.paginatePrevious();
+
+        assert.equal(store.getPageStart(), 1);
+      });
+
+      it('should decrement page end', function () {
+        store._collection.length = 20;
+        store.paginateNext();
+        store.paginatePrevious();
+
+        assert.equal(store.getPageEnd(), 20);
+      });
+
+      it('should set collection pageSize', function () {
+        store.paginateNext();
+        store.paginatePrevious();
+
+        assert.equal(store.getCollection().paging.pageSize, 20);
+      });
+
+    });
+
+    describe('totalDocsViewed', function () {
+      beforeEach(function () {
+        store.reset();
+      });
+
+      it('returns correct count for page 1 and 20 docs per page', function () {
+        assert.equal(store.totalDocsViewed(), 20);
+      });
+
+      it('returns correct count for page 3 and 10 docs per page', function () {
+        store._perPage = 10;
+        store._currentPage = 3;
+
+        assert.equal(store.totalDocsViewed(), 30);
+      });
+    });
+
+    describe('documentsLeftToFetch', function () {
+      beforeEach(function () {
+        store.reset();
+      });
+
+      it('returns 20 documents left', function () {
+        assert.equal(store.documentsLeftToFetch(), 20);
+      });
+
+      it('returns less if close to limit', function () {
+        store._docLimit = 35;
+        store._perPage = 10;
+        store._currentPage = 3;
+        assert.equal(store.documentsLeftToFetch(), 5);
+      });
+
+    });
+
+    describe('#initPerPage', function () {
+
+      it('uses default if no local storage set', function () {
+        window.localStorage.removeItem('fauxton:perpage');
+        store.initPerPage();
+        assert.equal(store.getPerPage(), 20);
+      });
+
+      it('uses localstorage when available', function () {
+        window.localStorage.setItem('fauxton:perpage', 44);
+        store.initPerPage();
+        assert.equal(store.getPerPage(), 44);
+      });
+
+      it('uses doc limit when its less than perPage', function () {
+        window.localStorage.setItem('fauxton:perpage', 100);
+        store._docLimit = 6;
+        store.initPerPage();
+        assert.equal(store.getPerPage(), 6);
+      });
+
+    });
+
+    describe('#setDocumentLimit', function () {
+
+      it('sets document if exists', function () {
+        store.setDocumentLimit(10);
+        assert.equal(store._docLimit, 10);
+      });
+
+      it('sets perPage to doclimit if doclimit less than perPage', function () {
+        store.setPerPage(20);
+        store.setDocumentLimit(1);
+        assert.equal(store._docLimit, 1);
+      });
+
+      it('sets doclimit to 10000 if NaN', function () {
+        store.setDocumentLimit(NaN);
+        assert.equal(store._docLimit, 10000);
+      });
+    });
+
+    describe('#setPerPage', function () {
+      beforeEach(function () {
+        store.reset();
+        store._collection = new Documents.AllDocs(null, {
+          params: {},
+          database: {
+            safeID: function () { return '1';}
+          }
+        });
+
+      });
+
+      it('stores per page in local storage', function () {
+        var testPerPage = 111;
+        store.setPerPage(testPerPage);
+        var perPage = window.localStorage.getItem('fauxton:perpage');
+        assert.equal(perPage, testPerPage );
+      });
+
+      it('sets collections perPage', function () {
+        var spy = sinon.spy(store._collection, 'pageSizeReset');
+        var testPerPage = 110;
+
+        store.setPerPage(testPerPage);
+        assert.equal(spy.getCall(0).args[0], testPerPage);
+
+
+      });
+    });
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/mango/mango.actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/mango.actions.js b/app/addons/documents/mango/mango.actions.js
index 2cd4894..92c8627 100644
--- a/app/addons/documents/mango/mango.actions.js
+++ b/app/addons/documents/mango/mango.actions.js
@@ -16,10 +16,10 @@ define([
   'addons/documents/resources',
   'addons/documents/mango/mango.actiontypes',
   'addons/documents/mango/mango.stores',
-  'addons/documents/pagination/stores',
+  'addons/documents/index-results/stores',
   'addons/documents/index-results/actions',
 ],
-function (app, FauxtonAPI, Documents, ActionTypes, Stores, PaginationStores, IndexResultActions) {
+function (app, FauxtonAPI, Documents, ActionTypes, Stores, IndexResultsStores, IndexResultActions) {
   var store = Stores.mangoStore;
 
   return {
@@ -71,7 +71,7 @@ function (app, FauxtonAPI, Documents, ActionTypes, Stores, PaginationStores, Ind
             database: options.database,
             params: null,
             paging: {
-              pageSize: PaginationStores.indexPaginationStore.getPerPage()
+              pageSize: IndexResultsStores.indexResultsStore.getPerPage()
             }
           });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/mango/mango.components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/mango.components.react.jsx b/app/addons/documents/mango/mango.components.react.jsx
index b121f15..c7e949b 100644
--- a/app/addons/documents/mango/mango.components.react.jsx
+++ b/app/addons/documents/mango/mango.components.react.jsx
@@ -111,7 +111,8 @@ function (app, FauxtonAPI, React, Stores, Actions,
 
       IndexResultActions.runMangoFindQuery({
         database: this.state.database,
-        queryCode: this.getMangoEditor().getEditorValue()
+        queryCode: this.getMangoEditor().getEditorValue(),
+
       });
     }
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/pagination/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/actions.js b/app/addons/documents/pagination/actions.js
index cb4248a..5a4df7a 100644
--- a/app/addons/documents/pagination/actions.js
+++ b/app/addons/documents/pagination/actions.js
@@ -14,24 +14,28 @@ define([
   'app',
   'api',
   'addons/documents/pagination/actiontypes',
-  'addons/documents/pagination/stores',
-  'addons/documents/index-results/actions'
-],
-function (app, FauxtonAPI, ActionTypes, Stores, IndexResultsActions) {
+  'addons/documents/index-results/actions',
+
 
-  var store = Stores.indexPaginationStore;
+],
+function (app, FauxtonAPI, ActionTypes, IndexResultsActions) {
 
   return {
-    updatePerPage: function (perPage) {
+
+    updatePerPage: function (perPage, collection, bulkCollection) {
+
       FauxtonAPI.dispatch({
         type: ActionTypes.PER_PAGE_CHANGE,
         perPage: perPage
       });
 
       IndexResultsActions.clearResults();
-
-      store.getCollection().fetch().then(function () {
+      collection.fetch().then(function () {
         IndexResultsActions.resultsListReset();
+        IndexResultsActions.sendMessageNewResultList({
+          collection: collection,
+          bulkCollection: bulkCollection
+        });
       });
     },
 
@@ -42,29 +46,41 @@ function (app, FauxtonAPI, ActionTypes, Stores, IndexResultsActions) {
       });
     },
 
-    paginateNext: function () {
+    paginateNext: function (collection, bulkCollection) {
       FauxtonAPI.dispatch({
         type: ActionTypes.PAGINATE_NEXT,
       });
 
       IndexResultsActions.clearResults();
-
-      store.getCollection().next().then(function () {
+      collection.next().then(function () {
         IndexResultsActions.resultsListReset();
+
+        IndexResultsActions.sendMessageNewResultList({
+          collection: collection,
+          bulkCollection: bulkCollection
+        });
       });
     },
 
-    paginatePrevious: function () {
+    paginatePrevious: function (collection, bulkCollection) {
       FauxtonAPI.dispatch({
         type: ActionTypes.PAGINATE_PREVIOUS,
       });
 
       IndexResultsActions.clearResults();
-
-      store.getCollection().previous().then(function () {
+      collection.previous().then(function () {
         IndexResultsActions.resultsListReset();
+
+        IndexResultsActions.sendMessageNewResultList({
+          collection: collection,
+          bulkCollection: bulkCollection
+        });
       });
     },
 
+    toggleTableViewType: function () {
+      IndexResultsActions.togglePrioritizedTableView();
+    }
+
   };
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/pagination/pagination.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/pagination.react.jsx b/app/addons/documents/pagination/pagination.react.jsx
index 0b34e62..c5a658c 100644
--- a/app/addons/documents/pagination/pagination.react.jsx
+++ b/app/addons/documents/pagination/pagination.react.jsx
@@ -13,17 +13,19 @@
 define([
   "api",
   "react",
-  'addons/documents/pagination/stores',
   'addons/documents/pagination/actions',
-  ], function (FauxtonAPI, React, Stores, Actions) {
-    var indexPaginationStore = Stores.indexPaginationStore;
+  'addons/documents/index-results/stores',
+  ], function (FauxtonAPI, React, Actions, IndexResultsStore) {
+    var indexResultsStore = IndexResultsStore.indexResultsStore;
 
     var IndexPaginationController = React.createClass({
 
       getStoreState: function () {
         return {
-          canShowPrevious: indexPaginationStore.canShowPrevious(),
-          canShowNext: indexPaginationStore.canShowNext(),
+          canShowPrevious: indexResultsStore.canShowPrevious(),
+          canShowNext: indexResultsStore.canShowNext(),
+          collection: indexResultsStore.getCollection(),
+          bulkCollection: indexResultsStore.getBulkDocCollection(),
         };
       },
 
@@ -32,11 +34,11 @@ define([
       },
 
       componentDidMount: function () {
-        indexPaginationStore.on('change', this.onChange, this);
+        indexResultsStore.on('change', this.onChange, this);
       },
 
       componentWillUnmount: function () {
-        indexPaginationStore.off('change', this.onChange);
+        indexResultsStore.off('change', this.onChange);
       },
 
       onChange: function () {
@@ -45,16 +47,20 @@ define([
 
       nextClicked: function (event) {
         event.preventDefault();
-        event.stopPropagation();
         if (!this.state.canShowNext) { return; }
-        Actions.paginateNext();
+
+        var collection = this.state.collection;
+        var bulkCollection = this.state.bulkCollection;
+        Actions.paginateNext(collection, bulkCollection);
       },
 
       previousClicked: function (event) {
         event.preventDefault();
-        event.stopPropagation();
         if (!this.state.canShowPrevious) { return; }
-        Actions.paginatePrevious();
+
+        var collection = this.state.collection;
+        var bulkCollection = this.state.bulkCollection;
+        Actions.paginatePrevious(collection, bulkCollection);
       },
 
       render: function () {
@@ -68,15 +74,18 @@ define([
         if (!this.state.canShowNext) {
           canShowNextClassName = 'disabled';
         }
+
         return (
-          <ul className="pagination">
-            <li className={canShowPreviousClassName} >
-              <a id="previous" onClick={this.previousClicked} className="icon fonticon-left-open" href="#" data-bypass="true"></a>
-            </li>
-            <li className={canShowNextClassName} >
-              <a id="next" onClick={this.nextClicked} className="icon fonticon-right-open" href="#" data-bypass="true"></a>
-            </li>
-        </ul>
+          <div className="documents-pagination">
+            <ul className="pagination">
+              <li className={canShowPreviousClassName} >
+                <a id="previous" onClick={this.previousClicked} className="icon fonticon-left-open" href="#" data-bypass="true"></a>
+              </li>
+              <li className={canShowNextClassName} >
+                <a id="next" onClick={this.nextClicked} className="icon fonticon-right-open" href="#" data-bypass="true"></a>
+              </li>
+            </ul>
+          </div>
         );
       }
 
@@ -93,7 +102,7 @@ define([
         return (
           <div id="per-page">
             <label htmlFor="select-per-page" className="drop-down inline">
-              Documents per page:
+              Documents per page: &nbsp;
               <select id="select-per-page" onChange={this.perPageChange} value={this.props.perPage.toString()} className="input-small">
                 <option value="5">5</option>
                 <option value="10">10</option>
@@ -113,10 +122,15 @@ define([
 
       getStoreState: function () {
         return {
-          totalRows: indexPaginationStore.getTotalRows(),
-          pageStart: indexPaginationStore.getPageStart(),
-          pageEnd: indexPaginationStore.getPageEnd(),
-          perPage: indexPaginationStore.getPerPage()
+          totalRows: indexResultsStore.getTotalRows(),
+          pageStart: indexResultsStore.getPageStart(),
+          pageEnd: indexResultsStore.getPageEnd(),
+          perPage: indexResultsStore.getPerPage(),
+          prioritizedEnabled: indexResultsStore.getIsPrioritizedEnabled(),
+          showPrioritizedFieldToggler: indexResultsStore.getShowPrioritizedFieldToggler(),
+          displayedFields: indexResultsStore.getResults().displayedFields,
+          collection: indexResultsStore.getCollection(),
+          bulkCollection: indexResultsStore.getBulkDocCollection(),
         };
       },
 
@@ -125,36 +139,83 @@ define([
       },
 
       componentDidMount: function () {
-        indexPaginationStore.on('change', this.onChange, this);
+        indexResultsStore.on('change', this.onChange, this);
       },
 
       componentWillUnmount: function () {
-        indexPaginationStore.off('change', this.onChange);
+        indexResultsStore.off('change', this.onChange);
       },
 
       onChange: function () {
         this.setState(this.getStoreState());
       },
 
-      pageNumber: function () {
+      getPageNumberText: function () {
         if (this.state.totalRows === 0) {
-          return <p>Showing 0 documents</p>;
+          return <span>Showing 0 documents</span>;
         }
 
-        return <p>Showing document {this.state.pageStart} - {this.state.pageEnd}</p>;
+        return <span>Showing document {this.state.pageStart} - {this.state.pageEnd}</span>;
+      },
+
+      toggleTableViewType: function () {
+        Actions.toggleTableViewType();
+      },
+
+      getTableControl: function () {
+        if (!this.state.showPrioritizedFieldToggler) {
+          return null;
+        }
+
+        return (
+          <div className="footer-table-control">
+            <div className="footer-doc-control-prioritized-wrapper pull-left">
+              <label htmlFor="footer-doc-control-prioritized">
+                <input
+                  id="footer-doc-control-prioritized"
+                  checked={this.state.prioritizedEnabled}
+                  onChange={this.toggleTableViewType}
+                  type="checkbox">
+                </input>
+                Show all columns
+              </label>
+            </div>
+            {this.getAmountShownFields()}
+          </div>
+        );
       },
 
       perPageChange: function (perPage) {
-        Actions.updatePerPage(perPage);
+        var collection = this.state.collection;
+        var bulkCollection = this.state.bulkCollection;
+        Actions.updatePerPage(perPage, collection, bulkCollection);
       },
 
+      getAmountShownFields: function () {
+        var fields = this.state.displayedFields;
+        if (!fields || this.state.prioritizedEnabled) {
+          return null;
+        }
+
+        return (
+          <div className="pull-right">
+            Showing {fields.shown} of {fields.allFieldCount} columns.
+          </div>
+        );
+      },
+
+
       render: function () {
         return (
-          <div>
-            <div className="index-indicator">
-              {this.pageNumber()}
+          <div className="footer-controls">
+            <div className="page-controls">
+              {this.getTableControl()}
             </div>
+
             <PerPageSelector perPageChange={this.perPageChange} perPage={this.state.perPage} />
+            <div className="current-docs">
+              {this.getPageNumberText()}
+            </div>
           </div>
         );
       }
@@ -165,12 +226,8 @@ define([
       render: function () {
         return (
           <footer className="index-pagination pagination-footer">
-            <div id="documents-pagination">
-              <IndexPaginationController />
-            </div>
-            <div id="item-numbers">
-              <AllDocsNumberController />
-            </div>
+            <IndexPaginationController />
+            <AllDocsNumberController />
           </footer>
         );
       }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/pagination/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/stores.js b/app/addons/documents/pagination/stores.js
deleted file mode 100644
index 31573a2..0000000
--- a/app/addons/documents/pagination/stores.js
+++ /dev/null
@@ -1,197 +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.
-
-define([
-  'app',
-  'api',
-  'addons/documents/pagination/actiontypes',
-  'addons/documents/index-results/actiontypes'
-], function (app, FauxtonAPI, ActionTypes, IndexResultsActionTypes) {
-
-  var Stores = {};
-  var maxDocLimit = 10000;
-
-  Stores.IndexPaginationStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._pageStart = 1;
-      this._enabled = true;
-      this._currentPage = 1;
-      this._pageStart = 1;
-      this._newView = false;
-      this._docLimit = _.isUndefined(this._docLimit) ? maxDocLimit : this._docLimit;
-      this.initPerPage();
-    },
-
-    setDocumentLimit: function (docLimit) {
-      if (docLimit) {
-        this._docLimit = docLimit;
-      } else {
-        this._docLimit = maxDocLimit;
-      }
-
-      this.initPerPage();
-    },
-
-    newPagination: function (collection) {
-      this._collection = collection;
-      this.reset();
-    },
-
-    getCollection: function () {
-      return this._collection;
-    },
-
-    canShowPrevious: function () {
-      if (!this._enabled) { return false; }
-      if (!this._collection.hasPrevious) { return false; }
-
-      return this._collection.hasPrevious();
-    },
-
-    canShowNext: function () {
-      if (!this._enabled) { return this._enabled; }
-
-      if ((this._pageStart + this._perPage) >= this._docLimit) {
-        return false;
-      }
-
-      if (!this._collection.hasNext) { return false; }
-
-      return this._collection.hasNext();
-    },
-
-    paginateNext: function () {
-      this._currentPage += 1;
-      this._pageStart += this.getPerPage();
-      this._collection.paging.pageSize = this.documentsLeftToFetch();
-    },
-
-    paginatePrevious: function () {
-      this._currentPage -= 1;
-
-      this._pageStart = this._pageStart - this.getPerPage();
-      if (this._pageStart < 1) {
-        this._pageStart = 1;
-      }
-
-      this._collection.paging.pageSize = this.getPerPage();
-    },
-
-    getCurrentPage: function () {
-      return this._currentPage;
-    },
-
-    totalDocsViewed: function () {
-      return this._perPage * this._currentPage;
-    },
-
-    documentsLeftToFetch: function () {
-      var documentsLeftToFetch = this._docLimit - this.totalDocsViewed();
-
-      if (documentsLeftToFetch < this.getPerPage() ) {
-        return documentsLeftToFetch;
-      }
-
-      return this._perPage;
-    },
-
-    getPerPage: function () {
-      return this._perPage;
-    },
-
-    initPerPage: function () {
-      var perPage = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
-
-      if (window.localStorage) {
-        var storedPerPage = app.utils.localStorageGet('fauxton:perpage');
-
-        if (storedPerPage) {
-          perPage = parseInt(storedPerPage, 10);
-        }
-      }
-
-      if (this._docLimit < perPage) {
-        perPage = this._docLimit;
-      }
-
-      this.setPerPage(perPage);
-    },
-
-    setPerPage: function (perPage) {
-      this._perPage = perPage;
-      app.utils.localStorageSet('fauxton:perpage', perPage);
-
-      if (this._collection && this._collection.pageSizeReset) {
-        this._collection.pageSizeReset(perPage, {fetch: false});
-      }
-    },
-
-    getTotalRows: function () {
-      return this._collection.length;
-    },
-
-    getPageStart: function () {
-      return this._pageStart;
-    },
-
-    getPageEnd: function () {
-      return this._pageStart + this._collection.length - 1;
-    },
-
-    getUpdateSeq: function () {
-      if (!this._collection.updateSeq) { return false; }
-      return this._collection.updateSeq();
-    },
-
-    dispatch: function (action) {
-
-      switch (action.type) {
-        case IndexResultsActionTypes.INDEX_RESULTS_NEW_RESULTS:
-          this.newPagination(action.options.collection);
-          this.triggerChange();
-        break;
-        case ActionTypes.SET_PAGINATION_DOCUMENT_LIMIT:
-          this.setDocumentLimit(action.docLimit);
-          this.triggerChange();
-        break;
-        case IndexResultsActionTypes.INDEX_RESULTS_RESET:
-          this.triggerChange();
-        break;
-        case ActionTypes.PAGINATE_NEXT:
-          this.paginateNext();
-          this.triggerChange();
-        break;
-        case ActionTypes.PAGINATE_PREVIOUS:
-          this.paginatePrevious();
-          this.triggerChange();
-        break;
-        case ActionTypes.PER_PAGE_CHANGE:
-          this.reset();
-          this.setPerPage(action.perPage);
-          this.triggerChange();
-        break;
-        default:
-        return;
-      }
-    }
-  });
-
-  Stores.indexPaginationStore = new Stores.IndexPaginationStore();
-  Stores.indexPaginationStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.indexPaginationStore.dispatch);
-
-  return Stores;
-
-});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/pagination/tests/pagination.actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/tests/pagination.actionsSpec.js b/app/addons/documents/pagination/tests/pagination.actionsSpec.js
deleted file mode 100644
index edeff05..0000000
--- a/app/addons/documents/pagination/tests/pagination.actionsSpec.js
+++ /dev/null
@@ -1,104 +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.
-
-define([
-  'api',
-  'addons/documents/pagination/actions',
-  'addons/documents/pagination/stores',
-  'addons/documents/index-results/actions',
-  'addons/documents/shared-resources',
-  'testUtils',
-], function (FauxtonAPI, Actions, Stores, IndexResultsActions, Documents, testUtils) {
-  var assert = testUtils.assert;
-
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
-
-  describe('Pagination Actions', function () {
-
-    afterEach(function () {
-      Stores.indexPaginationStore.documentsLeftToFetch.restore && Stores.indexPaginationStore.documentsLeftToFetch.restore();
-      Stores.indexPaginationStore.getCurrentPage.restore && Stores.indexPaginationStore.getCurrentPage.restore();
-      Stores.indexPaginationStore.getPerPage.restore && Stores.indexPaginationStore.getPerPage.restore();
-
-      IndexResultsActions.resultsListReset.restore && IndexResultsActions.resultsListReset.restore();
-      Stores.indexPaginationStore.getCollection.restore && Stores.indexPaginationStore.getCollection.restore();
-    });
-
-    describe('updatePerPage', function () {
-
-      beforeEach(function () {
-        Stores.indexPaginationStore._collection = new Documents.AllDocs([{id:1}, {id: 2}], {
-          params: {},
-          database: {
-            safeID: function () { return '1';}
-          }
-        });
-
-      });
-
-      it('fetches collection', function () {
-        var spy = sinon.spy(Stores.indexPaginationStore, 'getCollection');
-        Actions.updatePerPage(30);
-
-        assert.ok(spy.calledOnce);
-      });
-
-      it('sends results list reset', function () {
-        var promise = $.Deferred();
-        promise.resolve();
-        var stub = sinon.stub(Stores.indexPaginationStore, 'getCollection');
-        var spy = sinon.spy(IndexResultsActions, 'resultsListReset');
-        stub.returns({
-          fetch: function () { return promise; }
-        });
-
-        Actions.updatePerPage(30);
-        assert.ok(spy.calledOnce);
-      });
-    });
-
-    describe('paginateNext', function () {
-
-      it('sends results list reset', function () {
-        var promise = $.Deferred();
-        promise.resolve();
-        var stub = sinon.stub(Stores.indexPaginationStore, 'getCollection');
-        var spy = sinon.spy(IndexResultsActions, 'resultsListReset');
-        stub.returns({
-          next: function () { return promise; }
-        });
-
-        Actions.paginateNext();
-        assert.ok(spy.calledOnce);
-      });
-
-    });
-
-    describe('paginatePrevious', function () {
-
-      it('sends results list reset', function () {
-        var promise = $.Deferred();
-        promise.resolve();
-        var stub = sinon.stub(Stores.indexPaginationStore, 'getCollection');
-        var spy = sinon.spy(IndexResultsActions, 'resultsListReset');
-        stub.returns({
-          previous: function () { return promise; }
-        });
-
-        Actions.paginatePrevious();
-        assert.ok(spy.calledOnce);
-      });
-
-    });
-  });
-
-});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/pagination/tests/paginationStoreSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/tests/paginationStoreSpec.js b/app/addons/documents/pagination/tests/paginationStoreSpec.js
deleted file mode 100644
index 7719372..0000000
--- a/app/addons/documents/pagination/tests/paginationStoreSpec.js
+++ /dev/null
@@ -1,285 +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.
-
-define([
-  'api',
-  'addons/documents/pagination/stores',
-  'addons/documents/pagination/actiontypes',
-  'addons/documents/shared-resources',
-  'testUtils'
-], function (FauxtonAPI, Stores, ActionTypes, Documents, testUtils) {
-  var assert = testUtils.assert;
-  var dispatchToken;
-  var store;
-
-  describe('Index Pagination Store', function () {
-
-    beforeEach(function () {
-      store = new Stores.IndexPaginationStore();
-      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
-    });
-
-    afterEach(function () {
-      FauxtonAPI.dispatcher.unregister(dispatchToken);
-    });
-
-    describe('#collectionChanged', function () {
-      var collection;
-      beforeEach(function () {
-        collection = new Documents.AllDocs([{id:1}, {id: 2}], {
-          params: {},
-          database: {
-            safeID: function () { return '1';}
-          }
-        });
-        store.reset();
-      });
-
-      it('sets total rows correctly', function () {
-        store.newPagination(collection);
-        assert.equal(store.getTotalRows(), 2);
-      });
-    });
-
-    describe('canShowPrevious', function () {
-      it('cannot show previous if disabled', function () {
-        store._enabled = false;
-        assert.notOk(store.canShowPrevious());
-      });
-
-      it('can show if collection can show', function () {
-        store._enabled = true;
-        store._collection = new Backbone.Collection();
-        store._collection.hasPrevious = function () { return true;};
-        assert.ok(store.canShowPrevious());
-      });
-
-    });
-
-    describe('canShowNext', function () {
-      it('cannot show next if disabled', function () {
-        store._enabled = false;
-        assert.notOk(store.canShowNext());
-      });
-
-      it('cannot show if pageStart and perPage greater than docLimit', function () {
-        store._enabled = true;
-        store._docLimit = 10;
-        store._perPage = 20;
-
-        assert.notOk(store.canShowNext());
-      });
-
-      it('can show if collection can show', function () {
-        store._enabled = true;
-        store._docLimit = 100000;
-        store.reset();
-        store._collection = new Backbone.Collection();
-        store._collection.hasNext = function () { return true;};
-        assert.ok(store.canShowNext());
-      });
-    });
-
-    describe('paginateNext', function () {
-      beforeEach(function () {
-        store.setPerPage(20);
-        store._collection = new Documents.AllDocs(null, {
-          params: {},
-          database: {
-            safeID: function () { return '1';}
-          }
-        });
-      });
-
-      it('should increment page number', function () {
-
-        store.reset();
-        store.paginateNext();
-
-        assert.equal(store.getCurrentPage(), 2);
-      });
-
-      it('should increment page start', function () {
-
-        store.reset();
-        store.paginateNext();
-
-        assert.equal(store.getPageStart(), 21);
-      });
-
-      it('should set correct page end', function () {
-        store._collection.length = 20;
-        store.reset();
-        store.paginateNext();
-
-        assert.equal(store.getPageEnd(), 40);
-      });
-
-      it('should set collection pageSize', function () {
-        store.reset();
-        store.paginateNext();
-
-        assert.equal(store.getCollection().paging.pageSize, 20);
-      });
-    });
-
-    describe('paginatePrevious', function () {
-      beforeEach(function () {
-        store.reset();
-        store._collection = new Documents.AllDocs(null, {
-          params: {},
-          database: {
-            safeID: function () { return '1';}
-          }
-        });
-      });
-
-      it('should decrement page number', function () {
-        store.paginateNext();
-        store.paginatePrevious();
-
-        assert.equal(store.getCurrentPage(), 1);
-      });
-
-      it('should decrement page start', function () {
-        store.paginateNext();
-        store.paginatePrevious();
-
-        assert.equal(store.getPageStart(), 1);
-      });
-
-      it('should decrement page end', function () {
-        store._collection.length = 20;
-        store.paginateNext();
-        store.paginatePrevious();
-
-        assert.equal(store.getPageEnd(), 20);
-      });
-
-      it('should set collection pageSize', function () {
-        store.reset();
-        store.paginateNext();
-        store.paginatePrevious();
-
-        assert.equal(store.getCollection().paging.pageSize, 20);
-      });
-
-    });
-
-    describe('totalDocsViewed', function () {
-      beforeEach(function () {
-        store.reset();
-      });
-
-      it('returns correct count for page 1 and 20 docs per page', function () {
-        assert.equal(store.totalDocsViewed(), 20);
-      });
-
-      it('returns correct count for page 3 and 10 docs per page', function () {
-        store._perPage = 10;
-        store._currentPage = 3;
-
-        assert.equal(store.totalDocsViewed(), 30);
-      });
-    });
-
-    describe('documentsLeftToFetch', function () {
-      beforeEach(function () {
-        store.reset();
-      });
-
-      it('returns 20 documents left', function () {
-        assert.equal(store.documentsLeftToFetch(), 20);
-      });
-
-      it('returns less if close to limit', function () {
-        store._docLimit = 35;
-        store._perPage = 10;
-        store._currentPage = 3;
-        assert.equal(store.documentsLeftToFetch(), 5);
-      });
-
-    });
-
-    describe('#initPerPage', function () {
-
-      it('uses default if no local storage set', function () {
-        window.localStorage.removeItem('fauxton:perpage');
-        store.initPerPage();
-        assert.equal(store.getPerPage(), 20);
-      });
-
-      it('uses localstorage when available', function () {
-        window.localStorage.setItem('fauxton:perpage', 44);
-        store.initPerPage();
-        assert.equal(store.getPerPage(), 44);
-      });
-
-      it('uses doc limit when its less than perPage', function () {
-        window.localStorage.setItem('fauxton:perpage', 100);
-        store._docLimit = 6;
-        store.initPerPage();
-        assert.equal(store.getPerPage(), 6);
-      });
-
-    });
-
-    describe('#setDocumentLimit', function () {
-
-      it('sets document if exists', function () {
-        store.setDocumentLimit(10);
-        assert.equal(store._docLimit, 10);
-      });
-
-      it('sets perPage to doclimit if doclimit less than perPage', function () {
-        store.setPerPage(20);
-        store.setDocumentLimit(1);
-        assert.equal(store._docLimit, 1);
-      });
-
-      it('sets doclimit to 10000 if NaN', function () {
-        store.setDocumentLimit(NaN);
-        assert.equal(store._docLimit, 10000);
-      });
-    });
-
-    describe('#setPerPage', function () {
-      beforeEach(function () {
-        store.reset();
-        store._collection = new Documents.AllDocs(null, {
-          params: {},
-          database: {
-            safeID: function () { return '1';}
-          }
-        });
-
-      });
-
-      it('stores per page in local storage', function () {
-        var testPerPage = 111;
-        store.setPerPage(testPerPage);
-        var perPage = window.localStorage.getItem('fauxton:perpage');
-        assert.equal(perPage, testPerPage );
-      });
-
-      it('sets collections perPage', function () {
-        var spy = sinon.spy(store._collection, 'pageSizeReset');
-        var testPerPage = 110;
-
-        store.setPerPage(testPerPage);
-        assert.equal(spy.getCall(0).args[0], testPerPage);
-
-
-      });
-    });
-  });
-});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/queryoptions/queryoptions.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/queryoptions.react.jsx b/app/addons/documents/queryoptions/queryoptions.react.jsx
index 1612b71..b04e533 100644
--- a/app/addons/documents/queryoptions/queryoptions.react.jsx
+++ b/app/addons/documents/queryoptions/queryoptions.react.jsx
@@ -324,7 +324,7 @@ A key value is the first parameter emitted in a map function. For example emit("
             containerClasses="header-control-box control-toggle-queryoptions"
             title="Query Options"
             fonticon="fonticon-gears"
-            text="Query Options" />
+            text="Options" />
 
           <TrayContents
             className="query-options"

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/queryoptions/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/stores.js b/app/addons/documents/queryoptions/stores.js
index 48c43b8..14299c2 100644
--- a/app/addons/documents/queryoptions/stores.js
+++ b/app/addons/documents/queryoptions/stores.js
@@ -221,6 +221,10 @@ function (app, FauxtonAPI, ActionTypes) {
       return params;
     },
 
+    getIncludeDocsEnabled: function () {
+      return this._includeDocs;
+    },
+
     dispatch: function (action) {
       switch (action.type) {
         case ActionTypes.QUERY_RESET:

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index ed7f811..bd6b3f6 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -90,10 +90,12 @@ function (app, FauxtonAPI, Documents, PagingCollection) {
       return true;
     },
 
+    // @deprecated, see isJSONDocBulkDeletable
     isDeletable: function () {
       return this.get('type') !== 'special';
     },
 
+    // @deprecated, see isJSONDocBulkDeletable
     isBulkDeletable: function () {
       return this.isDeletable();
     },
@@ -118,6 +120,8 @@ function (app, FauxtonAPI, Documents, PagingCollection) {
       this.params = _.extend({limit: defaultLimit}, options.params);
     },
 
+    collectionType: 'MangoIndex',
+
     url: function () {
       return this.urlRef.apply(this, arguments);
     },
@@ -126,6 +130,7 @@ function (app, FauxtonAPI, Documents, PagingCollection) {
       return false;
     },
 
+    //@deprecated, see isJSONDocEditable
     isEditable: function () {
       return false;
     },
@@ -155,6 +160,9 @@ function (app, FauxtonAPI, Documents, PagingCollection) {
 
   Documents.MangoDocumentCollection = PagingCollection.extend({
     model: Documents.MangoDoc,
+
+    collectionType: 'MangoDocumentCollection',
+
     initialize: function (_attr, options) {
       var defaultLimit = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index f240501..17afb3e 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -22,7 +22,7 @@ define([
   'addons/databases/base',
   'addons/documents/resources',
   'addons/fauxton/components',
-  'addons/documents/pagination/stores',
+  'addons/documents/index-results/stores',
   'addons/documents/index-results/actions',
   'addons/documents/index-results/index-results.components.react',
   'addons/documents/pagination/pagination.react',
@@ -34,7 +34,7 @@ define([
 ],
 
 function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, Databases, Resources, Components,
-  PaginationStores, IndexResultsActions, IndexResultsComponents, ReactPagination, ReactHeader, ReactActions,
+  IndexResultStores, IndexResultsActions, IndexResultsComponents, ReactPagination, ReactHeader, ReactActions,
   SidebarActions, DesignDocInfoActions, DesignDocInfoComponents) {
 
     var DocumentsRouteObject = BaseRoute.extend({
@@ -114,13 +114,14 @@ function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, Databa
             docParams = params.docParams,
             collection;
 
-        this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController);
+        this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: true});
         this.setComponent('#footer', ReactPagination.Footer);
 
         this.leftheader.updateCrumbs(this.getCrumbs(this.database));
 
+
         // includes_docs = true if you are visiting the _replicator/_users databases
-        if ( ['_replicator', '_users'].indexOf(databaseName) > -1) {
+        if (['_replicator', '_users'].indexOf(databaseName) > -1) {
           docParams.include_docs = true;
           urlParams = params.docParams;
           var updatedURL = FauxtonAPI.urls('allDocs', 'app', databaseName, '?' + $.param(urlParams));
@@ -143,13 +144,16 @@ function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, Databa
           docParams = {};
         }
 
+        var frozenCollection = app.utils.localStorageGet('include_docs_bulkdocs');
+        window.localStorage.removeItem('include_docs_bulkdocs');
+
         IndexResultsActions.newResultsList({
           collection: collection,
           textEmptyIndex: 'No Documents Found',
-          bulkCollection: Documents.BulkDeleteDocCollection
+          bulkCollection: new Documents.BulkDeleteDocCollection(frozenCollection, { databaseId: this.database.safeID() }),
         });
 
-        this.database.allDocs.paging.pageSize = PaginationStores.indexPaginationStore.getPerPage();
+        this.database.allDocs.paging.pageSize = IndexResultStores.indexResultsStore.getPerPage();
 
         this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/routes-index-editor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js
index f614bd9..8d94a39 100644
--- a/app/addons/documents/routes-index-editor.js
+++ b/app/addons/documents/routes-index-editor.js
@@ -22,7 +22,7 @@ define([
   'addons/documents/index-editor/actions',
   'addons/databases/base',
   'addons/fauxton/components',
-  'addons/documents/pagination/stores',
+  'addons/documents/index-results/stores',
   'addons/documents/index-results/actions',
   'addons/documents/index-results/index-results.components.react',
   'addons/documents/pagination/pagination.react',
@@ -31,7 +31,7 @@ define([
 ],
 
 function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents, ActionsIndexEditor,
-          Databases, Components, PaginationStores, IndexResultsActions,
+          Databases, Components, IndexResultsStores, IndexResultsActions,
           IndexResultsComponents, ReactPagination, ReactHeader, ReactHeaderActions) {
 
 
@@ -90,7 +90,7 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents,
         view: viewName,
         params: docParams,
         paging: {
-          pageSize: PaginationStores.indexPaginationStore.getPerPage()
+          pageSize: IndexResultsStores.indexResultsStore.getPerPage()
         }
       });
 
@@ -98,7 +98,7 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents,
 
       IndexResultsActions.newResultsList({
         collection: this.indexedDocs,
-        bulkCollection: Documents.BulkDeleteDocCollection
+        bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
       });
 
       ActionsIndexEditor.fetchDesignDocsBeforeEdit({
@@ -109,7 +109,7 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents,
         designDocId: '_design/' + decodeDdoc
       });
 
-      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController);
+      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: true});
 
       this.setComponent('#left-content', IndexEditorComponents.EditorController);
       this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
@@ -152,10 +152,8 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents,
       this.setComponent('#left-content', IndexEditorComponents.EditorController);
       this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
 
-      IndexResultsActions.newResultsList({
-        collection: [],
-        bulkCollection: Documents.BulkDeleteDocCollection
-      });
+      IndexResultsActions.clearResults();
+      IndexResultsActions.resultsListReset();
     }
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/routes-mango.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-mango.js b/app/addons/documents/routes-mango.js
index 1293eef..c5410e8 100644
--- a/app/addons/documents/routes-mango.js
+++ b/app/addons/documents/routes-mango.js
@@ -22,7 +22,7 @@ define([
   'addons/documents/resources',
   'addons/documents/views',
   'addons/documents/index-results/actions',
-  'addons/documents/pagination/stores',
+  'addons/documents/index-results/stores',
 
   'addons/documents/header/header.react',
   'addons/documents/header/header.actions',
@@ -37,7 +37,7 @@ define([
 
 
 function (app, FauxtonAPI, Helpers, BaseRoute, Databases,
-  Components, Resources, Documents, IndexResultsActions, PaginationStores,
+  Components, Resources, Documents, IndexResultsActions, IndexResultStores,
   ReactHeader, ReactActions, ReactPagination,
   MangoComponents, MangoActions, MangoStores, IndexResultsComponents, SidebarActions) {
 
@@ -70,30 +70,32 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Databases,
     },
 
     findUsingIndex: function () {
+      console.log(this.database);
+
       var params = this.createParams(),
           urlParams = params.urlParams,
           mangoResultCollection = new Resources.MangoDocumentCollection(null, {
             database: this.database,
             paging: {
-              pageSize: PaginationStores.indexPaginationStore.getPerPage()
+              pageSize: IndexResultStores.indexResultsStore.getPerPage()
             }
           }),
           mangoIndexList = new Resources.MangoIndexCollection(null, {
             database: this.database,
             params: null,
             paging: {
-              pageSize: PaginationStores.indexPaginationStore.getPerPage()
+              pageSize: IndexResultStores.indexResultsStore.getPerPage()
             }
           });
 
       SidebarActions.setSelectedTab('mango-query');
-      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController);
+      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
       this.setComponent('#footer', ReactPagination.Footer);
 
       IndexResultsActions.newMangoResultsList({
         collection: mangoResultCollection,
         textEmptyIndex: 'No Results',
-        bulkCollection: Documents.BulkDeleteDocCollection
+        bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
       });
 
       MangoActions.getIndexList({
@@ -128,13 +130,13 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Databases,
             database: this.database,
             params: null,
             paging: {
-              pageSize: PaginationStores.indexPaginationStore.getPerPage()
+              pageSize: IndexResultStores.indexResultsStore.getPerPage()
             }
           });
 
       IndexResultsActions.newResultsList({
         collection: mangoIndexCollection,
-        bulkCollection: Documents.MangoBulkDeleteDocCollection,
+        bulkCollection: new Documents.MangoBulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
         typeOfIndex: 'mango'
       });
 
@@ -147,7 +149,7 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Databases,
         ]
       }));
 
-      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController);
+      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
       this.setComponent('#footer', ReactPagination.Footer);
 
       this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/shared-resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/shared-resources.js b/app/addons/documents/shared-resources.js
index 570cef6..fcf9293 100644
--- a/app/addons/documents/shared-resources.js
+++ b/app/addons/documents/shared-resources.js
@@ -57,6 +57,7 @@ define([
       return app.utils.getDocTypeFromId(this.id);
     },
 
+    // @deprecated, see isJSONDocBulkDeletable
     isBulkDeletable: function () {
       return !!this.id && !!this.get('_rev');
     },

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/shared-routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/shared-routes.js b/app/addons/documents/shared-routes.js
index 771cc13..daab73b 100644
--- a/app/addons/documents/shared-routes.js
+++ b/app/addons/documents/shared-routes.js
@@ -17,10 +17,10 @@ define([
   'addons/databases/base',
   'addons/fauxton/components',
   'addons/documents/pagination/actions',
-  'addons/documents/pagination/stores',
+  'addons/documents/index-results/stores',
   'addons/documents/sidebar/sidebar.react',
   'addons/documents/sidebar/actions'
-], function (app, FauxtonAPI, Documents, Databases, Components, PaginationActions, PaginationStores,
+], function (app, FauxtonAPI, Documents, Databases, Components, PaginationActions, IndexResultStores,
   SidebarComponents, SidebarActions) {
 
 
@@ -139,7 +139,7 @@ define([
 
       PaginationActions.setDocumentLimit(parseInt(urlParams.limit, 10));
 
-      var limit = PaginationStores.indexPaginationStore.getPerPage();
+      var limit = IndexResultStores.indexResultsStore.getPerPage();
       return {
         urlParams: urlParams,
         docParams: _.extend(params, {limit: limit})

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/tests/nightwatch/changes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/changes.js b/app/addons/documents/tests/nightwatch/changes.js
index 59fab05..15d410d 100644
--- a/app/addons/documents/tests/nightwatch/changes.js
+++ b/app/addons/documents/tests/nightwatch/changes.js
@@ -20,10 +20,10 @@ module.exports = {
     client
       .loginToGUI()
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
-      .waitForElementPresent('.control-view', waitTime, false)
+      .waitForElementPresent('.header-toggle-button', waitTime, false)
       .clickWhenVisible('#changes')
       .waitForElementPresent('.js-changes-view', waitTime, false)
-      .assert.elementNotPresent('.control-view')
+      .assert.elementNotPresent('.header-toggle-button')
       .end();
   },
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/tests/nightwatch/paginateView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/paginateView.js b/app/addons/documents/tests/nightwatch/paginateView.js
index 7f7e6ca..2ec10e0 100644
--- a/app/addons/documents/tests/nightwatch/paginateView.js
+++ b/app/addons/documents/tests/nightwatch/paginateView.js
@@ -42,7 +42,6 @@ module.exports = {
       .execute(function () {
         return $('.doc-row').length;
       }, function (result) {
-        console.log(result.value);
         client.assert.equal(result.value, 10);
       })
       .end();

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js b/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
index d5ef543..54ca26f 100644
--- a/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
+++ b/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
@@ -23,7 +23,7 @@ module.exports = {
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
       .waitForElementPresent('#jump-to-doc-id', waitTime, false)
       .waitForElementPresent('.prettyprint', waitTime, false)
-      .waitForElementPresent('#documents-pagination', waitTime, false)
+      .waitForElementPresent('.documents-pagination', waitTime, false)
       .waitForElementPresent('.breadcrumb .js-lastelement', waitTime, false)
       .click('.burger')
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/tests/nightwatch/tableView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/tableView.js b/app/addons/documents/tests/nightwatch/tableView.js
index 4fc704d..70ce7f8 100644
--- a/app/addons/documents/tests/nightwatch/tableView.js
+++ b/app/addons/documents/tests/nightwatch/tableView.js
@@ -14,24 +14,27 @@ module.exports = {
 
   'Shows data in the table for all docs (include docs enabled)': function (client) {
     var waitTime = client.globals.maxWaitTime,
-      newDatabaseName = client.globals.testDatabaseName,
-      newDocumentName1 = 'bulktest1',
-      newDocumentName2 = 'bulktest2',
-      baseUrl = client.globals.test_settings.launch_url;
+        newDatabaseName = client.globals.testDatabaseName,
+        newDocumentName1 = 'bulktest1',
+        newDocumentName2 = 'bulktest2',
+        baseUrl = client.globals.test_settings.launch_url;
 
     client
-      .loginToGUI()
       .createDocument(newDocumentName1, newDatabaseName)
       .createDocument(newDocumentName2, newDatabaseName)
+      .loginToGUI()
+      .checkForDocumentCreated(newDocumentName1)
+      .checkForDocumentCreated(newDocumentName2)
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs?include_docs=true')
 
-      // ensures page content has loaded before proceeding
-      .waitForElementVisible('.prettyprint', waitTime, false)
-      .clickWhenVisible('.control-view')
-      .clickWhenVisible('.alternative-header .dropdown-menu li:last-child a')
+      .clickWhenVisible('.alternative-header .header-toggle-button button:last-child')
       .getText('.table', function (result) {
         var data = result.value;
 
+        if (!data.indexOf) {
+          console.error('check your selenium test, race condition');
+        }
+
         this.verify.ok(data.indexOf('testingValue') !== -1,
           'Check if doc content is shown in table');
       })
@@ -41,24 +44,27 @@ module.exports = {
 
   'Shows data in the table for all docs (include docs disabled)': function (client) {
     var waitTime = client.globals.maxWaitTime,
-      newDatabaseName = client.globals.testDatabaseName,
-      newDocumentName1 = 'bulktest1',
-      newDocumentName2 = 'bulktest2',
-      baseUrl = client.globals.test_settings.launch_url;
+        newDatabaseName = client.globals.testDatabaseName,
+        newDocumentName1 = 'bulktest1',
+        newDocumentName2 = 'bulktest2',
+        baseUrl = client.globals.test_settings.launch_url;
 
     client
-      .loginToGUI()
       .createDocument(newDocumentName1, newDatabaseName)
       .createDocument(newDocumentName2, newDatabaseName)
+      .loginToGUI()
+      .checkForDocumentCreated(newDocumentName1)
+      .checkForDocumentCreated(newDocumentName2)
       .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
 
-      // ensures page content has loaded before proceeding
-      .waitForElementVisible('.prettyprint', waitTime, false)
-      .clickWhenVisible('.control-view')
-      .clickWhenVisible('.alternative-header .dropdown-menu li:last-child a')
+      .clickWhenVisible('.alternative-header .header-toggle-button button:last-child')
       .getText('.table', function (result) {
         var data = result.value;
 
+        if (!data.indexOf) {
+          console.error('check your selenium test, race condition');
+        }
+
         this.verify.ok(data.indexOf('bulktest1') !== -1,
           'Check if doc content is shown in table');
       })

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/documents/tests/nightwatch/viewCreate.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewCreate.js b/app/addons/documents/tests/nightwatch/viewCreate.js
index f163ea5..26c549b 100644
--- a/app/addons/documents/tests/nightwatch/viewCreate.js
+++ b/app/addons/documents/tests/nightwatch/viewCreate.js
@@ -53,7 +53,7 @@ module.exports = {
       .execute('$("#save-view")[0].scrollIntoView();')
       .waitForElementPresent('#save-view', waitTime, false)
       .clickWhenVisible('#save-view', waitTime, false)
-      .checkForDocumentCreated('_design/test_design_doc-selenium-1')
+      .checkForDocumentCreated('_design/test_design_doc-selenium-3')
       .waitForElementPresent('.prettyprint', waitTime, false)
       .waitForElementNotPresent('.loading-lines', waitTime, false)
       .assert.containsText('.prettyprint', 'hasehase')

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/addons/fauxton/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.react.jsx b/app/addons/fauxton/components.react.jsx
index f106cde..8f2dafa 100644
--- a/app/addons/fauxton/components.react.jsx
+++ b/app/addons/fauxton/components.react.jsx
@@ -43,7 +43,8 @@ function (app, FauxtonAPI, React, ZeroClipboard, ReactBootstrap) {
       return {
         displayType: 'icon',
         textDisplay: 'Copy',
-        onClipboardClick: function () { }
+        onClipboardClick: function () { },
+        title: 'Copy to clipboard'
       };
     },
 
@@ -70,7 +71,13 @@ function (app, FauxtonAPI, React, ZeroClipboard, ReactBootstrap) {
 
     render: function () {
       return (
-        <a href="#" ref="copy" className="copy" data-clipboard-text={this.props.text} data-bypass="true" title="Copy to clipboard">
+        <a href="#"
+          ref="copy"
+          className="copy"
+          data-clipboard-text={this.props.text}
+          data-bypass="true"
+          title={this.props.title}
+        >
           {this.getClipboardElement()}
         </a>
       );

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/config.js
----------------------------------------------------------------------
diff --git a/app/config.js b/app/config.js
index bee2dc5..8f289e6 100644
--- a/app/config.js
+++ b/app/config.js
@@ -33,6 +33,7 @@ require.config({
     "cloudant.pagingcollection": "../assets/js/plugins/cloudant.pagingcollection",
     "velocity": "../assets/js/plugins/velocity",
     "velocity.ui": "../assets/js/plugins/velocity.ui",
+    "react-autocomplete": "../assets/js/plugins/react-autocomplete",
     react: "../assets/js/libs/react",
     flux: "../assets/js/libs/flux",
     "es5-shim": "../assets/js/libs/es5-shim",
@@ -62,6 +63,8 @@ require.config({
       exports: "Bootstrap"
     },
 
+    "react-autocomplete": ["react"],
+
     "plugins/prettify": [],
     "plugins/beautify": [],
     "velocity": ["jquery"],

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/app/core/utils.js
----------------------------------------------------------------------
diff --git a/app/core/utils.js b/app/core/utils.js
index 6728a1b..6948526 100644
--- a/app/core/utils.js
+++ b/app/core/utils.js
@@ -66,28 +66,6 @@ function ($, _) {
       return fragment;
     },
 
-    addWindowResize: function (fun, key) {
-      onWindowResize[key] = fun;
-      // You shouldn't need to call it here. Just define it at startup and each time it will loop
-      // through all the functions in the hash.
-      //app.initWindowResize();
-    },
-
-    removeWindowResize: function (key) {
-      delete onWindowResize[key];
-      utils.initWindowResize();
-    },
-
-    initWindowResize: function () {
-      //when calling this it should be overriding what was called previously
-      window.onresize = function (e) {
-        // could do this instead of the above for loop
-        _.each(onWindowResize, function (fn) {
-          fn();
-        });
-      };
-    },
-
     removeSpecialCharacters: function (name) {
       return name.replace(/[^\w\s]/gi, "");
     },

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less
index f71cf57..ce86ccd 100644
--- a/assets/less/fauxton.less
+++ b/assets/less/fauxton.less
@@ -53,6 +53,11 @@ a {
   .transition(all .25s linear);
 }
 
+// remove blue borders from clicked elements
+button:focus, a:focus {
+  outline: 0;
+}
+
 a,
 a:visited,
 a:active {
@@ -547,12 +552,15 @@ body #dashboard .flex-body#breadcrumbs {
 }
 
 //----footer--///
+
 footer.pagination-footer {
   background-color: #fff;
   border-top: 1px solid #ccc;
   height: 50px;
   overflow: hidden;
 
+  font-size: 14px;
+
   .pagination {
     .box-shadow(none);
     margin: 0;
@@ -566,14 +574,22 @@ footer.pagination-footer {
       }
     }
   }
-  .index-indicator {
+
+  .footer-doc-control-prioritized-wrapper {
+    margin-right: 18px;
+  }
+
+  .page-controls {
     float: left;
-    p {
-      margin: 20px;
-      font-size: 14px;
-    }
+    margin: 17px 20px 17px 20px;
   }
-  #documents-pagination {
+
+  .current-docs {
+    float: right;
+    margin: 17px 20px 17px 20px;
+  }
+
+  .documents-pagination {
     float: right;
   }
   #per-page {
@@ -648,3 +664,59 @@ footer.pagination-footer {
     }
   }
 }
+
+@media (max-width: 1227px) {
+  body.closeMenu {
+    .with-sidebar {
+      .two-panel-header {
+        button span {
+          display: none;
+        }
+        button i:before {
+          float: none;
+        }
+        i.icon.fonticon-link:before,
+        i.icon.fonticon-gears:before {
+          margin: 10px 0px 0 0;
+        }
+        .icon.fontawesome {
+          margin: 0 -6px 0 0px;
+        }
+        .right-header button i:before{
+          margin: 2px 0 0 0;
+        }
+        #query-options-tray:before {
+          right: 136px
+        }
+      }
+    }
+  }
+}
+
+@media (max-width: 1389px) {
+  body:not(.closeMenu) {
+    .with-sidebar {
+      .two-panel-header {
+        button span {
+          display: none;
+        }
+        button i:before {
+          float: none;
+        }
+        i.icon.fonticon-link:before,
+        i.icon.fonticon-gears:before {
+          margin: 10px 0px 0 0;
+        }
+        .icon.fontawesome {
+          margin: 0 -6px 0 0px;
+        }
+        .right-header button i:before{
+          margin: 2px 0 0 0;
+        }
+        #query-options-tray:before {
+          right: 136px
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/bfdbf112/assets/less/templates.less
----------------------------------------------------------------------
diff --git a/assets/less/templates.less b/assets/less/templates.less
index 3b803a6..26098dd 100644
--- a/assets/less/templates.less
+++ b/assets/less/templates.less
@@ -396,6 +396,7 @@ with_tabs_sidebar.html
 #dashboard-lower-content {
   padding: 20px;
   background-color: #F1F1F1;
+  position: relative;
 }
 
 #dashboard-content {


Mime
View raw message