You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2016/05/31 07:58:44 UTC

[16/27] fauxton commit: updated refs/heads/master to 0ca35da

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx b/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
index 129acc0..a12409c 100644
--- a/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
+++ b/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
@@ -9,286 +9,283 @@
 // 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([
-  '../../../../core/api',
-  '../../resources',
-  '../components.react',
-  '../stores',
-  '../actions',
-  '../../../documents/resources',
-  '../../../../../test/mocha/testUtils',
-  "react",
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Resources, Views, Stores, Actions, Documents, utils, React, ReactDOM, TestUtils, sinon) {
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
-
-  var assert = utils.assert;
-
-
-  var resetStore = function (designDocs) {
-    Actions.editIndex({
-      database: { id: 'rockos-db' },
-      newView: false,
-      viewName: 'test-view',
-      designDocs: getDesignDocsCollection(designDocs),
-      designDocId: designDocs[0]._id
-    });
-  };
+import FauxtonAPI from "../../../../core/api";
+import Resources from "../../resources";
+import Views from "../components.react";
+import Stores from "../stores";
+import Actions from "../actions";
+import Documents from "../../../documents/resources";
+import utils from "../../../../../test/mocha/testUtils";
+import React from "react";
+import ReactDOM from "react-dom";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+FauxtonAPI.router = new FauxtonAPI.Router([]);
+
+var assert = utils.assert;
+
+
+var resetStore = function (designDocs) {
+  Actions.editIndex({
+    database: { id: 'rockos-db' },
+    newView: false,
+    viewName: 'test-view',
+    designDocs: getDesignDocsCollection(designDocs),
+    designDocId: designDocs[0]._id
+  });
+};
 
-  var getDesignDocsCollection = function (designDocs) {
-    designDocs = designDocs.map(function (doc) {
-      return Resources.Doc.prototype.parse(doc);
-    });
+var getDesignDocsCollection = function (designDocs) {
+  designDocs = designDocs.map(function (doc) {
+    return Resources.Doc.prototype.parse(doc);
+  });
 
-    return new Resources.AllDocs(designDocs, {
-      params: { limit: 10 },
-      database: {
-        safeID: function () { return 'id'; }
-      }
-    });
-  };
+  return new Resources.AllDocs(designDocs, {
+    params: { limit: 10 },
+    database: {
+      safeID: function () { return 'id'; }
+    }
+  });
+};
 
 
-  describe('reduce editor', function () {
-    var container, reduceEl;
+describe('reduce editor', function () {
+  var container, reduceEl;
+
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
+
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
+
+  describe('getReduceValue', function () {
+    var container;
 
     beforeEach(function () {
       container = document.createElement('div');
+      $('body').append('<div id="reduce-function"></div>');
     });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
+    it('returns null for none', function () {
+      var designDoc = {
+        _id: '_design/test-doc',
+        views: {
+          'test-view': {
+            map: 'function () {};'
+          }
+        }
+      };
+
+      resetStore([designDoc]);
+
+      reduceEl = TestUtils.renderIntoDocument(<Views.ReduceEditor/>, container);
+      assert.ok(_.isNull(reduceEl.getReduceValue()));
     });
 
-    describe('getReduceValue', function () {
-      var container;
-
-      beforeEach(function () {
-        container = document.createElement('div');
-        $('body').append('<div id="reduce-function"></div>');
-      });
-
-      it('returns null for none', function () {
-        var designDoc = {
-          _id: '_design/test-doc',
-          views: {
-            'test-view': {
-              map: 'function () {};'
-            }
-          }
-        };
-
-        resetStore([designDoc]);
-
-        reduceEl = TestUtils.renderIntoDocument(<Views.ReduceEditor/>, container);
-        assert.ok(_.isNull(reduceEl.getReduceValue()));
-      });
-
-      it('returns built in for built in reduce', function () {
-        var designDoc = {
-          _id: '_design/test-doc',
-          views: {
-            'test-view': {
-              map: 'function () {};',
-              reduce: '_sum'
-            }
+    it('returns built in for built in reduce', function () {
+      var designDoc = {
+        _id: '_design/test-doc',
+        views: {
+          'test-view': {
+            map: 'function () {};',
+            reduce: '_sum'
           }
-        };
-
-        resetStore([designDoc]);
+        }
+      };
 
-        reduceEl = TestUtils.renderIntoDocument(<Views.ReduceEditor/>, container);
-        assert.equal(reduceEl.getReduceValue(), '_sum');
-      });
+      resetStore([designDoc]);
 
+      reduceEl = TestUtils.renderIntoDocument(<Views.ReduceEditor/>, container);
+      assert.equal(reduceEl.getReduceValue(), '_sum');
     });
+
   });
+});
 
-  describe('DesignDocSelector component', function () {
-    var container, selectorEl;
-    var designDoc = {
-      "id": "_design/test-doc",
-      "key": "_design/test-doc",
-      "value": {
-        "rev": "20-9e4bc8b76fd7d752d620bbe6e0ea9a80"
-      },
-      "doc": {
-        "_id": "_design/test-doc",
-        "_rev": "20-9e4bc8b76fd7d752d620bbe6e0ea9a80",
-        "views": {
-          "test-view": {
-            "map": "function(doc) {\n  emit(doc._id, 2);\n}"
-          },
-          "new-view": {
-            "map": "function(doc) {\n  if (doc.class === \"mammal\" && doc.diet === \"herbivore\")\n    emit(doc._id, 1);\n}",
-            "reduce": "_sum"
-          }
+describe('DesignDocSelector component', function () {
+  var container, selectorEl;
+  var designDoc = {
+    "id": "_design/test-doc",
+    "key": "_design/test-doc",
+    "value": {
+      "rev": "20-9e4bc8b76fd7d752d620bbe6e0ea9a80"
+    },
+    "doc": {
+      "_id": "_design/test-doc",
+      "_rev": "20-9e4bc8b76fd7d752d620bbe6e0ea9a80",
+      "views": {
+        "test-view": {
+          "map": "function(doc) {\n  emit(doc._id, 2);\n}"
         },
-        "language": "javascript",
-        "indexes": {
-          "newSearch": {
-            "analyzer": "standard",
-            "index": "function(doc){\n index(\"default\", doc._id);\n}"
-          }
+        "new-view": {
+          "map": "function(doc) {\n  if (doc.class === \"mammal\" && doc.diet === \"herbivore\")\n    emit(doc._id, 1);\n}",
+          "reduce": "_sum"
+        }
+      },
+      "language": "javascript",
+      "indexes": {
+        "newSearch": {
+          "analyzer": "standard",
+          "index": "function(doc){\n index(\"default\", doc._id);\n}"
         }
       }
-    };
+    }
+  };
 
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
 
-    it('calls onSelectDesignDoc on change', function () {
-      var spy = sinon.spy();
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={getDesignDocsCollection([designDoc])}
-          selectedDDocName={'new-doc'}
-          onSelectDesignDoc={spy}
-        />, container);
+  it('calls onSelectDesignDoc on change', function () {
+    var spy = sinon.spy();
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={getDesignDocsCollection([designDoc])}
+        selectedDDocName={'new-doc'}
+        onSelectDesignDoc={spy}
+      />, container);
 
-      TestUtils.Simulate.change($(ReactDOM.findDOMNode(selectorEl)).find('#ddoc')[0], {
-        target: {
-          value: '_design/test-doc'
-        }
-      });
-      assert.ok(spy.calledOnce);
+    TestUtils.Simulate.change($(ReactDOM.findDOMNode(selectorEl)).find('#ddoc')[0], {
+      target: {
+        value: '_design/test-doc'
+      }
     });
+    assert.ok(spy.calledOnce);
+  });
 
-    it('shows new design doc field when set to new-doc', function () {
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={['_design/test-doc']}
-          selectedDesignDocName={'new-doc'}
-          onSelectDesignDoc={function () { }}
-        />, container);
+  it('shows new design doc field when set to new-doc', function () {
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={['_design/test-doc']}
+        selectedDesignDocName={'new-doc'}
+        onSelectDesignDoc={function () { }}
+      />, container);
 
-      assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('#new-ddoc-section').length, 1);
-    });
+    assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('#new-ddoc-section').length, 1);
+  });
 
-    it('hides new design doc field when design doc selected', function () {
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={['_design/test-doc']}
-          selectedDesignDocName={'_design/test-doc'}
-          onSelectDesignDoc={function () { }}
-        />, container);
+  it('hides new design doc field when design doc selected', function () {
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={['_design/test-doc']}
+        selectedDesignDocName={'_design/test-doc'}
+        onSelectDesignDoc={function () { }}
+      />, container);
 
-      assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('#new-ddoc-section').length, 0);
-    });
+    assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('#new-ddoc-section').length, 0);
+  });
 
-    it('always passes validation when design doc selected', function () {
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={['_design/test-doc']}
-          selectedDesignDocName={'_design/test-doc'}
-          onSelectDesignDoc={function () { }}
-        />, container);
+  it('always passes validation when design doc selected', function () {
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={['_design/test-doc']}
+        selectedDesignDocName={'_design/test-doc'}
+        onSelectDesignDoc={function () { }}
+      />, container);
 
-      assert.equal(selectorEl.validate(), true);
-    });
+    assert.equal(selectorEl.validate(), true);
+  });
 
-    it('fails validation if new doc name entered/not entered', function () {
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={['_design/test-doc']}
-          selectedDesignDocName={'new-doc'}
-          newDesignDocName=''
-          onSelectDesignDoc={function () { }}
-        />, container);
-
-      // it shouldn't validate at this point: no new design doc name has been entered
-      assert.equal(selectorEl.validate(), false);
-    });
+  it('fails validation if new doc name entered/not entered', function () {
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={['_design/test-doc']}
+        selectedDesignDocName={'new-doc'}
+        newDesignDocName=''
+        onSelectDesignDoc={function () { }}
+      />, container);
+
+    // it shouldn't validate at this point: no new design doc name has been entered
+    assert.equal(selectorEl.validate(), false);
+  });
 
-    it('passes validation if new doc name entered/not entered', function () {
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={['_design/test-doc']}
-          selectedDesignDocName={'new-doc'}
-          newDesignDocName='new-doc-name'
-          onSelectDesignDoc={function () { }}
-        />, container);
-      assert.equal(selectorEl.validate(), true);
-    });
+  it('passes validation if new doc name entered/not entered', function () {
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={['_design/test-doc']}
+        selectedDesignDocName={'new-doc'}
+        newDesignDocName='new-doc-name'
+        onSelectDesignDoc={function () { }}
+      />, container);
+    assert.equal(selectorEl.validate(), true);
+  });
 
 
-    it('omits doc URL when not supplied', function () {
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={['_design/test-doc']}
-          selectedDesignDocName={'new-doc'}
-          onSelectDesignDoc={function () { }}
-        />, container);
-      assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('.help-link').length, 0);
-    });
+  it('omits doc URL when not supplied', function () {
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={['_design/test-doc']}
+        selectedDesignDocName={'new-doc'}
+        onSelectDesignDoc={function () { }}
+      />, container);
+    assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('.help-link').length, 0);
+  });
 
-    it('includes help doc link when supplied', function () {
-      var docLink = 'http://docs.com';
-      selectorEl = TestUtils.renderIntoDocument(
-        <Views.DesignDocSelector
-          designDocList={['_design/test-doc']}
-          selectedDesignDocName={'new-doc'}
-          onSelectDesignDoc={function () { }}
-          docLink={docLink}
-        />, container);
-      assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('.help-link').length, 1);
-      assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('.help-link').attr('href'), docLink);
-    });
+  it('includes help doc link when supplied', function () {
+    var docLink = 'http://docs.com';
+    selectorEl = TestUtils.renderIntoDocument(
+      <Views.DesignDocSelector
+        designDocList={['_design/test-doc']}
+        selectedDesignDocName={'new-doc'}
+        onSelectDesignDoc={function () { }}
+        docLink={docLink}
+      />, container);
+    assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('.help-link').length, 1);
+    assert.equal($(ReactDOM.findDOMNode(selectorEl)).find('.help-link').attr('href'), docLink);
   });
+});
 
 
-  describe('Editor', function () {
-    var container, editorEl, sandbox;
+describe('Editor', function () {
+  var container, editorEl, sandbox;
 
-    beforeEach(function () {
-      container = document.createElement('div');
-      $('body').append('<div id="map-function"></div>');
-      $('body').append('<div id="editor"></div>');
-      editorEl = TestUtils.renderIntoDocument(<Views.EditorController />, container);
-      sandbox = sinon.sandbox.create();
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+    $('body').append('<div id="map-function"></div>');
+    $('body').append('<div id="editor"></div>');
+    editorEl = TestUtils.renderIntoDocument(<Views.EditorController />, container);
+    sandbox = sinon.sandbox.create();
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-      sandbox.restore();
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+    sandbox.restore();
+  });
 
-    it('returns false on invalid map editor code', function () {
-      var stub = sandbox.stub(editorEl.refs.mapEditor.getEditor(), 'hasErrors');
-      stub.returns(false);
-      assert.notOk(editorEl.hasErrors());
-    });
+  it('returns false on invalid map editor code', function () {
+    var stub = sandbox.stub(editorEl.refs.mapEditor.getEditor(), 'hasErrors');
+    stub.returns(false);
+    assert.notOk(editorEl.hasErrors());
+  });
 
-    it('returns true on valid map editor code', function () {
-      var stub = sandbox.stub(editorEl.refs.mapEditor.getEditor(), 'hasErrors');
-      stub.returns(true);
-      assert.ok(editorEl.hasErrors());
-    });
+  it('returns true on valid map editor code', function () {
+    var stub = sandbox.stub(editorEl.refs.mapEditor.getEditor(), 'hasErrors');
+    stub.returns(true);
+    assert.ok(editorEl.hasErrors());
+  });
 
-    it('returns false on non-custom reduce', function () {
-      var stub = sandbox.stub(Stores.indexEditorStore, 'hasCustomReduce');
-      stub.returns(false);
-      assert.notOk(editorEl.hasErrors());
-    });
+  it('returns false on non-custom reduce', function () {
+    var stub = sandbox.stub(Stores.indexEditorStore, 'hasCustomReduce');
+    stub.returns(false);
+    assert.notOk(editorEl.hasErrors());
+  });
 
-    it('calls changeViewName on view name change', function () {
-      var viewName = 'new-name';
-      var spy = sandbox.spy(Actions, 'changeViewName');
-      var el = $(ReactDOM.findDOMNode(editorEl)).find('#index-name')[0];
-      TestUtils.Simulate.change(el, {
-        target: {
-          value: viewName
-        }
-      });
-      assert.ok(spy.calledWith(viewName));
+  it('calls changeViewName on view name change', function () {
+    var viewName = 'new-name';
+    var spy = sandbox.spy(Actions, 'changeViewName');
+    var el = $(ReactDOM.findDOMNode(editorEl)).find('#index-name')[0];
+    TestUtils.Simulate.change(el, {
+      target: {
+        value: viewName
+      }
     });
+    assert.ok(spy.calledWith(viewName));
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-results/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/actions.js b/app/addons/documents/index-results/actions.js
index ad657d7..6a54834 100644
--- a/app/addons/documents/index-results/actions.js
+++ b/app/addons/documents/index-results/actions.js
@@ -10,202 +10,198 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes',
-  './stores',
-  '../resources',
-  '../sidebar/actions'
-],
-function (app, FauxtonAPI, ActionTypes, Stores, Documents, SidebarActions) {
-  var indexResultsStore = Stores.indexResultsStore;
-
-  var errorMessage = function (ids) {
-    var msg = 'Failed to delete your document!';
-
-    if (ids) {
-      msg = 'Failed to delete: ' + ids.join(', ');
-    }
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import Stores from "./stores";
+import Documents from "../resources";
+import SidebarActions from "../sidebar/actions";
+var indexResultsStore = Stores.indexResultsStore;
+
+var errorMessage = function (ids) {
+  var msg = 'Failed to delete your document!';
+
+  if (ids) {
+    msg = 'Failed to delete: ' + ids.join(', ');
+  }
+
+  FauxtonAPI.addNotification({
+    msg: msg,
+    type: 'error',
+    clear:  true
+  });
+};
+
+export default {
+
+  togglePrioritizedTableView: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW
+    });
+  },
 
-    FauxtonAPI.addNotification({
-      msg: msg,
-      type: 'error',
-      clear:  true
+  sendMessageNewResultList: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_NEW_RESULTS,
+      options: options
     });
-  };
+  },
 
-  return {
+  newResultsList: function (options) {
+    this.clearResults();
 
-    togglePrioritizedTableView: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW
-      });
-    },
+    if (!options.collection.fetch) { return; }
 
-    sendMessageNewResultList: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_NEW_RESULTS,
-        options: options
-      });
-    },
+    return options.collection.fetch({reset: true}).then(function () {
+      this.resultsListReset();
+      this.sendMessageNewResultList(options);
 
-    newResultsList: function (options) {
-      this.clearResults();
+    }.bind(this), function (collection, _xhr) {
+      //Make this more robust as sometimes the colection is passed through here.
+      var xhr = collection.responseText ? collection : _xhr;
+      var errorMsg = 'Bad Request';
 
-      if (!options.collection.fetch) { return; }
-
-      return options.collection.fetch({reset: true}).then(function () {
-        this.resultsListReset();
-        this.sendMessageNewResultList(options);
-
-      }.bind(this), function (collection, _xhr) {
-        //Make this more robust as sometimes the colection is passed through here.
-        var xhr = collection.responseText ? collection : _xhr;
-        var errorMsg = 'Bad Request';
-
-        try {
-          var responseText = JSON.parse(xhr.responseText);
-          if (responseText.reason) {
-            errorMsg = responseText.reason;
-          }
-        } catch (e) {
-          console.log(e);
+      try {
+        var responseText = JSON.parse(xhr.responseText);
+        if (responseText.reason) {
+          errorMsg = responseText.reason;
         }
+      } catch (e) {
+        console.log(e);
+      }
 
-        FauxtonAPI.addNotification({
-          msg: errorMsg,
-          type: "error",
-          clear:  true
-       });
-      });
-    },
+      FauxtonAPI.addNotification({
+        msg: errorMsg,
+        type: "error",
+        clear:  true
+     });
+    });
+  },
 
-    newMangoResultsList: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_NEW_RESULTS,
-        options: options
-      });
-    },
-
-    runMangoFindQuery: function (options) {
-      var query = JSON.parse(options.queryCode),
-          collection = indexResultsStore.getCollection(),
-          bulkCollection = indexResultsStore.getBulkDocCollection();
-
-      this.clearResults();
-
-      return collection
-        .setQuery(query)
-        .fetch()
-        .then(function () {
-          this.resultsListReset();
-          this.newMangoResultsList({
-            collection: collection,
-            query: options.queryCode,
-            textEmptyIndex: 'No Results Found!',
-            bulkCollection: bulkCollection
-          });
-        }.bind(this), function (res) {
-          FauxtonAPI.addNotification({
-            msg: res.reason,
-            clear:  true,
-            type: 'error'
-          });
-
-          this.resultsListReset();
-        }.bind(this));
-    },
-
-    reloadResultsList: function () {
-      if (indexResultsStore.getTypeOfIndex() === 'mango') {
-        return this.newResultsList({
-          collection: indexResultsStore.getCollection(),
-          bulkCollection: indexResultsStore.getBulkDocCollection(),
-          typeOfIndex: 'mango'
+  newMangoResultsList: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_NEW_RESULTS,
+      options: options
+    });
+  },
+
+  runMangoFindQuery: function (options) {
+    var query = JSON.parse(options.queryCode),
+        collection = indexResultsStore.getCollection(),
+        bulkCollection = indexResultsStore.getBulkDocCollection();
+
+    this.clearResults();
+
+    return collection
+      .setQuery(query)
+      .fetch()
+      .then(function () {
+        this.resultsListReset();
+        this.newMangoResultsList({
+          collection: collection,
+          query: options.queryCode,
+          textEmptyIndex: 'No Results Found!',
+          bulkCollection: bulkCollection
         });
-      }
+      }.bind(this), function (res) {
+        FauxtonAPI.addNotification({
+          msg: res.reason,
+          clear:  true,
+          type: 'error'
+        });
+
+        this.resultsListReset();
+      }.bind(this));
+  },
 
+  reloadResultsList: function () {
+    if (indexResultsStore.getTypeOfIndex() === 'mango') {
       return this.newResultsList({
         collection: indexResultsStore.getCollection(),
-        bulkCollection: indexResultsStore.getBulkDocCollection()
+        bulkCollection: indexResultsStore.getBulkDocCollection(),
+        typeOfIndex: 'mango'
       });
-    },
+    }
 
-    resultsListReset: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_RESET
-      });
-    },
-
-    selectDoc: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_SELECT_DOC,
-        options: {
-          _id: options._id,
-          _rev: options._rev,
-          _deleted: true
-        }
-      });
-    },
+    return this.newResultsList({
+      collection: indexResultsStore.getCollection(),
+      bulkCollection: indexResultsStore.getBulkDocCollection()
+    });
+  },
 
-    changeField: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE,
-        options: options
-      });
-    },
+  resultsListReset: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_RESET
+    });
+  },
+
+  selectDoc: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_SELECT_DOC,
+      options: {
+        _id: options._id,
+        _rev: options._rev,
+        _deleted: true
+      }
+    });
+  },
 
-    toggleAllDocuments: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS
-      });
-    },
+  changeField: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE,
+      options: options
+    });
+  },
 
-    clearResults: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INDEX_RESULTS_CLEAR_RESULTS
-      });
-    },
+  toggleAllDocuments: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS
+    });
+  },
 
-    deleteSelected: function (bulkDeleteCollection, itemsLength) {
-      var msg = (itemsLength === 1) ? 'Are you sure you want to delete this doc?' :
-        'Are you sure you want to delete these ' + itemsLength + ' docs?';
+  clearResults: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INDEX_RESULTS_CLEAR_RESULTS
+    });
+  },
 
-      if (itemsLength === 0) {
-        window.alert('Please select the document rows you want to delete.');
-        return false;
-      }
+  deleteSelected: function (bulkDeleteCollection, itemsLength) {
+    var msg = (itemsLength === 1) ? 'Are you sure you want to delete this doc?' :
+      'Are you sure you want to delete these ' + itemsLength + ' docs?';
 
-      if (!window.confirm(msg)) {
-        return false;
-      }
+    if (itemsLength === 0) {
+      window.alert('Please select the document rows you want to delete.');
+      return false;
+    }
 
-      var reloadResultsList = _.bind(this.reloadResultsList, this);
-      var selectedIds = [];
-
-      bulkDeleteCollection
-        .bulkDelete()
-        .then(function (ids) {
-          FauxtonAPI.addNotification({
-            msg: 'Successfully deleted your docs',
-            clear:  true
-          });
-
-          if (!_.isEmpty(ids.errorIds)) {
-            errorMessage(ids.errorIds);
-            selectedIds = ids.errorIds;
-          }
-        }, function (ids) {
-          errorMessage(ids);
-          selectedIds = ids;
-        })
-        .always(function (id) {
-          reloadResultsList().then(function () {
-            bulkDeleteCollection.reset(selectedIds);
-            SidebarActions.refresh();
-          });
-        });
+    if (!window.confirm(msg)) {
+      return false;
     }
-  };
-});
+
+    var reloadResultsList = _.bind(this.reloadResultsList, this);
+    var selectedIds = [];
+
+    bulkDeleteCollection
+      .bulkDelete()
+      .then(function (ids) {
+        FauxtonAPI.addNotification({
+          msg: 'Successfully deleted your docs',
+          clear:  true
+        });
+
+        if (!_.isEmpty(ids.errorIds)) {
+          errorMessage(ids.errorIds);
+          selectedIds = ids.errorIds;
+        }
+      }, function (ids) {
+        errorMessage(ids);
+        selectedIds = ids;
+      })
+      .always(function (id) {
+        reloadResultsList().then(function () {
+          bulkDeleteCollection.reset(selectedIds);
+          SidebarActions.refresh();
+        });
+      });
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-results/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/actiontypes.js b/app/addons/documents/index-results/actiontypes.js
index d98ae40..e39c17b 100644
--- a/app/addons/documents/index-results/actiontypes.js
+++ b/app/addons/documents/index-results/actiontypes.js
@@ -10,16 +10,14 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    INDEX_RESULTS_NEW_RESULTS: 'INDEX_RESULTS_NEW_RESULTS',
-    INDEX_RESULTS_RESET: 'INDEX_RESULTS_RESET',
-    INDEX_RESULTS_SELECT_DOC: 'INDEX_RESULTS_SELECT_DOC',
-    INDEX_RESULTS_CLEAR_RESULTS: 'INDEX_RESULTS_CLEAR_RESULTS',
-    INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS: 'INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS',
-    INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE: 'INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE',
-    INDEX_RESULTS_CLEAR_SELECTED_ITEMS: 'INDEX_RESULTS_CLEAR_SELECTED_ITEMS',
-    INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW: 'INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW',
+export default {
+  INDEX_RESULTS_NEW_RESULTS: 'INDEX_RESULTS_NEW_RESULTS',
+  INDEX_RESULTS_RESET: 'INDEX_RESULTS_RESET',
+  INDEX_RESULTS_SELECT_DOC: 'INDEX_RESULTS_SELECT_DOC',
+  INDEX_RESULTS_CLEAR_RESULTS: 'INDEX_RESULTS_CLEAR_RESULTS',
+  INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS: 'INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS',
+  INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE: 'INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE',
+  INDEX_RESULTS_CLEAR_SELECTED_ITEMS: 'INDEX_RESULTS_CLEAR_SELECTED_ITEMS',
+  INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW: 'INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW',
 
-  };
-});
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-results/index-results.components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/index-results.components.react.jsx b/app/addons/documents/index-results/index-results.components.react.jsx
index f7d93dc..5d70c93 100644
--- a/app/addons/documents/index-results/index-results.components.react.jsx
+++ b/app/addons/documents/index-results/index-results.components.react.jsx
@@ -10,533 +10,517 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  './stores',
-  './actions',
-  '../../components/react-components.react',
-  '../resources',
-  '../..//fauxton/components.react',
-
-  'react-bootstrap',
-  'react-select',
-  'react-addons-css-transition-group',
-
-  '../../../../assets/js/plugins/prettify'
-],
-
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import Stores from "./stores";
+import Actions from "./actions";
+import Components from "../../components/react-components.react";
+import Documents from "../resources";
+import FauxtonComponents from "../..//fauxton/components.react";
+import { SplitButton, MenuItem } from "react-bootstrap";
+import ReactSelect from "react-select";
+import ReactCSSTransitionGroup from "react-addons-css-transition-group";
+import "../../../../assets/js/plugins/prettify";
+
+const {LoadLines, BulkActionComponent} = Components;
+const { Clipboard } = FauxtonComponents;
+const store  = Stores.indexResultsStore;
+
+var NoResultsScreen = React.createClass({
+  propTypes: {
+    text: React.PropTypes.string.isRequired
+  },
+
+  render: function () {
+    return (
+      <div className="no-results-screen">
+        <div className="watermark-logo"></div>
+        <h3>{this.props.text}</h3>
+      </div>
+    );
+  }
+});
 
-function (app, FauxtonAPI, React, Stores, Actions, Components, Documents, FauxtonComponents,
-  ReactBootstrap, ReactSelect, ReactCSSTransitionGroup) {
+var TableRow = React.createClass({
+  propTypes: {
+    docIdentifier: React.PropTypes.string.isRequired,
+    docChecked: React.PropTypes.func.isRequired,
+    isSelected: React.PropTypes.bool.isRequired,
+    index: React.PropTypes.number.isRequired,
+    data: React.PropTypes.object.isRequired
+  },
 
+  onChange: function (e) {
+    this.props.docChecked(this.props.el.id, this.props.el._rev);
+  },
 
-  var store = Stores.indexResultsStore;
-  var BulkActionComponent = Components.BulkActionComponent;
-  var Clipboard = FauxtonComponents.Clipboard;
+  getInitialState: function () {
+    return {
+      checked: this.props.isSelected
+    };
+  },
 
-  var SplitButton = ReactBootstrap.SplitButton;
-  var MenuItem = ReactBootstrap.MenuItem;
+  getRowContents: function (element, rowNumber) {
+    var el = element.content;
 
+    var row = this.props.data.selectedFields.map(function (k, i) {
 
-  var NoResultsScreen = React.createClass({
-    propTypes: {
-      text: React.PropTypes.string.isRequired
-    },
+      var key = 'tableview-data-cell-' + rowNumber + k + i + el[k];
+      var stringified = typeof el[k] === 'object' ? JSON.stringify(el[k], null, '  ') : el[k];
 
-    render: function () {
       return (
-        <div className="no-results-screen">
-          <div className="watermark-logo"></div>
-          <h3>{this.props.text}</h3>
-        </div>
+        <td key={key} title={stringified}>
+          {stringified}
+        </td>
       );
-    }
-  });
+    }.bind(this));
 
-  var TableRow = React.createClass({
-    propTypes: {
-      docIdentifier: React.PropTypes.string.isRequired,
-      docChecked: React.PropTypes.func.isRequired,
-      isSelected: React.PropTypes.bool.isRequired,
-      index: React.PropTypes.number.isRequired,
-      data: React.PropTypes.object.isRequired
-    },
+    return row;
+  },
 
-    onChange: function (e) {
-      this.props.docChecked(this.props.el.id, this.props.el._rev);
-    },
+  maybeGetSpecialField: function (element, i) {
+    if (!this.props.data.hasMetadata) {
+      return null;
+    }
 
-    getInitialState: function () {
-      return {
-        checked: this.props.isSelected
-      };
-    },
+    var el = element.content;
 
-    getRowContents: function (element, rowNumber) {
-      var el = element.content;
+    return (
+      <td className="tableview-data-cell-id" key={'tableview-data-cell-id' + i}>
+        <div>{this.maybeGetUrl(element.url, el._id || el.id)}</div>
+        <div>{el._rev}</div>
+      </td>
+    );
+  },
 
-      var row = this.props.data.selectedFields.map(function (k, i) {
+  maybeGetUrl: function (url, stringified) {
+    if (!url) {
+      return stringified;
+    }
 
-        var key = 'tableview-data-cell-' + rowNumber + k + i + el[k];
-        var stringified = typeof el[k] === 'object' ? JSON.stringify(el[k], null, '  ') : el[k];
+    return (
+      <a href={'#' + url}>
+        {stringified}
+      </a>
+    );
+  },
 
-        return (
-          <td key={key} title={stringified}>
-            {stringified}
-          </td>
-        );
-      }.bind(this));
+  maybeGetCheckboxCell: function (el, i) {
+    return (
+      <td className="tableview-checkbox-cell" key={"tableview-checkbox-cell-" + i}>
+        {el.isDeletable ? <input
+          id={"checkbox-" + this.props.docIdentifier}
+          checked={this.props.isSelected}
+          type="checkbox"
+          onChange={this.onChange} /> : null}
+      </td>
+    );
+  },
 
-      return row;
-    },
+  getAdditionalInfoRow: function (el) {
+    const attachmentCount = Object.keys(el._attachments ||�{}).length;
+    let attachmentIndicator = null;
+    let textAttachments = null;
 
-    maybeGetSpecialField: function (element, i) {
-      if (!this.props.data.hasMetadata) {
-        return null;
-      }
+    const conflictCount = Object.keys(el._conflicts ||�{}).length;
+    let conflictIndicator = null;
+    let textConflicts = null;
 
-      var el = element.content;
 
-      return (
-        <td className="tableview-data-cell-id" key={'tableview-data-cell-id' + i}>
-          <div>{this.maybeGetUrl(element.url, el._id || el.id)}</div>
-          <div>{el._rev}</div>
-        </td>
+    if (attachmentCount) {
+      textAttachments = attachmentCount === 1 ? attachmentCount + ' Attachment' : attachmentCount + ' Attachments';
+      attachmentIndicator = (
+        <div style={{display: 'inline', marginLeft: '5px'}} title={textAttachments}>
+          <i className="icon fonticon-paperclip"></i>{attachmentCount}
+        </div>
       );
-    },
-
-    maybeGetUrl: function (url, stringified) {
-      if (!url) {
-        return stringified;
-      }
+    }
 
-      return (
-        <a href={'#' + url}>
-          {stringified}
-        </a>
+    if (conflictCount) {
+      textConflicts = conflictCount === 1 ? conflictCount + ' Conflict' : conflictCount + ' Conflicts';
+      conflictIndicator = (
+        <div className="tableview-conflict" data-conflicts-indicator style={{display: 'inline'}} title={textConflicts}>
+          <i
+            style={{fontSize: '17px'}}
+            className="icon icon-code-fork"></i>{conflictCount}
+        </div>
       );
-    },
+    }
 
-    maybeGetCheckboxCell: function (el, i) {
-      return (
-        <td className="tableview-checkbox-cell" key={"tableview-checkbox-cell-" + i}>
-          {el.isDeletable ? <input
-            id={"checkbox-" + this.props.docIdentifier}
-            checked={this.props.isSelected}
-            type="checkbox"
-            onChange={this.onChange} /> : null}
-        </td>
-      );
-    },
-
-    getAdditionalInfoRow: function (el) {
-      const attachmentCount = Object.keys(el._attachments ||�{}).length;
-      let attachmentIndicator = null;
-      let textAttachments = null;
-
-      const conflictCount = Object.keys(el._conflicts ||�{}).length;
-      let conflictIndicator = null;
-      let textConflicts = null;
-
-
-      if (attachmentCount) {
-        textAttachments = attachmentCount === 1 ? attachmentCount + ' Attachment' : attachmentCount + ' Attachments';
-        attachmentIndicator = (
-          <div style={{display: 'inline', marginLeft: '5px'}} title={textAttachments}>
-            <i className="icon fonticon-paperclip"></i>{attachmentCount}
-          </div>
-        );
-      }
-
-      if (conflictCount) {
-        textConflicts = conflictCount === 1 ? conflictCount + ' Conflict' : conflictCount + ' Conflicts';
-        conflictIndicator = (
-          <div className="tableview-conflict" data-conflicts-indicator style={{display: 'inline'}} title={textConflicts}>
-            <i
-              style={{fontSize: '17px'}}
-              className="icon icon-code-fork"></i>{conflictCount}
-          </div>
-        );
-      }
+    return (
+      <td className="tableview-el-last">
+        {conflictIndicator}
+        {attachmentIndicator}
+      </td>
+    );
+  },
 
-      return (
-        <td className="tableview-el-last">
-          {conflictIndicator}
-          {attachmentIndicator}
-        </td>
-      );
-    },
+  getCopyButton: function (el) {
+    var text = JSON.stringify(el, null, '  ');
+    return (
+      <td title={text} className="tableview-el-copy">
+        <Clipboard
+          onClipboardClick={this.showCopiedMessage}
+          title={text}
+          text={text} />
+      </td>
+    );
+  },
 
-    getCopyButton: function (el) {
-      var text = JSON.stringify(el, null, '  ');
-      return (
-        <td title={text} className="tableview-el-copy">
-          <Clipboard
-            onClipboardClick={this.showCopiedMessage}
-            title={text}
-            text={text} />
-        </td>
-      );
-    },
+  showCopiedMessage: function () {
+    FauxtonAPI.addNotification({
+      msg: 'The document content has been copied to the clipboard.',
+      type: 'success',
+      clear: true
+    });
+  },
 
-    showCopiedMessage: function () {
-      FauxtonAPI.addNotification({
-        msg: 'The document content has been copied to the clipboard.',
-        type: 'success',
-        clear: true
-      });
-    },
+  render: function () {
+    var i = this.props.index;
+    var docContent = this.props.el.content;
+    var el = this.props.el;
 
-    render: function () {
-      var i = this.props.index;
-      var docContent = this.props.el.content;
-      var el = this.props.el;
+    return (
+      <tr key={"tableview-content-row-" + i}>
+        {this.maybeGetCheckboxCell(el, i)}
+        {this.getCopyButton(docContent)}
+        {this.maybeGetSpecialField(el, i)}
+        {this.getRowContents(el, i)}
+        {this.getAdditionalInfoRow(docContent)}
+      </tr>
+    );
+  }
+});
 
-      return (
-        <tr key={"tableview-content-row-" + i}>
-          {this.maybeGetCheckboxCell(el, i)}
-          {this.getCopyButton(docContent)}
-          {this.maybeGetSpecialField(el, i)}
-          {this.getRowContents(el, i)}
-          {this.getAdditionalInfoRow(docContent)}
-        </tr>
-      );
-    }
+const WrappedAutocomplete = ({selectedField, notSelectedFields, index}) => {
+  const options = notSelectedFields.map((el) => {
+    return {value: el, label: el};
   });
 
-  const WrappedAutocomplete = ({selectedField, notSelectedFields, index}) => {
-    const options = notSelectedFields.map((el) => {
-      return {value: el, label: el};
-    });
-
-    return (
-      <div className="table-container-autocomplete">
-        <div className="table-select-wrapper">
-          <ReactSelect
-            value={selectedField}
-            options={options}
-            clearable={false}
-            onChange={(el) => {
-              Actions.changeField({
-                newSelectedRow: el.value,
-                index: index
-              });
-            }} />
-        </div>
+  return (
+    <div className="table-container-autocomplete">
+      <div className="table-select-wrapper">
+        <ReactSelect
+          value={selectedField}
+          options={options}
+          clearable={false}
+          onChange={(el) => {
+            Actions.changeField({
+              newSelectedRow: el.value,
+              index: index
+            });
+          }} />
       </div>
-    );
-  };
-
+    </div>
+  );
+};
 
-  var TableView = React.createClass({
 
-    getContentRows: function () {
-      var data = this.props.data.results;
+var TableView = React.createClass({
 
-      return data.map(function (el, i) {
+  getContentRows: function () {
+    var data = this.props.data.results;
 
-        return (
-          <TableRow
-            key={"tableview-row-component-" + i}
-            index={i}
-            el={el}
-            docIdentifier={el.id || "tableview-row-component-" + i}
-            docChecked={this.props.docChecked}
-            isSelected={this.props.isSelected(el.id)}
-            data={this.props.data} />
-        );
-      }.bind(this));
-    },
+    return data.map(function (el, i) {
 
-    getOptionFieldRows: function (filtered) {
-      var notSelectedFields = this.props.data.notSelectedFields;
+      return (
+        <TableRow
+          key={"tableview-row-component-" + i}
+          index={i}
+          el={el}
+          docIdentifier={el.id || "tableview-row-component-" + i}
+          docChecked={this.props.docChecked}
+          isSelected={this.props.isSelected(el.id)}
+          data={this.props.data} />
+      );
+    }.bind(this));
+  },
 
-      if (!notSelectedFields) {
-        return filtered.map(function (el, i) {
-          return <th key={'header-el-' + i}>{el}</th>;
-        });
-      }
+  getOptionFieldRows: function (filtered) {
+    var notSelectedFields = this.props.data.notSelectedFields;
 
+    if (!notSelectedFields) {
       return filtered.map(function (el, i) {
-        return (
-          <th key={'header-el-' + i}>
-            {this.getDropdown(el, this.props.data.schema, i)}
-          </th>
-        );
-      }.bind(this));
-    },
-
-    getDropdown: function (selectedField, notSelectedFields, i) {
+        return <th key={'header-el-' + i}>{el}</th>;
+      });
+    }
 
+    return filtered.map(function (el, i) {
       return (
-        <WrappedAutocomplete
-          selectedField={selectedField}
-          notSelectedFields={notSelectedFields}
-          index={i} />
+        <th key={'header-el-' + i}>
+          {this.getDropdown(el, this.props.data.schema, i)}
+        </th>
       );
-    },
+    }.bind(this));
+  },
 
-    getHeader: function () {
-      var selectedFields = this.props.data.selectedFields;
+  getDropdown: function (selectedField, notSelectedFields, i) {
 
-      var specialField = null;
-      if (this.props.data.hasMetadata) {
-        specialField = (<th key="header-el-metadata" title="Metadata">Metadata</th>);
-      }
+    return (
+      <WrappedAutocomplete
+        selectedField={selectedField}
+        notSelectedFields={notSelectedFields}
+        index={i} />
+    );
+  },
 
-      var row = this.getOptionFieldRows(selectedFields);
+  getHeader: function () {
+    var selectedFields = this.props.data.selectedFields;
 
-      var box = (
-        <th className="tableview-header-el-checkbox" key="tableview-header-el-checkbox">
-          {this.props.isListDeletable ? <BulkActionComponent
-            disabled={this.props.isLoading}
-            removeItem={this.props.removeItem}
-            isChecked={this.props.isChecked}
-            hasSelectedItem={this.props.hasSelectedItem}
-            toggleSelect={this.props.toggleSelect}
-            title="Select all docs that can be..." /> : null}
-        </th>
-      );
+    var specialField = null;
+    if (this.props.data.hasMetadata) {
+      specialField = (<th key="header-el-metadata" title="Metadata">Metadata</th>);
+    }
 
+    var row = this.getOptionFieldRows(selectedFields);
+
+    var box = (
+      <th className="tableview-header-el-checkbox" key="tableview-header-el-checkbox">
+        {this.props.isListDeletable ? <BulkActionComponent
+          disabled={this.props.isLoading}
+          removeItem={this.props.removeItem}
+          isChecked={this.props.isChecked}
+          hasSelectedItem={this.props.hasSelectedItem}
+          toggleSelect={this.props.toggleSelect}
+          title="Select all docs that can be..." /> : null}
+      </th>
+    );
 
-      return (
-        <tr key="tableview-content-row-header">
-          {box}
-          <th className="tableview-el-copy"></th>
-          {specialField}
-          {row}
-          <th className="tableview-el-last"></th>
-        </tr>
-      );
-    },
 
-    render: function () {
-      var header = this.getHeader();
-      var contentRows = this.getContentRows();
+    return (
+      <tr key="tableview-content-row-header">
+        {box}
+        <th className="tableview-el-copy"></th>
+        {specialField}
+        {row}
+        <th className="tableview-el-last"></th>
+      </tr>
+    );
+  },
 
-      return (
-        <div className="table-view-docs">
-          <table className="table table-striped">
-            <thead>
-              {header}
-            </thead>
-            <tbody>
-              {contentRows}
-            </tbody>
-          </table>
-        </div>
-      );
-    }
-  });
+  render: function () {
+    var header = this.getHeader();
+    var contentRows = this.getContentRows();
 
+    return (
+      <div className="table-view-docs">
+        <table className="table table-striped">
+          <thead>
+            {header}
+          </thead>
+          <tbody>
+            {contentRows}
+          </tbody>
+        </table>
+      </div>
+    );
+  }
+});
 
-  var ResultsScreen = React.createClass({
 
-    onDoubleClick: function (id, doc) {
-      FauxtonAPI.navigate(doc.url);
-    },
+var ResultsScreen = React.createClass({
 
-    getUrlFragment: function (url) {
-      if (!this.props.isEditable) {
-        return null;
-      }
+  onDoubleClick: function (id, doc) {
+    FauxtonAPI.navigate(doc.url);
+  },
 
-      return (
-        <a href={url}>
-          <i className="fonticon-pencil"></i>
-        </a>);
-    },
-
-    getDocumentList: function () {
-      var noop = function () {};
-      var data = this.props.results.results;
-
-      return _.map(data, function (doc, i) {
-        return (
-         <Components.Document
-           key={doc.id + i}
-           doc={doc}
-           onDoubleClick={this.props.isEditable ? this.onDoubleClick : noop}
-           keylabel={doc.keylabel}
-           docContent={doc.content}
-           checked={this.props.isSelected(doc.id)}
-           header={doc.header}
-           docChecked={this.props.docChecked}
-           isDeletable={doc.isDeletable}
-           docIdentifier={doc.id} >
-           {doc.url ? this.getUrlFragment('#' + doc.url) : doc.url}
-         </Components.Document>
-       );
-      }, this);
-    },
-
-    getDocumentStyleView: function (loadLines) {
-      var classNames = 'view';
-      var isDeletable = this.props.isListDeletable;
-
-      if (this.props.isListDeletable) {
-        classNames += ' show-select';
-      }
+  getUrlFragment: function (url) {
+    if (!this.props.isEditable) {
+      return null;
+    }
 
-      return (
-        <div className={classNames}>
-          <div className="loading-lines-wrapper">
-            {loadLines}
-          </div>
-
-          <div id="doc-list">
-            {isDeletable ? <BulkActionComponent
-              removeItem={this.props.removeItem}
-              isChecked={this.props.allDocumentsSelected}
-              hasSelectedItem={this.props.hasSelectedItem}
-              toggleSelect={this.toggleSelectAll}
-              disabled={this.props.isLoading}
-              title="Select all docs that can be..." /> : null}
-
-            <ReactCSSTransitionGroup transitionName="slow-fade" transitionEnterTimeout={500} transitionLeaveTimeout={300}>
-              {this.getDocumentList()}
-            </ReactCSSTransitionGroup>
-          </div>
-        </div>
-      );
-    },
+    return (
+      <a href={url}>
+        <i className="fonticon-pencil"></i>
+      </a>);
+  },
 
-    getTableStyleView: function (loadLines) {
+  getDocumentList: function () {
+    var noop = function () {};
+    var data = this.props.results.results;
+
+    return _.map(data, function (doc, i) {
       return (
-        <div>
-          <div className="loading-lines-wrapper">
-            {loadLines}
-          </div>
-
-          <TableView
-            docChecked={this.props.docChecked}
-            isSelected={this.props.isSelected}
-            isListDeletable={this.props.isListDeletable}
-            data={this.props.results}
-            isLoading={this.props.isLoading}
+       <Components.Document
+         key={doc.id + i}
+         doc={doc}
+         onDoubleClick={this.props.isEditable ? this.onDoubleClick : noop}
+         keylabel={doc.keylabel}
+         docContent={doc.content}
+         checked={this.props.isSelected(doc.id)}
+         header={doc.header}
+         docChecked={this.props.docChecked}
+         isDeletable={doc.isDeletable}
+         docIdentifier={doc.id} >
+         {doc.url ? this.getUrlFragment('#' + doc.url) : doc.url}
+       </Components.Document>
+     );
+    }, this);
+  },
+
+  getDocumentStyleView: function (loadLines) {
+    var classNames = 'view';
+    var isDeletable = this.props.isListDeletable;
+
+    if (this.props.isListDeletable) {
+      classNames += ' show-select';
+    }
+
+    return (
+      <div className={classNames}>
+        <div className="loading-lines-wrapper">
+          {loadLines}
+        </div>
 
+        <div id="doc-list">
+          {isDeletable ? <BulkActionComponent
             removeItem={this.props.removeItem}
             isChecked={this.props.allDocumentsSelected}
             hasSelectedItem={this.props.hasSelectedItem}
             toggleSelect={this.toggleSelectAll}
-            title="Select all docs that can be..." />
+            disabled={this.props.isLoading}
+            title="Select all docs that can be..." /> : null}
+
+          <ReactCSSTransitionGroup transitionName="slow-fade" transitionEnterTimeout={500} transitionLeaveTimeout={300}>
+            {this.getDocumentList()}
+          </ReactCSSTransitionGroup>
         </div>
-      );
-    },
+      </div>
+    );
+  },
 
-    render: function () {
+  getTableStyleView: function (loadLines) {
+    return (
+      <div>
+        <div className="loading-lines-wrapper">
+          {loadLines}
+        </div>
 
-      var loadLines = null;
-      var isTableView = this.props.isTableView;
+        <TableView
+          docChecked={this.props.docChecked}
+          isSelected={this.props.isSelected}
+          isListDeletable={this.props.isListDeletable}
+          data={this.props.results}
+          isLoading={this.props.isLoading}
+
+          removeItem={this.props.removeItem}
+          isChecked={this.props.allDocumentsSelected}
+          hasSelectedItem={this.props.hasSelectedItem}
+          toggleSelect={this.toggleSelectAll}
+          title="Select all docs that can be..." />
+      </div>
+    );
+  },
 
-      if (this.props.isLoading) {
-        loadLines = <Components.LoadLines />;
-      }
+  render: function () {
 
-      var mainView = isTableView ? this.getTableStyleView(loadLines) : this.getDocumentStyleView(loadLines);
-      return (
-        <div className="document-result-screen">
-          {mainView}
-        </div>
-      );
-    },
+    var loadLines = null;
+    var isTableView = this.props.isTableView;
 
-    toggleSelectAll: function () {
-      Actions.toggleAllDocuments();
-    },
+    if (this.props.isLoading) {
+      loadLines = <LoadLines />;
+    }
 
-    componentDidMount: function () {
-      prettyPrint();
-    },
+    var mainView = isTableView ? this.getTableStyleView(loadLines) : this.getDocumentStyleView(loadLines);
+    return (
+      <div className="document-result-screen">
+        {mainView}
+      </div>
+    );
+  },
 
-    componentDidUpdate: function () {
-      prettyPrint();
-    },
+  toggleSelectAll: function () {
+    Actions.toggleAllDocuments();
+  },
 
-  });
+  componentDidMount: function () {
+    prettyPrint();
+  },
 
+  componentDidUpdate: function () {
+    prettyPrint();
+  },
 
+});
 
-  var ViewResultListController = React.createClass({
-    getStoreState: function () {
-      var selectedItemsLength = store.getSelectedItemsLength();
-      return {
-        hasResults: store.hasResults(),
-        results: store.getResults(),
-        isLoading: store.isLoading(),
-        isEditable: store.isEditable(),
-        textEmptyIndex: store.getTextEmptyIndex(),
-        isTableView: store.getIsTableView(),
-        allDocumentsSelected: store.areAllDocumentsSelected(),
-        hasSelectedItem: !!selectedItemsLength,
-        selectedItemsLength: selectedItemsLength,
-        bulkDeleteCollection: store.getBulkDocCollection()
-      };
-    },
-
-    isSelected: function (id) {
-      return !!this.state.bulkDeleteCollection.get(id);
-    },
-
-    removeItem: function () {
-      Actions.deleteSelected(this.state.bulkDeleteCollection, this.state.selectedItemsLength);
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      store.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      store.off('change', this.onChange);
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    docChecked: function (_id, _rev) {
-      Actions.selectDoc({
-        _id: _id,
-        _rev: _rev
-      });
-    },
-
-    render: function () {
-      var view = <NoResultsScreen text={this.state.textEmptyIndex}/>;
-
-      if (this.state.hasResults) {
-        view = <ResultsScreen
-          removeItem={this.removeItem}
-          hasSelectedItem={this.state.hasSelectedItem}
-          allDocumentsSelected={this.state.allDocumentsSelected}
-          isSelected={this.isSelected}
-          isEditable={this.state.isEditable}
-          isListDeletable={this.state.results.hasBulkDeletableDoc}
-          docChecked={this.docChecked}
-          isLoading={this.state.isLoading}
-          results={this.state.results}
-          isTableView={this.state.isTableView} />;
-      }
 
-      return (
-        view
-      );
+
+var ViewResultListController = React.createClass({
+  getStoreState: function () {
+    var selectedItemsLength = store.getSelectedItemsLength();
+    return {
+      hasResults: store.hasResults(),
+      results: store.getResults(),
+      isLoading: store.isLoading(),
+      isEditable: store.isEditable(),
+      textEmptyIndex: store.getTextEmptyIndex(),
+      isTableView: store.getIsTableView(),
+      allDocumentsSelected: store.areAllDocumentsSelected(),
+      hasSelectedItem: !!selectedItemsLength,
+      selectedItemsLength: selectedItemsLength,
+      bulkDeleteCollection: store.getBulkDocCollection()
+    };
+  },
+
+  isSelected: function (id) {
+    return !!this.state.bulkDeleteCollection.get(id);
+  },
+
+  removeItem: function () {
+    Actions.deleteSelected(this.state.bulkDeleteCollection, this.state.selectedItemsLength);
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  docChecked: function (_id, _rev) {
+    Actions.selectDoc({
+      _id: _id,
+      _rev: _rev
+    });
+  },
+
+  render: function () {
+    var view = <NoResultsScreen text={this.state.textEmptyIndex}/>;
+
+    if (this.state.hasResults) {
+      view = <ResultsScreen
+        removeItem={this.removeItem}
+        hasSelectedItem={this.state.hasSelectedItem}
+        allDocumentsSelected={this.state.allDocumentsSelected}
+        isSelected={this.isSelected}
+        isEditable={this.state.isEditable}
+        isListDeletable={this.state.results.hasBulkDeletableDoc}
+        docChecked={this.docChecked}
+        isLoading={this.state.isLoading}
+        results={this.state.results}
+        isTableView={this.state.isTableView} />;
     }
-  });
 
+    return (
+      view
+    );
+  }
+});
 
-  var Views = {
-    List: ViewResultListController,
-    NoResultsScreen: NoResultsScreen,
-    ResultsScreen: ResultsScreen,
-    WrappedAutocomplete: WrappedAutocomplete
-  };
 
-  return Views;
-});
+export default {
+  List: ViewResultListController,
+  NoResultsScreen: NoResultsScreen,
+  ResultsScreen: ResultsScreen,
+  WrappedAutocomplete: WrappedAutocomplete
+};