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:29 UTC

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

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 2f22a89f7 -> 0ca35da7c


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/tests/routeObjectSpec.js
----------------------------------------------------------------------
diff --git a/app/core/tests/routeObjectSpec.js b/app/core/tests/routeObjectSpec.js
index c609def..8330e8b 100644
--- a/app/core/tests/routeObjectSpec.js
+++ b/app/core/tests/routeObjectSpec.js
@@ -9,243 +9,238 @@
 // 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',
-  'react',
-  'react-dom',
-  '../../../test/mocha/testUtils',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, React, ReactDOM, utils, TestUtils, sinon) {
-  var assert = utils.assert,
-      restore = utils.restore,
-      RouteObject = FauxtonAPI.RouteObject;
-
-  describe('RouteObjects', function () {
-
-    describe('renderWith', function () {
-      var TestRouteObject, testRouteObject, mockLayout;
-
-      beforeEach(function () {
-        TestRouteObject = RouteObject.extend({
-          crumbs: ['mycrumbs']
-        });
-
-        testRouteObject = new TestRouteObject();
-        var apiBar = {};
-        apiBar.hide = sinon.spy();
-
-        // Need to find a better way of doing this
-        mockLayout = {
-          setTemplate: function () {
-            var promise = $.Deferred();
-            promise.resolve();
-            return promise;
-          },
-          clearBreadcrumbs: sinon.spy(),
-          setView: sinon.spy(),
-          renderView: sinon.spy(),
-          hooks: [],
-          setBreadcrumbs: sinon.spy(),
-          apiBar: apiBar
-        };
-
+import FauxtonAPI from "../api";
+import React from "react";
+import ReactDOM from "react-dom";
+import utils from "../../../test/mocha/testUtils";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+var assert = utils.assert,
+    restore = utils.restore,
+    RouteObject = FauxtonAPI.RouteObject;
+
+describe('RouteObjects', function () {
+
+  describe('renderWith', function () {
+    var TestRouteObject, testRouteObject, mockLayout;
+
+    beforeEach(function () {
+      TestRouteObject = RouteObject.extend({
+        crumbs: ['mycrumbs']
       });
 
-      it('Should set template for first render ', function () {
-        var setTemplateSpy = sinon.stub(mockLayout, 'setTemplate'),
-        promise = $.Deferred();
+      testRouteObject = new TestRouteObject();
+      var apiBar = {};
+      apiBar.hide = sinon.spy();
 
-        promise.resolve();
-        setTemplateSpy.returns(promise);
-        testRouteObject.renderWith('the-route', mockLayout, 'args');
+      // Need to find a better way of doing this
+      mockLayout = {
+        setTemplate: function () {
+          var promise = $.Deferred();
+          promise.resolve();
+          return promise;
+        },
+        clearBreadcrumbs: sinon.spy(),
+        setView: sinon.spy(),
+        renderView: sinon.spy(),
+        hooks: [],
+        setBreadcrumbs: sinon.spy(),
+        apiBar: apiBar
+      };
 
-        assert.ok(setTemplateSpy.calledOnce);
-      });
+    });
 
-      it('Should not set template after first render', function () {
-        var setTemplateSpy = sinon.stub(mockLayout, 'setTemplate'),
-        promise = $.Deferred();
+    it('Should set template for first render ', function () {
+      var setTemplateSpy = sinon.stub(mockLayout, 'setTemplate'),
+      promise = $.Deferred();
 
-        promise.resolve();
-        setTemplateSpy.returns(promise);
+      promise.resolve();
+      setTemplateSpy.returns(promise);
+      testRouteObject.renderWith('the-route', mockLayout, 'args');
 
-        testRouteObject.renderWith('the-route', mockLayout, 'args');
-        testRouteObject.renderWith('the-route', mockLayout, 'args');
+      assert.ok(setTemplateSpy.calledOnce);
+    });
 
-        assert.ok(setTemplateSpy.calledOnce, 'SetTemplate not meant to be called');
-      });
+    it('Should not set template after first render', function () {
+      var setTemplateSpy = sinon.stub(mockLayout, 'setTemplate'),
+      promise = $.Deferred();
 
-      it('Should call renderReactComponents', function () {
-        var renderSpy = sinon.spy(testRouteObject, "renderReactComponents");
+      promise.resolve();
+      setTemplateSpy.returns(promise);
 
-        testRouteObject.renderWith('the-route', mockLayout, 'args');
-        assert.ok(renderSpy.calledOnce);
-      });
+      testRouteObject.renderWith('the-route', mockLayout, 'args');
+      testRouteObject.renderWith('the-route', mockLayout, 'args');
 
-      it("Should call establish of routeObject", function () {
-        var establishSpy = sinon.spy(testRouteObject, "establish");
+      assert.ok(setTemplateSpy.calledOnce, 'SetTemplate not meant to be called');
+    });
 
-        testRouteObject.renderWith('the-route', mockLayout, 'args');
-        assert.ok(establishSpy.calledOnce, 'Calls establish');
-      });
+    it('Should call renderReactComponents', function () {
+      var renderSpy = sinon.spy(testRouteObject, "renderReactComponents");
 
-      it("Should render views", function () {
-        var view = new FauxtonAPI.View(),
-        getViewsSpy = sinon.stub(testRouteObject, "getViews"),
-        viewSpy = sinon.stub(view, "establish");
+      testRouteObject.renderWith('the-route', mockLayout, 'args');
+      assert.ok(renderSpy.calledOnce);
+    });
 
-        view.hasRendered = false;
-        view.promise = function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        };
-        getViewsSpy.returns({'#view': view});
-        mockLayout.renderView = function () { return view;};
+    it("Should call establish of routeObject", function () {
+      var establishSpy = sinon.spy(testRouteObject, "establish");
 
-        testRouteObject.renderWith('the-route', mockLayout, 'args');
-        assert.ok(viewSpy.calledOnce, 'Should render view');
-      });
+      testRouteObject.renderWith('the-route', mockLayout, 'args');
+      assert.ok(establishSpy.calledOnce, 'Calls establish');
+    });
 
-      it("Should not re-render a view", function () {
-        var view = new FauxtonAPI.View(),
-        getViewsSpy = sinon.stub(testRouteObject, "getViews"),
-        viewSpy = sinon.stub(view, "establish");
+    it("Should render views", function () {
+      var view = new FauxtonAPI.View(),
+      getViewsSpy = sinon.stub(testRouteObject, "getViews"),
+      viewSpy = sinon.stub(view, "establish");
 
-        view.hasRendered = true;
-        getViewsSpy.returns({'#view': view});
+      view.hasRendered = false;
+      view.promise = function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      };
+      getViewsSpy.returns({'#view': view});
+      mockLayout.renderView = function () { return view;};
 
-        testRouteObject.renderWith('the-route', mockLayout, 'args');
-        assert.notOk(viewSpy.calledOnce, 'Should render view');
-      });
+      testRouteObject.renderWith('the-route', mockLayout, 'args');
+      assert.ok(viewSpy.calledOnce, 'Should render view');
     });
 
-    describe('React Integration', function () {
-      var testRouteObject;
+    it("Should not re-render a view", function () {
+      var view = new FauxtonAPI.View(),
+      getViewsSpy = sinon.stub(testRouteObject, "getViews"),
+      viewSpy = sinon.stub(view, "establish");
 
-      beforeEach(function () {
-        var TestRouteObject = RouteObject.extend({
-          crumbs: ['mycrumbs']
-        });
+      view.hasRendered = true;
+      getViewsSpy.returns({'#view': view});
 
-        testRouteObject = new TestRouteObject();
-        var apiBar = {};
-        //apiBar.hide = sinon.spy();
-
-        var mockLayout = {
-          setTemplate: function () {
-            var promise = $.Deferred();
-            promise.resolve();
-            return promise;
-          },
-          clearBreadcrumbs: sinon.spy(),
-          setView: sinon.spy(),
-          renderView: sinon.spy(),
-          hooks: [],
-          setBreadcrumbs: sinon.spy(),
-          apiBar: apiBar
-        };
+      testRouteObject.renderWith('the-route', mockLayout, 'args');
+      assert.notOk(viewSpy.calledOnce, 'Should render view');
+    });
+  });
 
+  describe('React Integration', function () {
+    var testRouteObject;
+
+    beforeEach(function () {
+      var TestRouteObject = RouteObject.extend({
+        crumbs: ['mycrumbs']
       });
 
-      describe('setComponent', function () {
+      testRouteObject = new TestRouteObject();
+      var apiBar = {};
+      //apiBar.hide = sinon.spy();
 
-        afterEach(function () {
-          restore(testRouteObject.removeComponent);
-          restore(testRouteObject.removeView);
-        });
+      var mockLayout = {
+        setTemplate: function () {
+          var promise = $.Deferred();
+          promise.resolve();
+          return promise;
+        },
+        clearBreadcrumbs: sinon.spy(),
+        setView: sinon.spy(),
+        renderView: sinon.spy(),
+        hooks: [],
+        setBreadcrumbs: sinon.spy(),
+        apiBar: apiBar
+      };
 
-        it('removes existing view for selector', function () {
-          var fakeReactComponent = React.createElement('div');
-          var fakeSelector = '.fake-selector';
-          console.log('WOOOOOOO');
-          var spy = sinon.spy(testRouteObject, 'removeView');
+    });
 
-          testRouteObject.setComponent(fakeSelector, fakeReactComponent);
+    describe('setComponent', function () {
 
-          assert.ok(spy.calledWith(fakeSelector));
-        });
+      afterEach(function () {
+        restore(testRouteObject.removeComponent);
+        restore(testRouteObject.removeView);
+      });
 
-        it('removes existing component for selector', function () {
-          var fakeReactComponent = React.createElement('div');
-          var fakeSelector = '.fake-selector';
-          var spy = sinon.spy(testRouteObject, 'removeComponent');
+      it('removes existing view for selector', function () {
+        var fakeReactComponent = React.createElement('div');
+        var fakeSelector = '.fake-selector';
+        console.log('WOOOOOOO');
+        var spy = sinon.spy(testRouteObject, 'removeView');
 
-          testRouteObject.setComponent(fakeSelector, fakeReactComponent);
+        testRouteObject.setComponent(fakeSelector, fakeReactComponent);
 
-          assert.ok(spy.calledWith(fakeSelector));
-        });
+        assert.ok(spy.calledWith(fakeSelector));
+      });
 
-        it('sets component for selector', function () {
-          var fakeReactComponent = React.createElement('div');
-          var fakeSelector = '.fake-selector';
+      it('removes existing component for selector', function () {
+        var fakeReactComponent = React.createElement('div');
+        var fakeSelector = '.fake-selector';
+        var spy = sinon.spy(testRouteObject, 'removeComponent');
 
-          testRouteObject.setComponent(fakeSelector, fakeReactComponent);
-          assert.deepEqual(fakeReactComponent, testRouteObject.reactComponents[fakeSelector].component);
-        });
+        testRouteObject.setComponent(fakeSelector, fakeReactComponent);
 
-        it('sets props for the selector', function () {
-          var fakeReactComponent = React.createElement('div');
-          var fakeSelector = '.fake-selector';
+        assert.ok(spy.calledWith(fakeSelector));
+      });
 
-          testRouteObject.setComponent(fakeSelector, fakeReactComponent, {foo: 'bar baromat'});
-          assert.deepEqual(fakeReactComponent, testRouteObject.reactComponents[fakeSelector].component);
-        });
+      it('sets component for selector', function () {
+        var fakeReactComponent = React.createElement('div');
+        var fakeSelector = '.fake-selector';
 
+        testRouteObject.setComponent(fakeSelector, fakeReactComponent);
+        assert.deepEqual(fakeReactComponent, testRouteObject.reactComponents[fakeSelector].component);
       });
 
-      describe('removeComponent', function () {
+      it('sets props for the selector', function () {
+        var fakeReactComponent = React.createElement('div');
+        var fakeSelector = '.fake-selector';
 
-        afterEach(function () {
-          restore(ReactDOM.unmountComponentAtNode);
-        });
+        testRouteObject.setComponent(fakeSelector, fakeReactComponent, {foo: 'bar baromat'});
+        assert.deepEqual(fakeReactComponent, testRouteObject.reactComponents[fakeSelector].component);
+      });
 
-        it('removes existing components via React', function () {
-          var spy = sinon.stub(ReactDOM, 'unmountComponentAtNode');
-          var fakeSelector = 'remove-selector';
+    });
 
-          var container = document.createElement('div');
-          var Hmm = React.createClass({displayName: "Hmm",
-            render: function () {
-              return (
-                React.createElement("div", {id: "remove-selector"})
-              );
-            }
-          });
+    describe('removeComponent', function () {
 
-          TestUtils.renderIntoDocument(React.createElement('Hmm'), container);
-          testRouteObject.reactComponents[fakeSelector] = React.createElement('div');
-          testRouteObject.removeComponent(fakeSelector);
+      afterEach(function () {
+        restore(ReactDOM.unmountComponentAtNode);
+      });
 
-          assert.ok(_.isUndefined(testRouteObject.reactComponents[fakeSelector]));
+      it('removes existing components via React', function () {
+        var spy = sinon.stub(ReactDOM, 'unmountComponentAtNode');
+        var fakeSelector = 'remove-selector';
+
+        var container = document.createElement('div');
+        var Hmm = React.createClass({displayName: "Hmm",
+          render: function () {
+            return (
+              React.createElement("div", {id: "remove-selector"})
+            );
+          }
         });
 
-        it('removes existing components key', function () {
-          var spy = sinon.stub(ReactDOM, 'unmountComponentAtNode');
-          var fakeSelector = 'remove-selector';
-          testRouteObject.reactComponents[fakeSelector] = React.createElement('div');
+        TestUtils.renderIntoDocument(React.createElement('Hmm'), container);
+        testRouteObject.reactComponents[fakeSelector] = React.createElement('div');
+        testRouteObject.removeComponent(fakeSelector);
 
-          testRouteObject.removeComponent(fakeSelector);
+        assert.ok(_.isUndefined(testRouteObject.reactComponents[fakeSelector]));
+      });
 
-          assert.ok(_.isUndefined(testRouteObject.reactComponents[fakeSelector]));
+      it('removes existing components key', function () {
+        var spy = sinon.stub(ReactDOM, 'unmountComponentAtNode');
+        var fakeSelector = 'remove-selector';
+        testRouteObject.reactComponents[fakeSelector] = React.createElement('div');
 
-        });
+        testRouteObject.removeComponent(fakeSelector);
 
-        it('does nothing for non existing component', function () {
-          var spy = sinon.spy(ReactDOM, 'unmountComponentAtNode');
-          var fakeSelector = 'remove-selector';
+        assert.ok(_.isUndefined(testRouteObject.reactComponents[fakeSelector]));
 
-          testRouteObject.removeComponent(fakeSelector);
+      });
 
-          assert.notOk(spy.calledOnce);
+      it('does nothing for non existing component', function () {
+        var spy = sinon.spy(ReactDOM, 'unmountComponentAtNode');
+        var fakeSelector = 'remove-selector';
 
-        });
+        testRouteObject.removeComponent(fakeSelector);
+
+        assert.notOk(spy.calledOnce);
 
       });
-    });
 
+    });
   });
 
-
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/tests/utilsSpec.js
----------------------------------------------------------------------
diff --git a/app/core/tests/utilsSpec.js b/app/core/tests/utilsSpec.js
index a782846..c5632f5 100644
--- a/app/core/tests/utilsSpec.js
+++ b/app/core/tests/utilsSpec.js
@@ -9,91 +9,87 @@
 // 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',
-  '../../../test/mocha/testUtils',
-  '../utils'
-], function (FauxtonAPI, testUtils, utils) {
-  var assert = testUtils.assert;
+import FauxtonAPI from "../api";
+import testUtils from "../../../test/mocha/testUtils";
+import utils from "../utils";
+var assert = testUtils.assert;
 
-  describe('Utils', function () {
+describe('Utils', function () {
 
-    describe('getDocTypeFromId', function () {
+  describe('getDocTypeFromId', function () {
 
-      it('returns doc if id not given', function () {
-        var res = utils.getDocTypeFromId();
-        assert.equal(res, 'doc');
-      });
+    it('returns doc if id not given', function () {
+      var res = utils.getDocTypeFromId();
+      assert.equal(res, 'doc');
+    });
 
-      it('returns design doc for design docs', function () {
-        var res = utils.getDocTypeFromId('_design/foobar');
-        assert.equal(res, 'design doc');
-      });
+    it('returns design doc for design docs', function () {
+      var res = utils.getDocTypeFromId('_design/foobar');
+      assert.equal(res, 'design doc');
+    });
 
-      it('returns doc for all others', function () {
-        var res = utils.getDocTypeFromId('blerg');
-        assert.equal(res, 'doc');
-      });
+    it('returns doc for all others', function () {
+      var res = utils.getDocTypeFromId('blerg');
+      assert.equal(res, 'doc');
     });
+  });
 
-    describe('getSafeIdForDoc', function () {
+  describe('getSafeIdForDoc', function () {
 
-      it('keeps _design/ intact', function () {
-        var res = utils.getSafeIdForDoc('_design/foo/do');
-        assert.equal(res, '_design/foo%2Fdo');
-      });
+    it('keeps _design/ intact', function () {
+      var res = utils.getSafeIdForDoc('_design/foo/do');
+      assert.equal(res, '_design/foo%2Fdo');
+    });
 
-      it('encodes all other', function () {
-        var res = utils.getSafeIdForDoc('_redesign/foobar');
-        assert.equal(res, '_redesign%2Ffoobar');
-      });
+    it('encodes all other', function () {
+      var res = utils.getSafeIdForDoc('_redesign/foobar');
+      assert.equal(res, '_redesign%2Ffoobar');
     });
+  });
 
-    describe('isSystemDatabase', function () {
+  describe('isSystemDatabase', function () {
 
-      it('detects system databases', function () {
-        assert.ok(utils.isSystemDatabase('_replicator'));
-      });
+    it('detects system databases', function () {
+      assert.ok(utils.isSystemDatabase('_replicator'));
+    });
 
-      it('ignores other dbs', function () {
-        assert.notOk(utils.isSystemDatabase('foo'));
-      });
+    it('ignores other dbs', function () {
+      assert.notOk(utils.isSystemDatabase('foo'));
     });
+  });
 
-    describe('localStorage', function () {
+  describe('localStorage', function () {
 
-      it('Should get undefined when getting a non-existent key', function () {
-        assert.isUndefined(utils.localStorageGet('qwerty'));
-      });
+    it('Should get undefined when getting a non-existent key', function () {
+      assert.isUndefined(utils.localStorageGet('qwerty'));
+    });
 
-      it ('Should get value after setting it', function () {
-        var key = 'key1';
-        utils.localStorageSet(key, 1);
-        assert.equal(utils.localStorageGet(key), 1);
-      });
+    it ('Should get value after setting it', function () {
+      var key = 'key1';
+      utils.localStorageSet(key, 1);
+      assert.equal(utils.localStorageGet(key), 1);
+    });
 
-      it ('Set and retrieve complex object', function () {
-        var key = 'key2',
-          obj = {
-            one: 1,
-            two: ['1', 'string', 3]
-          };
-        utils.localStorageSet(key, obj);
-        assert.deepEqual(utils.localStorageGet(key), obj);
-      });
+    it ('Set and retrieve complex object', function () {
+      var key = 'key2',
+        obj = {
+          one: 1,
+          two: ['1', 'string', 3]
+        };
+      utils.localStorageSet(key, obj);
+      assert.deepEqual(utils.localStorageGet(key), obj);
+    });
 
-      it ('stripHTML removes HTML', function () {
-        [
-          { html: '<span>okay</span>', text: 'okay' },
-          { html: 'test <span>before</span> and after', text: 'test before and after' },
-          { html: 'testing <a href="#whatever">attributes</span>', text: 'testing attributes' },
-          { html: '<span>testing</span> multiple <p>elements</p>', text: 'testing multiple elements' }
-        ].forEach(function (item) {
-          assert.equal(utils.stripHTML(item.html), item.text);
-        });
+    it ('stripHTML removes HTML', function () {
+      [
+        { html: '<span>okay</span>', text: 'okay' },
+        { html: 'test <span>before</span> and after', text: 'test before and after' },
+        { html: 'testing <a href="#whatever">attributes</span>', text: 'testing attributes' },
+        { html: '<span>testing</span> multiple <p>elements</p>', text: 'testing multiple elements' }
+      ].forEach(function (item) {
+        assert.equal(utils.stripHTML(item.html), item.text);
       });
-
     });
-  });
 
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/utils.js
----------------------------------------------------------------------
diff --git a/app/core/utils.js b/app/core/utils.js
index fe93802..35ce2db 100644
--- a/app/core/utils.js
+++ b/app/core/utils.js
@@ -18,124 +18,118 @@
 // "purely functional" helper system.
 
 
-define([
-  "jquery",
-  "lodash"
-],
-
-function ($, _) {
-
-  var onWindowResize = {};
-
-  var utils = {
-
-    // Thanks to: http://stackoverflow.com/a/2880929
-    getParams: function (queryString) {
-      if (queryString) {
-        // I think this could be combined into one if
-        if (queryString.substring(0, 1) === "?") {
-          queryString = queryString.substring(1);
-        } else if (queryString.indexOf('?') > -1) {
-          queryString = queryString.split('?')[1];
-        }
-      }
-      var hash = window.location.hash.split('?')[1];
-      queryString = queryString || hash || window.location.search.substring(1);
-      var match,
-      urlParams = {},
-      pl     = /\+/g,  // Regex for replacing addition symbol with a space
-      search = /([^&=]+)=?([^&]*)/g,
-      decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
-      query  = queryString;
-
-      if (queryString) {
-        while ((match = search.exec(query))) {
-          urlParams[decode(match[1])] = decode(match[2]);
-        }
-      }
+import $ from "jquery";
+import _ from "lodash";
+
+var onWindowResize = {};
 
-      return urlParams;
-    },
+var utils = {
 
-    // this takes the current URL and replaces all ?x=x with whatever new params are passed
-    replaceQueryParams: function (params) {
-      var fragment = window.location.hash.replace(/\?.*$/, "");
-      if (!_.isEmpty(params)) {
-        fragment = fragment + "?" + $.param(params);
+  // Thanks to: http://stackoverflow.com/a/2880929
+  getParams: function (queryString) {
+    if (queryString) {
+      // I think this could be combined into one if
+      if (queryString.substring(0, 1) === "?") {
+        queryString = queryString.substring(1);
+      } else if (queryString.indexOf('?') > -1) {
+        queryString = queryString.split('?')[1];
       }
-      return fragment;
-    },
-
-    removeSpecialCharacters: function (name) {
-      return name.replace(/[^\w\s]/gi, "");
-    },
-
-    safeURLName: function (name) {
-      var testName = name || "";
-      var checkforBad = testName.match(/[\$\-/,+-]/g);
-      return (checkforBad !== null) ? encodeURIComponent(name) : name;
-    },
-
-    getDocTypeFromId: function (id) {
-      if (id && /^_design\//.test(id)) {
-        return 'design doc';
+    }
+    var hash = window.location.hash.split('?')[1];
+    queryString = queryString || hash || window.location.search.substring(1);
+    var match,
+    urlParams = {},
+    pl     = /\+/g,  // Regex for replacing addition symbol with a space
+    search = /([^&=]+)=?([^&]*)/g,
+    decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
+    query  = queryString;
+
+    if (queryString) {
+      while ((match = search.exec(query))) {
+        urlParams[decode(match[1])] = decode(match[2]);
       }
+    }
 
-      return 'doc';
-    },
-
-    isSystemDatabase: function (id) {
-      return (/^_/).test(id);
-    },
-
-    // Need this to work around backbone router thinking _design/foo
-    // is a separate route. Alternatively, maybe these should be
-    // treated separately. For instance, we could default into the
-    // json editor for docs, or into a ddoc specific page.
-    getSafeIdForDoc: function (id) {
-      if (utils.getDocTypeFromId(id) === 'design doc') {
-        var ddoc = id.replace(/^_design\//, '');
-        return '_design/' + utils.safeURLName(ddoc);
-      }
+    return urlParams;
+  },
 
-      return utils.safeURLName(id);
-    },
+  // this takes the current URL and replaces all ?x=x with whatever new params are passed
+  replaceQueryParams: function (params) {
+    var fragment = window.location.hash.replace(/\?.*$/, "");
+    if (!_.isEmpty(params)) {
+      fragment = fragment + "?" + $.param(params);
+    }
+    return fragment;
+  },
+
+  removeSpecialCharacters: function (name) {
+    return name.replace(/[^\w\s]/gi, "");
+  },
+
+  safeURLName: function (name) {
+    var testName = name || "";
+    var checkforBad = testName.match(/[\$\-/,+-]/g);
+    return (checkforBad !== null) ? encodeURIComponent(name) : name;
+  },
+
+  getDocTypeFromId: function (id) {
+    if (id && /^_design\//.test(id)) {
+      return 'design doc';
+    }
 
-    // a pair of simple local storage wrapper functions. These ward against problems getting or
-    // setting (e.g. local storage full) and allow you to get/set complex data structures
-    localStorageSet: function (key, value) {
-      if (_.isObject(value) || _.isArray(value)) {
-        value = JSON.stringify(value);
-      }
-      var success = true;
+    return 'doc';
+  },
+
+  isSystemDatabase: function (id) {
+    return (/^_/).test(id);
+  },
+
+  // Need this to work around backbone router thinking _design/foo
+  // is a separate route. Alternatively, maybe these should be
+  // treated separately. For instance, we could default into the
+  // json editor for docs, or into a ddoc specific page.
+  getSafeIdForDoc: function (id) {
+    if (utils.getDocTypeFromId(id) === 'design doc') {
+      var ddoc = id.replace(/^_design\//, '');
+      return '_design/' + utils.safeURLName(ddoc);
+    }
+
+    return utils.safeURLName(id);
+  },
+
+  // a pair of simple local storage wrapper functions. These ward against problems getting or
+  // setting (e.g. local storage full) and allow you to get/set complex data structures
+  localStorageSet: function (key, value) {
+    if (_.isObject(value) || _.isArray(value)) {
+      value = JSON.stringify(value);
+    }
+    var success = true;
+    try {
+      window.localStorage.setItem(key, value);
+    } catch (e) {
+      success = false;
+    }
+    return success;
+  },
+
+  localStorageGet: function (key) {
+    var data;
+    if (_.has(window.localStorage, key)) {
+      data = window.localStorage[key];
       try {
-        window.localStorage.setItem(key, value);
+        return JSON.parse(data);
       } catch (e) {
-        success = false;
+        return data;
       }
-      return success;
-    },
-
-    localStorageGet: function (key) {
-      var data;
-      if (_.has(window.localStorage, key)) {
-        data = window.localStorage[key];
-        try {
-          return JSON.parse(data);
-        } catch (e) {
-          return data;
-        }
-      }
-      return data;
-    },
-
-    stripHTML: function (str) {
-      var tmpElement = document.createElement("div");
-      tmpElement.innerHTML = str;
-      return tmpElement.textContent || tmpElement.innerText;
     }
-  };
+    return data;
+  },
 
-  return utils;
-});
+  stripHTML: function (str) {
+    var tmpElement = document.createElement("div");
+    tmpElement.innerHTML = str;
+    return tmpElement.textContent || tmpElement.innerText;
+  }
+};
 
+export default utils;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/helpers.js
----------------------------------------------------------------------
diff --git a/app/helpers.js b/app/helpers.js
index 50a17d6..16f56ee 100644
--- a/app/helpers.js
+++ b/app/helpers.js
@@ -17,49 +17,44 @@
 // want to change this later, but for now this should be thought of as a
 // "purely functional" helper system.
 
-define([
-  './constants',
-  "./core/utils",
-  "d3",
-  'moment'
-],
-
-function (constants, utils, d3, moment) {
-
-  var Helpers = {};
-
-  Helpers.removeSpecialCharacters = utils.removeSpecialCharacters;
-
-  Helpers.safeURL = utils.safeURLName;
-
-  Helpers.imageUrl = function (path) {
-    // TODO: add dynamic path for different deploy targets
-    return path;
+import constants from "./constants";
+import utils from "./core/utils";
+import d3 from "d3";
+import moment from "moment";
+
+var Helpers = {};
+
+Helpers.removeSpecialCharacters = utils.removeSpecialCharacters;
+
+Helpers.safeURL = utils.safeURLName;
+
+Helpers.imageUrl = function (path) {
+  // TODO: add dynamic path for different deploy targets
+  return path;
+};
+
+Helpers.getDocUrl = function (key) {
+  return (_.has(constants.DOC_URLS, key)) ? constants.DOC_URLS[key] : '#';
+};
+
+// File size pretty printing, taken from futon.format.js
+Helpers.formatSize = function (size) {
+    var jump = 512;
+    if (size < jump) return size + " bytes";
+    var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
+    var i = 0;
+    while (size >= jump && i < units.length) {
+      i += 1;
+      size /= 1024;
+    }
+    return size.toFixed(1) + ' ' + units[i - 1];
   };
 
-  Helpers.getDocUrl = function (key) {
-    return (_.has(constants.DOC_URLS, key)) ? constants.DOC_URLS[key] : '#';
-  };
-
-  // File size pretty printing, taken from futon.format.js
-  Helpers.formatSize = function (size) {
-      var jump = 512;
-      if (size < jump) return size + " bytes";
-      var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
-      var i = 0;
-      while (size >= jump && i < units.length) {
-        i += 1;
-        size /= 1024;
-      }
-      return size.toFixed(1) + ' ' + units[i - 1];
-    };
-
-  Helpers.formatDate = function (timestamp) {
-    return moment(timestamp, 'X').format('MMM Do, h:mm:ss a');
-  };
-  Helpers.getDateFromNow = function (timestamp) {
-    return moment(timestamp, 'X').fromNow();
-  };
+Helpers.formatDate = function (timestamp) {
+  return moment(timestamp, 'X').format('MMM Do, h:mm:ss a');
+};
+Helpers.getDateFromNow = function (timestamp) {
+  return moment(timestamp, 'X').fromNow();
+};
 
-  return Helpers;
-});
+export default Helpers;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/initialize.js.underscore
----------------------------------------------------------------------
diff --git a/app/initialize.js.underscore b/app/initialize.js.underscore
index 95290d6..3a0b8e0 100644
--- a/app/initialize.js.underscore
+++ b/app/initialize.js.underscore
@@ -15,20 +15,13 @@
  * THIS IS A GENERATED FILE. DO NOT EDIT.
  */
 
-
-define([],
-function () {
-  // Provide a global location to place configuration settings and module
-  // creation.
-  var app = {
-    // The root path to run the application.
-    root: "<%= root %>",
-    version: "<%= version %>",
-    // Host is used as prefix for urls
-    host: "<%= host %>",
-    i18n: <%= i18n %>
-  };
-
-  return app;
-});
-
+// Provide a global location to place configuration settings and module
+// creation.
+export default {
+  // The root path to run the application.
+  root: "<%= root %>",
+  version: "<%= version %>",
+  // Host is used as prefix for urls
+  host: "<%= host %>",
+  i18n: <%= i18n %>
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/load_addons.js.underscore
----------------------------------------------------------------------
diff --git a/app/load_addons.js.underscore b/app/load_addons.js.underscore
index eb408c4..ca6593b 100644
--- a/app/load_addons.js.underscore
+++ b/app/load_addons.js.underscore
@@ -15,13 +15,13 @@
  * ::WARNING::
  * THIS IS A GENERATED FILE. DO NOT EDIT.
  */
-define([
-  <%= '"' + deps.join('",\n"') + '"' %>
-],
-function () {
-  var LoadAddons = {
-    addons: arguments
-  };
 
-  return LoadAddons;
-});
+<% deps.forEach(function (dep, i) { %>
+<%= 'import { default as addon_' + i + ' } from "' + dep + '";' %>
+<% }); %>
+
+export default [
+  <% deps.forEach(function (dep, i) { %>
+    <%= 'addon_' + i + ',' %>
+  <% }); %>
+];

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/main.js
----------------------------------------------------------------------
diff --git a/app/main.js b/app/main.js
index 89d114a..8e61bf7 100644
--- a/app/main.js
+++ b/app/main.js
@@ -10,47 +10,42 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-require([
-  // Application
-  "./app",
-  "./core/api",
-  "./load_addons",
-  "backbone",
-],
-
-function (app, FauxtonAPI, LoadAddons, Backbone) {
-
-  app.addons = LoadAddons.addons;
-  FauxtonAPI.router = app.router = new FauxtonAPI.Router(app.addons);
-  // Trigger the initial route and enable HTML5 History API support, set the
-  // root folder to '/' by default.  Change in app.js.
-  Backbone.history.start({ pushState: false, root: app.root });
-
-  // feature detect IE
-  if ('ActiveXObject' in window) {
-    $.ajaxSetup({ cache: false });
+import app from './app';
+import FauxtonAPI from './core/api';
+import LoadAddons from './load_addons';
+import Backbone from 'backbone';
+import $ from 'jquery';
+
+app.addons = LoadAddons;
+FauxtonAPI.router = app.router = new FauxtonAPI.Router(app.addons);
+// Trigger the initial route and enable HTML5 History API support, set the
+// root folder to '/' by default.  Change in app.js.
+Backbone.history.start({ pushState: false, root: app.root });
+
+// feature detect IE
+if ('ActiveXObject' in window) {
+  $.ajaxSetup({ cache: false });
+}
+
+
+// All navigation that is relative should be passed through the navigate
+// method, to be processed by the router. If the link has a `data-bypass`
+// attribute, bypass the delegation completely.
+$(document).on("click", "a:not([data-bypass])", function (evt) {
+
+  // Get the absolute anchor href.
+  var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
+
+  // Get the absolute root
+  var root = location.protocol + "//" + location.host;
+
+  // Ensure the root is part of the anchor href, meaning it's relative
+  if (href.prop && href.prop.slice(0, root.length) === root) {
+    // Stop the default event to ensure the link will not cause a page
+    // refresh.
+    evt.preventDefault();
+
+    //User app navigate so that navigate goes through a central place
+    app.router.navigate(href.attr, true);
   }
-
-
-  // All navigation that is relative should be passed through the navigate
-  // method, to be processed by the router. If the link has a `data-bypass`
-  // attribute, bypass the delegation completely.
-  $(document).on("click", "a:not([data-bypass])", function (evt) {
-
-    // Get the absolute anchor href.
-    var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
-
-    // Get the absolute root
-    var root = location.protocol + "//" + location.host;
-
-    // Ensure the root is part of the anchor href, meaning it's relative
-    if (href.prop && href.prop.slice(0, root.length) === root) {
-      // Stop the default event to ensure the link will not cause a page
-      // refresh.
-      evt.preventDefault();
-
-      //User app navigate so that navigate goes through a central place
-      app.router.navigate(href.attr, true);
-    }
-  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/import.md
----------------------------------------------------------------------
diff --git a/import.md b/import.md
new file mode 100644
index 0000000..5cb447e
--- /dev/null
+++ b/import.md
@@ -0,0 +1,9 @@
+#From `define` to `import`
+
+To run the ast to change a file from using amd to es6 import follow these steps:
+
+* npm i -g jscodeshift
+* npm install 5to6-codemod
+* Replace `./node_modules/5to6-codemod/transforms/amd.js` with https://gist.github.com/robertkowalski/9167d45c0af6b9abdd4b51a09ef4e039
+* run `jscodeshift --extensions=js,jsx -t node_modules/5to6-codemod/transforms/amd.js app/file/name`
+* run git diff to check

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 8d7b6e7..661f18f 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,7 @@
     "babel-cli": "^6.4.5",
     "babel-core": "^6.4.5",
     "babel-loader": "^6.2.1",
+    "babel-plugin-transform-object-assign": "^6.8.0",
     "babel-preset-es2015": "^6.3.13",
     "babel-preset-react": "^6.3.13",
     "babel-register": "^6.4.3",
@@ -72,9 +73,9 @@
     "nano": "~5.12.0",
     "optimist": "^0.6.1",
     "papaparse": "^4.1.2",
+    "pouchdb": "^5.3.1",
     "react": "~15.0.1",
     "react-addons-css-transition-group": "~15.0.1",
-    "pouchdb": "^5.3.1",
     "react-bootstrap": "^0.28.5",
     "react-dom": "~15.0.1",
     "react-select": "^1.0.0-beta12",
@@ -87,8 +88,8 @@
     "url-loader": "^0.5.7",
     "urls": "~0.0.3",
     "velocity-animate": "^1.2.3",
-    "visualizeRevTree": "git+https://github.com/neojski/visualizeRevTree.git#gh-pages",
     "velocity-react": "^1.1.4",
+    "visualizeRevTree": "git+https://github.com/neojski/visualizeRevTree.git#gh-pages",
     "webpack": "^1.12.12",
     "webpack-dev-server": "^1.14.1",
     "zeroclipboard": "^2.2.0"

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/test/mocha/testUtils.js
----------------------------------------------------------------------
diff --git a/test/mocha/testUtils.js b/test/mocha/testUtils.js
index d2b3482..fa0fd0f 100644
--- a/test/mocha/testUtils.js
+++ b/test/mocha/testUtils.js
@@ -10,49 +10,44 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-       "../../app/core/api",
-       "chai"
-],
-function(FauxtonAPI, chai) {
+import chai from "chai";
 
-  var ViewSandbox = function () {
-    this.initialize();
-  };
+var ViewSandbox = function () {
+  this.initialize();
+};
 
-   _.extend(ViewSandbox.prototype, {
-    initialize: function () {
-      this.$el = $('<div style="display:none"></div>').appendTo('body');
-      this.$ = this.$el.find;
-    },
-    views: [],
-    renderView: function (view, done) {
-      this.views.push(view);
-      this.$el.append(view.el);
-      view.render();
-      if (done) {
-        view.promise().done(function () { done(); });
-      }
-      return view;
-    },
-
-    remove: function () {
-      _.each(this.views, function (view) {
-        view.remove();
-      }, this);
-    }
-  });
-
-  var restore = function (fn) {
-    if (fn.restore) {
-      fn.restore();
+_.extend(ViewSandbox.prototype, {
+  initialize: function () {
+    this.$el = $('<div style="display:none"></div>').appendTo('body');
+    this.$ = this.$el.find;
+  },
+  views: [],
+  renderView: function (view, done) {
+    this.views.push(view);
+    this.$el.append(view.el);
+    view.render();
+    if (done) {
+      view.promise().done(function () { done(); });
     }
-  };
+    return view;
+  },
 
-  return {
-    chai: chai,
-    assert: chai.assert,
-    ViewSandbox: ViewSandbox,
-    restore: restore
-  };
+  remove: function () {
+    _.each(this.views, function (view) {
+      view.remove();
+    }, this);
+  }
 });
+
+var restore = function (fn) {
+  if (fn.restore) {
+    fn.restore();
+  }
+};
+
+export default {
+  chai: chai,
+  assert: chai.assert,
+  ViewSandbox: ViewSandbox,
+  restore: restore
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/test/auth.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/test/auth.storesSpec.js b/app/addons/auth/test/auth.storesSpec.js
index d2744c0..1c8818f 100644
--- a/app/addons/auth/test/auth.storesSpec.js
+++ b/app/addons/auth/test/auth.storesSpec.js
@@ -10,139 +10,135 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  'react',
-  '../../../../test/mocha/testUtils',
-  '../actiontypes',
-  '../stores'
-], function (FauxtonAPI, React, testUtils, ActionTypes, Stores) {
-  var assert = testUtils.assert;
-
-  var changePasswordStore = Stores.changePasswordStore;
-  var createAdminStore = Stores.createAdminStore;
-  var createAdminSidebarStore = Stores.createAdminSidebarStore;
-
-  describe('Auth Stores', function () {
-
-    describe('ChangePasswordStore', function () {
-
-      it('get / set change password updates store', function () {
-        // check empty by default
-        assert.equal(changePasswordStore.getChangePassword(), '');
-
-        var newPassword = 'lets-rick-roll-mocha';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD,
-          value: newPassword
-        });
-        assert.equal(changePasswordStore.getChangePassword(), newPassword);
-      });
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import testUtils from "../../../../test/mocha/testUtils";
+import ActionTypes from "../actiontypes";
+import Stores from "../stores";
+var assert = testUtils.assert;
+
+var changePasswordStore = Stores.changePasswordStore;
+var createAdminStore = Stores.createAdminStore;
+var createAdminSidebarStore = Stores.createAdminSidebarStore;
+
+describe('Auth Stores', function () {
 
-      it('clearing change password clears in store', function () {
-        var newPassword = 'never-gonna-give-you-up';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD,
-          value: newPassword
-        });
-        assert.equal(changePasswordStore.getChangePassword(), newPassword);
+  describe('ChangePasswordStore', function () {
 
-        FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS });
-        assert.equal(changePasswordStore.getChangePassword(), '');
+    it('get / set change password updates store', function () {
+      // check empty by default
+      assert.equal(changePasswordStore.getChangePassword(), '');
+
+      var newPassword = 'lets-rick-roll-mocha';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD,
+        value: newPassword
       });
+      assert.equal(changePasswordStore.getChangePassword(), newPassword);
+    });
 
-      it('get / set change confirm password updates store', function () {
-        // check empty by default
-        assert.equal(changePasswordStore.getChangePasswordConfirm(), '');
-
-        // check getPassword works
-        var newPassword = 'never-gonna-let-you-down';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD,
-          value: newPassword
-        });
-        assert.equal(changePasswordStore.getChangePasswordConfirm(), newPassword);
+    it('clearing change password clears in store', function () {
+      var newPassword = 'never-gonna-give-you-up';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD,
+        value: newPassword
       });
+      assert.equal(changePasswordStore.getChangePassword(), newPassword);
 
-      it('clearing change confirm password clears in store', function () {
-        var newPassword = 'never-gonna-run-around-and-desert-you';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD,
-          value: newPassword
-        });
-        assert.equal(changePasswordStore.getChangePasswordConfirm(), newPassword);
+      FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS });
+      assert.equal(changePasswordStore.getChangePassword(), '');
+    });
 
-        FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS });
-        assert.equal(changePasswordStore.getChangePasswordConfirm(), '');
+    it('get / set change confirm password updates store', function () {
+      // check empty by default
+      assert.equal(changePasswordStore.getChangePasswordConfirm(), '');
+
+      // check getPassword works
+      var newPassword = 'never-gonna-let-you-down';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD,
+        value: newPassword
       });
+      assert.equal(changePasswordStore.getChangePasswordConfirm(), newPassword);
     });
 
+    it('clearing change confirm password clears in store', function () {
+      var newPassword = 'never-gonna-run-around-and-desert-you';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD,
+        value: newPassword
+      });
+      assert.equal(changePasswordStore.getChangePasswordConfirm(), newPassword);
 
-    describe('CreateAdminStore', function () {
+      FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS });
+      assert.equal(changePasswordStore.getChangePasswordConfirm(), '');
+    });
+  });
 
-      it('get / set username updates store', function () {
-        assert.equal(createAdminStore.getUsername(), '');
 
-        var newUsername = 'never-gonna-make-you-cry';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD,
-          value: newUsername
-        });
-        assert.equal(createAdminStore.getUsername(), newUsername);
-      });
+  describe('CreateAdminStore', function () {
 
-      it('clearing username clears in store', function () {
-        var newUsername = 'never-gonna-say-goodbye';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD,
-          value: newUsername
-        });
-        assert.equal(createAdminStore.getUsername(), newUsername);
+    it('get / set username updates store', function () {
+      assert.equal(createAdminStore.getUsername(), '');
 
-        FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS });
-        assert.equal(createAdminStore.getUsername(), '');
+      var newUsername = 'never-gonna-make-you-cry';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD,
+        value: newUsername
       });
+      assert.equal(createAdminStore.getUsername(), newUsername);
+    });
 
-      it('get / set password updates store', function () {
-        // check empty by default
-        assert.equal(createAdminStore.getPassword(), '');
-
-        // check getPassword works
-        var newPassword = 'never-gonna-tell-a-lie-and-hurt-you';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD,
-          value: newPassword
-        });
-        assert.equal(createAdminStore.getPassword(), newPassword);
+    it('clearing username clears in store', function () {
+      var newUsername = 'never-gonna-say-goodbye';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD,
+        value: newUsername
       });
+      assert.equal(createAdminStore.getUsername(), newUsername);
 
-      it('clearing change confirm password clears in store', function () {
-        var newPassword = 'mocha-please-consider-yourself-rickrolled';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD,
-          value: newPassword
-        });
-        assert.equal(createAdminStore.getPassword(), newPassword);
-
-        FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS });
-        assert.equal(createAdminStore.getPassword(), '');
-      });
+      FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS });
+      assert.equal(createAdminStore.getUsername(), '');
     });
 
+    it('get / set password updates store', function () {
+      // check empty by default
+      assert.equal(createAdminStore.getPassword(), '');
 
-    describe('CreateAdminSidebarStore', function () {
-      var defaultPage = 'changePassword';
-      it('has correct default selected page', function () {
-        assert.equal(createAdminSidebarStore.getSelectedPage(), defaultPage);
+      // check getPassword works
+      var newPassword = 'never-gonna-tell-a-lie-and-hurt-you';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD,
+        value: newPassword
       });
+      assert.equal(createAdminStore.getPassword(), newPassword);
+    });
 
-      it('selecting a page updates the selected page in store', function () {
-        var newPage = 'addAdmin';
-        FauxtonAPI.dispatch({ type: ActionTypes.AUTH_SELECT_PAGE, page: newPage });
-        assert.equal(createAdminSidebarStore.getSelectedPage(), newPage);
+    it('clearing change confirm password clears in store', function () {
+      var newPassword = 'mocha-please-consider-yourself-rickrolled';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD,
+        value: newPassword
       });
+      assert.equal(createAdminStore.getPassword(), newPassword);
+
+      FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS });
+      assert.equal(createAdminStore.getPassword(), '');
     });
+  });
+
 
+  describe('CreateAdminSidebarStore', function () {
+    var defaultPage = 'changePassword';
+    it('has correct default selected page', function () {
+      assert.equal(createAdminSidebarStore.getSelectedPage(), defaultPage);
+    });
+
+    it('selecting a page updates the selected page in store', function () {
+      var newPage = 'addAdmin';
+      FauxtonAPI.dispatch({ type: ActionTypes.AUTH_SELECT_PAGE, page: newPage });
+      assert.equal(createAdminSidebarStore.getSelectedPage(), newPage);
+    });
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/test/baseSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/test/baseSpec.js b/app/addons/auth/test/baseSpec.js
index 81fa366..c566287 100644
--- a/app/addons/auth/test/baseSpec.js
+++ b/app/addons/auth/test/baseSpec.js
@@ -9,95 +9,92 @@
 // 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',
-      '../base',
-      '../../../core/auth',
-      '../../../../test/mocha/testUtils',
-      'sinon'
-], function (FauxtonAPI, Base, Auth, testUtils, sinon) {
-  var assert = testUtils.assert;
-
-  describe("Auth: Login", function () {
-
-    describe("failed login", function () {
-
-      it("redirects with replace: true set", function () {
-        var navigateSpy = sinon.spy(FauxtonAPI, 'navigate');
-        FauxtonAPI.auth = new Auth();
-        FauxtonAPI.session.isLoggedIn = function () { return false; };
-        Base.initialize();
-        FauxtonAPI.auth.authDeniedCb();
-        assert.ok(navigateSpy.withArgs('/login?urlback=', {replace: true}).calledOnce);
-      });
+import FauxtonAPI from "../../../core/api";
+import Base from "../base";
+import Auth from "../../../core/auth";
+import testUtils from "../../../../test/mocha/testUtils";
+import sinon from "sinon";
+var assert = testUtils.assert;
+
+describe("Auth: Login", function () {
+
+  describe("failed login", function () {
+
+    it("redirects with replace: true set", function () {
+      var navigateSpy = sinon.spy(FauxtonAPI, 'navigate');
+      FauxtonAPI.auth = new Auth();
+      FauxtonAPI.session.isLoggedIn = function () { return false; };
+      Base.initialize();
+      FauxtonAPI.auth.authDeniedCb();
+      assert.ok(navigateSpy.withArgs('/login?urlback=', {replace: true}).calledOnce);
     });
   });
+});
 
-  describe('auth session change', function () {
+describe('auth session change', function () {
 
-    afterEach(function () {
-      FauxtonAPI.updateHeaderLink.restore && FauxtonAPI.updateHeaderLink.restore();
-      FauxtonAPI.session.isAdminParty.restore && FauxtonAPI.session.isAdminParty.restore();
-    });
+  afterEach(function () {
+    FauxtonAPI.updateHeaderLink.restore && FauxtonAPI.updateHeaderLink.restore();
+    FauxtonAPI.session.isAdminParty.restore && FauxtonAPI.session.isAdminParty.restore();
+  });
 
-    it('for admin party changes title to admin party', function () {
-      var spy = sinon.spy(FauxtonAPI, 'updateHeaderLink');
-      var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(true);
-      FauxtonAPI.session.trigger('change');
+  it('for admin party changes title to admin party', function () {
+    var spy = sinon.spy(FauxtonAPI, 'updateHeaderLink');
+    var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(true);
+    FauxtonAPI.session.trigger('change');
 
-      assert.ok(spy.calledOnce);
-      var args = spy.getCall(0).args[0];
+    assert.ok(spy.calledOnce);
+    var args = spy.getCall(0).args[0];
 
-      assert.ok(args.title.match(/Admin Party/));
-      FauxtonAPI.session.isAdminParty.restore();
-    });
+    assert.ok(args.title.match(/Admin Party/));
+    FauxtonAPI.session.isAdminParty.restore();
+  });
 
-    it('for login changes title to login', function () {
-      var spy = sinon.spy(FauxtonAPI, 'updateHeaderLink');
-      var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
-      sinon.stub(FauxtonAPI.session, 'user').returns({name: 'test-user'});
-      sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(true);
-      FauxtonAPI.session.trigger('change');
+  it('for login changes title to login', function () {
+    var spy = sinon.spy(FauxtonAPI, 'updateHeaderLink');
+    var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
+    sinon.stub(FauxtonAPI.session, 'user').returns({name: 'test-user'});
+    sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(true);
+    FauxtonAPI.session.trigger('change');
 
-      assert.ok(spy.calledOnce);
-      var args = spy.getCall(0).args[0];
+    assert.ok(spy.calledOnce);
+    var args = spy.getCall(0).args[0];
 
-      assert.equal(args.title, 'test-user');
-      FauxtonAPI.session.isLoggedIn.restore();
-      FauxtonAPI.session.user.restore();
-      FauxtonAPI.session.isAdminParty.restore();
-    });
+    assert.equal(args.title, 'test-user');
+    FauxtonAPI.session.isLoggedIn.restore();
+    FauxtonAPI.session.user.restore();
+    FauxtonAPI.session.isAdminParty.restore();
+  });
 
-    it('for login adds logout link', function () {
-      var spy = sinon.spy(FauxtonAPI, 'addHeaderLink');
-      var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
-      sinon.stub(FauxtonAPI.session, 'user').returns({name: 'test-user'});
-      sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(true);
-      FauxtonAPI.session.trigger('change');
+  it('for login adds logout link', function () {
+    var spy = sinon.spy(FauxtonAPI, 'addHeaderLink');
+    var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
+    sinon.stub(FauxtonAPI.session, 'user').returns({name: 'test-user'});
+    sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(true);
+    FauxtonAPI.session.trigger('change');
 
-      assert.ok(spy.calledOnce);
-      var args = spy.getCall(0).args[0];
+    assert.ok(spy.calledOnce);
+    var args = spy.getCall(0).args[0];
 
-      assert.equal(args.title, 'Logout');
-      FauxtonAPI.session.isLoggedIn.restore();
-      FauxtonAPI.session.user.restore();
-      FauxtonAPI.session.isAdminParty.restore();
-    });
+    assert.equal(args.title, 'Logout');
+    FauxtonAPI.session.isLoggedIn.restore();
+    FauxtonAPI.session.user.restore();
+    FauxtonAPI.session.isAdminParty.restore();
+  });
 
-    it('for logout, removes logout link', function () {
-      var spy = sinon.spy(FauxtonAPI, 'removeHeaderLink');
-      var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
-      sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(false);
-      FauxtonAPI.session.trigger('change');
+  it('for logout, removes logout link', function () {
+    var spy = sinon.spy(FauxtonAPI, 'removeHeaderLink');
+    var stub = sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
+    sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(false);
+    FauxtonAPI.session.trigger('change');
 
-      assert.ok(spy.calledOnce);
-      var args = spy.getCall(0).args[0];
+    assert.ok(spy.calledOnce);
+    var args = spy.getCall(0).args[0];
 
-      assert.equal(args.id, 'logout');
-      FauxtonAPI.session.isLoggedIn.restore();
-      FauxtonAPI.session.isAdminParty.restore();
-    });
+    assert.equal(args.id, 'logout');
+    FauxtonAPI.session.isLoggedIn.restore();
+    FauxtonAPI.session.isAdminParty.restore();
+  });
 
 
-  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/base.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/base.js b/app/addons/cluster/base.js
index 43f3a21..ec264ab 100644
--- a/app/addons/cluster/base.js
+++ b/app/addons/cluster/base.js
@@ -10,15 +10,10 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './routes'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Cluster from "./routes";
 
-function (app, FauxtonAPI, Cluster) {
+Cluster.initialize = function () {};
 
-  Cluster.initialize = function () {};
-
-  return Cluster;
-});
+export default Cluster;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/cluster.actions.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/cluster.actions.js b/app/addons/cluster/cluster.actions.js
index a21bd3e..f515548 100644
--- a/app/addons/cluster/cluster.actions.js
+++ b/app/addons/cluster/cluster.actions.js
@@ -10,42 +10,39 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../core/api',
-  './resources',
-  './cluster.actiontypes'
-],
-function (FauxtonAPI, ClusterResources, ActionTypes) {
-  return {
-    fetchNodes: function () {
-      var memberships = new ClusterResources.ClusterNodes();
-
-      memberships.fetch().then(function () {
-        this.updateNodes({
-          nodes: memberships.get('nodes_mapped')
-        });
-      }.bind(this));
-    },
-
-    updateNodes: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CLUSTER_FETCH_NODES,
-        options: options
+import FauxtonAPI from "../../core/api";
+import ClusterResources from "./resources";
+import ActionTypes from "./cluster.actiontypes";
+
+export default {
+  fetchNodes: function () {
+    var memberships = new ClusterResources.ClusterNodes();
+
+    memberships.fetch().then(function () {
+      this.updateNodes({
+        nodes: memberships.get('nodes_mapped')
       });
-    },
+    }.bind(this));
+  },
 
-    navigateToNodeBasedOnNodeCount: function (successtarget) {
-      var memberships = new ClusterResources.ClusterNodes();
+  updateNodes: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CLUSTER_FETCH_NODES,
+      options: options
+    });
+  },
 
-      memberships.fetch().then(function () {
-        var nodes = memberships.get('all_nodes');
+  navigateToNodeBasedOnNodeCount: function (successtarget) {
+    var memberships = new ClusterResources.ClusterNodes();
 
-        if (nodes.length === 1) {
-          return FauxtonAPI.navigate(successtarget + nodes[0]);
-        }
-        return FauxtonAPI.navigate('/cluster/disabled', {trigger: true});
-      });
-    }
+    memberships.fetch().then(function () {
+      var nodes = memberships.get('all_nodes');
+
+      if (nodes.length === 1) {
+        return FauxtonAPI.navigate(successtarget + nodes[0]);
+      }
+      return FauxtonAPI.navigate('/cluster/disabled', {trigger: true});
+    });
+  }
 
-  };
-});
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/cluster.actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/cluster.actiontypes.js b/app/addons/cluster/cluster.actiontypes.js
index 8fd521e..525e7f6 100644
--- a/app/addons/cluster/cluster.actiontypes.js
+++ b/app/addons/cluster/cluster.actiontypes.js
@@ -10,8 +10,6 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    CLUSTER_FETCH_NODES: 'CLUSTER_FETCH_NODES'
-  };
-});
+export default {
+  CLUSTER_FETCH_NODES: 'CLUSTER_FETCH_NODES'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/cluster.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/cluster/cluster.react.jsx b/app/addons/cluster/cluster.react.jsx
index 954f32c..97f6ea1 100644
--- a/app/addons/cluster/cluster.react.jsx
+++ b/app/addons/cluster/cluster.react.jsx
@@ -10,70 +10,64 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  './cluster.stores'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ClusterStore from "./cluster.stores";
 
-function (app, FauxtonAPI, React, ClusterStore) {
+var nodesStore = ClusterStore.nodesStore;
 
-  var nodesStore = ClusterStore.nodesStore;
 
+var DisabledConfigController = React.createClass({
 
-  var DisabledConfigController = React.createClass({
+  getStoreState: function () {
+    return {
+      nodes: nodesStore.getNodes()
+    };
+  },
 
-    getStoreState: function () {
-      return {
-        nodes: nodesStore.getNodes()
-      };
-    },
+  getInitialState: function () {
+    return this.getStoreState();
+  },
 
-    getInitialState: function () {
-      return this.getStoreState();
-    },
+  componentDidMount: function () {
+    nodesStore.on('change', this.onChange, this);
+  },
 
-    componentDidMount: function () {
-      nodesStore.on('change', this.onChange, this);
-    },
+  componentWillUnmount: function () {
+    nodesStore.off('change', this.onChange);
+  },
 
-    componentWillUnmount: function () {
-      nodesStore.off('change', this.onChange);
-    },
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
 
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    render: function () {
-      return (
-        <div className="config-warning-cluster-wrapper">
-          <div className="config-warning-cluster-container">
-            <div>
-              <div className="config-warning-icon-container pull-left">
-                <i className="fonticon-attention-circled"></i>
-              </div>
-              It seems that you are running a cluster with {this.state.nodes.length} nodes. For CouchDB 2.0
-              we recommend using a configuration management tools like Chef, Ansible,
-              Puppet or Salt (in no particular order) to configure your nodes in a cluster.
-              <br/>
-              <br/>
-              <div className="config-warning-other-text">
-                We highly recommend against configuring nodes in your cluster using the HTTP API and
-                suggest using a configuration management tool for all configurations.
-              </div>
+  render: function () {
+    return (
+      <div className="config-warning-cluster-wrapper">
+        <div className="config-warning-cluster-container">
+          <div>
+            <div className="config-warning-icon-container pull-left">
+              <i className="fonticon-attention-circled"></i>
+            </div>
+            It seems that you are running a cluster with {this.state.nodes.length} nodes. For CouchDB 2.0
+            we recommend using a configuration management tools like Chef, Ansible,
+            Puppet or Salt (in no particular order) to configure your nodes in a cluster.
+            <br/>
+            <br/>
+            <div className="config-warning-other-text">
+              We highly recommend against configuring nodes in your cluster using the HTTP API and
+              suggest using a configuration management tool for all configurations.
             </div>
           </div>
         </div>
-      );
-    }
-  });
-
-  var Views = {
-    DisabledConfigController: DisabledConfigController
-  };
+      </div>
+    );
+  }
+});
 
-  return Views;
+var Views = {
+  DisabledConfigController: DisabledConfigController
+};
 
-});
+export default Views;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/cluster.stores.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/cluster.stores.js b/app/addons/cluster/cluster.stores.js
index 5d91ea3..8463304 100644
--- a/app/addons/cluster/cluster.stores.js
+++ b/app/addons/cluster/cluster.stores.js
@@ -10,51 +10,48 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../core/api',
-  './cluster.actiontypes'
-], function (FauxtonAPI, ActionTypes) {
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./cluster.actiontypes";
 
-  var NodesStore = FauxtonAPI.Store.extend({
+var NodesStore = FauxtonAPI.Store.extend({
 
-    initialize: function () {
-      this.reset();
-    },
+  initialize: function () {
+    this.reset();
+  },
 
-    reset: function () {
-      this._nodes = [];
-    },
+  reset: function () {
+    this._nodes = [];
+  },
 
-    setNodes: function (options) {
-      this._nodes = options.nodes;
-    },
+  setNodes: function (options) {
+    this._nodes = options.nodes;
+  },
 
-    getNodes: function () {
-      return this._nodes;
-    },
+  getNodes: function () {
+    return this._nodes;
+  },
 
-    dispatch: function (action) {
+  dispatch: function (action) {
 
-      switch (action.type) {
-        case ActionTypes.CLUSTER_FETCH_NODES:
-          this.setNodes(action.options);
-        break;
+    switch (action.type) {
+      case ActionTypes.CLUSTER_FETCH_NODES:
+        this.setNodes(action.options);
+      break;
 
-        default:
-        return;
-      }
-
-      this.triggerChange();
+      default:
+      return;
     }
 
-  });
+    this.triggerChange();
+  }
+
+});
 
 
-  var nodesStore = new NodesStore();
+var nodesStore = new NodesStore();
 
-  nodesStore.dispatchToken = FauxtonAPI.dispatcher.register(nodesStore.dispatch.bind(nodesStore));
+nodesStore.dispatchToken = FauxtonAPI.dispatcher.register(nodesStore.dispatch.bind(nodesStore));
 
-  return {
-    nodesStore: nodesStore
-  };
-});
+export default {
+  nodesStore: nodesStore
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/resources.js b/app/addons/cluster/resources.js
index ed17d3a..cb74aeb 100644
--- a/app/addons/cluster/resources.js
+++ b/app/addons/cluster/resources.js
@@ -10,37 +10,33 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api'
-],
-function (app, FauxtonAPI) {
-
-  var Cluster = FauxtonAPI.addon();
-
-  Cluster.ClusterNodes = Backbone.Model.extend({
-    url: function (context) {
-      if (context === 'apiurl') {
-        return window.location.origin + '/_membership';
-      } else {
-        return app.host + '/_membership';
-      }
-    },
-
-    parse: function (res) {
-      var list;
-
-      list = res.all_nodes.reduce(function (acc, node) {
-        var isInCluster = res.cluster_nodes.indexOf(node) !== -1;
-
-        acc.push({node: node, isInCluster: isInCluster});
-        return acc;
-      }, []);
-
-      res.nodes_mapped = list;
-      return res;
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+
+var Cluster = FauxtonAPI.addon();
+
+Cluster.ClusterNodes = Backbone.Model.extend({
+  url: function (context) {
+    if (context === 'apiurl') {
+      return window.location.origin + '/_membership';
+    } else {
+      return app.host + '/_membership';
     }
-  });
+  },
+
+  parse: function (res) {
+    var list;
 
-  return Cluster;
+    list = res.all_nodes.reduce(function (acc, node) {
+      var isInCluster = res.cluster_nodes.indexOf(node) !== -1;
+
+      acc.push({node: node, isInCluster: isInCluster});
+      return acc;
+    }, []);
+
+    res.nodes_mapped = list;
+    return res;
+  }
 });
+
+export default Cluster;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/routes.js b/app/addons/cluster/routes.js
index 69d632a..7287c5a 100644
--- a/app/addons/cluster/routes.js
+++ b/app/addons/cluster/routes.js
@@ -10,43 +10,38 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './resources',
-  './cluster.react',
-  './cluster.actions'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Cluster from "./resources";
+import ClusterComponents from "./cluster.react";
+import ClusterActions from "./cluster.actions";
 
-function (app, FauxtonAPI, Cluster, ClusterComponents, ClusterActions) {
 
+var ConfigDisabledRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'one_pane',
 
-  var ConfigDisabledRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'one_pane',
+  routes: {
+    'cluster/disabled': 'showDisabledFeatureScreen'
+  },
 
-    routes: {
-      'cluster/disabled': 'showDisabledFeatureScreen'
-    },
+  crumbs: [
+    { name: 'Config disabled', link: '_config' }
+  ],
 
-    crumbs: [
-      { name: 'Config disabled', link: '_config' }
-    ],
+  apiUrl: function () {
+    return [this.memberships.url('apiurl'), this.memberships.documentation];
+  },
 
-    apiUrl: function () {
-      return [this.memberships.url('apiurl'), this.memberships.documentation];
-    },
+  initialize: function () {
+    this.memberships = new Cluster.ClusterNodes();
+  },
 
-    initialize: function () {
-      this.memberships = new Cluster.ClusterNodes();
-    },
-
-    showDisabledFeatureScreen: function () {
-      ClusterActions.fetchNodes();
-      this.warning = this.setComponent('#dashboard-content', ClusterComponents.DisabledConfigController);
-    }
-  });
+  showDisabledFeatureScreen: function () {
+    ClusterActions.fetchNodes();
+    this.warning = this.setComponent('#dashboard-content', ClusterComponents.DisabledConfigController);
+  }
+});
 
-  Cluster.RouteObjects = [ConfigDisabledRouteObject];
+Cluster.RouteObjects = [ConfigDisabledRouteObject];
 
-  return Cluster;
-});
+export default Cluster;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/tests/clusterSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/cluster/tests/clusterSpec.react.jsx b/app/addons/cluster/tests/clusterSpec.react.jsx
index 85687b3..fae04be 100644
--- a/app/addons/cluster/tests/clusterSpec.react.jsx
+++ b/app/addons/cluster/tests/clusterSpec.react.jsx
@@ -9,49 +9,46 @@
 // 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',
-  '../cluster.react',
-  '../cluster.actions',
-  '../cluster.stores',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-], function (FauxtonAPI, ClusterComponent, ClusterActions, ClusterStores, utils, React, ReactDOM, TestUtils) {
-
-  var assert = utils.assert;
-
-  describe('Cluster Controller', function () {
-    var container, controller;
-
-    beforeEach(function () {
-
-      var nodeList = [
-        {'node': 'node1@127.0.0.1', 'isInCluster': true},
-        {'node': 'node2@127.0.0.1', 'isInCluster': true},
-        {'node': 'node3@127.0.0.1', 'isInCluster': false},
-        {'node': 'node3@127.0.0.1', 'isInCluster': false},
-        {'node': 'node3@127.0.0.1', 'isInCluster': false},
-        {'node': 'node3@127.0.0.1', 'isInCluster': false}
-      ];
-
-      ClusterActions.updateNodes({nodes: nodeList});
-
-      container = document.createElement('div');
-      controller = TestUtils.renderIntoDocument(
-        <ClusterComponent.DisabledConfigController />,
-        container
-      );
-    });
-
-    afterEach(function () {
-      ClusterStores.nodesStore.reset();
-      ReactDOM.unmountComponentAtNode(container);
-    });
-
-    it('renders the amount of nodes', function () {
-      assert.ok(/6 nodes/.test($(ReactDOM.findDOMNode(controller)).text()), 'finds 6 nodes');
-    });
+import FauxtonAPI from "../../../core/api";
+import ClusterComponent from "../cluster.react";
+import ClusterActions from "../cluster.actions";
+import ClusterStores from "../cluster.stores";
+import utils from "../../../../test/mocha/testUtils";
+import React from "react";
+import ReactDOM from "react-dom";
+import TestUtils from "react-addons-test-utils";
+
+var assert = utils.assert;
+
+describe('Cluster Controller', function () {
+  var container, controller;
+
+  beforeEach(function () {
+
+    var nodeList = [
+      {'node': 'node1@127.0.0.1', 'isInCluster': true},
+      {'node': 'node2@127.0.0.1', 'isInCluster': true},
+      {'node': 'node3@127.0.0.1', 'isInCluster': false},
+      {'node': 'node3@127.0.0.1', 'isInCluster': false},
+      {'node': 'node3@127.0.0.1', 'isInCluster': false},
+      {'node': 'node3@127.0.0.1', 'isInCluster': false}
+    ];
+
+    ClusterActions.updateNodes({nodes: nodeList});
+
+    container = document.createElement('div');
+    controller = TestUtils.renderIntoDocument(
+      <ClusterComponent.DisabledConfigController />,
+      container
+    );
+  });
+
+  afterEach(function () {
+    ClusterStores.nodesStore.reset();
+    ReactDOM.unmountComponentAtNode(container);
+  });
+
+  it('renders the amount of nodes', function () {
+    assert.ok(/6 nodes/.test($(ReactDOM.findDOMNode(controller)).text()), 'finds 6 nodes');
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cluster/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/cluster/tests/resourcesSpec.js b/app/addons/cluster/tests/resourcesSpec.js
index ad365f8..7443d6d 100644
--- a/app/addons/cluster/tests/resourcesSpec.js
+++ b/app/addons/cluster/tests/resourcesSpec.js
@@ -10,51 +10,48 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../test/mocha/testUtils',
-  '../../../core/api',
-  '../resources',
-], function (testUtils, FauxtonAPI, Resources) {
-  var assert = testUtils.assert;
-
-
-  describe('Membership Model', function () {
-    var data = {
-      'all_nodes': ['node1@127.0.0.1', 'node2@127.0.0.1', 'node3@127.0.0.1', 'notpartofclusternode'],
-      'cluster_nodes': ['node1@127.0.0.1', 'node2@127.0.0.1', 'node3@127.0.0.1']
-    };
-
-    it('reorders the data', function () {
-      var memberships = new Resources.ClusterNodes();
-      var res = memberships.parse(data);
-
-      assert.deepEqual([
-        {node: 'node1@127.0.0.1', isInCluster: true},
-        {node: 'node2@127.0.0.1', isInCluster: true},
-        {node: 'node3@127.0.0.1', isInCluster: true},
-        {node: 'notpartofclusternode', isInCluster: false}
-      ],
-      res.nodes_mapped);
-    });
-
-    it('keeps the exiting data', function () {
-      var memberships = new Resources.ClusterNodes();
-      var res = memberships.parse(data);
-
-      assert.deepEqual([
-        'node1@127.0.0.1',
-        'node2@127.0.0.1',
-        'node3@127.0.0.1',
-        'notpartofclusternode'
-      ],
-      res.all_nodes);
-
-      assert.deepEqual([
-        'node1@127.0.0.1',
-        'node2@127.0.0.1',
-        'node3@127.0.0.1'
-      ],
-      res.cluster_nodes);
-    });
+import testUtils from "../../../../test/mocha/testUtils";
+import FauxtonAPI from "../../../core/api";
+import Resources from "../resources";
+var assert = testUtils.assert;
+
+
+describe('Membership Model', function () {
+  var data = {
+    'all_nodes': ['node1@127.0.0.1', 'node2@127.0.0.1', 'node3@127.0.0.1', 'notpartofclusternode'],
+    'cluster_nodes': ['node1@127.0.0.1', 'node2@127.0.0.1', 'node3@127.0.0.1']
+  };
+
+  it('reorders the data', function () {
+    var memberships = new Resources.ClusterNodes();
+    var res = memberships.parse(data);
+
+    assert.deepEqual([
+      {node: 'node1@127.0.0.1', isInCluster: true},
+      {node: 'node2@127.0.0.1', isInCluster: true},
+      {node: 'node3@127.0.0.1', isInCluster: true},
+      {node: 'notpartofclusternode', isInCluster: false}
+    ],
+    res.nodes_mapped);
+  });
+
+  it('keeps the exiting data', function () {
+    var memberships = new Resources.ClusterNodes();
+    var res = memberships.parse(data);
+
+    assert.deepEqual([
+      'node1@127.0.0.1',
+      'node2@127.0.0.1',
+      'node3@127.0.0.1',
+      'notpartofclusternode'
+    ],
+    res.all_nodes);
+
+    assert.deepEqual([
+      'node1@127.0.0.1',
+      'node2@127.0.0.1',
+      'node3@127.0.0.1'
+    ],
+    res.cluster_nodes);
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/components/actions.js b/app/addons/components/actions.js
index 74bc733..a2b5855 100644
--- a/app/addons/components/actions.js
+++ b/app/addons/components/actions.js
@@ -10,75 +10,70 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../core/api',
-  './actiontypes'
-],
-function (FauxtonAPI, ActionTypes) {
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
 
-  function showAPIBarButton () {
-    FauxtonAPI.dispatch({ type: ActionTypes.CMPNTS_SHOW_API_BAR_BUTTON });
-  }
+function showAPIBarButton () {
+  FauxtonAPI.dispatch({ type: ActionTypes.CMPNTS_SHOW_API_BAR_BUTTON });
+}
 
-  function hideAPIBarButton () {
-    FauxtonAPI.dispatch({ type: ActionTypes.CMPNTS_HIDE_API_BAR_BUTTON });
-  }
+function hideAPIBarButton () {
+  FauxtonAPI.dispatch({ type: ActionTypes.CMPNTS_HIDE_API_BAR_BUTTON });
+}
 
-  function toggleApiBarVisibility (visible) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE,
-      options: visible
-    });
-  }
+function toggleApiBarVisibility (visible) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE,
+    options: visible
+  });
+}
 
-  function updateAPIBar (params) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.CMPNTS_UPDATE_API_BAR,
-      options: params
-    });
-  }
+function updateAPIBar (params) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.CMPNTS_UPDATE_API_BAR,
+    options: params
+  });
+}
 
-  function showDeleteDatabaseModal (options) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.CMPNTS_DATABASES_SHOWDELETE_MODAL,
-      options: options
-    });
-  }
+function showDeleteDatabaseModal (options) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.CMPNTS_DATABASES_SHOWDELETE_MODAL,
+    options: options
+  });
+}
 
-  function deleteDatabase (dbId) {
-    var url = FauxtonAPI.urls('databaseBaseURL', 'server', dbId, '');
+function deleteDatabase (dbId) {
+  var url = FauxtonAPI.urls('databaseBaseURL', 'server', dbId, '');
 
-    $.ajax({
-      url: url,
-      dataType: 'json',
-      type: 'DELETE'
-    }).then(function () {
-      this.showDeleteDatabaseModal({ showModal: true });
+  $.ajax({
+    url: url,
+    dataType: 'json',
+    type: 'DELETE'
+  }).then(function () {
+    this.showDeleteDatabaseModal({ showModal: true });
 
-      FauxtonAPI.addNotification({
-        msg: 'The database <code>' + _.escape(dbId) + '</code> has been deleted.',
-        clear: true,
-        escape: false // beware of possible XSS when the message changes
-      });
+    FauxtonAPI.addNotification({
+      msg: 'The database <code>' + _.escape(dbId) + '</code> has been deleted.',
+      clear: true,
+      escape: false // beware of possible XSS when the message changes
+    });
 
-      Backbone.history.loadUrl(FauxtonAPI.urls('allDBs', 'app'));
+    Backbone.history.loadUrl(FauxtonAPI.urls('allDBs', 'app'));
 
-    }.bind(this)).fail(function (rsp, error, msg) {
-      FauxtonAPI.addNotification({
-        msg: 'Could not delete the database, reason ' + msg + '.',
-        type: 'error',
-        clear: true
-      });
+  }.bind(this)).fail(function (rsp, error, msg) {
+    FauxtonAPI.addNotification({
+      msg: 'Could not delete the database, reason ' + msg + '.',
+      type: 'error',
+      clear: true
     });
-  }
-
-  return {
-    deleteDatabase: deleteDatabase,
-    showDeleteDatabaseModal: showDeleteDatabaseModal,
-    showAPIBarButton: showAPIBarButton,
-    hideAPIBarButton: hideAPIBarButton,
-    toggleApiBarVisibility: toggleApiBarVisibility,
-    updateAPIBar: updateAPIBar,
-  };
+  });
+}
 
-});
+export default {
+  deleteDatabase: deleteDatabase,
+  showDeleteDatabaseModal: showDeleteDatabaseModal,
+  showAPIBarButton: showAPIBarButton,
+  hideAPIBarButton: hideAPIBarButton,
+  toggleApiBarVisibility: toggleApiBarVisibility,
+  updateAPIBar: updateAPIBar,
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/components/actiontypes.js b/app/addons/components/actiontypes.js
index 454fe28..e1ce518 100644
--- a/app/addons/components/actiontypes.js
+++ b/app/addons/components/actiontypes.js
@@ -10,14 +10,10 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([],  function () {
-
-  return {
-    CMPNTS_SHOW_API_BAR_BUTTON: 'CMPNTS_SHOW_API_BAR_BUTTON',
-    CMPNTS_HIDE_API_BAR_BUTTON: 'CMPNTS_HIDE_API_BAR_BUTTON',
-    CMPNTS_UPDATE_API_BAR: 'CMPNTS_UPDATE_API_BAR',
-    CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE: 'CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE',
-    CMPNTS_DATABASES_SHOWDELETE_MODAL: 'CMPNTS_DATABASES_SHOWDELETE_MODAL'
-  };
-
-});
+export default {
+  CMPNTS_SHOW_API_BAR_BUTTON: 'CMPNTS_SHOW_API_BAR_BUTTON',
+  CMPNTS_HIDE_API_BAR_BUTTON: 'CMPNTS_HIDE_API_BAR_BUTTON',
+  CMPNTS_UPDATE_API_BAR: 'CMPNTS_UPDATE_API_BAR',
+  CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE: 'CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE',
+  CMPNTS_DATABASES_SHOWDELETE_MODAL: 'CMPNTS_DATABASES_SHOWDELETE_MODAL'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/base.js
----------------------------------------------------------------------
diff --git a/app/addons/components/base.js b/app/addons/components/base.js
index 5c9197a..7fa290e 100644
--- a/app/addons/components/base.js
+++ b/app/addons/components/base.js
@@ -10,13 +10,8 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  './assets/less/components.less'
-],
+import "./assets/less/components.less";
+var Components = {};
+Components.initialize = function () {};
 
-function () {
-  var Components = {};
-  Components.initialize = function () {};
-
-  return Components;
-});
+export default Components;


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/replication/views.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/views.js b/app/addons/replication/views.js
index 42a543f..cef6629 100644
--- a/app/addons/replication/views.js
+++ b/app/addons/replication/views.js
@@ -10,338 +10,334 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  '../fauxton/components',
-  './resources'
-],
-function (app, FauxtonAPI, Components, Replication) {
-  var View = {},
-    Events = {},
-    pollingInfo = {
-      rate: 5,
-      intervalId: null
-    };
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Components from "../fauxton/components";
+import Replication from "./resources";
+var View = {},
+  Events = {},
+  pollingInfo = {
+    rate: 5,
+    intervalId: null
+  };
+
+_.extend(Events, Backbone.Events);
+
+// NOTES: http://wiki.apache.org/couchdb/Replication
+
+// Replication form view is huge
+// -----------------------------------
+// afterRender: autocomplete on the target input field
+// beforeRender:  add the status table
+// disableFields:  disable non active fields on submit
+// enableFields:  enable field when radio btns are clicked
+// establish:  get the DB list for autocomplete
+// formValidation:  make sure fields aren't empty
+// showProgress:  make a call to active_tasks model and show only replication types.  Poll every 5 seconds. (make this it's own view)
+// startReplication:  saves to the model, starts replication
+// submit:  form submit handler
+// swapFields:  change to and from target
+// toggleAdvancedOptions:  toggle advanced
+
+View.ReplicationFormForAdmins = FauxtonAPI.View.extend({
+  template: 'addons/replication/templates/form',
+  events:  {
+    'submit #replication': 'validate',
+    'click .btn-group .btn': 'showFields',
+    'click .swap': 'swapFields',
+    'click .options': 'toggleAdvancedOptions'
+  },
+
+  initialize: function (options) {
+    this.status = options.status;
+    this.selectedDB = options.selectedDB;
+    this.newRepModel = new Replication.Replicate({});
+  },
+
+  afterRender: function () {
+    this.dbSearchTypeahead = new Components.DbSearchTypeahead({
+      dbLimit: 30,
+      el: 'input#to_name'
+    });
+
+    this.dbSearchTypeahead.render();
+  },
+
+  beforeRender: function () {
+    this.insertView('#replicationStatus', new View.ReplicationListForAdmins({
+      collection: this.status
+    }));
+  },
+
+  cleanup: function () {
+    clearInterval(pollingInfo.intervalId);
+  },
+
+  enableFields: function () {
+    this.$el.find('input', 'select').attr('disabled', false);
+  },
+
+  disableFields: function () {
+    this.$el.find('input:hidden', 'select:hidden').attr('disabled', true);
+  },
+
+  showFields: function (e) {
+    var $currentTarget = this.$(e.currentTarget),
+    targetVal = $currentTarget.val();
+
+    if (targetVal === 'local') {
+      $currentTarget.parents('.form_set').addClass('local');
+      return;
+    }
 
-  _.extend(Events, Backbone.Events);
-
-  // NOTES: http://wiki.apache.org/couchdb/Replication
-
-  // Replication form view is huge
-  // -----------------------------------
-  // afterRender: autocomplete on the target input field
-  // beforeRender:  add the status table
-  // disableFields:  disable non active fields on submit
-  // enableFields:  enable field when radio btns are clicked
-  // establish:  get the DB list for autocomplete
-  // formValidation:  make sure fields aren't empty
-  // showProgress:  make a call to active_tasks model and show only replication types.  Poll every 5 seconds. (make this it's own view)
-  // startReplication:  saves to the model, starts replication
-  // submit:  form submit handler
-  // swapFields:  change to and from target
-  // toggleAdvancedOptions:  toggle advanced
-
-  View.ReplicationFormForAdmins = FauxtonAPI.View.extend({
-    template: 'addons/replication/templates/form',
-    events:  {
-      'submit #replication': 'validate',
-      'click .btn-group .btn': 'showFields',
-      'click .swap': 'swapFields',
-      'click .options': 'toggleAdvancedOptions'
-    },
+    $currentTarget.parents('.form_set').removeClass('local');
+  },
 
-    initialize: function (options) {
-      this.status = options.status;
-      this.selectedDB = options.selectedDB;
-      this.newRepModel = new Replication.Replicate({});
-    },
+  establish: function () {
+    return [this.collection.fetch(), this.status.fetch()];
+  },
 
-    afterRender: function () {
-      this.dbSearchTypeahead = new Components.DbSearchTypeahead({
-        dbLimit: 30,
-        el: 'input#to_name'
+  validate: function (e) {
+    e.preventDefault();
+    if (this.formValidation()) {
+      FauxtonAPI.addNotification({
+        msg: 'Please enter every field.',
+        type: 'error',
+        clear: true
       });
+      return;
 
-      this.dbSearchTypeahead.render();
-    },
-
-    beforeRender: function () {
-      this.insertView('#replicationStatus', new View.ReplicationListForAdmins({
-        collection: this.status
-      }));
-    },
-
-    cleanup: function () {
-      clearInterval(pollingInfo.intervalId);
-    },
-
-    enableFields: function () {
-      this.$el.find('input', 'select').attr('disabled', false);
-    },
-
-    disableFields: function () {
-      this.$el.find('input:hidden', 'select:hidden').attr('disabled', true);
-    },
-
-    showFields: function (e) {
-      var $currentTarget = this.$(e.currentTarget),
-      targetVal = $currentTarget.val();
-
-      if (targetVal === 'local') {
-        $currentTarget.parents('.form_set').addClass('local');
-        return;
-      }
-
-      $currentTarget.parents('.form_set').removeClass('local');
-    },
-
-    establish: function () {
-      return [this.collection.fetch(), this.status.fetch()];
-    },
-
-    validate: function (e) {
-      e.preventDefault();
-      if (this.formValidation()) {
+    } else if (this.$('input#to_name').is(':visible') && !this.$('input[name=create_target]').is(':checked')) {
+      var alreadyExists = this.collection.where({
+        "name": this.$('input#to_name').val()
+      });
+      if (alreadyExists.length === 0) {
         FauxtonAPI.addNotification({
-          msg: 'Please enter every field.',
+          msg: 'This database doesn\'t exist. Check create target if you want to create it.',
           type: 'error',
           clear: true
         });
         return;
-
-      } else if (this.$('input#to_name').is(':visible') && !this.$('input[name=create_target]').is(':checked')) {
-        var alreadyExists = this.collection.where({
-          "name": this.$('input#to_name').val()
-        });
-        if (alreadyExists.length === 0) {
-          FauxtonAPI.addNotification({
-            msg: 'This database doesn\'t exist. Check create target if you want to create it.',
-            type: 'error',
-            clear: true
-          });
-          return;
-        }
       }
-
-      this.submit(e);
-    },
-
-    formValidation: function () {
-      var $remote = this.$el.find('input:visible'),
-          error = false;
-      _.each($remote, function (item) {
-        if (item.value === 'http://' || item.value === '') {
-          error = true;
-        }
-      });
-      return error;
-    },
-
-    serialize: function () {
-      return {
-        databases:  this.collection.toJSON(),
-        selectedDB: this.selectedDB
-      };
-    },
-
-    startReplication: function (json) {
-      var that = this;
-      this.newRepModel.save(json, {
-        success: function (resp) {
-          FauxtonAPI.addNotification({
-            msg: 'Replication from ' + resp.get('source') + ' to ' + resp.get('target') + ' has begun.',
-            type: 'success',
-            clear: true
-          });
-          that.updateButtonText(false);
-          Events.trigger('update:tasks');
-        },
-        error: function (model, xhr, options) {
-          var errorMessage = JSON.parse(xhr.responseText);
-          FauxtonAPI.addNotification({
-            msg: errorMessage.reason,
-            type: 'error',
-            clear: true
-          });
-          that.updateButtonText(false);
-        }
-      });
-      this.enableFields();
-    },
-
-    updateButtonText: function (wait) {
-      var $button = this.$('#replication button[type=submit]');
-      if (wait) {
-        $button.text('Starting replication...').attr('disabled', true);
-      } else {
-        $button.text('Replication').attr('disabled', false);
-      }
-    },
-
-    submit: function (e) {
-      this.disableFields();
-      var formJSON = {};
-      _.map(this.$(e.currentTarget).serializeArray(), function (formData) {
-        if (formData.value !== '') {
-          formJSON[formData.name] = (formData.value === "true" ? true : formData.value.replace(/\s/g, '').toLowerCase());
-        }
-      });
-
-      this.updateButtonText(true);
-      this.startReplication(formJSON);
-    },
-
-    swapFields: function (e) {
-      // WALL O' VARIABLES
-      var $fromSelect = this.$('#from_name'),
-          $toSelect = this.$('#to_name'),
-          $toInput = this.$('#to_url'),
-          $fromInput = this.$('#from_url'),
-          fromSelectVal = $fromSelect.val(),
-          fromInputVal = $fromInput.val(),
-          toSelectVal = $toSelect.val(),
-          toInputVal = $toInput.val();
-
-      $fromSelect.val(toSelectVal);
-      $toSelect.val(fromSelectVal);
-
-      $fromInput.val(toInputVal);
-      $toInput.val(fromInputVal);
-
-      // prevent other click handlers from running
-      return false;
     }
-  });
-
-  View.ReplicationForm = View.ReplicationFormForAdmins.extend({
-    template: 'addons/replication/templates/form',
-
-    events: {
-      'submit #replication': 'validate',
-      'click .btn-group .btn': 'showFields',
-      'click .swap': 'swapFields',
-      'click .options': 'toggleAdvancedOptions'
-    },
 
-    initialize: function (options) {
-      this.selectedDB = options.selectedDB;
-      this.newRepModel = new Replication.Replicate({});
-    },
+    this.submit(e);
+  },
 
-    beforeRender: function () {},
+  formValidation: function () {
+    var $remote = this.$el.find('input:visible'),
+        error = false;
+    _.each($remote, function (item) {
+      if (item.value === 'http://' || item.value === '') {
+        error = true;
+      }
+    });
+    return error;
+  },
+
+  serialize: function () {
+    return {
+      databases:  this.collection.toJSON(),
+      selectedDB: this.selectedDB
+    };
+  },
 
-    establish: function () {
-      return [this.collection.fetch()];
+  startReplication: function (json) {
+    var that = this;
+    this.newRepModel.save(json, {
+      success: function (resp) {
+        FauxtonAPI.addNotification({
+          msg: 'Replication from ' + resp.get('source') + ' to ' + resp.get('target') + ' has begun.',
+          type: 'success',
+          clear: true
+        });
+        that.updateButtonText(false);
+        Events.trigger('update:tasks');
+      },
+      error: function (model, xhr, options) {
+        var errorMessage = JSON.parse(xhr.responseText);
+        FauxtonAPI.addNotification({
+          msg: errorMessage.reason,
+          type: 'error',
+          clear: true
+        });
+        that.updateButtonText(false);
+      }
+    });
+    this.enableFields();
+  },
+
+  updateButtonText: function (wait) {
+    var $button = this.$('#replication button[type=submit]');
+    if (wait) {
+      $button.text('Starting replication...').attr('disabled', true);
+    } else {
+      $button.text('Replication').attr('disabled', false);
     }
-  });
-
-  View.ReplicationListForAdmins = FauxtonAPI.View.extend({
-    tagName: 'ul',
-
-    initialize: function () {
-      Events.bind('update:tasks', this.establish, this);
-      this.listenTo(this.collection, 'reset', this.render);
-      this.$el.prepend('<li class="header"><h4>Active Replication Tasks</h4></li>');
-    },
-
-    establish: function () {
-      return [this.collection.fetch({ reset: true })];
-    },
+  },
+
+  submit: function (e) {
+    this.disableFields();
+    var formJSON = {};
+    _.map(this.$(e.currentTarget).serializeArray(), function (formData) {
+      if (formData.value !== '') {
+        formJSON[formData.name] = (formData.value === "true" ? true : formData.value.replace(/\s/g, '').toLowerCase());
+      }
+    });
+
+    this.updateButtonText(true);
+    this.startReplication(formJSON);
+  },
+
+  swapFields: function (e) {
+    // WALL O' VARIABLES
+    var $fromSelect = this.$('#from_name'),
+        $toSelect = this.$('#to_name'),
+        $toInput = this.$('#to_url'),
+        $fromInput = this.$('#from_url'),
+        fromSelectVal = $fromSelect.val(),
+        fromInputVal = $fromInput.val(),
+        toSelectVal = $toSelect.val(),
+        toInputVal = $toInput.val();
+
+    $fromSelect.val(toSelectVal);
+    $toSelect.val(fromSelectVal);
+
+    $fromInput.val(toInputVal);
+    $toInput.val(fromInputVal);
+
+    // prevent other click handlers from running
+    return false;
+  }
+});
 
-    setPolling: function () {
-      var that = this;
-      this.cleanup();
-      pollingInfo.intervalId = setInterval(function () {
-        that.establish();
-      }, pollingInfo.rate * 1000);
-    },
+View.ReplicationForm = View.ReplicationFormForAdmins.extend({
+  template: 'addons/replication/templates/form',
 
-    cleanup: function () {
-      Events.unbind('update:tasks');
-      clearInterval(pollingInfo.intervalId);
-    },
+  events: {
+    'submit #replication': 'validate',
+    'click .btn-group .btn': 'showFields',
+    'click .swap': 'swapFields',
+    'click .options': 'toggleAdvancedOptions'
+  },
 
-    beforeRender: function () {
-      this.collection.forEach(function (item) {
-        this.insertView(new View.replicationItem({
-          model: item
-        }));
-      }, this);
-    },
+  initialize: function (options) {
+    this.selectedDB = options.selectedDB;
+    this.newRepModel = new Replication.Replicate({});
+  },
 
-    showHeader: function () {
-      this.$el.parent()
-        .toggleClass('showHeader', this.collection.length > 0);
-    },
+  beforeRender: function () {},
 
-    afterRender: function () {
-      this.showHeader();
-      this.setPolling();
-    }
-  });
-
-  //make this a table row item.
-  View.replicationItem = FauxtonAPI.View.extend({
-    tagName: 'li',
-    className: 'row',
-    template: 'addons/replication/templates/progress',
-    events: {
-      'click .cancel': 'cancelReplication'
-    },
+  establish: function () {
+    return [this.collection.fetch()];
+  }
+});
 
-    initialize: function () {
-      this.newRepModel = new Replication.Replicate({});
-    },
+View.ReplicationListForAdmins = FauxtonAPI.View.extend({
+  tagName: 'ul',
+
+  initialize: function () {
+    Events.bind('update:tasks', this.establish, this);
+    this.listenTo(this.collection, 'reset', this.render);
+    this.$el.prepend('<li class="header"><h4>Active Replication Tasks</h4></li>');
+  },
+
+  establish: function () {
+    return [this.collection.fetch({ reset: true })];
+  },
+
+  setPolling: function () {
+    var that = this;
+    this.cleanup();
+    pollingInfo.intervalId = setInterval(function () {
+      that.establish();
+    }, pollingInfo.rate * 1000);
+  },
+
+  cleanup: function () {
+    Events.unbind('update:tasks');
+    clearInterval(pollingInfo.intervalId);
+  },
+
+  beforeRender: function () {
+    this.collection.forEach(function (item) {
+      this.insertView(new View.replicationItem({
+        model: item
+      }));
+    }, this);
+  },
+
+  showHeader: function () {
+    this.$el.parent()
+      .toggleClass('showHeader', this.collection.length > 0);
+  },
+
+  afterRender: function () {
+    this.showHeader();
+    this.setPolling();
+  }
+});
 
-    establish: function () {
-      return [this.model.fetch()];
+//make this a table row item.
+View.replicationItem = FauxtonAPI.View.extend({
+  tagName: 'li',
+  className: 'row',
+  template: 'addons/replication/templates/progress',
+  events: {
+    'click .cancel': 'cancelReplication'
+  },
+
+  initialize: function () {
+    this.newRepModel = new Replication.Replicate({});
+  },
+
+  establish: function () {
+    return [this.model.fetch()];
+  },
+
+  cancelReplication: function (e) {
+    // need to pass "cancel": true with source & target
+    var $currentTarget = this.$(e.currentTarget),
+        repID = $currentTarget.attr('data-rep-id');
+
+    this.newRepModel.save({
+      "replication_id": repID,
+      "cancel": true
     },
-
-    cancelReplication: function (e) {
-      // need to pass "cancel": true with source & target
-      var $currentTarget = this.$(e.currentTarget),
-          repID = $currentTarget.attr('data-rep-id');
-
-      this.newRepModel.save({
-        "replication_id": repID,
-        "cancel": true
+    {
+      success: function (model, xhr, options) {
+        FauxtonAPI.addNotification({
+          msg: 'Replication stopped.',
+          type: 'success',
+          clear: true
+        });
       },
-      {
-        success: function (model, xhr, options) {
-          FauxtonAPI.addNotification({
-            msg: 'Replication stopped.',
-            type: 'success',
-            clear: true
-          });
-        },
-        error: function (model, xhr, options) {
-          var errorMessage = JSON.parse(xhr.responseText);
-          FauxtonAPI.addNotification({
-            msg: errorMessage.reason,
-            type: 'error',
-            clear: true
-          });
-        }
-      });
-    },
-
-    afterRender: function () {
-      if (this.model.get('continuous')) {
-        this.$el.addClass('continuous');
+      error: function (model, xhr, options) {
+        var errorMessage = JSON.parse(xhr.responseText);
+        FauxtonAPI.addNotification({
+          msg: errorMessage.reason,
+          type: 'error',
+          clear: true
+        });
       }
-    },
+    });
+  },
 
-    serialize: function () {
-      return {
-        progress:  this.model.get('progress'),
-        target: this.model.get('target'),
-        source: this.model.get('source'),
-        continuous: this.model.get('continuous'),
-        repid: this.model.get('replication_id')
-      };
+  afterRender: function () {
+    if (this.model.get('continuous')) {
+      this.$el.addClass('continuous');
     }
-  });
-
-  return View;
+  },
+
+  serialize: function () {
+    return {
+      progress:  this.model.get('progress'),
+      target: this.model.get('target'),
+      source: this.model.get('source'),
+      continuous: this.model.get('continuous'),
+      repid: this.model.get('replication_id')
+    };
+  }
 });
+
+export default View;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/base.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/base.js b/app/addons/setup/base.js
index c1abf1b..1750885 100644
--- a/app/addons/setup/base.js
+++ b/app/addons/setup/base.js
@@ -10,21 +10,16 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './route',
-  './assets/less/setup.less'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Setup from "./route";
+import "./assets/less/setup.less";
+Setup.initialize = function () {
+  FauxtonAPI.addHeaderLink({
+    title: 'Setup',
+    href: "#setup",
+    icon: 'fonticon-wrench'
+  });
+};
 
-function (app, FauxtonAPI, Setup) {
-  Setup.initialize = function () {
-    FauxtonAPI.addHeaderLink({
-      title: 'Setup',
-      href: "#setup",
-      icon: 'fonticon-wrench'
-    });
-  };
-
-  return Setup;
-});
+export default Setup;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/resources.js b/app/addons/setup/resources.js
index 0073a0a..1963f04 100644
--- a/app/addons/setup/resources.js
+++ b/app/addons/setup/resources.js
@@ -10,47 +10,42 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
 
-function (app, FauxtonAPI) {
+var Setup = FauxtonAPI.addon();
 
-  var Setup = FauxtonAPI.addon();
 
+Setup.Model = Backbone.Model.extend({
 
-  Setup.Model = Backbone.Model.extend({
+  documentation: app.host + '/_utils/docs',
 
-    documentation: app.host + '/_utils/docs',
-
-    url: function (context) {
-      if (context === "apiurl") {
-        return window.location.origin + "/_cluster_setup";
-      } else {
-        return '/_cluster_setup';
-      }
-    },
-
-    validate: function (attrs) {
-      if (!attrs.username) {
-        return 'Admin name is required';
-      }
+  url: function (context) {
+    if (context === "apiurl") {
+      return window.location.origin + "/_cluster_setup";
+    } else {
+      return '/_cluster_setup';
+    }
+  },
 
-      if (!attrs.password) {
-        return 'Admin password is required';
-      }
+  validate: function (attrs) {
+    if (!attrs.username) {
+      return 'Admin name is required';
+    }
 
-      if (attrs.bind_address && attrs.bind_address === '127.0.0.1') {
-        return 'Bind address can not be 127.0.0.1';
-      }
+    if (!attrs.password) {
+      return 'Admin password is required';
+    }
 
-      if (attrs.port && _.isNaN(+attrs.port)) {
-        return 'Bind port must be a number';
-      }
+    if (attrs.bind_address && attrs.bind_address === '127.0.0.1') {
+      return 'Bind address can not be 127.0.0.1';
     }
 
-  });
+    if (attrs.port && _.isNaN(+attrs.port)) {
+      return 'Bind port must be a number';
+    }
+  }
 
-  return Setup;
 });
+
+export default Setup;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/route.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/route.js b/app/addons/setup/route.js
index ddff10d..49d8a8e 100644
--- a/app/addons/setup/route.js
+++ b/app/addons/setup/route.js
@@ -10,62 +10,58 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './resources',
-  './setup.react',
-  './setup.actions',
-  '../cluster/cluster.actions'
-],
-function (app, FauxtonAPI, Setup, SetupComponents, SetupActions, ClusterActions) {
-  var RouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'one_pane',
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Setup from "./resources";
+import SetupComponents from "./setup.react";
+import SetupActions from "./setup.actions";
+import ClusterActions from "../cluster/cluster.actions";
+var RouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'one_pane',
 
-    roles: ['_admin'],
+  roles: ['_admin'],
 
-    routes: {
-      'setup': 'setupInitView',
-      'setup/finish': 'finishView',
-      'setup/singlenode': 'setupSingleNode',
-      'setup/multinode': 'setupMultiNode'
-    },
+  routes: {
+    'setup': 'setupInitView',
+    'setup/finish': 'finishView',
+    'setup/singlenode': 'setupSingleNode',
+    'setup/multinode': 'setupMultiNode'
+  },
 
-    crumbs: [
-      {'name': 'Setup ' + app.i18n.en_US['couchdb-productname'], 'link': 'setup'}
-    ],
+  crumbs: [
+    {'name': 'Setup ' + app.i18n.en_US['couchdb-productname'], 'link': 'setup'}
+  ],
 
-    apiUrl: function () {
-      return [this.setupModel.url('apiurl'), this.setupModel.documentation];
-    },
+  apiUrl: function () {
+    return [this.setupModel.url('apiurl'), this.setupModel.documentation];
+  },
 
-    initialize: function () {
-      this.setupModel = new Setup.Model();
-    },
+  initialize: function () {
+    this.setupModel = new Setup.Model();
+  },
 
-    setupInitView: function () {
-      ClusterActions.fetchNodes();
-      SetupActions.getClusterStateFromCouch();
-      this.setComponent('#dashboard-content', SetupComponents.SetupFirstStepController);
-    },
+  setupInitView: function () {
+    ClusterActions.fetchNodes();
+    SetupActions.getClusterStateFromCouch();
+    this.setComponent('#dashboard-content', SetupComponents.SetupFirstStepController);
+  },
 
-    setupSingleNode: function () {
-      ClusterActions.fetchNodes();
-      this.setComponent('#dashboard-content', SetupComponents.SetupSingleNodeController);
-    },
+  setupSingleNode: function () {
+    ClusterActions.fetchNodes();
+    this.setComponent('#dashboard-content', SetupComponents.SetupSingleNodeController);
+  },
 
-    setupMultiNode: function () {
-      ClusterActions.fetchNodes();
-      this.setComponent('#dashboard-content', SetupComponents.SetupMultipleNodesController);
-    },
+  setupMultiNode: function () {
+    ClusterActions.fetchNodes();
+    this.setComponent('#dashboard-content', SetupComponents.SetupMultipleNodesController);
+  },
 
-    finishView: function () {
-      this.setComponent('#dashboard-content', SetupComponents.ClusterConfiguredScreen);
-    }
-  });
+  finishView: function () {
+    this.setComponent('#dashboard-content', SetupComponents.ClusterConfiguredScreen);
+  }
+});
 
 
-  Setup.RouteObjects = [RouteObject];
+Setup.RouteObjects = [RouteObject];
 
-  return Setup;
-});
+export default Setup;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/setup.actions.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/setup.actions.js b/app/addons/setup/setup.actions.js
index cfcfff3..bdafc32 100644
--- a/app/addons/setup/setup.actions.js
+++ b/app/addons/setup/setup.actions.js
@@ -9,277 +9,273 @@
 // 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',
-  '../config/resources',
-  './resources',
-  './setup.actiontypes',
-  '../cluster/cluster.stores',
-  './setup.stores',
+import FauxtonAPI from "../../core/api";
+import ConfigResources from "../config/resources";
+import SetupResources from "./resources";
+import ActionTypes from "./setup.actiontypes";
+import ClusterStores from "../cluster/cluster.stores";
+import SetupStores from "./setup.stores";
+var nodesStore = ClusterStores.nodesStore;
+var setupStore = SetupStores.setupStore;
 
-], function (FauxtonAPI, ConfigResources, SetupResources, ActionTypes, ClusterStores, SetupStores) {
-    var nodesStore = ClusterStores.nodesStore;
-    var setupStore = SetupStores.setupStore;
+export default {
 
-    return {
+  getClusterStateFromCouch: function () {
+    var setupData = new SetupResources.Model();
 
-      getClusterStateFromCouch: function () {
-        var setupData = new SetupResources.Model();
+    setupData.fetch().then(function () {
+      FauxtonAPI.dispatch({
+        type: ActionTypes.SETUP_SET_CLUSTERSTATUS,
+        options: {
+          state: setupData.get('state')
+        }
+      });
+    });
+  },
 
-        setupData.fetch().then(function () {
-          FauxtonAPI.dispatch({
-            type: ActionTypes.SETUP_SET_CLUSTERSTATUS,
-            options: {
-              state: setupData.get('state')
-            }
-          });
-        });
-      },
+  finishClusterSetup: function (message) {
 
-      finishClusterSetup: function (message) {
+    $.ajax({
+      type: 'POST',
+      url: '/_cluster_setup',
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify({
+        action: 'finish_cluster'
+      })
+    })
+    .success(function (res) {
+      FauxtonAPI.addNotification({
+        msg: message,
+        type: 'success',
+        fade: false,
+        clear: true
+      });
+      FauxtonAPI.navigate('#setup/finish');
+    })
+    .fail(function () {
+      FauxtonAPI.addNotification({
+        msg: 'There was an error. Please check your setup and try again.',
+        type: 'error',
+        fade: false,
+        clear: true
+      });
+    });
 
-        $.ajax({
-          type: 'POST',
-          url: '/_cluster_setup',
-          contentType: 'application/json',
-          dataType: 'json',
-          data: JSON.stringify({
-            action: 'finish_cluster'
-          })
-        })
-        .success(function (res) {
-          FauxtonAPI.addNotification({
-            msg: message,
-            type: 'success',
-            fade: false,
-            clear: true
-          });
-          FauxtonAPI.navigate('#setup/finish');
-        })
-        .fail(function () {
-          FauxtonAPI.addNotification({
-            msg: 'There was an error. Please check your setup and try again.',
-            type: 'error',
-            fade: false,
-            clear: true
-          });
-        });
+  },
 
-      },
+  setupSingleNode: function () {
+    var nodes = nodesStore.getNodes();
+    var isAdminParty = setupStore.getIsAdminParty();
+    var username = setupStore.getUsername();
+    var password = setupStore.getPassword();
 
-      setupSingleNode: function () {
-        var nodes = nodesStore.getNodes();
-        var isAdminParty = setupStore.getIsAdminParty();
-        var username = setupStore.getUsername();
-        var password = setupStore.getPassword();
+    var setupModel = new SetupResources.Model({
+      action: 'enable_cluster',
+      username: username,
+      password: password,
+      bind_address: setupStore.getBindAdressForSetupNode(),
+      port: setupStore.getPortForSetupNode()
+    });
 
-        var setupModel = new SetupResources.Model({
-          action: 'enable_cluster',
-          username: username,
-          password: password,
-          bind_address: setupStore.getBindAdressForSetupNode(),
-          port: setupStore.getPortForSetupNode()
-        });
+    setupModel.on('invalid', function (model, error) {
+      FauxtonAPI.addNotification({
+        msg: error,
+        type: 'error',
+        fade: false,
+        clear: true
+      });
+    });
 
-        setupModel.on('invalid', function (model, error) {
-          FauxtonAPI.addNotification({
-            msg: error,
-            type: 'error',
-            fade: false,
-            clear: true
-          });
-        });
+    setupModel.save()
+      .then(function () {
+        return FauxtonAPI.session.login(username, password);
+      })
+      .then(function () {
+        return this.finishClusterSetup('CouchDB is set up!');
+      }.bind(this));
+  },
 
-        setupModel.save()
-          .then(function () {
-            return FauxtonAPI.session.login(username, password);
-          })
-          .then(function () {
-            return this.finishClusterSetup('CouchDB is set up!');
-          }.bind(this));
-      },
+  addNode: function (isOrWasAdminParty) {
+    var username = setupStore.getUsername();
+    var password = setupStore.getPassword();
+    var portForSetupNode = setupStore.getPortForSetupNode();
+    var bindAddressForSetupNode = setupStore.getBindAdressForSetupNode();
 
-      addNode: function (isOrWasAdminParty) {
-        var username = setupStore.getUsername();
-        var password = setupStore.getPassword();
-        var portForSetupNode = setupStore.getPortForSetupNode();
-        var bindAddressForSetupNode = setupStore.getBindAdressForSetupNode();
+    var bindAddressForAdditionalNode = setupStore.getAdditionalNode().bindAddress;
+    var remoteAddressForAdditionalNode = setupStore.getAdditionalNode().remoteAddress;
+    var portForForAdditionalNode = setupStore.getAdditionalNode().port;
 
-        var bindAddressForAdditionalNode = setupStore.getAdditionalNode().bindAddress;
-        var remoteAddressForAdditionalNode = setupStore.getAdditionalNode().remoteAddress;
-        var portForForAdditionalNode = setupStore.getAdditionalNode().port;
 
+    var setupNode = new SetupResources.Model({
+      action: 'enable_cluster',
+      username: username,
+      password: password,
+      bind_address: bindAddressForSetupNode,
+      port: portForSetupNode
+    });
 
-        var setupNode = new SetupResources.Model({
-          action: 'enable_cluster',
-          username: username,
-          password: password,
-          bind_address: bindAddressForSetupNode,
-          port: portForSetupNode
-        });
+    setupNode.on('invalid', function (model, error) {
+      FauxtonAPI.addNotification({
+        msg: error,
+        type: 'error',
+        fade: false,
+        clear: true
+      });
+    });
 
-        setupNode.on('invalid', function (model, error) {
-          FauxtonAPI.addNotification({
-            msg: error,
-            type: 'error',
-            fade: false,
-            clear: true
-          });
-        });
+    var additionalNodeData = {
+      action: 'enable_cluster',
+      username: username,
+      password: password,
+      bind_address: bindAddressForAdditionalNode,
+      port: portForForAdditionalNode,
+      remote_node: remoteAddressForAdditionalNode,
+      remote_current_user: username,
+      remote_current_password: password
+    };
 
-        var additionalNodeData = {
-          action: 'enable_cluster',
-          username: username,
-          password: password,
-          bind_address: bindAddressForAdditionalNode,
-          port: portForForAdditionalNode,
-          remote_node: remoteAddressForAdditionalNode,
-          remote_current_user: username,
-          remote_current_password: password
-        };
+    if (isOrWasAdminParty) {
+      delete additionalNodeData.remote_current_user;
+      delete additionalNodeData.remote_current_password;
+    }
 
-        if (isOrWasAdminParty) {
-          delete additionalNodeData.remote_current_user;
-          delete additionalNodeData.remote_current_password;
+    function dontGiveUp (f, u, p) {
+      return f(u, p).then(
+        undefined,
+        function (err) {
+          return dontGiveUp(f, u, p);
         }
+      );
+    }
 
-        function dontGiveUp (f, u, p) {
-          return f(u, p).then(
-            undefined,
-            function (err) {
-              return dontGiveUp(f, u, p);
-            }
-          );
-        }
+    var additionalNode = new SetupResources.Model(additionalNodeData);
+
+    additionalNode.on('invalid', function (model, error) {
+      FauxtonAPI.addNotification({
+        msg: error,
+        type: 'error',
+        fade: false,
+        clear: true
+      });
+    });
+    setupNode
+      .save()
+      .always(function () {
+        FauxtonAPI.session.login(username, password).then(function () {
+          continueSetup();
+        });
+      });
 
-        var additionalNode = new SetupResources.Model(additionalNodeData);
+    function continueSetup () {
+      var addNodeModel = new SetupResources.Model({
+        action: 'add_node',
+        username: username,
+        password: password,
+        host: remoteAddressForAdditionalNode,
+        port: portForForAdditionalNode
+      });
 
-        additionalNode.on('invalid', function (model, error) {
+      additionalNode
+        .save()
+        .then(function () {
+          return addNodeModel.save();
+        })
+        .then(function () {
+          FauxtonAPI.dispatch({
+            type: ActionTypes.SETUP_ADD_NODE_TO_LIST,
+            options: {
+              value: {
+                port: portForForAdditionalNode,
+                remoteAddress: remoteAddressForAdditionalNode
+              }
+            }
+          });
           FauxtonAPI.addNotification({
-            msg: error,
+            msg: 'Added node',
+            type: 'success',
+            fade: false,
+            clear: true
+          });
+        })
+        .fail(function (xhr) {
+          var responseText = JSON.parse(xhr.responseText).reason;
+          FauxtonAPI.addNotification({
+            msg: 'Adding node failed: ' + responseText,
             type: 'error',
             fade: false,
             clear: true
           });
         });
-        setupNode
-          .save()
-          .always(function () {
-            FauxtonAPI.session.login(username, password).then(function () {
-              continueSetup();
-            });
-          });
-
-        function continueSetup () {
-          var addNodeModel = new SetupResources.Model({
-            action: 'add_node',
-            username: username,
-            password: password,
-            host: remoteAddressForAdditionalNode,
-            port: portForForAdditionalNode
-          });
+    }
+  },
 
-          additionalNode
-            .save()
-            .then(function () {
-              return addNodeModel.save();
-            })
-            .then(function () {
-              FauxtonAPI.dispatch({
-                type: ActionTypes.SETUP_ADD_NODE_TO_LIST,
-                options: {
-                  value: {
-                    port: portForForAdditionalNode,
-                    remoteAddress: remoteAddressForAdditionalNode
-                  }
-                }
-              });
-              FauxtonAPI.addNotification({
-                msg: 'Added node',
-                type: 'success',
-                fade: false,
-                clear: true
-              });
-            })
-            .fail(function (xhr) {
-              var responseText = JSON.parse(xhr.responseText).reason;
-              FauxtonAPI.addNotification({
-                msg: 'Adding node failed: ' + responseText,
-                type: 'error',
-                fade: false,
-                clear: true
-              });
-            });
-        }
-      },
-
-      resetAddtionalNodeForm: function () {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_RESET_ADDITIONAL_NODE,
-        });
-      },
+  resetAddtionalNodeForm: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_RESET_ADDITIONAL_NODE,
+    });
+  },
 
-      alterPortAdditionalNode: function (value) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_PORT_ADDITIONAL_NODE,
-          options: {
-            value: value
-          }
-        });
-      },
+  alterPortAdditionalNode: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_PORT_ADDITIONAL_NODE,
+      options: {
+        value: value
+      }
+    });
+  },
 
-      alterRemoteAddressAdditionalNode: function (value) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE,
-          options: {
-            value: value
-          }
-        });
-      },
+  alterRemoteAddressAdditionalNode: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE,
+      options: {
+        value: value
+      }
+    });
+  },
 
-      alterBindAddressAdditionalNode: function (value) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_BIND_ADDRESS_ADDITIONAL_NODE,
-          options: {
-            value: value
-          }
-        });
-      },
+  alterBindAddressAdditionalNode: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_BIND_ADDRESS_ADDITIONAL_NODE,
+      options: {
+        value: value
+      }
+    });
+  },
 
-      setUsername: function (value) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_SET_USERNAME,
-          options: {
-            value: value
-          }
-        });
-      },
+  setUsername: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_SET_USERNAME,
+      options: {
+        value: value
+      }
+    });
+  },
 
-      setPassword: function (value) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_SET_PASSWORD,
-          options: {
-            value: value
-          }
-        });
-      },
+  setPassword: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_SET_PASSWORD,
+      options: {
+        value: value
+      }
+    });
+  },
 
-      setPortForSetupNode: function (value) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_PORT_FOR_SINGLE_NODE,
-          options: {
-            value: value
-          }
-        });
-      },
+  setPortForSetupNode: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_PORT_FOR_SINGLE_NODE,
+      options: {
+        value: value
+      }
+    });
+  },
 
-      setBindAddressForSetupNode: function (value) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.SETUP_BIND_ADDRESS_FOR_SINGLE_NODE,
-          options: {
-            value: value
-          }
-        });
+  setBindAddressForSetupNode: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SETUP_BIND_ADDRESS_FOR_SINGLE_NODE,
+      options: {
+        value: value
       }
-    };
-  });
+    });
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/setup.actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/setup.actiontypes.js b/app/addons/setup/setup.actiontypes.js
index 6bbd390..a7ef0eb 100644
--- a/app/addons/setup/setup.actiontypes.js
+++ b/app/addons/setup/setup.actiontypes.js
@@ -10,18 +10,15 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    SETUP_SET_CLUSTERSTATUS: 'SETUP_SET_CLUSTERSTATUS',
-    SETUP_SET_USERNAME: 'SETUP_SET_USERNAME',
-    SETUP_SET_PASSWORD: 'SETUP_SET_PASSWORD',
-    SETUP_BIND_ADDRESS_FOR_SINGLE_NODE: 'SETUP_BIND_ADDRESS_FOR_SINGLE_NODE',
-    SETUP_PORT_FOR_SINGLE_NODE: 'SETUP_PORT_FOR_SINGLE_NODE',
-    SETUP_PORT_ADDITIONAL_NODE: 'SETUP_PORT_ADDITIONAL_NODE',
-    SETUP_BIND_ADDRESS_ADDITIONAL_NODE: 'SETUP_BIND_ADDRESS_ADDITIONAL_NODE',
-    SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE: 'SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE',
-    SETUP_RESET_ADDITIONAL_NODE: 'SETUP_RESET_ADDITIONAL_NODE',
-    SETUP_ADD_NODE_TO_LIST: 'SETUP_ADD_NODE_TO_LIST',
-  };
-});
-
+export default {
+  SETUP_SET_CLUSTERSTATUS: 'SETUP_SET_CLUSTERSTATUS',
+  SETUP_SET_USERNAME: 'SETUP_SET_USERNAME',
+  SETUP_SET_PASSWORD: 'SETUP_SET_PASSWORD',
+  SETUP_BIND_ADDRESS_FOR_SINGLE_NODE: 'SETUP_BIND_ADDRESS_FOR_SINGLE_NODE',
+  SETUP_PORT_FOR_SINGLE_NODE: 'SETUP_PORT_FOR_SINGLE_NODE',
+  SETUP_PORT_ADDITIONAL_NODE: 'SETUP_PORT_ADDITIONAL_NODE',
+  SETUP_BIND_ADDRESS_ADDITIONAL_NODE: 'SETUP_BIND_ADDRESS_ADDITIONAL_NODE',
+  SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE: 'SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE',
+  SETUP_RESET_ADDITIONAL_NODE: 'SETUP_RESET_ADDITIONAL_NODE',
+  SETUP_ADD_NODE_TO_LIST: 'SETUP_ADD_NODE_TO_LIST',
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/setup.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/setup/setup.react.jsx b/app/addons/setup/setup.react.jsx
index 268dda8..03f2852 100644
--- a/app/addons/setup/setup.react.jsx
+++ b/app/addons/setup/setup.react.jsx
@@ -10,379 +10,374 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  '../components/react-components.react',
-  './setup.actions',
-  './setup.stores',
-
-
-], function (app, FauxtonAPI, React, ReactComponents, SetupActions, SetupStores) {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactComponents from "../components/react-components.react";
+import SetupActions from "./setup.actions";
+import SetupStores from "./setup.stores";
+
+var setupStore = SetupStores.setupStore;
+var ConfirmButton = ReactComponents.ConfirmButton;
+
+
+var ClusterConfiguredScreen = React.createClass({
+
+  render: function () {
+    return (
+      <div className="setup-screen">
+        {app.i18n.en_US['couchdb-productname']} is configured for production usage!
+        <br />
+        <br/>
+        Do you want to <a href="#replication">replicate data</a>?
+      </div>
+    );
+  }
+});
 
-  var setupStore = SetupStores.setupStore;
-  var ConfirmButton = ReactComponents.ConfirmButton;
+var SetupCurrentAdminPassword = React.createClass({
 
+  render: function () {
+    var text = 'Your current Admin Username & Password';
 
-  var ClusterConfiguredScreen = React.createClass({
+    if (this.props.adminParty) {
+      text = 'Admin Username & Password that you want to use';
+    }
 
-    render: function () {
-      return (
-        <div className="setup-screen">
-          {app.i18n.en_US['couchdb-productname']} is configured for production usage!
-          <br />
-          <br/>
-          Do you want to <a href="#replication">replicate data</a>?
+    return (
+      <div className="setup-creds">
+        <div>
+          <h2>Specify Credentials</h2>
+          {text}
         </div>
-      );
-    }
-  });
+        <input
+          className="setup-username"
+          onChange={this.props.onAlterUsername}
+          placeholder="Admin Username"
+          type="text" />
+        <input
+          className="setup-password"
+          onChange={this.props.onAlterPassword}
+          placeholder="Admin Password"
+          type="password" />
+      </div>
+    );
+  },
 
-  var SetupCurrentAdminPassword = React.createClass({
 
-    render: function () {
-      var text = 'Your current Admin Username & Password';
+});
 
-      if (this.props.adminParty) {
-        text = 'Admin Username & Password that you want to use';
-      }
 
-      return (
-        <div className="setup-creds">
-          <div>
-            <h2>Specify Credentials</h2>
-            {text}
-          </div>
+var SetupOptionalSettings = React.createClass({
+  getInitialState: function () {
+    return {
+      ipValue: this.props.ipInitialValue,
+      portValue: this.props.portValue
+    };
+  },
+
+  handleIpChange: function (event) {
+    this.props.onAlterBindAddress(event);
+    this.setState({ipValue: event.target.value});
+  },
+
+  handlePortChange: function (event) {
+    this.props.onAlterPort(event);
+    this.setState({portValue: event.target.value});
+  },
+
+  render: function () {
+    return (
+      <div className="setup-opt-settings">
+        <h2>IP</h2>
+        Bind address to listen on<br/>
+
+        <input
+          className="setup-input-ip"
+          value={this.state.ipValue}
+          onChange={this.handleIpChange}
+          defaultValue="0.0.0.0"
+          type="text" />
+
+        <div className="setup-port">
+          <h2>Port</h2>
+          Port that the Node uses <br/>
           <input
-            className="setup-username"
-            onChange={this.props.onAlterUsername}
-            placeholder="Admin Username"
+            className="setup-input-port"
+            value={this.state.portValue}
+            onChange={this.handlePortChange}
+            defaultValue="5984"
             type="text" />
-          <input
-            className="setup-password"
-            onChange={this.props.onAlterPassword}
-            placeholder="Admin Password"
-            type="password" />
         </div>
-      );
-    },
+      </div>
+    );
+  }
+});
 
+var SetupMultipleNodesController = React.createClass({
 
-  });
+  getInitialState: function () {
+    return this.getStoreState();
+  },
 
+  getStoreState: function () {
+    return {
+      nodeList: setupStore.getNodeList(),
+      isAdminParty: setupStore.getIsAdminParty(),
+      remoteAddress: setupStore.getAdditionalNode().remoteAddress
+    };
+  },
 
-  var SetupOptionalSettings = React.createClass({
-    getInitialState: function () {
-      return {
-        ipValue: this.props.ipInitialValue,
-        portValue: this.props.portValue
-      };
-    },
+  componentDidMount: function () {
+    this.isAdminParty = setupStore.getIsAdminParty();
+    setupStore.on('change', this.onChange, this);
+  },
 
-    handleIpChange: function (event) {
-      this.props.onAlterBindAddress(event);
-      this.setState({ipValue: event.target.value});
-    },
+  componentWillUnmount: function () {
+    setupStore.off('change', this.onChange);
+  },
 
-    handlePortChange: function (event) {
-      this.props.onAlterPort(event);
-      this.setState({portValue: event.target.value});
-    },
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
+    }
+  },
 
-    render: function () {
+  getNodeList: function () {
+    return this.state.nodeList.map(function (el, i) {
       return (
-        <div className="setup-opt-settings">
-          <h2>IP</h2>
-          Bind address to listen on<br/>
-
-          <input
-            className="setup-input-ip"
-            value={this.state.ipValue}
-            onChange={this.handleIpChange}
-            defaultValue="0.0.0.0"
-            type="text" />
-
-          <div className="setup-port">
-            <h2>Port</h2>
-            Port that the Node uses <br/>
-            <input
-              className="setup-input-port"
-              value={this.state.portValue}
-              onChange={this.handlePortChange}
-              defaultValue="5984"
-              type="text" />
-          </div>
+        <div key={i} className="node-item">
+          {el.remoteAddress}:{el.port}
         </div>
       );
-    }
-  });
-
-  var SetupMultipleNodesController = React.createClass({
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        nodeList: setupStore.getNodeList(),
-        isAdminParty: setupStore.getIsAdminParty(),
-        remoteAddress: setupStore.getAdditionalNode().remoteAddress
-      };
-    },
-
-    componentDidMount: function () {
-      this.isAdminParty = setupStore.getIsAdminParty();
-      setupStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      setupStore.off('change', this.onChange);
-    },
-
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
-
-    getNodeList: function () {
-      return this.state.nodeList.map(function (el, i) {
-        return (
-          <div key={i} className="node-item">
-            {el.remoteAddress}:{el.port}
+    }, this);
+  },
+
+  addNode: function () {
+    SetupActions.addNode(this.isAdminParty);
+  },
+
+  alterPortAdditionalNode: function (e) {
+    SetupActions.alterPortAdditionalNode(e.target.value);
+  },
+
+  alterBindAddressAdditionalNode: function (e) {
+    SetupActions.alterBindAddressAdditionalNode(e.target.value);
+  },
+
+  alterRemoteAddressAdditionalNode: function (e) {
+    SetupActions.alterRemoteAddressAdditionalNode(e.target.value);
+  },
+
+  alterUsername: function (e) {
+    SetupActions.setUsername(e.target.value);
+  },
+
+  alterPassword: function (e) {
+    SetupActions.setPassword(e.target.value);
+  },
+
+  alterBindAddressSetupNode: function (e) {
+    SetupActions.setBindAddressForSetupNode(e.target.value);
+  },
+
+  alterPortSetupNode: function (e) {
+    SetupActions.setPortForSetupNode(e.target.value);
+  },
+
+  finishClusterSetup: function () {
+    SetupActions.finishClusterSetup('CouchDB Cluster set up!');
+  },
+
+  render: function () {
+
+    return (
+      <div className="setup-nodes">
+        Setup your initial base-node, afterwards add the other nodes that you want to add
+        <div className="setup-setupnode-section">
+          <SetupCurrentAdminPassword
+            onAlterUsername={this.alterUsername}
+            onAlterPassword={this.alterPassword}
+            adminParty={this.state.isAdminParty} />
+
+          <SetupOptionalSettings
+            onAlterPort={this.alterPortSetupNode}
+            onAlterBindAddress={this.alterBindAddressSetupNode} />
           </div>
-        );
-      }, this);
-    },
-
-    addNode: function () {
-      SetupActions.addNode(this.isAdminParty);
-    },
-
-    alterPortAdditionalNode: function (e) {
-      SetupActions.alterPortAdditionalNode(e.target.value);
-    },
-
-    alterBindAddressAdditionalNode: function (e) {
-      SetupActions.alterBindAddressAdditionalNode(e.target.value);
-    },
-
-    alterRemoteAddressAdditionalNode: function (e) {
-      SetupActions.alterRemoteAddressAdditionalNode(e.target.value);
-    },
-
-    alterUsername: function (e) {
-      SetupActions.setUsername(e.target.value);
-    },
-
-    alterPassword: function (e) {
-      SetupActions.setPassword(e.target.value);
-    },
-
-    alterBindAddressSetupNode: function (e) {
-      SetupActions.setBindAddressForSetupNode(e.target.value);
-    },
-
-    alterPortSetupNode: function (e) {
-      SetupActions.setPortForSetupNode(e.target.value);
-    },
-
-    finishClusterSetup: function () {
-      SetupActions.finishClusterSetup('CouchDB Cluster set up!');
-    },
-
-    render: function () {
+        <hr/>
+        <div className="setup-add-nodes-section">
+          <h2>Add Nodes</h2>
+          Remote host <br/>
+          <input
+            value={this.state.remoteAddress}
+            onChange={this.alterRemoteAddressAdditionalNode}
+            className="input-remote-node"
+            type="text"
+            placeholder="127.0.0.1" />
 
-      return (
-        <div className="setup-nodes">
-          Setup your initial base-node, afterwards add the other nodes that you want to add
-          <div className="setup-setupnode-section">
-            <SetupCurrentAdminPassword
-              onAlterUsername={this.alterUsername}
-              onAlterPassword={this.alterPassword}
-              adminParty={this.state.isAdminParty} />
-
-            <SetupOptionalSettings
-              onAlterPort={this.alterPortSetupNode}
-              onAlterBindAddress={this.alterBindAddressSetupNode} />
-            </div>
-          <hr/>
-          <div className="setup-add-nodes-section">
-            <h2>Add Nodes</h2>
-            Remote host <br/>
-            <input
-              value={this.state.remoteAddress}
-              onChange={this.alterRemoteAddressAdditionalNode}
-              className="input-remote-node"
-              type="text"
-              placeholder="127.0.0.1" />
-
-            <SetupOptionalSettings
-              onAlterPort={this.alterPortAdditionalNode}
-              onAlterBindAddress={this.alterBindAddressAdditionalNode} />
-
-            <div className="setup-add-button">
-              <ConfirmButton
-                onClick={this.addNode}
-                showIcon={false}
-                id="setup-btn-no-thanks"
-                text="Add Node" />
-            </div>
-          </div>
-          <div className="setup-nodelist">
-            {this.getNodeList()}
-          </div>
+          <SetupOptionalSettings
+            onAlterPort={this.alterPortAdditionalNode}
+            onAlterBindAddress={this.alterBindAddressAdditionalNode} />
 
-          <div className="centered setup-finish">
-            <ConfirmButton onClick={this.finishClusterSetup} showIcon={false} text="Configure Cluster" />
+          <div className="setup-add-button">
+            <ConfirmButton
+              onClick={this.addNode}
+              showIcon={false}
+              id="setup-btn-no-thanks"
+              text="Add Node" />
           </div>
         </div>
-      );
-    }
-  });
-
-  var SetupSingleNodeController = React.createClass({
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        isAdminParty: setupStore.getIsAdminParty()
-      };
-    },
-
-    componentDidMount: function () {
-      setupStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      setupStore.off('change', this.onChange);
-    },
+        <div className="setup-nodelist">
+          {this.getNodeList()}
+        </div>
 
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
+        <div className="centered setup-finish">
+          <ConfirmButton onClick={this.finishClusterSetup} showIcon={false} text="Configure Cluster" />
+        </div>
+      </div>
+    );
+  }
+});
 
-    alterUsername: function (e) {
-      SetupActions.setUsername(e.target.value);
-    },
+var SetupSingleNodeController = React.createClass({
 
-    alterPassword: function (e) {
-      SetupActions.setPassword(e.target.value);
-    },
+  getInitialState: function () {
+    return this.getStoreState();
+  },
 
-    alterBindAddress: function (e) {
-      SetupActions.setBindAddressForSetupNode(e.target.value);
-    },
+  getStoreState: function () {
+    return {
+      isAdminParty: setupStore.getIsAdminParty()
+    };
+  },
 
-    alterPort: function (e) {
-      SetupActions.setPortForSetupNode(e.target.value);
-    },
+  componentDidMount: function () {
+    setupStore.on('change', this.onChange, this);
+  },
 
-    render: function () {
-      return (
-        <div className="setup-nodes">
-          <div className="setup-setupnode-section">
-            <SetupCurrentAdminPassword
-              onAlterUsername={this.alterUsername}
-              onAlterPassword={this.alterPassword}
-              adminParty={this.state.isAdminParty} />
-            <SetupOptionalSettings
-              onAlterPort={this.alterPort}
-              onAlterBindAddress={this.alterBindAddress} />
-            <ConfirmButton
-              onClick={this.finishSingleNode}
-              text="Configure Node" />
-          </div>
-        </div>
-      );
-    },
+  componentWillUnmount: function () {
+    setupStore.off('change', this.onChange);
+  },
 
-    finishSingleNode: function (e) {
-      e.preventDefault();
-      SetupActions.setupSingleNode();
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
     }
-  });
+  },
+
+  alterUsername: function (e) {
+    SetupActions.setUsername(e.target.value);
+  },
+
+  alterPassword: function (e) {
+    SetupActions.setPassword(e.target.value);
+  },
+
+  alterBindAddress: function (e) {
+    SetupActions.setBindAddressForSetupNode(e.target.value);
+  },
+
+  alterPort: function (e) {
+    SetupActions.setPortForSetupNode(e.target.value);
+  },
+
+  render: function () {
+    return (
+      <div className="setup-nodes">
+        <div className="setup-setupnode-section">
+          <SetupCurrentAdminPassword
+            onAlterUsername={this.alterUsername}
+            onAlterPassword={this.alterPassword}
+            adminParty={this.state.isAdminParty} />
+          <SetupOptionalSettings
+            onAlterPort={this.alterPort}
+            onAlterBindAddress={this.alterBindAddress} />
+          <ConfirmButton
+            onClick={this.finishSingleNode}
+            text="Configure Node" />
+        </div>
+      </div>
+    );
+  },
+
+  finishSingleNode: function (e) {
+    e.preventDefault();
+    SetupActions.setupSingleNode();
+  }
+});
 
-  var SetupFirstStepController = React.createClass({
+var SetupFirstStepController = React.createClass({
 
-    getInitialState: function () {
-      return this.getStoreState();
-    },
+  getInitialState: function () {
+    return this.getStoreState();
+  },
 
-    getStoreState: function () {
-      return {
-        clusterState: setupStore.getClusterState()
-      };
-    },
+  getStoreState: function () {
+    return {
+      clusterState: setupStore.getClusterState()
+    };
+  },
 
-    componentDidMount: function () {
-      setupStore.on('change', this.onChange, this);
-    },
+  componentDidMount: function () {
+    setupStore.on('change', this.onChange, this);
+  },
 
-    componentWillUnmount: function () {
-      setupStore.off('change', this.onChange);
-    },
+  componentWillUnmount: function () {
+    setupStore.off('change', this.onChange);
+  },
 
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
+    }
+  },
 
-    render: function () {
-      if (this.state.clusterState === 'cluster_finished') {
-        return (<ClusterConfiguredScreen />);
-      }
+  render: function () {
+    if (this.state.clusterState === 'cluster_finished') {
+      return (<ClusterConfiguredScreen />);
+    }
 
-      return (
-        <div className="setup-screen">
-          <h2>Welcome to {app.i18n.en_US['couchdb-productname']}!</h2>
-          <p>
-            The recommended way to run the wizard is directly on your
-            node (e.g without a Loadbalancer) in front of it.
-          </p>
-          <p>
-            Do you want to setup a cluster with multiple nodes
-            or just a single node CouchDB installation?
-          </p>
-          <div>
-            <ConfirmButton
-              onClick={this.redirectToMultiNodeSetup}
-              showIcon={false}
-              text="Configure	Cluster" />
-            <ConfirmButton
-              onClick={this.redirectToSingleNodeSetup}
-              showIcon={false}
-              id="setup-btn-no-thanks"
-              text="Configure	Single	Node" />
-          </div>
+    return (
+      <div className="setup-screen">
+        <h2>Welcome to {app.i18n.en_US['couchdb-productname']}!</h2>
+        <p>
+          The recommended way to run the wizard is directly on your
+          node (e.g without a Loadbalancer) in front of it.
+        </p>
+        <p>
+          Do you want to setup a cluster with multiple nodes
+          or just a single node CouchDB installation?
+        </p>
+        <div>
+          <ConfirmButton
+            onClick={this.redirectToMultiNodeSetup}
+            showIcon={false}
+            text="Configure	Cluster" />
+          <ConfirmButton
+            onClick={this.redirectToSingleNodeSetup}
+            showIcon={false}
+            id="setup-btn-no-thanks"
+            text="Configure	Single	Node" />
         </div>
-      );
-    },
-
-    redirectToSingleNodeSetup: function (e) {
-      e.preventDefault();
-      FauxtonAPI.navigate('#setup/singlenode');
-    },
-
-    redirectToMultiNodeSetup: function (e) {
-      e.preventDefault();
-      FauxtonAPI.navigate('#setup/multinode');
-    }
-  });
-
-  return {
-    SetupMultipleNodesController: SetupMultipleNodesController,
-    SetupFirstStepController: SetupFirstStepController,
-    ClusterConfiguredScreen: ClusterConfiguredScreen,
-    SetupSingleNodeController: SetupSingleNodeController,
-    SetupOptionalSettings: SetupOptionalSettings
-  };
+      </div>
+    );
+  },
+
+  redirectToSingleNodeSetup: function (e) {
+    e.preventDefault();
+    FauxtonAPI.navigate('#setup/singlenode');
+  },
+
+  redirectToMultiNodeSetup: function (e) {
+    e.preventDefault();
+    FauxtonAPI.navigate('#setup/multinode');
+  }
 });
+
+export default {
+  SetupMultipleNodesController: SetupMultipleNodesController,
+  SetupFirstStepController: SetupFirstStepController,
+  ClusterConfiguredScreen: ClusterConfiguredScreen,
+  SetupSingleNodeController: SetupSingleNodeController,
+  SetupOptionalSettings: SetupOptionalSettings
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/setup.stores.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/setup.stores.js b/app/addons/setup/setup.stores.js
index ab0504f..93946df 100644
--- a/app/addons/setup/setup.stores.js
+++ b/app/addons/setup/setup.stores.js
@@ -10,175 +10,171 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../core/api',
-  './setup.actiontypes'
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./setup.actiontypes";
 
-], function (FauxtonAPI, ActionTypes) {
+var SetupStore = FauxtonAPI.Store.extend({
 
-  var SetupStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
 
-    initialize: function () {
-      this.reset();
-    },
+  reset: function () {
+    this._clusterState = [];
 
-    reset: function () {
-      this._clusterState = [];
+    this._username = '';
+    this._password = '';
 
-      this._username = '';
-      this._password = '';
+    this._setupNode = {
+      bindAddress: '0.0.0.0',
+      port: 5984
+    };
 
-      this._setupNode = {
-        bindAddress: '0.0.0.0',
-        port: 5984
-      };
+    this.resetAddtionalNode();
 
-      this.resetAddtionalNode();
+    this._nodeList = [];
+  },
 
-      this._nodeList = [];
-    },
+  resetAddtionalNode: function () {
+    this._additionalNode = {
+      bindAddress: '0.0.0.0',
+      port: 5984,
+      remoteAddress: '127.0.0.1'
+    };
+  },
 
-    resetAddtionalNode: function () {
-      this._additionalNode = {
-        bindAddress: '0.0.0.0',
-        port: 5984,
-        remoteAddress: '127.0.0.1'
-      };
-    },
+  setClusterState: function (options) {
+    this._clusterState = options.state;
+  },
 
-    setClusterState: function (options) {
-      this._clusterState = options.state;
-    },
+  getClusterState: function () {
+    return this._clusterState;
+  },
 
-    getClusterState: function () {
-      return this._clusterState;
-    },
+  getNodeList: function () {
+    return this._nodeList;
+  },
 
-    getNodeList: function () {
-      return this._nodeList;
-    },
+  getIsAdminParty: function () {
+    return FauxtonAPI.session.isAdminParty();
+  },
 
-    getIsAdminParty: function () {
-      return FauxtonAPI.session.isAdminParty();
-    },
+  setUsername: function (options) {
+    this._username = options.value;
+  },
 
-    setUsername: function (options) {
-      this._username = options.value;
-    },
+  setPassword: function (options) {
+    this._password = options.value;
+  },
 
-    setPassword: function (options) {
-      this._password = options.value;
-    },
+  getUsername: function () {
+    return this._username;
+  },
 
-    getUsername: function () {
-      return this._username;
-    },
+  getPassword: function () {
+    return this._password;
+  },
 
-    getPassword: function () {
-      return this._password;
-    },
+  setBindAdressForSetupNode: function (options) {
+    this._setupNode.bindAddress = options.value;
+  },
 
-    setBindAdressForSetupNode: function (options) {
-      this._setupNode.bindAddress = options.value;
-    },
+  setPortForSetupNode: function (options) {
+    this._setupNode.port = options.value;
+  },
 
-    setPortForSetupNode: function (options) {
-      this._setupNode.port = options.value;
-    },
+  getPortForSetupNode: function () {
+    return this._setupNode.port;
+  },
 
-    getPortForSetupNode: function () {
-      return this._setupNode.port;
-    },
+  getBindAdressForSetupNode: function () {
+    return this._setupNode.bindAddress;
+  },
 
-    getBindAdressForSetupNode: function () {
-      return this._setupNode.bindAddress;
-    },
+  setBindAdressForAdditionalNode: function (options) {
+    this._additionalNode.bindAddress = options.value;
+  },
 
-    setBindAdressForAdditionalNode: function (options) {
-      this._additionalNode.bindAddress = options.value;
-    },
+  setPortForAdditionalNode: function (options) {
+    this._additionalNode.port = options.value;
+  },
 
-    setPortForAdditionalNode: function (options) {
-      this._additionalNode.port = options.value;
-    },
+  setRemoteAddressForAdditionalNode: function (options) {
+    this._additionalNode.remoteAddress = options.value;
+  },
 
-    setRemoteAddressForAdditionalNode: function (options) {
-      this._additionalNode.remoteAddress = options.value;
-    },
+  getAdditionalNode: function () {
+    return this._additionalNode;
+  },
 
-    getAdditionalNode: function () {
-      return this._additionalNode;
-    },
+  addNodeToList: function (options) {
+    this._nodeList.push(options.value);
+    this.resetAddtionalNode();
+  },
 
-    addNodeToList: function (options) {
-      this._nodeList.push(options.value);
-      this.resetAddtionalNode();
-    },
+  getHostForSetupNode: function () {
+    return '127.0.0.1';
+  },
 
-    getHostForSetupNode: function () {
-      return '127.0.0.1';
-    },
+  dispatch: function (action) {
 
-    dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.SETUP_SET_CLUSTERSTATUS:
+        this.setClusterState(action.options);
+      break;
 
-      switch (action.type) {
-        case ActionTypes.SETUP_SET_CLUSTERSTATUS:
-          this.setClusterState(action.options);
-        break;
+      case ActionTypes.SETUP_SET_USERNAME:
+        this.setUsername(action.options);
+      break;
 
-        case ActionTypes.SETUP_SET_USERNAME:
-          this.setUsername(action.options);
-        break;
+      case ActionTypes.SETUP_SET_PASSWORD:
+        this.setPassword(action.options);
+      break;
 
-        case ActionTypes.SETUP_SET_PASSWORD:
-          this.setPassword(action.options);
-        break;
+      case ActionTypes.SETUP_BIND_ADDRESS_FOR_SINGLE_NODE:
+        this.setBindAdressForSetupNode(action.options);
+      break;
 
-        case ActionTypes.SETUP_BIND_ADDRESS_FOR_SINGLE_NODE:
-          this.setBindAdressForSetupNode(action.options);
-        break;
+      case ActionTypes.SETUP_PORT_FOR_SINGLE_NODE:
+        this.setPortForSetupNode(action.options);
+      break;
 
-        case ActionTypes.SETUP_PORT_FOR_SINGLE_NODE:
-          this.setPortForSetupNode(action.options);
-        break;
+      case ActionTypes.SETUP_PORT_ADDITIONAL_NODE:
+        this.setPortForAdditionalNode(action.options);
+      break;
 
-        case ActionTypes.SETUP_PORT_ADDITIONAL_NODE:
-          this.setPortForAdditionalNode(action.options);
-        break;
+      case ActionTypes.SETUP_BIND_ADDRESS_ADDITIONAL_NODE:
+        this.setBindAdressForAdditionalNode(action.options);
+      break;
 
-        case ActionTypes.SETUP_BIND_ADDRESS_ADDITIONAL_NODE:
-          this.setBindAdressForAdditionalNode(action.options);
-        break;
+      case ActionTypes.SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE:
+        this.setRemoteAddressForAdditionalNode(action.options);
+      break;
 
-        case ActionTypes.SETUP_REMOTE_ADDRESS_ADDITIONAL_NODE:
-          this.setRemoteAddressForAdditionalNode(action.options);
-        break;
+      case ActionTypes.SETUP_ADD_NODE_TO_LIST:
+        this.addNodeToList(action.options);
+      break;
 
-        case ActionTypes.SETUP_ADD_NODE_TO_LIST:
-          this.addNodeToList(action.options);
-        break;
+      case ActionTypes.SETUP_RESET_ADDITIONAL_NODE:
+        this.resetAddtionalNode();
+      break;
 
-        case ActionTypes.SETUP_RESET_ADDITIONAL_NODE:
-          this.resetAddtionalNode();
-        break;
 
-
-        default:
-        return;
-      }
-
-      this.triggerChange();
+      default:
+      return;
     }
 
-  });
+    this.triggerChange();
+  }
 
+});
 
-  var setupStore = new SetupStore();
 
-  setupStore.dispatchToken = FauxtonAPI.dispatcher.register(setupStore.dispatch.bind(setupStore));
+var setupStore = new SetupStore();
 
-  return {
-    setupStore: setupStore,
-    SetupStore: SetupStore
-  };
-});
+setupStore.dispatchToken = FauxtonAPI.dispatcher.register(setupStore.dispatch.bind(setupStore));
+
+export default {
+  setupStore: setupStore,
+  SetupStore: SetupStore
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/tests/setupComponentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/setup/tests/setupComponentsSpec.react.jsx b/app/addons/setup/tests/setupComponentsSpec.react.jsx
index 288500f..d0872bf 100644
--- a/app/addons/setup/tests/setupComponentsSpec.react.jsx
+++ b/app/addons/setup/tests/setupComponentsSpec.react.jsx
@@ -9,137 +9,133 @@
 // 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',
-  '../setup.react',
-  '../setup.stores',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, Stores, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import Views from "../setup.react";
+import Stores from "../setup.stores";
+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";
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('Setup Components', function () {
+describe('Setup Components', function () {
 
-    describe('IP / Port area', function () {
-      var changeHandler, container;
+  describe('IP / Port area', function () {
+    var changeHandler, container;
 
-      beforeEach(function () {
-        changeHandler = sinon.spy();
-        container = document.createElement('div');
-      });
+    beforeEach(function () {
+      changeHandler = sinon.spy();
+      container = document.createElement('div');
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
+
+    it('fires callbacks on change, ip', function () {
+      var optSettings = TestUtils.renderIntoDocument(
+        <Views.SetupOptionalSettings onAlterPort={null} onAlterBindAddress={changeHandler} />,
+        container
+      );
+
+      var node = $(ReactDOM.findDOMNode(optSettings)).find('.setup-input-ip')[0];
+      TestUtils.Simulate.change(node, {target: {value: 'Hello, world'}});
+
+      assert.ok(changeHandler.calledOnce);
+    });
+
+    it('fires callbacks on change, port', function () {
+      var optSettings = TestUtils.renderIntoDocument(
+        <Views.SetupOptionalSettings onAlterPort={changeHandler} onAlterBindAddress={null} />,
+        container
+      );
+
+      var node = $(ReactDOM.findDOMNode(optSettings)).find('.setup-input-port')[0];
+      TestUtils.Simulate.change(node, {target: {value: 'Hello, world'}});
+
+      assert.ok(changeHandler.calledOnce);
+    });
+
+  });
+
+  //commenting out for now. These tests cause other tests to fail. No idea why
+  /*describe('SetupMultipleNodesController', function () {
+    var controller, changeHandler, container;
+
+    beforeEach(function () {
+      sinon.stub(Stores.setupStore, 'getIsAdminParty', function () { return false; });
+      container = document.createElement('div');
+      controller = TestUtils.renderIntoDocument(
+          <Views.SetupMultipleNodesController />,
+        container
+      );
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(container);
-      });
+    afterEach(function () {
+      utils.restore(Stores.setupStore.getIsAdminParty);
+      ReactDOM.unmountComponentAtNode(container);
+      Stores.setupStore.reset();
+    });
 
-      it('fires callbacks on change, ip', function () {
-        var optSettings = TestUtils.renderIntoDocument(
-          <Views.SetupOptionalSettings onAlterPort={null} onAlterBindAddress={changeHandler} />,
-          container
-        );
+    it('changes the values in the store for additional nodes', function () {
+      var $addNodesSection = $(ReactDOM.findDOMNode(controller)).find('.setup-add-nodes-section');
+      TestUtils.Simulate.change($addNodesSection.find('.setup-input-ip')[0], {target: {value: '192.168.13.37'}});
+      TestUtils.Simulate.change($addNodesSection.find('.setup-input-port')[0], {target: {value: '1337'}});
+      TestUtils.Simulate.change($addNodesSection.find('.input-remote-node')[0], {target: {value: 'node2.local'}});
 
-        var node = $(ReactDOM.findDOMNode(optSettings)).find('.setup-input-ip')[0];
-        TestUtils.Simulate.change(node, {target: {value: 'Hello, world'}});
+      var additionalNode = Stores.setupStore.getAdditionalNode();
+      assert.equal(additionalNode.bindAddress, '192.168.13.37');
+      assert.equal(additionalNode.remoteAddress, 'node2.local');
+      assert.equal(additionalNode.port, '1337');
+    });
 
-        assert.ok(changeHandler.calledOnce);
-      });
+    it('changes the values in the store for the setup node', function () {
+      var $setupNodesSection = $(ReactDOM.findDOMNode(controller)).find('.setup-setupnode-section');
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-input-ip')[0], {target: {value: '192.168.42.42'}});
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-input-port')[0], {target: {value: '4242'}});
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-username')[0], {target: {value: 'tester'}});
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-password')[0], {target: {value: 'testerpass'}});
 
-      it('fires callbacks on change, port', function () {
-        var optSettings = TestUtils.renderIntoDocument(
-          <Views.SetupOptionalSettings onAlterPort={changeHandler} onAlterBindAddress={null} />,
-          container
-        );
 
-        var node = $(ReactDOM.findDOMNode(optSettings)).find('.setup-input-port')[0];
-        TestUtils.Simulate.change(node, {target: {value: 'Hello, world'}});
+      assert.equal(Stores.setupStore.getBindAdressForSetupNode(), '192.168.42.42');
+      assert.equal(Stores.setupStore.getPortForSetupNode(), '4242');
+      assert.equal(Stores.setupStore.getUsername(), 'tester');
+      assert.equal(Stores.setupStore.getPassword(), 'testerpass');
+    });
 
-        assert.ok(changeHandler.calledOnce);
-      });
+  });*/
 
+  describe('SingleNodeSetup', function () {
+    var controller, changeHandler, container;
+
+    beforeEach(function () {
+      sinon.stub(Stores.setupStore, 'getIsAdminParty', function () { return false; });
+      container = document.createElement('div');
+      controller = TestUtils.renderIntoDocument(
+        <Views.SetupSingleNodeController />,
+        container
+      );
     });
 
-    //commenting out for now. These tests cause other tests to fail. No idea why
-    /*describe('SetupMultipleNodesController', function () {
-      var controller, changeHandler, container;
-
-      beforeEach(function () {
-        sinon.stub(Stores.setupStore, 'getIsAdminParty', function () { return false; });
-        container = document.createElement('div');
-        controller = TestUtils.renderIntoDocument(
-            <Views.SetupMultipleNodesController />,
-          container
-        );
-      });
-
-      afterEach(function () {
-        utils.restore(Stores.setupStore.getIsAdminParty);
-        ReactDOM.unmountComponentAtNode(container);
-        Stores.setupStore.reset();
-      });
-
-      it('changes the values in the store for additional nodes', function () {
-        var $addNodesSection = $(ReactDOM.findDOMNode(controller)).find('.setup-add-nodes-section');
-        TestUtils.Simulate.change($addNodesSection.find('.setup-input-ip')[0], {target: {value: '192.168.13.37'}});
-        TestUtils.Simulate.change($addNodesSection.find('.setup-input-port')[0], {target: {value: '1337'}});
-        TestUtils.Simulate.change($addNodesSection.find('.input-remote-node')[0], {target: {value: 'node2.local'}});
-
-        var additionalNode = Stores.setupStore.getAdditionalNode();
-        assert.equal(additionalNode.bindAddress, '192.168.13.37');
-        assert.equal(additionalNode.remoteAddress, 'node2.local');
-        assert.equal(additionalNode.port, '1337');
-      });
-
-      it('changes the values in the store for the setup node', function () {
-        var $setupNodesSection = $(ReactDOM.findDOMNode(controller)).find('.setup-setupnode-section');
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-input-ip')[0], {target: {value: '192.168.42.42'}});
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-input-port')[0], {target: {value: '4242'}});
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-username')[0], {target: {value: 'tester'}});
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-password')[0], {target: {value: 'testerpass'}});
-
-
-        assert.equal(Stores.setupStore.getBindAdressForSetupNode(), '192.168.42.42');
-        assert.equal(Stores.setupStore.getPortForSetupNode(), '4242');
-        assert.equal(Stores.setupStore.getUsername(), 'tester');
-        assert.equal(Stores.setupStore.getPassword(), 'testerpass');
-      });
-
-    });*/
-
-    describe('SingleNodeSetup', function () {
-      var controller, changeHandler, container;
-
-      beforeEach(function () {
-        sinon.stub(Stores.setupStore, 'getIsAdminParty', function () { return false; });
-        container = document.createElement('div');
-        controller = TestUtils.renderIntoDocument(
-          <Views.SetupSingleNodeController />,
-          container
-        );
-      });
-
-      afterEach(function () {
-        utils.restore(Stores.setupStore.getIsAdminParty);
-        ReactDOM.unmountComponentAtNode(container);
-        Stores.setupStore.reset();
-      });
-
-      it('changes the values in the store for the setup node', function () {
-        var $setupNodesSection = $(ReactDOM.findDOMNode(controller)).find('.setup-setupnode-section');
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-input-ip')[0], {target: {value: '192.168.13.42'}});
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-input-port')[0], {target: {value: '1342'}});
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-username')[0], {target: {value: 'tester'}});
-        TestUtils.Simulate.change($setupNodesSection.find('.setup-password')[0], {target: {value: 'testerpass'}});
-
-        assert.equal(Stores.setupStore.getBindAdressForSetupNode(), '192.168.13.42');
-        assert.equal(Stores.setupStore.getPortForSetupNode(), '1342');
-        assert.equal(Stores.setupStore.getUsername(), 'tester');
-        assert.equal(Stores.setupStore.getPassword(), 'testerpass');
-      });
+    afterEach(function () {
+      utils.restore(Stores.setupStore.getIsAdminParty);
+      ReactDOM.unmountComponentAtNode(container);
+      Stores.setupStore.reset();
+    });
 
+    it('changes the values in the store for the setup node', function () {
+      var $setupNodesSection = $(ReactDOM.findDOMNode(controller)).find('.setup-setupnode-section');
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-input-ip')[0], {target: {value: '192.168.13.42'}});
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-input-port')[0], {target: {value: '1342'}});
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-username')[0], {target: {value: 'tester'}});
+      TestUtils.Simulate.change($setupNodesSection.find('.setup-password')[0], {target: {value: 'testerpass'}});
+
+      assert.equal(Stores.setupStore.getBindAdressForSetupNode(), '192.168.13.42');
+      assert.equal(Stores.setupStore.getPortForSetupNode(), '1342');
+      assert.equal(Stores.setupStore.getUsername(), 'tester');
+      assert.equal(Stores.setupStore.getPassword(), 'testerpass');
     });
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/setup/tests/setupSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/setup/tests/setupSpec.js b/app/addons/setup/tests/setupSpec.js
index 4ccf221..78267ba 100644
--- a/app/addons/setup/tests/setupSpec.js
+++ b/app/addons/setup/tests/setupSpec.js
@@ -9,66 +9,63 @@
 // 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',
-  '../../../../test/mocha/testUtils'
-], function (FauxtonAPI, Resources, testUtils) {
-  var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox,
-      model;
+import FauxtonAPI from "../../../core/api";
+import Resources from "../resources";
+import testUtils from "../../../../test/mocha/testUtils";
+var assert = testUtils.assert,
+    ViewSandbox = testUtils.ViewSandbox,
+    model;
 
-  describe('Setup: verify input', function () {
+describe('Setup: verify input', function () {
 
-    beforeEach(function () {
-      model = new Resources.Model();
-    });
-
-    it('You have to set a username', function () {
-      var error = model.validate({
-        admin: {
-          user: '',
-          password: 'ente'
-        }
-      });
+  beforeEach(function () {
+    model = new Resources.Model();
+  });
 
-      assert.ok(error);
+  it('You have to set a username', function () {
+    var error = model.validate({
+      admin: {
+        user: '',
+        password: 'ente'
+      }
     });
 
-    it('You have to set a password', function () {
-      var error = model.validate({
-        admin: {
-          user: 'rocko',
-          password: ''
-        }
-      });
+    assert.ok(error);
+  });
 
-      assert.ok(error);
+  it('You have to set a password', function () {
+    var error = model.validate({
+      admin: {
+        user: 'rocko',
+        password: ''
+      }
     });
 
-    it('Port must be a number, if defined', function () {
-      var error = model.validate({
-        admin: {
-          user: 'rocko',
-          password: 'ente'
-        },
-        port: 'port'
-      });
+    assert.ok(error);
+  });
 
-      assert.ok(error);
+  it('Port must be a number, if defined', function () {
+    var error = model.validate({
+      admin: {
+        user: 'rocko',
+        password: 'ente'
+      },
+      port: 'port'
     });
 
-    it('Bind address can not be 127.0.0.1', function () {
-      var error = model.validate({
-        admin: {
-          user: 'rocko',
-          password: 'ente'
-        },
-        bind_address: '127.0.0.1'
-      });
+    assert.ok(error);
+  });
 
-      assert.ok(error);
+  it('Bind address can not be 127.0.0.1', function () {
+    var error = model.validate({
+      admin: {
+        user: 'rocko',
+        password: 'ente'
+      },
+      bind_address: '127.0.0.1'
     });
 
+    assert.ok(error);
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/styletests/base.js
----------------------------------------------------------------------
diff --git a/app/addons/styletests/base.js b/app/addons/styletests/base.js
index 3bdcb17..dc57ef4 100644
--- a/app/addons/styletests/base.js
+++ b/app/addons/styletests/base.js
@@ -10,25 +10,20 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  "./routes",
-  "./assets/less/styletests.less"
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import tests from "./routes";
+import "./assets/less/styletests.less";
 
-function (app, FauxtonAPI, tests) {
+tests.initialize = function () {
 
-  tests.initialize = function () {
+  FauxtonAPI.addHeaderLink({
+    title: "Tests",
+    href: '#/tests',
+    bottomNav: true,
+    icon: "fonticon-wrench"
+  });
 
-    FauxtonAPI.addHeaderLink({
-      title: "Tests",
-      href: '#/tests',
-      bottomNav: true,
-      icon: "fonticon-wrench"
-    });
+};
 
-  };
-
-  return tests;
-});
+export default tests;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/styletests/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/styletests/routes.js b/app/addons/styletests/routes.js
index 0a0a803..c931317 100644
--- a/app/addons/styletests/routes.js
+++ b/app/addons/styletests/routes.js
@@ -10,33 +10,27 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "app",
-  "api",
-  'addons/styletests/styletests.react'
-],
+import app from "app";
+import FauxtonAPI from "api";
+import StyleTests from "addons/styletests/styletests.react";
 
-function (app, FauxtonAPI, StyleTests) {
+var TestRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: "one_pane",
+  routes: {
+    "tests": "initialize"
+  },
 
-  var TestRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: "one_pane",
-    routes: {
-      "tests": "initialize"
-    },
+  selectedHeader: 'theme tests',
 
-    selectedHeader: 'theme tests',
+  crumbs:[],
 
-    crumbs:[],
-
-    apiUrl: function () {
-      return false;
-    },
-
-    initialize: function () {
-      this.setComponent('#dashboard-content', StyleTests.StyleTests);
-    }
-  });
-
-  return {RouteObjects: [TestRouteObject]};
+  apiUrl: function () {
+    return false;
+  },
 
+  initialize: function () {
+    this.setComponent('#dashboard-content', StyleTests.StyleTests);
+  }
 });
+
+export default {RouteObjects: [TestRouteObject]};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.react.jsx b/app/addons/fauxton/components.react.jsx
index ede501c..1ae7be1 100644
--- a/app/addons/fauxton/components.react.jsx
+++ b/app/addons/fauxton/components.react.jsx
@@ -10,422 +10,411 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  'react-dom',
-  'zeroclipboard',
-  'react-bootstrap',
-
-  // needed to run the test individually. Don't remove
-  "velocity-animate/velocity",
-  "velocity-animate/velocity.ui",
-  "zeroclipboard/dist/ZeroClipboard.swf"
-],
-
-function (app, FauxtonAPI, React, ReactDOM, ZeroClipboard, ReactBootstrap) {
-
-  var Modal = ReactBootstrap.Modal;
-
-
-  function getZeroClipboardSwfPath () {
-    return './dashboard.assets/ZeroClipboard.swf';
-  }
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import ZeroClipboard from "zeroclipboard";
+import { Modal } from "react-bootstrap";
+import "velocity-animate/velocity";
+import "velocity-animate/velocity.ui";
+import "zeroclipboard/dist/ZeroClipboard.swf";
+
+function getZeroClipboardSwfPath () {
+  return './dashboard.assets/ZeroClipboard.swf';
+}
+
+// super basic right now, but can be expanded later to handle all the varieties of copy-to-clipboards
+// (target content element, custom label, classes, notifications, etc.)
+var Clipboard = React.createClass({
+  propTypes: function () {
+    return {
+      text: React.PropTypes.string.isRequired,
+      displayType: React.PropTypes.string.oneOf(['icon', 'text'])
+    };
+  },
+
+  getDefaultProps: function () {
+    return {
+      displayType: 'icon',
+      textDisplay: 'Copy',
+      onClipboardClick: function () { },
+      title: 'Copy to clipboard'
+    };
+  },
+
+  componentWillMount: function () {
+    ZeroClipboard.config({ swfPath: getZeroClipboardSwfPath() });
+  },
+
+  getClipboardElement: function () {
+    if (this.props.displayType === 'icon') {
+      return (<i className="fontawesome icon-paste"></i>);
+    }
+    return this.props.textDisplay;
+  },
 
-  // super basic right now, but can be expanded later to handle all the varieties of copy-to-clipboards
-  // (target content element, custom label, classes, notifications, etc.)
-  var Clipboard = React.createClass({
-    propTypes: function () {
-      return {
-        text: React.PropTypes.string.isRequired,
-        displayType: React.PropTypes.string.oneOf(['icon', 'text'])
-      };
-    },
-
-    getDefaultProps: function () {
-      return {
-        displayType: 'icon',
-        textDisplay: 'Copy',
-        onClipboardClick: function () { },
-        title: 'Copy to clipboard'
-      };
-    },
-
-    componentWillMount: function () {
-      ZeroClipboard.config({ swfPath: getZeroClipboardSwfPath() });
-    },
-
-    getClipboardElement: function () {
-      if (this.props.displayType === 'icon') {
-        return (<i className="fontawesome icon-paste"></i>);
-      }
-      return this.props.textDisplay;
-    },
-
-    componentDidMount: function () {
-      var el = ReactDOM.findDOMNode(this);
-        this.clipboard = new ZeroClipboard(el);
-        this.clipboard.on('ready', function () {
-          this.clipboard.on('copy', function () {
-            this.props.onClipboardClick();
-          }.bind(this));
+  componentDidMount: function () {
+    var el = ReactDOM.findDOMNode(this);
+      this.clipboard = new ZeroClipboard(el);
+      this.clipboard.on('ready', function () {
+        this.clipboard.on('copy', function () {
+          this.props.onClipboardClick();
         }.bind(this));
+      }.bind(this));
 
-        this.clipboard.on('error', function (event) {
-          console.log( 'ZeroClipboard error of type "' + event.name + '": ' + event.message );
-        });
-    },
+      this.clipboard.on('error', function (event) {
+        console.log( 'ZeroClipboard error of type "' + event.name + '": ' + event.message );
+      });
+  },
+
+  onClick: function (event) {
+    event.preventDefault();
+  },
+
+  render: function () {
+    return (
+      <a href="#"
+        onClick={this.onClick}
+        ref="copy"
+        className="copy clipboard-copy-element"
+        data-clipboard-text={this.props.text}
+        data-bypass="true"
+        title={this.props.title}
+      >
+        {this.getClipboardElement()}
+      </a>
+    );
+  }
+});
 
-    onClick: function (event) {
-      event.preventDefault();
-    },
+// use like this:
+//  <ComponentsReact.ClipboardWithTextField textToCopy={yourText} uniqueKey={someUniqueValue}>
+//  </ComponentsReact.ClipboardWithTextField>
+// pass in the text and a unique key, the key has to be unique or you'll get a warning
+var ClipboardWithTextField = React.createClass({
+  propTypes: {
+    onClipBoardClick: React.PropTypes.func.isRequired,
+    textToCopy: React.PropTypes.string.isRequired,
+    uniqueKey: React.PropTypes.string.isRequired,
+    showCopyIcon: React.PropTypes.bool
+  },
+
+  getDefaultProps: function () {
+    return {
+      showCopyIcon: true,
+      text: 'Copy'
+    };
+  },
+
+  componentWillMount: function () {
+    ZeroClipboard.config({ swfPath: getZeroClipboardSwfPath() });
+  },
+
+  componentDidMount: function () {
+    var el = ReactDOM.findDOMNode(this.refs["copy-text-" + this.props.uniqueKey]);
+    this.clipboard = new ZeroClipboard(el);
+    this.clipboard.on('ready', function () {
+      this.clipboard.on('copy', function () {
+        this.props.onClipBoardClick();
+      }.bind(this));
+    }.bind(this));
+  },
 
-    render: function () {
-      return (
-        <a href="#"
-          onClick={this.onClick}
-          ref="copy"
-          className="copy clipboard-copy-element"
-          data-clipboard-text={this.props.text}
+  getCopyIcon: function () {
+    if (!this.props.showCopyIcon) {
+      return null;
+    }
+    return (<i className="fontawesome icon-paste"></i>);
+  },
+
+  render: function () {
+    return (
+      <p key={this.props.uniqueKey}>
+        <input
+          type="text"
+          className="input-xxlarge text-field-to-copy"
+          readOnly
+          value={this.props.textToCopy} />
+        <a
+          id={"copy-text-" + this.props.uniqueKey}
+          className="btn copy-button clipboard-copy-element"
+          data-clipboard-text={this.props.textToCopy}
           data-bypass="true"
-          title={this.props.title}
+          ref={"copy-text-" + this.props.uniqueKey}
+          title="Copy to clipboard"
         >
-          {this.getClipboardElement()}
+          {this.getCopyIcon()} {this.props.text}
         </a>
-      );
-    }
-  });
-
-  // use like this:
-  //  <ComponentsReact.ClipboardWithTextField textToCopy={yourText} uniqueKey={someUniqueValue}>
-  //  </ComponentsReact.ClipboardWithTextField>
-  // pass in the text and a unique key, the key has to be unique or you'll get a warning
-  var ClipboardWithTextField = React.createClass({
-    propTypes: {
-      onClipBoardClick: React.PropTypes.func.isRequired,
-      textToCopy: React.PropTypes.string.isRequired,
-      uniqueKey: React.PropTypes.string.isRequired,
-      showCopyIcon: React.PropTypes.bool
-    },
-
-    getDefaultProps: function () {
-      return {
-        showCopyIcon: true,
-        text: 'Copy'
-      };
-    },
-
-    componentWillMount: function () {
-      ZeroClipboard.config({ swfPath: getZeroClipboardSwfPath() });
-    },
-
-    componentDidMount: function () {
-      var el = ReactDOM.findDOMNode(this.refs["copy-text-" + this.props.uniqueKey]);
-      this.clipboard = new ZeroClipboard(el);
-      this.clipboard.on('ready', function () {
-        this.clipboard.on('copy', function () {
-          this.props.onClipBoardClick();
-        }.bind(this));
-      }.bind(this));
-    },
-
-    getCopyIcon: function () {
-      if (!this.props.showCopyIcon) {
-        return null;
-      }
-      return (<i className="fontawesome icon-paste"></i>);
-    },
+      </p>
+    );
+  }
+});
 
-    render: function () {
-      return (
-        <p key={this.props.uniqueKey}>
-          <input
-            type="text"
-            className="input-xxlarge text-field-to-copy"
-            readOnly
-            value={this.props.textToCopy} />
-          <a
-            id={"copy-text-" + this.props.uniqueKey}
-            className="btn copy-button clipboard-copy-element"
-            data-clipboard-text={this.props.textToCopy}
-            data-bypass="true"
-            ref={"copy-text-" + this.props.uniqueKey}
-            title="Copy to clipboard"
-          >
-            {this.getCopyIcon()} {this.props.text}
-          </a>
-        </p>
-      );
+// formats a block of code and pretty-prints it in the page. Currently uses the prettyPrint plugin
+var CodeFormat = React.createClass({
+  getDefaultProps: function () {
+    return {
+      lang: "js"
+    };
+  },
+
+  getClasses: function () {
+    // added for forward compatibility. This component defines an api via it's props so you can pass lang="N" and
+    // not the class that prettyprint requires for that lang. If (when, hopefully!) we drop prettyprint we won't
+    // have any change this component's props API and break things
+    var classMap = {
+      js: 'lang-js'
+    };
+
+    var classNames = 'prettyprint';
+    if (_.has(classMap, this.props.lang)) {
+      classNames += ' ' + classMap[this.props.lang];
     }
-  });
-
-  // formats a block of code and pretty-prints it in the page. Currently uses the prettyPrint plugin
-  var CodeFormat = React.createClass({
-    getDefaultProps: function () {
-      return {
-        lang: "js"
-      };
-    },
-
-    getClasses: function () {
-      // added for forward compatibility. This component defines an api via it's props so you can pass lang="N" and
-      // not the class that prettyprint requires for that lang. If (when, hopefully!) we drop prettyprint we won't
-      // have any change this component's props API and break things
-      var classMap = {
-        js: 'lang-js'
-      };
-
-      var classNames = 'prettyprint';
-      if (_.has(classMap, this.props.lang)) {
-        classNames += ' ' + classMap[this.props.lang];
-      }
-      return classNames;
-    },
+    return classNames;
+  },
+
+  componentDidMount: function () {
+    // this one function is all the lib offers. It parses the entire page and pretty-prints anything with
+    // a .prettyprint class; only executes on an element once
+    prettyPrint();
+  },
+
+  render: function () {
+    var code = JSON.stringify(this.props.code, null, " ");
+    return (
+      <div><pre className={this.getClasses()}>{code}</pre></div>
+    );
+  }
+});
 
-    componentDidMount: function () {
-      // this one function is all the lib offers. It parses the entire page and pretty-prints anything with
-      // a .prettyprint class; only executes on an element once
-      prettyPrint();
-    },
+var _NextTrayInternalId = 0;
+var Tray = React.createClass({
+
+  propTypes: {
+    onAutoHide: React.PropTypes.func
+  },
+
+  getDefaultProps: function () {
+    return {
+      onAutoHide: function () { }
+    };
+  },
+
+  getInitialState: function () {
+    return {
+      show: false,
+      internalid: (_NextTrayInternalId++)
+    };
+  },
+
+  toggle: function (done) {
+    if (this.state.show) {
+      this.hide(done);
+    } else {
+      this.show(done);
+    }
+  },
 
-    render: function () {
-      var code = JSON.stringify(this.props.code, null, " ");
-      return (
-        <div><pre className={this.getClasses()}>{code}</pre></div>
-      );
+  setVisible: function (visible, done) {
+    if (this.state.show && !visible) {
+      this.hide(done);
+    } else if (!this.state.show && visible) {
+      this.show(done);
     }
-  });
-
-  var _NextTrayInternalId = 0;
-  var Tray = React.createClass({
-
-    propTypes: {
-      onAutoHide: React.PropTypes.func
-    },
-
-    getDefaultProps: function () {
-      return {
-        onAutoHide: function () { }
-      };
-    },
-
-    getInitialState: function () {
-      return {
-        show: false,
-        internalid: (_NextTrayInternalId++)
-      };
-    },
-
-    toggle: function (done) {
-      if (this.state.show) {
-        this.hide(done);
-      } else {
-        this.show(done);
+  },
+
+  componentDidMount: function () {
+    $('body').on('click.Tray-' + this.state.internalid, function (e) {
+      var tgt = $(e.target);
+      if (this.state.show && tgt.closest('.tray').length === 0) {
+        this.hide();
+        this.props.onAutoHide();
       }
-    },
-
-    setVisible: function (visible, done) {
-      if (this.state.show && !visible) {
-        this.hide(done);
-      } else if (!this.state.show && visible) {
-        this.show(done);
+    }.bind(this));
+  },
+
+  componentWillUnmount: function () {
+    $('body').off('click.Tray-' + this.state.internalid);
+  },
+
+  show: function (done) {
+    this.setState({show: true});
+    $(ReactDOM.findDOMNode(this.refs.myself)).velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
+      if (done) {
+        done(true);
       }
-    },
-
-    componentDidMount: function () {
-      $('body').on('click.Tray-' + this.state.internalid, function (e) {
-        var tgt = $(e.target);
-        if (this.state.show && tgt.closest('.tray').length === 0) {
-          this.hide();
-          this.props.onAutoHide();
-        }
-      }.bind(this));
-    },
-
-    componentWillUnmount: function () {
-      $('body').off('click.Tray-' + this.state.internalid);
-    },
-
-    show: function (done) {
-      this.setState({show: true});
-      $(ReactDOM.findDOMNode(this.refs.myself)).velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
-        if (done) {
-          done(true);
-        }
-      });
-    },
-
-    hide: function (done) {
-      $(ReactDOM.findDOMNode(this.refs.myself)).velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
-        this.setState({show: false});
-        if (done) {
-          done(false);
-        }
-      }.bind(this));
-    },
+    });
+  },
+
+  hide: function (done) {
+    $(ReactDOM.findDOMNode(this.refs.myself)).velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
+      this.setState({show: false});
+      if (done) {
+        done(false);
+      }
+    }.bind(this));
+  },
+
+  render: function () {
+    var styleSpec = this.state.show ? {"display": "block", "opacity": 1} :  {"display": "none", "opacity": 0};
+    var classSpec = this.props.className || "";
+    classSpec += " tray";
+    return (
+      <div ref="myself" style={styleSpec} className={classSpec}>{this.props.children}</div>
+    );
+  }
+});
 
-    render: function () {
-      var styleSpec = this.state.show ? {"display": "block", "opacity": 1} :  {"display": "none", "opacity": 0};
-      var classSpec = this.props.className || "";
-      classSpec += " tray";
-      return (
-        <div ref="myself" style={styleSpec} className={classSpec}>{this.props.children}</div>
-      );
-    }
-  });
-
-
-  var Pagination = React.createClass({
-
-    getDefaultProps: function () {
-      return {
-        perPage: FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE,
-        onClick: null,
-        page: 1,
-        total: 0,
-        urlPrefix: '',
-        urlSuffix: '',
-        maxNavPages: 10
-      };
-    },
-
-    getVisiblePages: function (page, totalPages) {
-      var from, to;
-      if (totalPages < this.props.maxNavPages) {
+
+var Pagination = React.createClass({
+
+  getDefaultProps: function () {
+    return {
+      perPage: FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE,
+      onClick: null,
+      page: 1,
+      total: 0,
+      urlPrefix: '',
+      urlSuffix: '',
+      maxNavPages: 10
+    };
+  },
+
+  getVisiblePages: function (page, totalPages) {
+    var from, to;
+    if (totalPages < this.props.maxNavPages) {
+      from = 1;
+      to = totalPages + 1;
+    } else {
+      var halfMaxNavPages = Math.floor(this.props.maxNavPages / 2);
+      from = page - halfMaxNavPages;
+      to = page + halfMaxNavPages;
+      if (from <= 1) {
         from = 1;
-        to = totalPages + 1;
-      } else {
-        var halfMaxNavPages = Math.floor(this.props.maxNavPages / 2);
-        from = page - halfMaxNavPages;
-        to = page + halfMaxNavPages;
-        if (from <= 1) {
-          from = 1;
-          to = this.props.maxNavPages + 1;
-        }
-        if (to > totalPages + 1) {
-          from = totalPages - (this.props.maxNavPages - 1);
-          to = totalPages + 1;
-        }
+        to = this.props.maxNavPages + 1;
       }
-      return {
-        from: from,
-        to: to
-      };
-    },
-
-    createItemsForPage: function (visiblePages) {
-      return _.range(visiblePages.from, visiblePages.to).map(function (i) {
-        return (
-          <li key={i} className={(this.props.page === i ? 'active' : null)}>
-            {this.getLink(i, i)}
-          </li>
-        );
-      }.bind(this));
-    },
-
-    getLink: function (i, label) {
-      if (this.props.onClick) {
-        return (
-          <a onClick={this.props.onClick.bind(null, i)} dangerouslySetInnerHTML={{__html: label}}></a>
-        );
+      if (to > totalPages + 1) {
+        from = totalPages - (this.props.maxNavPages - 1);
+        to = totalPages + 1;
       }
+    }
+    return {
+      from: from,
+      to: to
+    };
+  },
+
+  createItemsForPage: function (visiblePages) {
+    return _.range(visiblePages.from, visiblePages.to).map(function (i) {
       return (
-        <a href={this.props.urlPrefix + i + this.props.urlSuffix} dangerouslySetInnerHTML={{__html: label}}></a>
+        <li key={i} className={(this.props.page === i ? 'active' : null)}>
+          {this.getLink(i, i)}
+        </li>
       );
-    },
-
-    getTotalPages: function () {
-      return this.props.total === 0 ? 1 : Math.ceil(this.props.total / this.props.perPage);
-    },
-
-    render: function () {
-      var totalPages = this.getTotalPages();
-      var visiblePages = this.getVisiblePages(this.props.page, totalPages);
-      var rangeItems = this.createItemsForPage(visiblePages);
-      var prevPage = Math.max(this.props.page - 1, 1);
-      var nextPage = Math.min(this.props.page + 1, totalPages);
+    }.bind(this));
+  },
 
+  getLink: function (i, label) {
+    if (this.props.onClick) {
       return (
-        <ul className="pagination">
-          <li className={(this.props.page === 1 ? "disabled" : null)}>
-            {this.getLink(prevPage, '&laquo;')}
-          </li>
-          {rangeItems}
-          <li className={(this.props.page < totalPages ? null : "disabled")}>
-            {this.getLink(nextPage, '&raquo;')}
-          </li>
-        </ul>
+        <a onClick={this.props.onClick.bind(null, i)} dangerouslySetInnerHTML={{__html: label}}></a>
       );
     }
-  });
-
-
-  // a super-simple replacement for window.confirm()
-  var ConfirmationModal = React.createClass({
-    propTypes: {
-      visible: React.PropTypes.bool.isRequired,
-      text: React.PropTypes.oneOfType([
-        React.PropTypes.string,
-        React.PropTypes.element
-      ]).isRequired,
-      onClose: React.PropTypes.func.isRequired,
-      onSubmit: React.PropTypes.func.isRequired
-    },
-
-    getDefaultProps: function () {
-      return {
-        visible: false,
-        title: 'Please confirm',
-        text: '',
-        successButtonLabel: 'Okay',
-        buttonClass: 'btn-success',
-        onClose: function () { },
-        onSubmit: function () { }
-      };
-    },
-
-    close: function (e) {
-      if (e) {
-        e.preventDefault();
-      }
-      this.props.onClose();
-    },
+    return (
+      <a href={this.props.urlPrefix + i + this.props.urlSuffix} dangerouslySetInnerHTML={{__html: label}}></a>
+    );
+  },
+
+  getTotalPages: function () {
+    return this.props.total === 0 ? 1 : Math.ceil(this.props.total / this.props.perPage);
+  },
+
+  render: function () {
+    var totalPages = this.getTotalPages();
+    var visiblePages = this.getVisiblePages(this.props.page, totalPages);
+    var rangeItems = this.createItemsForPage(visiblePages);
+    var prevPage = Math.max(this.props.page - 1, 1);
+    var nextPage = Math.min(this.props.page + 1, totalPages);
+
+    return (
+      <ul className="pagination">
+        <li className={(this.props.page === 1 ? "disabled" : null)}>
+          {this.getLink(prevPage, '&laquo;')}
+        </li>
+        {rangeItems}
+        <li className={(this.props.page < totalPages ? null : "disabled")}>
+          {this.getLink(nextPage, '&raquo;')}
+        </li>
+      </ul>
+    );
+  }
+});
 
-    render: function () {
-      var content = <p>{this.props.text}</p>;
-      if (!_.isString(this.props.text)) {
-        content = this.props.text;
-      }
-      var btnClasses = 'btn ' + this.props.buttonClass;
 
-      return (
-        <Modal dialogClassName="confirmation-modal" show={this.props.visible} onHide={this.close}>
-          <Modal.Header closeButton={true}>
-            <Modal.Title>{this.props.title}</Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-            {content}
-          </Modal.Body>
-          <Modal.Footer>
-            <a href="#" data-bypass="true" className="cancel-link" onClick={this.close}>Cancel</a>
-            <button className={btnClasses} onClick={this.props.onSubmit}>
-              <i className="fonticon-ok-circled"></i> {this.props.successButtonLabel}
-            </button>
-          </Modal.Footer>
-        </Modal>
-      );
+// a super-simple replacement for window.confirm()
+var ConfirmationModal = React.createClass({
+  propTypes: {
+    visible: React.PropTypes.bool.isRequired,
+    text: React.PropTypes.oneOfType([
+      React.PropTypes.string,
+      React.PropTypes.element
+    ]).isRequired,
+    onClose: React.PropTypes.func.isRequired,
+    onSubmit: React.PropTypes.func.isRequired
+  },
+
+  getDefaultProps: function () {
+    return {
+      visible: false,
+      title: 'Please confirm',
+      text: '',
+      successButtonLabel: 'Okay',
+      buttonClass: 'btn-success',
+      onClose: function () { },
+      onSubmit: function () { }
+    };
+  },
+
+  close: function (e) {
+    if (e) {
+      e.preventDefault();
     }
-  });
+    this.props.onClose();
+  },
 
+  render: function () {
+    var content = <p>{this.props.text}</p>;
+    if (!_.isString(this.props.text)) {
+      content = this.props.text;
+    }
+    var btnClasses = 'btn ' + this.props.buttonClass;
+
+    return (
+      <Modal dialogClassName="confirmation-modal" show={this.props.visible} onHide={this.close}>
+        <Modal.Header closeButton={true}>
+          <Modal.Title>{this.props.title}</Modal.Title>
+        </Modal.Header>
+        <Modal.Body>
+          {content}
+        </Modal.Body>
+        <Modal.Footer>
+          <a href="#" data-bypass="true" className="cancel-link" onClick={this.close}>Cancel</a>
+          <button className={btnClasses} onClick={this.props.onSubmit}>
+            <i className="fonticon-ok-circled"></i> {this.props.successButtonLabel}
+          </button>
+        </Modal.Footer>
+      </Modal>
+    );
+  }
+});
 
-  return {
-    Clipboard: Clipboard,
-    ClipboardWithTextField: ClipboardWithTextField,
-    CodeFormat: CodeFormat,
-    Tray: Tray,
-    Pagination: Pagination,
-    ConfirmationModal: ConfirmationModal
-  };
 
-});
+export default {
+  Clipboard: Clipboard,
+  ClipboardWithTextField: ClipboardWithTextField,
+  CodeFormat: CodeFormat,
+  Tray: Tray,
+  Pagination: Pagination,
+  ConfirmationModal: ConfirmationModal
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/navigation/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/actions.js b/app/addons/fauxton/navigation/actions.js
index 12e4bcb..4870d1d 100644
--- a/app/addons/fauxton/navigation/actions.js
+++ b/app/addons/fauxton/navigation/actions.js
@@ -10,58 +10,54 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes'
-],
-function (app, FauxtonAPI, ActionTypes) {
-
-  return {
-    toggleNavbarMenu () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.TOGGLE_NAVBAR_MENU
-      });
-    },
-
-    addHeaderLink (link) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ADD_NAVBAR_LINK,
-        link: link
-      });
-    },
-
-    removeHeaderLink (link) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.REMOVE_NAVBAR_LINK,
-        link: link
-      });
-    },
-
-    setNavbarVersionInfo (versionInfo) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.NAVBAR_SET_VERSION_INFO,
-        version: versionInfo
-      });
-    },
-
-    setNavbarActiveLink (header) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.NAVBAR_ACTIVE_LINK,
-        name: header
-      });
-    },
-
-    showNavBar () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.NAVBAR_SHOW
-      });
-    },
-
-    hideNavBar () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.NAVBAR_HIDE
-      });
-    }
-  };
-});
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+
+export default {
+  toggleNavbarMenu () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.TOGGLE_NAVBAR_MENU
+    });
+  },
+
+  addHeaderLink (link) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ADD_NAVBAR_LINK,
+      link: link
+    });
+  },
+
+  removeHeaderLink (link) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.REMOVE_NAVBAR_LINK,
+      link: link
+    });
+  },
+
+  setNavbarVersionInfo (versionInfo) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.NAVBAR_SET_VERSION_INFO,
+      version: versionInfo
+    });
+  },
+
+  setNavbarActiveLink (header) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.NAVBAR_ACTIVE_LINK,
+      name: header
+    });
+  },
+
+  showNavBar () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.NAVBAR_SHOW
+    });
+  },
+
+  hideNavBar () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.NAVBAR_HIDE
+    });
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/navigation/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/actiontypes.js b/app/addons/fauxton/navigation/actiontypes.js
index 9c2aedd..b5515bd 100644
--- a/app/addons/fauxton/navigation/actiontypes.js
+++ b/app/addons/fauxton/navigation/actiontypes.js
@@ -10,16 +10,14 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    ADD_NAVBAR_LINK: 'ADD_NAVBAR_LINK',
-    TOGGLE_NAVBAR_MENU: 'TOGGLE_NAVBAR_MENU',
-    UPDATE_NAVBAR_LINK: 'UPDATE_NAVBAR_LINK',
-    CLEAR_NAVBAR_LINK: 'CLEAR_NAVBAR_LINK',
-    REMOVE_NAVBAR_LINK: 'REMOVE_NAVBAR_LINK',
-    NAVBAR_SET_VERSION_INFO: 'NAVBAR_SET_VERSION_INFO',
-    NAVBAR_ACTIVE_LINK: 'NAVBAR_ACTIVE_LINK',
-    NAVBAR_HIDE: 'NAVBAR_HIDE',
-    NAVBAR_SHOW: 'NAVBAR_SHOW'
-  };
-});
+export default {
+  ADD_NAVBAR_LINK: 'ADD_NAVBAR_LINK',
+  TOGGLE_NAVBAR_MENU: 'TOGGLE_NAVBAR_MENU',
+  UPDATE_NAVBAR_LINK: 'UPDATE_NAVBAR_LINK',
+  CLEAR_NAVBAR_LINK: 'CLEAR_NAVBAR_LINK',
+  REMOVE_NAVBAR_LINK: 'REMOVE_NAVBAR_LINK',
+  NAVBAR_SET_VERSION_INFO: 'NAVBAR_SET_VERSION_INFO',
+  NAVBAR_ACTIVE_LINK: 'NAVBAR_ACTIVE_LINK',
+  NAVBAR_HIDE: 'NAVBAR_HIDE',
+  NAVBAR_SHOW: 'NAVBAR_SHOW'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/navigation/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/components.react.jsx b/app/addons/fauxton/navigation/components.react.jsx
index 3e145d2..ed29b21 100644
--- a/app/addons/fauxton/navigation/components.react.jsx
+++ b/app/addons/fauxton/navigation/components.react.jsx
@@ -9,163 +9,157 @@
 // 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',
-  '../../../core/api',
-  'react',
-  'react-dom',
-  './stores',
-  './actions'
-],
-
-function (app, FauxtonAPI, React, ReactDOM, Stores, Actions) {
-  const navBarStore = Stores.navBarStore;
-
-  const Footer = React.createClass({
-    render () {
-      const version = this.props.version;
-
-      if (!version) { return null; }
-      return (
-        <div className="version-footer">
-          Fauxton on
-          <a href="http://couchdb.apache.org/"> Apache CouchDB</a>
-          <br/>
-          v. {version}
-        </div>
-      );
-    }
-  });
-
-  const Burger = React.createClass({
-    render () {
-      return (
-        <div className="burger" onClick={this.props.toggleMenu}>
-          <div></div>
-          <div></div>
-          <div></div>
-        </div>
-      );
-    }
-  });
-
-  const NavLink = React.createClass({
-    render () {
-      const link = this.props.link;
-      const liClassName = this.props.active === link.title ? 'active' : '';
-
-      return (
-        <li data-nav-name={link.title} className={liClassName} >
-          <a href={link.href} target={link.target ? '_blank' : null} data-bypass={link.target ? 'true' : null}>
-            <i className={link.icon + " fonticon "}></i>
-            <span dangerouslySetInnerHTML={{__html: link.title }} />
-          </a>
-        </li>
-      );
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Stores from "./stores";
+import Actions from "./actions";
+const navBarStore = Stores.navBarStore;
+
+const Footer = React.createClass({
+  render () {
+    const version = this.props.version;
+
+    if (!version) { return null; }
+    return (
+      <div className="version-footer">
+        Fauxton on
+        <a href="http://couchdb.apache.org/"> Apache CouchDB</a>
+        <br/>
+        v. {version}
+      </div>
+    );
+  }
+});
+
+const Burger = React.createClass({
+  render () {
+    return (
+      <div className="burger" onClick={this.props.toggleMenu}>
+        <div></div>
+        <div></div>
+        <div></div>
+      </div>
+    );
+  }
+});
+
+const NavLink = React.createClass({
+  render () {
+    const link = this.props.link;
+    const liClassName = this.props.active === link.title ? 'active' : '';
+
+    return (
+      <li data-nav-name={link.title} className={liClassName} >
+        <a href={link.href} target={link.target ? '_blank' : null} data-bypass={link.target ? 'true' : null}>
+          <i className={link.icon + " fonticon "}></i>
+          <span dangerouslySetInnerHTML={{__html: link.title }} />
+        </a>
+      </li>
+    );
+  }
+});
+
+const NavBar = React.createClass({
+  getStoreState () {
+    return {
+      navLinks: navBarStore.getNavLinks(),
+      bottomNavLinks: navBarStore.getBottomNavLinks(),
+      footerNavLinks: navBarStore.getFooterNavLinks(),
+      activeLink: navBarStore.getActiveLink(),
+      version: navBarStore.getVersion(),
+      isMinimized: navBarStore.isMinimized(),
+      isNavBarVisible: navBarStore.isNavBarVisible()
+    };
+  },
+
+  getInitialState () {
+    return this.getStoreState();
+  },
+
+  createLinks (links) {
+    return _.map(links, function (link, i) {
+      return <NavLink key={i} link={link} active={this.state.activeLink} />;
+    }, this);
+  },
+
+  onChange () {
+    this.setState(this.getStoreState());
+  },
+
+  setMenuState () {
+    $('body').toggleClass('closeMenu', this.state.isMinimized);
+    FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENTS.NAVBAR_SIZE_CHANGED, this.state.isMinimized);
+  },
+
+  componentDidMount () {
+    navBarStore.on('change', this.onChange, this);
+    this.setMenuState();
+  },
+
+  componentDidUpdate () {
+    this.setMenuState();
+  },
+
+  componentWillUnmount () {
+    navBarStore.off('change', this.onChange);
+  },
+
+  toggleMenu () {
+    Actions.toggleNavbarMenu();
+  },
+
+  render () {
+    //YUCK!! but we can only really fix this once we have removed all backbone
+    if (!this.state.isNavBarVisible) {
+      $('#primary-navbar').hide();
+      return null;
     }
-  });
-
-  const NavBar = React.createClass({
-    getStoreState () {
-      return {
-        navLinks: navBarStore.getNavLinks(),
-        bottomNavLinks: navBarStore.getBottomNavLinks(),
-        footerNavLinks: navBarStore.getFooterNavLinks(),
-        activeLink: navBarStore.getActiveLink(),
-        version: navBarStore.getVersion(),
-        isMinimized: navBarStore.isMinimized(),
-        isNavBarVisible: navBarStore.isNavBarVisible()
-      };
-    },
-
-    getInitialState () {
-      return this.getStoreState();
-    },
-
-    createLinks (links) {
-      return _.map(links, function (link, i) {
-        return <NavLink key={i} link={link} active={this.state.activeLink} />;
-      }, this);
-    },
-
-    onChange () {
-      this.setState(this.getStoreState());
-    },
-
-    setMenuState () {
-      $('body').toggleClass('closeMenu', this.state.isMinimized);
-      FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENTS.NAVBAR_SIZE_CHANGED, this.state.isMinimized);
-    },
-
-    componentDidMount () {
-      navBarStore.on('change', this.onChange, this);
-      this.setMenuState();
-    },
-
-    componentDidUpdate () {
-      this.setMenuState();
-    },
-
-    componentWillUnmount () {
-      navBarStore.off('change', this.onChange);
-    },
-
-    toggleMenu () {
-      Actions.toggleNavbarMenu();
-    },
-
-    render () {
-      //YUCK!! but we can only really fix this once we have removed all backbone
-      if (!this.state.isNavBarVisible) {
-        $('#primary-navbar').hide();
-        return null;
-      }
-
-      $('#primary-navbar').show();
-
-      const navLinks = this.createLinks(this.state.navLinks);
-      const bottomNavLinks = this.createLinks(this.state.bottomNavLinks);
-      const footerNavLinks = this.createLinks(this.state.footerNavLinks);
-
-      return (
-        <div className="navbar">
-          <Burger toggleMenu={this.toggleMenu}/>
-          <nav id="main_navigation">
-            <ul id="nav-links" className="nav">
-              {navLinks}
-            </ul>
 
-            <div id="bottom-nav">
-              <ul id="bottom-nav-links" className="nav">
-                {bottomNavLinks}
-              </ul>
-            </div>
-          </nav>
-          <div id="primary-nav-right-shadow"/>
-
-          <div className="bottom-container">
-            <div className="brand">
-              <div className="icon">Apache Fauxton</div>
-            </div>
-
-            <Footer version={this.state.version}/>
-            <div id="footer-links">
-              <ul id="footer-nav-links" className="nav">
-                {footerNavLinks}
-              </ul>
-            </div>
+    $('#primary-navbar').show();
+
+    const navLinks = this.createLinks(this.state.navLinks);
+    const bottomNavLinks = this.createLinks(this.state.bottomNavLinks);
+    const footerNavLinks = this.createLinks(this.state.footerNavLinks);
+
+    return (
+      <div className="navbar">
+        <Burger toggleMenu={this.toggleMenu}/>
+        <nav id="main_navigation">
+          <ul id="nav-links" className="nav">
+            {navLinks}
+          </ul>
+
+          <div id="bottom-nav">
+            <ul id="bottom-nav-links" className="nav">
+              {bottomNavLinks}
+            </ul>
           </div>
-        </div>
-      );
-    }
-  });
+        </nav>
+        <div id="primary-nav-right-shadow"/>
 
-  return {
-    renderNavBar (el) {
-      ReactDOM.render(<NavBar/>, el);
-    },
-    NavBar: NavBar,
-    Burger: Burger
-  };
+        <div className="bottom-container">
+          <div className="brand">
+            <div className="icon">Apache Fauxton</div>
+          </div>
 
+          <Footer version={this.state.version}/>
+          <div id="footer-links">
+            <ul id="footer-nav-links" className="nav">
+              {footerNavLinks}
+            </ul>
+          </div>
+        </div>
+      </div>
+    );
+  }
 });
+
+export default {
+  renderNavBar (el) {
+    ReactDOM.render(<NavBar/>, el);
+  },
+  NavBar: NavBar,
+  Burger: Burger
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/navigation/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/stores.js b/app/addons/fauxton/navigation/stores.js
index c45d194..5e781a8 100644
--- a/app/addons/fauxton/navigation/stores.js
+++ b/app/addons/fauxton/navigation/stores.js
@@ -10,196 +10,191 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes'
-],
-
-function (app, FauxtonAPI, ActionTypes) {
-  const Stores = {};
-
-
-  Stores.NavBarStore = FauxtonAPI.Store.extend({
-    initialize () {
-      this.reset();
-    },
-
-    reset () {
-      this._activeLink = null;
-      this._version = null;
-      this._navLinks = [];
-      this._footerNavLinks = [];
-      this._bottomNavLinks = [];
-      this._navBarVisible = true;
-    },
-
-    isNavBarVisible () {
-      return this._navBarVisible;
-    },
-
-    showNavBar () {
-      this._navBarVisible = true;
-    },
-
-    hideNavBar () {
-      this._navBarVisible = false;
-    },
-
-    addLink (link) {
-      if (link.top && !link.bottomNav) {
-        this._navLinks.unshift(link);
-        return;
-      }
-      if (link.top && link.bottomNav) {
-        this._bottomNavLinks.unshift(link);
-        return;
-      }
-      if (link.bottomNav) {
-        this._bottomNavLinks.push(link);
-        return;
-      }
-      if (link.footerNav) {
-        this._footerNavLinks.push(link);
-        return;
-      }
-
-      this._navLinks.push(link);
-    },
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+const Stores = {};
+
+
+Stores.NavBarStore = FauxtonAPI.Store.extend({
+  initialize () {
+    this.reset();
+  },
+
+  reset () {
+    this._activeLink = null;
+    this._version = null;
+    this._navLinks = [];
+    this._footerNavLinks = [];
+    this._bottomNavLinks = [];
+    this._navBarVisible = true;
+  },
+
+  isNavBarVisible () {
+    return this._navBarVisible;
+  },
+
+  showNavBar () {
+    this._navBarVisible = true;
+  },
+
+  hideNavBar () {
+    this._navBarVisible = false;
+  },
+
+  addLink (link) {
+    if (link.top && !link.bottomNav) {
+      this._navLinks.unshift(link);
+      return;
+    }
+    if (link.top && link.bottomNav) {
+      this._bottomNavLinks.unshift(link);
+      return;
+    }
+    if (link.bottomNav) {
+      this._bottomNavLinks.push(link);
+      return;
+    }
+    if (link.footerNav) {
+      this._footerNavLinks.push(link);
+      return;
+    }
 
-    removeLink (removeLink) {
-      const links = this.getLinkSection(removeLink);
-      let indexOf = 0;
+    this._navLinks.push(link);
+  },
 
-      const res = _.filter(links, function (link) {
-        if (link.id === removeLink.id) {
-          return true;
-        }
+  removeLink (removeLink) {
+    const links = this.getLinkSection(removeLink);
+    let indexOf = 0;
 
-        indexOf++;
-        return false;
-      });
+    const res = _.filter(links, function (link) {
+      if (link.id === removeLink.id) {
+        return true;
+      }
 
-      if (!res.length) { return; }
+      indexOf++;
+      return false;
+    });
 
-      links.splice(indexOf, 1);
-    },
+    if (!res.length) { return; }
 
-    getNavLinks () {
-      return this._navLinks;
-    },
+    links.splice(indexOf, 1);
+  },
 
-    getBottomNavLinks () {
-      return this._bottomNavLinks;
-    },
+  getNavLinks () {
+    return this._navLinks;
+  },
 
-    getFooterNavLinks () {
-      return this._footerNavLinks;
-    },
+  getBottomNavLinks () {
+    return this._bottomNavLinks;
+  },
 
-    toggleMenu () {
-      app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED,
-                                !this.isMinimized());
-    },
+  getFooterNavLinks () {
+    return this._footerNavLinks;
+  },
 
-    getLinkSection (link) {
-      let links = this._navLinks;
+  toggleMenu () {
+    app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED,
+                              !this.isMinimized());
+  },
 
-      if (link.bottomNav) {
-        links = this._bottomNavLinks;
-      }
+  getLinkSection (link) {
+    let links = this._navLinks;
 
-      if (link.footerNav) {
-        links = this._footerNavLinks;
-      }
+    if (link.bottomNav) {
+      links = this._bottomNavLinks;
+    }
 
-      return links;
-    },
+    if (link.footerNav) {
+      links = this._footerNavLinks;
+    }
 
-    updateLink (link) {
-      let oldLink;
-      const links = this.getLinkSection(link);
+    return links;
+  },
 
-      oldLink = _.find(links, function (oldLink) {
-        return oldLink.id === link.id;
-      });
+  updateLink (link) {
+    let oldLink;
+    const links = this.getLinkSection(link);
 
-      if (!oldLink) { return; }
+    oldLink = _.find(links, function (oldLink) {
+      return oldLink.id === link.id;
+    });
 
-      oldLink.title = link.title;
-      oldLink.href = link.href;
-    },
+    if (!oldLink) { return; }
 
-    getVersion () {
-      return this._version;
-    },
+    oldLink.title = link.title;
+    oldLink.href = link.href;
+  },
 
-    setVersion (version) {
-      this._version = version;
-    },
+  getVersion () {
+    return this._version;
+  },
 
-    getActiveLink () {
-      return this._activeLink;
-    },
+  setVersion (version) {
+    this._version = version;
+  },
 
-    setActiveLink (activeLink) {
-      this._activeLink = activeLink;
-    },
+  getActiveLink () {
+    return this._activeLink;
+  },
 
-    isMinimized () {
-      const isMinimized = app.utils.localStorageGet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED);
-      return (_.isUndefined(isMinimized)) ? false : isMinimized;
-    },
+  setActiveLink (activeLink) {
+    this._activeLink = activeLink;
+  },
 
-    dispatch (action) {
-      switch (action.type) {
-        case ActionTypes.ADD_NAVBAR_LINK:
-          this.addLink(action.link);
-        break;
+  isMinimized () {
+    const isMinimized = app.utils.localStorageGet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED);
+    return (_.isUndefined(isMinimized)) ? false : isMinimized;
+  },
 
-        case ActionTypes.TOGGLE_NAVBAR_MENU:
-          this.toggleMenu();
-        break;
+  dispatch (action) {
+    switch (action.type) {
+      case ActionTypes.ADD_NAVBAR_LINK:
+        this.addLink(action.link);
+      break;
 
-        case ActionTypes.UPDATE_NAVBAR_LINK:
-          this.updateLink(action.link);
-        break;
+      case ActionTypes.TOGGLE_NAVBAR_MENU:
+        this.toggleMenu();
+      break;
 
-        case ActionTypes.CLEAR_NAVBAR_LINK:
-          this.reset();
-        break;
+      case ActionTypes.UPDATE_NAVBAR_LINK:
+        this.updateLink(action.link);
+      break;
 
-        case ActionTypes.REMOVE_NAVBAR_LINK:
-          this.removeLink(action.link);
-        break;
+      case ActionTypes.CLEAR_NAVBAR_LINK:
+        this.reset();
+      break;
 
-        case ActionTypes.NAVBAR_SET_VERSION_INFO:
-          this.setVersion(action.version);
-        break;
+      case ActionTypes.REMOVE_NAVBAR_LINK:
+        this.removeLink(action.link);
+      break;
 
-        case ActionTypes.NAVBAR_ACTIVE_LINK:
-          this.setActiveLink(action.name);
-        break;
+      case ActionTypes.NAVBAR_SET_VERSION_INFO:
+        this.setVersion(action.version);
+      break;
 
-        case ActionTypes.NAVBAR_HIDE:
-          this.hideNavBar();
-        break;
+      case ActionTypes.NAVBAR_ACTIVE_LINK:
+        this.setActiveLink(action.name);
+      break;
 
-        case ActionTypes.NAVBAR_SHOW:
-          this.showNavBar();
-        break;
+      case ActionTypes.NAVBAR_HIDE:
+        this.hideNavBar();
+      break;
 
-        default:
-        return;
-        // do nothing
-      }
+      case ActionTypes.NAVBAR_SHOW:
+        this.showNavBar();
+      break;
 
-      this.triggerChange();
+      default:
+      return;
+      // do nothing
     }
-  });
-
-  Stores.navBarStore = new Stores.NavBarStore();
-  Stores.navBarStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.navBarStore.dispatch);
 
-  return Stores;
+    this.triggerChange();
+  }
 });
+
+Stores.navBarStore = new Stores.NavBarStore();
+Stores.navBarStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.navBarStore.dispatch);
+
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/navigation/tests/componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/tests/componentsSpec.react.jsx b/app/addons/fauxton/navigation/tests/componentsSpec.react.jsx
index b82dfa5..f14d960 100644
--- a/app/addons/fauxton/navigation/tests/componentsSpec.react.jsx
+++ b/app/addons/fauxton/navigation/tests/componentsSpec.react.jsx
@@ -9,68 +9,65 @@
 // 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',
-  '../components.react',
-  '../actions',
-  '../../../../core/auth',
-  '../../../auth/base',
-  '../../../../../test/mocha/testUtils',
-  "react",
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, Actions, Auth, BaseAuth, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../../core/api";
+import Views from "../components.react";
+import Actions from "../actions";
+import Auth from "../../../../core/auth";
+import BaseAuth from "../../../auth/base";
+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";
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('NavBar', function () {
+describe('NavBar', function () {
 
-    describe('burger', function () {
-      var container, burgerEl, toggleMenu;
+  describe('burger', function () {
+    var container, burgerEl, toggleMenu;
 
-      beforeEach(function () {
-        toggleMenu = sinon.spy();
-        container = document.createElement('div');
-        burgerEl = TestUtils.renderIntoDocument(<Views.Burger toggleMenu={toggleMenu} />, container);
-      });
-
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(container);
-      });
+    beforeEach(function () {
+      toggleMenu = sinon.spy();
+      container = document.createElement('div');
+      burgerEl = TestUtils.renderIntoDocument(<Views.Burger toggleMenu={toggleMenu} />, container);
+    });
 
-      it('dispatch TOGGLE_NAVBAR_MENU on click', function () {
-        TestUtils.Simulate.click(ReactDOM.findDOMNode(burgerEl));
-        assert.ok(toggleMenu.calledOnce);
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
 
+    it('dispatch TOGGLE_NAVBAR_MENU on click', function () {
+      TestUtils.Simulate.click(ReactDOM.findDOMNode(burgerEl));
+      assert.ok(toggleMenu.calledOnce);
     });
 
-    it('logout link only ever appears once', function () {
-      FauxtonAPI.auth = new Auth();
-      sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(true);
-      sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
-      sinon.stub(FauxtonAPI.session, 'user').returns({ name: 'test-user' });
-      BaseAuth.initialize();
+  });
 
-      var container = document.createElement('div');
-      var el = TestUtils.renderIntoDocument(<Views.NavBar />, container);
+  it('logout link only ever appears once', function () {
+    FauxtonAPI.auth = new Auth();
+    sinon.stub(FauxtonAPI.session, 'isLoggedIn').returns(true);
+    sinon.stub(FauxtonAPI.session, 'isAdminParty').returns(false);
+    sinon.stub(FauxtonAPI.session, 'user').returns({ name: 'test-user' });
+    BaseAuth.initialize();
 
-      FauxtonAPI.session.trigger('change');
+    var container = document.createElement('div');
+    var el = TestUtils.renderIntoDocument(<Views.NavBar />, container);
 
-      // confirm the logout link is present
-      var matches = ReactDOM.findDOMNode(el).outerHTML.match(/Logout/);
-      assert.equal(matches.length, 1);
+    FauxtonAPI.session.trigger('change');
 
-      // now confirm there's still only a single logout link after publishing multiple
-      FauxtonAPI.session.trigger('change');
-      FauxtonAPI.session.trigger('change');
-      matches = ReactDOM.findDOMNode(el).outerHTML.match(/Logout/);
-      assert.equal(matches.length, 1);
+    // confirm the logout link is present
+    var matches = ReactDOM.findDOMNode(el).outerHTML.match(/Logout/);
+    assert.equal(matches.length, 1);
 
-      FauxtonAPI.session.isLoggedIn.restore();
-      FauxtonAPI.session.user.restore();
-      FauxtonAPI.session.isAdminParty.restore();
-    });
+    // now confirm there's still only a single logout link after publishing multiple
+    FauxtonAPI.session.trigger('change');
+    FauxtonAPI.session.trigger('change');
+    matches = ReactDOM.findDOMNode(el).outerHTML.match(/Logout/);
+    assert.equal(matches.length, 1);
+
+    FauxtonAPI.session.isLoggedIn.restore();
+    FauxtonAPI.session.user.restore();
+    FauxtonAPI.session.isAdminParty.restore();
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/navigation/tests/storeSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/navigation/tests/storeSpec.js b/app/addons/fauxton/navigation/tests/storeSpec.js
index d8b97f8..778dac1 100644
--- a/app/addons/fauxton/navigation/tests/storeSpec.js
+++ b/app/addons/fauxton/navigation/tests/storeSpec.js
@@ -9,259 +9,256 @@
 // 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',
-  '../../../../../test/mocha/testUtils',
-  '../../../../core/api',
-  '../stores',
-], function (app, testUtils, FauxtonAPI, Stores) {
-  var assert = testUtils.assert;
-  var navBarStore = Stores.navBarStore;
-
-  describe('NavBarStore', function () {
-    beforeEach(function () {
+import app from "../../../../app";
+import testUtils from "../../../../../test/mocha/testUtils";
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../stores";
+var assert = testUtils.assert;
+var navBarStore = Stores.navBarStore;
+
+describe('NavBarStore', function () {
+  beforeEach(function () {
+    FauxtonAPI.dispatch({
+      type: 'CLEAR_NAVBAR_LINK',
+    });
+
+  });
+
+  describe('add links', function () {
+
+    it('to nav links', function () {
+      var link = {
+        id: 'mylink'
+      };
       FauxtonAPI.dispatch({
-        type: 'CLEAR_NAVBAR_LINK',
+        type: 'ADD_NAVBAR_LINK',
+        link: link
       });
 
+      assert.equal(navBarStore.getNavLinks()[0].id, link.id);
     });
 
-    describe('add links', function () {
+    it('to top nav links', function () {
+      var link1 = {
+        id: 'mylink1'
+      };
 
-      it('to nav links', function () {
-        var link = {
-          id: 'mylink'
-        };
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
-        });
+      var link2 = {
+        id: 'mylink2',
+        top: true
+      };
 
-        assert.equal(navBarStore.getNavLinks()[0].id, link.id);
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link1
       });
 
-      it('to top nav links', function () {
-        var link1 = {
-          id: 'mylink1'
-        };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link2
+      });
 
-        var link2 = {
-          id: 'mylink2',
-          top: true
-        };
+      assert.equal(navBarStore.getNavLinks()[0].id, link2.id);
+    });
 
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link1
-        });
+    it('to bottom nav', function () {
+      var link = {
+        id: 'bottomNav',
+        bottomNav: true
+      };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link
+      });
 
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link2
-        });
+      assert.equal(navBarStore.getBottomNavLinks()[0].id, link.id);
+    });
 
-        assert.equal(navBarStore.getNavLinks()[0].id, link2.id);
+    it('to top of bottom nav', function () {
+      var link = {
+        id: 'bottomNav',
+        bottomNav: true,
+        top: true
+      };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link
       });
 
-      it('to bottom nav', function () {
-        var link = {
-          id: 'bottomNav',
-          bottomNav: true
-        };
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
-        });
+      assert.equal(navBarStore.getBottomNavLinks()[0].id, link.id);
+    });
 
-        assert.equal(navBarStore.getBottomNavLinks()[0].id, link.id);
+    it('to footer nav', function () {
+      var link = {
+        id: 'footerNav',
+        footerNav: true
+      };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link
       });
 
-      it('to top of bottom nav', function () {
-        var link = {
-          id: 'bottomNav',
-          bottomNav: true,
-          top: true
-        };
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
-        });
+      assert.equal(navBarStore.getFooterNavLinks()[0].id, link.id);
+    });
+  });
 
-        assert.equal(navBarStore.getBottomNavLinks()[0].id, link.id);
+  describe('remove link', function () {
+    it('from nav links', function () {
+      var link = {
+        id: 'remove_link',
+      };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link
       });
 
-      it('to footer nav', function () {
-        var link = {
-          id: 'footerNav',
-          footerNav: true
-        };
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
-        });
-
-        assert.equal(navBarStore.getFooterNavLinks()[0].id, link.id);
+      FauxtonAPI.dispatch({
+        type: 'REMOVE_NAVBAR_LINK',
+        link: link
       });
+
+      assert.equal(navBarStore.getNavLinks().length, 0);
     });
 
-    describe('remove link', function () {
-      it('from nav links', function () {
-        var link = {
-          id: 'remove_link',
-        };
+    it('remove link from list', function () {
+      function addLink (id) {
         FauxtonAPI.dispatch({
           type: 'ADD_NAVBAR_LINK',
-          link: link
+          link: {
+            id: id,
+            footerNav: true
+          }
         });
-
+      }
+      function removeLink () {
         FauxtonAPI.dispatch({
           type: 'REMOVE_NAVBAR_LINK',
-          link: link
+          link: {
+            id: 'remove_link3',
+            footerNav: true
+          }
         });
+      }
+      addLink('remove_link1');
+      addLink('remove_link2');
+      addLink('remove_link3');
 
-        assert.equal(navBarStore.getNavLinks().length, 0);
-      });
+      removeLink();
+      removeLink();
+      removeLink();
 
-      it('remove link from list', function () {
-        function addLink (id) {
-          FauxtonAPI.dispatch({
-            type: 'ADD_NAVBAR_LINK',
-            link: {
-              id: id,
-              footerNav: true
-            }
-          });
-        }
-        function removeLink () {
-          FauxtonAPI.dispatch({
-            type: 'REMOVE_NAVBAR_LINK',
-            link: {
-              id: 'remove_link3',
-              footerNav: true
-            }
-          });
-        }
-        addLink('remove_link1');
-        addLink('remove_link2');
-        addLink('remove_link3');
-
-        removeLink();
-        removeLink();
-        removeLink();
-
-        assert.equal(navBarStore.getFooterNavLinks().length, 2);
-      });
-
-      it('from bottom nav links', function () {
-        var link = {
-          id: 'remove_link',
-          bottomNav: true
-        };
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
-        });
+      assert.equal(navBarStore.getFooterNavLinks().length, 2);
+    });
 
-        FauxtonAPI.dispatch({
-          type: 'REMOVE_NAVBAR_LINK',
-          link: link
-        });
+    it('from bottom nav links', function () {
+      var link = {
+        id: 'remove_link',
+        bottomNav: true
+      };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link
+      });
 
-        assert.equal(navBarStore.getBottomNavLinks().length, 0);
+      FauxtonAPI.dispatch({
+        type: 'REMOVE_NAVBAR_LINK',
+        link: link
       });
 
-      it('from footer nav links', function () {
-        var link = {
-          id: 'remove_link',
-          footerNav: true
-        };
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
-        });
+      assert.equal(navBarStore.getBottomNavLinks().length, 0);
+    });
 
-        FauxtonAPI.dispatch({
-          type: 'REMOVE_NAVBAR_LINK',
-          link: link
-        });
+    it('from footer nav links', function () {
+      var link = {
+        id: 'remove_link',
+        footerNav: true
+      };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link
+      });
 
-        assert.equal(navBarStore.getFooterNavLinks().length, 0);
+      FauxtonAPI.dispatch({
+        type: 'REMOVE_NAVBAR_LINK',
+        link: link
       });
-    });
 
-    describe('update link', function () {
-      it('for nav links', function () {
-        var link = {
-          id: 'update-link',
-          title: 'first'
-        };
-        FauxtonAPI.dispatch({
-          type: 'ADD_NAVBAR_LINK',
-          link: link
-        });
+      assert.equal(navBarStore.getFooterNavLinks().length, 0);
+    });
+  });
 
-        link.title = 'second';
+  describe('update link', function () {
+    it('for nav links', function () {
+      var link = {
+        id: 'update-link',
+        title: 'first'
+      };
+      FauxtonAPI.dispatch({
+        type: 'ADD_NAVBAR_LINK',
+        link: link
+      });
 
-        FauxtonAPI.dispatch({
-          type: 'UPDATE_NAVBAR_LINK',
-          link: link
-        });
+      link.title = 'second';
 
-        assert.equal(navBarStore.getNavLinks()[0].title, 'second');
+      FauxtonAPI.dispatch({
+        type: 'UPDATE_NAVBAR_LINK',
+        link: link
       });
 
+      assert.equal(navBarStore.getNavLinks()[0].title, 'second');
     });
 
-    describe('set version', function () {
-      it('stores version number', function () {
-        FauxtonAPI.dispatch({
-          type: 'NAVBAR_SET_VERSION_INFO',
-          version: 1234
-        });
+  });
 
-        assert.equal(navBarStore.getVersion(), 1234);
+  describe('set version', function () {
+    it('stores version number', function () {
+      FauxtonAPI.dispatch({
+        type: 'NAVBAR_SET_VERSION_INFO',
+        version: 1234
       });
 
+      assert.equal(navBarStore.getVersion(), 1234);
     });
 
-    describe('is Minimized', function () {
+  });
 
-      it('returns true if localstorage is true', function () {
-        app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, true);
-        assert.ok(navBarStore.isMinimized());
-      });
+  describe('is Minimized', function () {
 
-      it('returns false if localstorage is false', function () {
-        app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, false);
-        assert.notOk(navBarStore.isMinimized(), false);
-      });
+    it('returns true if localstorage is true', function () {
+      app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, true);
+      assert.ok(navBarStore.isMinimized());
+    });
 
-      it('returns false if localstorage is undefined', function () {
-        window.localStorage.removeItem(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED);
-        assert.notOk(navBarStore.isMinimized(), false);
-      });
+    it('returns false if localstorage is false', function () {
+      app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, false);
+      assert.notOk(navBarStore.isMinimized(), false);
     });
 
-    describe('toggleMenu', function () {
+    it('returns false if localstorage is undefined', function () {
+      window.localStorage.removeItem(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED);
+      assert.notOk(navBarStore.isMinimized(), false);
+    });
+  });
 
-      it('that is minimized changes to false', function () {
-        app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, true);
-        navBarStore.toggleMenu();
-        assert.notOk(navBarStore.isMinimized());
-      });
+  describe('toggleMenu', function () {
 
-      it('that is not minimized changes to true', function () {
-        app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, false);
-        navBarStore.toggleMenu();
-        assert.ok(navBarStore.isMinimized());
-      });
+    it('that is minimized changes to false', function () {
+      app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, true);
+      navBarStore.toggleMenu();
+      assert.notOk(navBarStore.isMinimized());
+    });
 
-      it('that is undefined changes to true', function () {
-        window.localStorage.removeItem(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED);
-        navBarStore.toggleMenu();
-        assert.ok(navBarStore.isMinimized());
-      });
+    it('that is not minimized changes to true', function () {
+      app.utils.localStorageSet(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED, false);
+      navBarStore.toggleMenu();
+      assert.ok(navBarStore.isMinimized());
+    });
 
+    it('that is undefined changes to true', function () {
+      window.localStorage.removeItem(FauxtonAPI.constants.LOCAL_STORAGE.SIDEBAR_MINIMIZED);
+      navBarStore.toggleMenu();
+      assert.ok(navBarStore.isMinimized());
     });
+
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/notifications/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/notifications/actions.js b/app/addons/fauxton/notifications/actions.js
index 91fa822..32f40ab 100644
--- a/app/addons/fauxton/notifications/actions.js
+++ b/app/addons/fauxton/notifications/actions.js
@@ -10,83 +10,78 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  './actiontypes'
-],
-function (FauxtonAPI, ActionTypes) {
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
 
-  function addNotification (notificationInfo) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.ADD_NOTIFICATION,
-      options: {
-        info: notificationInfo
-      }
-    });
-  }
+function addNotification (notificationInfo) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.ADD_NOTIFICATION,
+    options: {
+      info: notificationInfo
+    }
+  });
+}
 
-  function showNotificationCenter () {
-    FauxtonAPI.dispatch({ type: ActionTypes.SHOW_NOTIFICATION_CENTER });
-  }
+function showNotificationCenter () {
+  FauxtonAPI.dispatch({ type: ActionTypes.SHOW_NOTIFICATION_CENTER });
+}
 
-  function hideNotificationCenter () {
-    FauxtonAPI.dispatch({ type: ActionTypes.HIDE_NOTIFICATION_CENTER });
-  }
+function hideNotificationCenter () {
+  FauxtonAPI.dispatch({ type: ActionTypes.HIDE_NOTIFICATION_CENTER });
+}
 
-  function clearAllNotifications () {
-    FauxtonAPI.dispatch({ type: ActionTypes.CLEAR_ALL_NOTIFICATIONS });
-  }
+function clearAllNotifications () {
+  FauxtonAPI.dispatch({ type: ActionTypes.CLEAR_ALL_NOTIFICATIONS });
+}
 
-  function clearSingleNotification (notificationId) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.CLEAR_SINGLE_NOTIFICATION,
-      options: {
-        notificationId: notificationId
-      }
-    });
-  }
+function clearSingleNotification (notificationId) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.CLEAR_SINGLE_NOTIFICATION,
+    options: {
+      notificationId: notificationId
+    }
+  });
+}
 
-  function selectNotificationFilter (filter) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.SELECT_NOTIFICATION_FILTER,
-      options: {
-        filter: filter
-      }
-    });
-  }
+function selectNotificationFilter (filter) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SELECT_NOTIFICATION_FILTER,
+    options: {
+      filter: filter
+    }
+  });
+}
 
-  function startHidingNotification (notificationId) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.START_HIDING_NOTIFICATION,
-      options: {
-        notificationId: notificationId
-      }
-    });
-  }
+function startHidingNotification (notificationId) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.START_HIDING_NOTIFICATION,
+    options: {
+      notificationId: notificationId
+    }
+  });
+}
 
-  function hideNotification (notificationId) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.HIDE_NOTIFICATION,
-      options: {
-        notificationId: notificationId
-      }
-    });
-  }
+function hideNotification (notificationId) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.HIDE_NOTIFICATION,
+    options: {
+      notificationId: notificationId
+    }
+  });
+}
 
-  function hideAllVisibleNotifications () {
-    FauxtonAPI.dispatch({ type: ActionTypes.HIDE_ALL_NOTIFICATIONS });
-  }
+function hideAllVisibleNotifications () {
+  FauxtonAPI.dispatch({ type: ActionTypes.HIDE_ALL_NOTIFICATIONS });
+}
 
-  return {
-    addNotification: addNotification,
-    showNotificationCenter: showNotificationCenter,
-    hideNotificationCenter: hideNotificationCenter,
-    clearAllNotifications: clearAllNotifications,
-    clearSingleNotification: clearSingleNotification,
-    selectNotificationFilter: selectNotificationFilter,
-    startHidingNotification: startHidingNotification,
-    hideNotification: hideNotification,
-    hideAllVisibleNotifications: hideAllVisibleNotifications
-  };
-
-});
+export default {
+  addNotification: addNotification,
+  showNotificationCenter: showNotificationCenter,
+  hideNotificationCenter: hideNotificationCenter,
+  clearAllNotifications: clearAllNotifications,
+  clearSingleNotification: clearSingleNotification,
+  selectNotificationFilter: selectNotificationFilter,
+  startHidingNotification: startHidingNotification,
+  hideNotification: hideNotification,
+  hideAllVisibleNotifications: hideAllVisibleNotifications
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/notifications/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/notifications/actiontypes.js b/app/addons/fauxton/notifications/actiontypes.js
index e346c24..5c1a468 100644
--- a/app/addons/fauxton/notifications/actiontypes.js
+++ b/app/addons/fauxton/notifications/actiontypes.js
@@ -10,16 +10,14 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([],  function () {
-  return {
-    ADD_NOTIFICATION: 'ADD_NOTIFICATION',
-    SHOW_NOTIFICATION_CENTER: 'SHOW_NOTIFICATION_CENTER',
-    HIDE_NOTIFICATION_CENTER: 'HIDE_NOTIFICATION_CENTER',
-    CLEAR_SINGLE_NOTIFICATION: 'CLEAR_SINGLE_NOTIFICATION',
-    CLEAR_ALL_NOTIFICATIONS: 'CLEAR_ALL_NOTIFICATIONS',
-    SELECT_NOTIFICATION_FILTER: 'SELECT_NOTIFICATION_FILTER',
-    START_HIDING_NOTIFICATION: 'START_HIDING_NOTIFICATION',
-    HIDE_NOTIFICATION: 'HIDE_NOTIFICATION',
-    HIDE_ALL_NOTIFICATIONS: 'HIDE_ALL_NOTIFICATIONS'
-  };
-});
+export default {
+  ADD_NOTIFICATION: 'ADD_NOTIFICATION',
+  SHOW_NOTIFICATION_CENTER: 'SHOW_NOTIFICATION_CENTER',
+  HIDE_NOTIFICATION_CENTER: 'HIDE_NOTIFICATION_CENTER',
+  CLEAR_SINGLE_NOTIFICATION: 'CLEAR_SINGLE_NOTIFICATION',
+  CLEAR_ALL_NOTIFICATIONS: 'CLEAR_ALL_NOTIFICATIONS',
+  SELECT_NOTIFICATION_FILTER: 'SELECT_NOTIFICATION_FILTER',
+  START_HIDING_NOTIFICATION: 'START_HIDING_NOTIFICATION',
+  HIDE_NOTIFICATION: 'HIDE_NOTIFICATION',
+  HIDE_ALL_NOTIFICATIONS: 'HIDE_ALL_NOTIFICATIONS'
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/config/tests/configSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/config/tests/configSpec.js b/app/addons/config/tests/configSpec.js
index 8e79c80..885ba24 100644
--- a/app/addons/config/tests/configSpec.js
+++ b/app/addons/config/tests/configSpec.js
@@ -9,157 +9,154 @@
 // 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',
-  '../views',
-  '../../../../test/mocha/testUtils',
-  'sinon'
-], function (FauxtonAPI, Resources, Views, testUtils, sinon) {
-  var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox,
-      collection;
+import FauxtonAPI from "../../../core/api";
+import Resources from "../resources";
+import Views from "../views";
+import testUtils from "../../../../test/mocha/testUtils";
+import sinon from "sinon";
+var assert = testUtils.assert,
+    ViewSandbox = testUtils.ViewSandbox,
+    collection;
+
+beforeEach(function () {
+  var optionModels = [];
+
+  _.each([1, 2, 3], function (i) {
+    var model = new Resources.OptionModel({
+      section: "foo" + i,
+      name: "bar" + i,
+      options: [{
+        name: "testname"
+      }]
+    }, {node: 'foo'});
+
+    optionModels.push(model);
+  });
 
-  beforeEach(function () {
-    var optionModels = [];
-
-    _.each([1, 2, 3], function (i) {
-      var model = new Resources.OptionModel({
-        section: "foo" + i,
-        name: "bar" + i,
-        options: [{
-          name: "testname"
-        }]
-      }, {node: 'foo'});
-
-      optionModels.push(model);
+  collection = new Resources.Collection(optionModels, {node: 'foo'}, "foo");
+});
+
+describe("Config: Add Option Tray", function () {
+  var viewSandbox,
+      tray;
+
+  beforeEach(function (done) {
+    tray = new Views.AddConfigOptionsButton({
+      collection: collection
     });
 
-    collection = new Resources.Collection(optionModels, {node: 'foo'}, "foo");
+    viewSandbox = new ViewSandbox();
+    viewSandbox.renderView(tray, done);
   });
 
-  describe("Config: Add Option Tray", function () {
-    var viewSandbox,
-        tray;
-
-    beforeEach(function (done) {
-      tray = new Views.AddConfigOptionsButton({
-        collection: collection
-      });
+  afterEach(function () {
+    viewSandbox.remove();
+  });
 
-      viewSandbox = new ViewSandbox();
-      viewSandbox.renderView(tray, done);
-    });
+  it("looks if entries are new", function () {
+    tray.$('input[name="section"]').val("foo1");
+    tray.$('input[name="name"]').val("testname");
+    assert.ok(tray.isUniqueEntryInSection(collection));
 
-    afterEach(function () {
-      viewSandbox.remove();
-    });
+    tray.$('input[name="name"]').val("testname2");
+    assert.notOk(tray.isUniqueEntryInSection(collection));
+  });
 
-    it("looks if entries are new", function () {
-      tray.$('input[name="section"]').val("foo1");
-      tray.$('input[name="name"]').val("testname");
-      assert.ok(tray.isUniqueEntryInSection(collection));
+  it("does not send an error for a new section", function () {
+    tray.$('input[name="section"]').val("newsection");
+    tray.$('input[name="name"]').val("testname");
+    tray.$('input[name="value"]').val("testvalue");
+    var spy = sinon.spy(tray, "showError");
 
-      tray.$('input[name="name"]').val("testname2");
-      assert.notOk(tray.isUniqueEntryInSection(collection));
-    });
+    tray.createConfigOption();
+    assert.notOk(spy.called);
+  });
+});
 
-    it("does not send an error for a new section", function () {
-      tray.$('input[name="section"]').val("newsection");
-      tray.$('input[name="name"]').val("testname");
-      tray.$('input[name="value"]').val("testvalue");
-      var spy = sinon.spy(tray, "showError");
+describe("Config: Collection", function () {
+  it("looks if entries are new", function () {
+    assert.ok(collection.findEntryInSection("foo1", "testname"));
+    assert.notOk(collection.findEntryInSection("foo1", "testname2"));
+  });
 
-      tray.createConfigOption();
-      assert.notOk(spy.called);
-    });
+  it("returns false if findEntryInSection does not have the section", function () {
+    assert.notOk(collection.findEntryInSection("foo-not-exists", "testname"));
   });
+});
 
-  describe("Config: Collection", function () {
-    it("looks if entries are new", function () {
-      assert.ok(collection.findEntryInSection("foo1", "testname"));
-      assert.notOk(collection.findEntryInSection("foo1", "testname2"));
-    });
+describe("Config: TableRow", function () {
+  var tabMenu, optionModel;
 
-    it("returns false if findEntryInSection does not have the section", function () {
-      assert.notOk(collection.findEntryInSection("foo-not-exists", "testname"));
+  beforeEach(function () {
+    optionModel = new Resources.OptionModel({
+      section: "foo",
+      name: "bar"
+    }, {node: 'foo'});
+
+    tabMenu = new Views.TableRow({
+      model: optionModel,
+      uniqueName: function () {
+        return false;
+      }
     });
   });
 
-  describe("Config: TableRow", function () {
-    var tabMenu, optionModel;
-
-    beforeEach(function () {
-      optionModel = new Resources.OptionModel({
-        section: "foo",
-        name: "bar"
-      }, {node: 'foo'});
+  describe("editing Items", function () {
+    var viewSandbox;
+    beforeEach(function (done) {
+      viewSandbox = new ViewSandbox();
+      viewSandbox.renderView(tabMenu, done);
+    });
 
-      tabMenu = new Views.TableRow({
-        model: optionModel,
-        uniqueName: function () {
-          return false;
-        }
-      });
+    afterEach(function () {
+      viewSandbox.remove();
     });
 
-    describe("editing Items", function () {
-      var viewSandbox;
-      beforeEach(function (done) {
-        viewSandbox = new ViewSandbox();
-        viewSandbox.renderView(tabMenu, done);
-      });
+    it("click on save should save the model and render", function () {
+      var renderSpy = sinon.stub(tabMenu, 'render');
+      var saveSpy = sinon.stub(optionModel, 'save');
 
-      afterEach(function () {
-        viewSandbox.remove();
+      var $fields = tabMenu.$('.js-edit-value').filter(function (el) {
+        return $(this).find('[name="value"]').length;
       });
 
-      it("click on save should save the model and render", function () {
-        var renderSpy = sinon.stub(tabMenu, 'render');
-        var saveSpy = sinon.stub(optionModel, 'save');
+      $fields.find('.js-edit-value').trigger('dblclick');
+      $fields.find('.js-save-value').trigger('click');
 
-        var $fields = tabMenu.$('.js-edit-value').filter(function (el) {
-          return $(this).find('[name="value"]').length;
-        });
-
-        $fields.find('.js-edit-value').trigger('dblclick');
-        $fields.find('.js-save-value').trigger('click');
-
-        assert.ok(renderSpy.calledOnce);
-        assert.ok(saveSpy.calledOnce);
-      });
+      assert.ok(renderSpy.calledOnce);
+      assert.ok(saveSpy.calledOnce);
+    });
 
-      it("pressing enter should save the model and render", function () {
-        var renderSpy = sinon.stub(tabMenu, 'render');
-        var saveSpy = sinon.stub(optionModel, 'save');
+    it("pressing enter should save the model and render", function () {
+      var renderSpy = sinon.stub(tabMenu, 'render');
+      var saveSpy = sinon.stub(optionModel, 'save');
 
-        var e = $.Event("keyup");
-        e.keyCode = 13;
+      var e = $.Event("keyup");
+      e.keyCode = 13;
 
-        var $fields = tabMenu.$('.js-edit-value').filter(function (el) {
-          return $(this).find('[name="value"]').length;
-        });
+      var $fields = tabMenu.$('.js-edit-value').filter(function (el) {
+        return $(this).find('[name="value"]').length;
+      });
 
-        $fields.find('.js-value-input').trigger(e);
+      $fields.find('.js-value-input').trigger(e);
 
-        assert.ok(renderSpy.calledOnce);
-        assert.ok(saveSpy.calledOnce);
-      });
+      assert.ok(renderSpy.calledOnce);
+      assert.ok(saveSpy.calledOnce);
+    });
 
-      it("pressing Esc hides the field", function () {
-        var e = $.Event("keyup");
-        e.keyCode = 27;
-        tabMenu.$('.js-value-input').trigger(e);
+    it("pressing Esc hides the field", function () {
+      var e = $.Event("keyup");
+      e.keyCode = 27;
+      tabMenu.$('.js-value-input').trigger(e);
 
-        assert.ok(tabMenu.$('.js-edit-value-form').hasClass('js-hidden'));
-      });
+      assert.ok(tabMenu.$('.js-edit-value-form').hasClass('js-hidden'));
+    });
 
-      it("pressing Cancel hides the field", function () {
-        tabMenu.$('.js-edit-value').trigger('dblclick');
-        tabMenu.$('.js-cancel-value').trigger('click');
+    it("pressing Cancel hides the field", function () {
+      tabMenu.$('.js-edit-value').trigger('dblclick');
+      tabMenu.$('.js-cancel-value').trigger('click');
 
-        assert.ok(tabMenu.$('.js-edit-value-form').hasClass('js-hidden'));
-      });
+      assert.ok(tabMenu.$('.js-edit-value-form').hasClass('js-hidden'));
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/config/views.js
----------------------------------------------------------------------
diff --git a/app/addons/config/views.js b/app/addons/config/views.js
index 7c2d7b9..398e396 100644
--- a/app/addons/config/views.js
+++ b/app/addons/config/views.js
@@ -10,264 +10,260 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  "./resources",
-  "../fauxton/components"
-],
-function (app, FauxtonAPI, Config, Components) {
-  var Views = {};
-
-  Views.TableRow = FauxtonAPI.View.extend({
-    tagName: "tr",
-    className: "config-item",
-    template: "addons/config/templates/item",
-    events: {
-      "dblclick .js-edit-value": "editValue",
-      "click .js-delete-value": "deleteValue",
-      "click .js-cancel-value": "cancelEdit",
-      "click .js-save-value": "saveAndRender",
-      "keyup .js-value-input": "processKeyEvents"
-    },
-
-    deleteValue: function () {
-      var collection = this.collection,
-          result = confirm("Are you sure you want to delete this configuration value?");
-
-      if (!result) { return; }
-
-      this.model.destroy().done(function () {
-        collection.fetch({reset: true}).done(function () {
-          FauxtonAPI.Events.trigger("config:rerender");
-        });
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Config from "./resources";
+import Components from "../fauxton/components";
+var Views = {};
+
+Views.TableRow = FauxtonAPI.View.extend({
+  tagName: "tr",
+  className: "config-item",
+  template: "addons/config/templates/item",
+  events: {
+    "dblclick .js-edit-value": "editValue",
+    "click .js-delete-value": "deleteValue",
+    "click .js-cancel-value": "cancelEdit",
+    "click .js-save-value": "saveAndRender",
+    "keyup .js-value-input": "processKeyEvents"
+  },
+
+  deleteValue: function () {
+    var collection = this.collection,
+        result = confirm("Are you sure you want to delete this configuration value?");
+
+    if (!result) { return; }
+
+    this.model.destroy().done(function () {
+      collection.fetch({reset: true}).done(function () {
+        FauxtonAPI.Events.trigger("config:rerender");
       });
+    });
 
-      this.remove();
-    },
+    this.remove();
+  },
 
-    editValue: function (event) {
-      this.$(event.currentTarget).find(".js-show-value").addClass("js-hidden");
-      this.$(event.currentTarget).find(".js-edit-value-form").removeClass("js-hidden");
-      this.$(event.currentTarget).find(".js-value-input").focus();
-    },
+  editValue: function (event) {
+    this.$(event.currentTarget).find(".js-show-value").addClass("js-hidden");
+    this.$(event.currentTarget).find(".js-edit-value-form").removeClass("js-hidden");
+    this.$(event.currentTarget).find(".js-value-input").focus();
+  },
 
-    processKeyEvents: function (event) {
-      // Enter key
-      if (event.keyCode === 13) {
-        return this.saveAndRender(event);
-      }
-      // Esc key
-      if (event.keyCode === 27) {
-        return this.discardValue(event);
-      }
-    },
-
-    discardValue: function (event) {
-      this.$(event.currentTarget).parents('td').find(".js-edit-value-form").addClass("js-hidden");
-      this.$(event.currentTarget).parents('td').find(".js-show-value").removeClass("js-hidden");
-    },
-
-    cancelEdit: function (event) {
-      this.discardValue(event);
-    },
-
-    serialize: function () {
-      return {option: this.model.toJSON()};
-    },
-
-    saveAndRender: function (event) {
-      var options = {},
-          $input = this.$(event.currentTarget).parents('td').find(".js-value-input"),
-          sectionName,
-          nameInSectionExists;
-
-      options[$input.attr('name')] = $input.val();
-
-      if ($input.attr('name') === 'name') {
-        sectionName = this.model.get("section");
-        nameInSectionExists = this.collection.findEntryInSection(sectionName, $input.val());
-        if (nameInSectionExists) {
-          FauxtonAPI.addNotification({
-            msg: "This config already exists, enter a unique name",
-            type: "error",
-            clear: true
-          });
-        } else {
-          var newModel = this.model.clone();
-          newModel.save(options);
-          this.model.destroy();
-          this.model = newModel;
-          this.render();
-        }
+  processKeyEvents: function (event) {
+    // Enter key
+    if (event.keyCode === 13) {
+      return this.saveAndRender(event);
+    }
+    // Esc key
+    if (event.keyCode === 27) {
+      return this.discardValue(event);
+    }
+  },
+
+  discardValue: function (event) {
+    this.$(event.currentTarget).parents('td').find(".js-edit-value-form").addClass("js-hidden");
+    this.$(event.currentTarget).parents('td').find(".js-show-value").removeClass("js-hidden");
+  },
+
+  cancelEdit: function (event) {
+    this.discardValue(event);
+  },
+
+  serialize: function () {
+    return {option: this.model.toJSON()};
+  },
+
+  saveAndRender: function (event) {
+    var options = {},
+        $input = this.$(event.currentTarget).parents('td').find(".js-value-input"),
+        sectionName,
+        nameInSectionExists;
+
+    options[$input.attr('name')] = $input.val();
+
+    if ($input.attr('name') === 'name') {
+      sectionName = this.model.get("section");
+      nameInSectionExists = this.collection.findEntryInSection(sectionName, $input.val());
+      if (nameInSectionExists) {
+        FauxtonAPI.addNotification({
+          msg: "This config already exists, enter a unique name",
+          type: "error",
+          clear: true
+        });
       } else {
-        this.model.save(options);
+        var newModel = this.model.clone();
+        newModel.save(options);
+        this.model.destroy();
+        this.model = newModel;
         this.render();
       }
+    } else {
+      this.model.save(options);
+      this.render();
     }
+  }
 
-  });
-
-  Views.Table = FauxtonAPI.View.extend({
-    template: "addons/config/templates/dashboard",
-
-    initialize: function () {
-      this.listenTo(FauxtonAPI.Events, "config:newSection", this.render);
-      this.listenTo(FauxtonAPI.Events, "config:rerender", this.render);
-    },
-
-    beforeRender: function () {
-      var collection = this.collection;
-
-      this.collection.each(function (config) {
-        _.each(config.get("options"), function (option, index) {
-          this.insertView("table.config tbody", new Views.TableRow({
-            collection: collection,
-            model: new Config.OptionModel({
-              section: config.get("section"),
-              name: option.name,
-              value: option.value,
-              index: index
-            }, {node: this.collection.node})
-          }));
-        }, this);
-      }, this);
-    },
-
-    establish: function () {
-      return [this.collection.fetch()];
-    }
-  });
-
-  Views.ConfigHeader = FauxtonAPI.View.extend({
-    template: 'addons/config/templates/header',
-    className: 'header-right',
-
-    initialize: function () {
-      this.rightHeader = this.setView('#add-section-button', new Views.AddConfigOptionsButton({ collection: this.collection }));
-    }
-  });
-
-
-  Views.AddConfigOptionsButton = Components.Tray.extend({
-    template: 'addons/config/templates/add_config_option',
+});
 
-    events: {
-      'click #js-create-config-section': 'createConfigOption'
-    },
+Views.Table = FauxtonAPI.View.extend({
+  template: "addons/config/templates/dashboard",
+
+  initialize: function () {
+    this.listenTo(FauxtonAPI.Events, "config:newSection", this.render);
+    this.listenTo(FauxtonAPI.Events, "config:rerender", this.render);
+  },
+
+  beforeRender: function () {
+    var collection = this.collection;
+
+    this.collection.each(function (config) {
+      _.each(config.get("options"), function (option, index) {
+        this.insertView("table.config tbody", new Views.TableRow({
+          collection: collection,
+          model: new Config.OptionModel({
+            section: config.get("section"),
+            name: option.name,
+            value: option.value,
+            index: index
+          }, {node: this.collection.node})
+        }));
+      }, this);
+    }, this);
+  },
 
-    initialize: function () {
-      this.initTray({ toggleTrayBtnSelector: '#add-new-section' });
-    },
+  establish: function () {
+    return [this.collection.fetch()];
+  }
+});
 
-    processKey: function (e) {
-      if (e.which === 13) {
-        e.preventDefault();
-        this.createConfigOption();
-      }
-    },
+Views.ConfigHeader = FauxtonAPI.View.extend({
+  template: 'addons/config/templates/header',
+  className: 'header-right',
 
-    afterRender: function () {
-      this.sectionNames = _.map(this.collection.toJSON(), function (item) {
-        return item.section;
-      });
+  initialize: function () {
+    this.rightHeader = this.setView('#add-section-button', new Views.AddConfigOptionsButton({ collection: this.collection }));
+  }
+});
 
-      this.sectionTypeAhead = new Components.Typeahead({
-        source: this.sectionNames,
-        el: 'input[name="section"]'
-      });
-      this.sectionTypeAhead.render();
-    },
 
-    createConfigOption: function (e) {
-      if (e) {
-        e.preventDefault();
-      }
+Views.AddConfigOptionsButton = Components.Tray.extend({
+  template: 'addons/config/templates/add_config_option',
 
-      var section = this.$('input[name="section"]').val(),
-          name = this.$('input[name="name"]').val(),
-          value = this.$('input[name="value"]').val(),
-          collection = this.collection;
-
-      // perform a little validation, then submit
-      if (!section) {
-        this.showError('Please enter or select a section.');
-      } else if (!name) {
-        this.showError('Please add an option name.');
-      } else if (this.isUniqueEntryInSection(collection)) {
-        this.showError('The option have a unique name.');
-      } else if (!value) {
-        this.showError('Please add a value.');
-      } else {
-        this.submitForm();
-      }
-    },
+  events: {
+    'click #js-create-config-section': 'createConfigOption'
+  },
 
-    submitForm: function () {
+  initialize: function () {
+    this.initTray({ toggleTrayBtnSelector: '#add-new-section' });
+  },
 
-      var option = new Config.OptionModel({
-        section: this.$('input[name="section"]').val(),
-        name: this.$('input[name="name"]').val(),
-        value: this.$('input[name="value"]').val()
-      }, {node: this.collection.node});
-      option.save();
+  processKey: function (e) {
+    if (e.which === 13) {
+      e.preventDefault();
+      this.createConfigOption();
+    }
+  },
+
+  afterRender: function () {
+    this.sectionNames = _.map(this.collection.toJSON(), function (item) {
+      return item.section;
+    });
+
+    this.sectionTypeAhead = new Components.Typeahead({
+      source: this.sectionNames,
+      el: 'input[name="section"]'
+    });
+    this.sectionTypeAhead.render();
+  },
+
+  createConfigOption: function (e) {
+    if (e) {
+      e.preventDefault();
+    }
 
-      var section = this.collection.find(function (section) {
-        return section.get('section') === option.get('section');
+    var section = this.$('input[name="section"]').val(),
+        name = this.$('input[name="name"]').val(),
+        value = this.$('input[name="value"]').val(),
+        collection = this.collection;
+
+    // perform a little validation, then submit
+    if (!section) {
+      this.showError('Please enter or select a section.');
+    } else if (!name) {
+      this.showError('Please add an option name.');
+    } else if (this.isUniqueEntryInSection(collection)) {
+      this.showError('The option have a unique name.');
+    } else if (!value) {
+      this.showError('Please add a value.');
+    } else {
+      this.submitForm();
+    }
+  },
+
+  submitForm: function () {
+
+    var option = new Config.OptionModel({
+      section: this.$('input[name="section"]').val(),
+      name: this.$('input[name="name"]').val(),
+      value: this.$('input[name="value"]').val()
+    }, {node: this.collection.node});
+    option.save();
+
+    var section = this.collection.find(function (section) {
+      return section.get('section') === option.get('section');
+    });
+
+    if (section) {
+      section.get('options').push(option.attributes);
+    } else {
+      this.collection.add({
+        section: option.get('section'),
+        options: [option.attributes]
       });
+    }
 
-      if (section) {
-        section.get('options').push(option.attributes);
-      } else {
-        this.collection.add({
-          section: option.get('section'),
-          options: [option.attributes]
-        });
-      }
-
-      this.hideTray();
-      FauxtonAPI.Events.trigger('config:newSection');
-    },
+    this.hideTray();
+    FauxtonAPI.Events.trigger('config:newSection');
+  },
 
-    isUniqueEntryInSection: function (collection) {
-      var sectionName = this.$('input[name="section"]').val(),
-          entry = this.$('input[name="name"]').val();
+  isUniqueEntryInSection: function (collection) {
+    var sectionName = this.$('input[name="section"]').val(),
+        entry = this.$('input[name="name"]').val();
 
-      return collection.findEntryInSection(sectionName, entry);
-    },
+    return collection.findEntryInSection(sectionName, entry);
+  },
 
-    showError: function (msg) {
-      FauxtonAPI.addNotification({
-        msg: msg,
-        type: 'error',
-        clear: true
-      });
-    }
-  });
-
-  Views.Tabs = FauxtonAPI.View.extend({
-    className: "sidenav",
-    tagName: "nav",
-    template: 'addons/config/templates/sidebartabs',
-    initialize: function (options) {
-      this.sidebarItems = options.sidebarItems;
-    },
-
-    setSelectedTab: function (selectedTab) {
-      this.selectedTab = selectedTab;
-      this.$('li').removeClass('active');
-      this.$('a[data-type-select="' + this.selectedTab + '"]').parent("li").addClass('active');
-    },
-    afterRender: function () {
-      this.setSelectedTab(this.selectedTab);
-    },
-
-    serialize: function () {
-      return {
-        sidebarItems: this.sidebarItems
-      };
-    }
-  });
+  showError: function (msg) {
+    FauxtonAPI.addNotification({
+      msg: msg,
+      type: 'error',
+      clear: true
+    });
+  }
+});
 
-  return Views;
+Views.Tabs = FauxtonAPI.View.extend({
+  className: "sidenav",
+  tagName: "nav",
+  template: 'addons/config/templates/sidebartabs',
+  initialize: function (options) {
+    this.sidebarItems = options.sidebarItems;
+  },
+
+  setSelectedTab: function (selectedTab) {
+    this.selectedTab = selectedTab;
+    this.$('li').removeClass('active');
+    this.$('a[data-type-select="' + this.selectedTab + '"]').parent("li").addClass('active');
+  },
+  afterRender: function () {
+    this.setSelectedTab(this.selectedTab);
+  },
+
+  serialize: function () {
+    return {
+      sidebarItems: this.sidebarItems
+    };
+  }
 });
+
+export default Views;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/actions.js b/app/addons/cors/actions.js
index 7773bd5..039cb67 100644
--- a/app/addons/cors/actions.js
+++ b/app/addons/cors/actions.js
@@ -9,190 +9,186 @@
 // 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',
-  './actiontypes',
-  './resources'
-], function (FauxtonAPI, ActionTypes, Resources) {
-
-
-  return {
-    fetchAndEditCors: function (node) {
-      var cors = new Resources.Config({node: node});
-      var httpd = new Resources.Httpd({node: node});
-
-      FauxtonAPI.when([cors.fetch(), httpd.fetch()]).then(function () {
-        this.editCors({
-          origins: cors.get('origins'),
-          isEnabled: httpd.corsEnabled(),
-          node: node
-        });
-      }.bind(this));
-    },
-
-    editCors: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.EDIT_CORS,
-        options: options
-      });
-    },
-
-    toggleEnableCors: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.TOGGLE_ENABLE_CORS
-      });
-    },
-
-    addOrigin: function (origin) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CORS_ADD_ORIGIN,
-        origin: origin
-      });
-    },
-
-    originChange: function (isAllOrigins) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CORS_IS_ALL_ORIGINS,
-        isAllOrigins: isAllOrigins
-      });
-    },
-
-    deleteOrigin: function (origin) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CORS_DELETE_ORIGIN,
-        origin: origin
-      });
-    },
-
-    updateOrigin: function (updatedOrigin, originalOrigin) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CORS_UPDATE_ORIGIN,
-        updatedOrigin: updatedOrigin,
-        originalOrigin: originalOrigin
-      });
-    },
-
-    methodChange: function (httpMethod) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CORS_METHOD_CHANGE,
-        httpMethod: httpMethod
-      });
-    },
-
-    saveEnableCorsToHttpd: function (enableCors, node) {
-      var enableOption = new Resources.ConfigModel({
-        section: 'httpd',
-        attribute: 'enable_cors',
-        value: enableCors.toString(),
-        node: node
-      });
-
-      return enableOption.save();
-    },
-
-    saveCorsOrigins: function (origins, node) {
-      var allowOrigins = new Resources.ConfigModel({
-        section: 'cors',
-        attribute: 'origins',
-        value: origins,
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+import Resources from "./resources";
+
+export default {
+  fetchAndEditCors: function (node) {
+    var cors = new Resources.Config({node: node});
+    var httpd = new Resources.Httpd({node: node});
+
+    FauxtonAPI.when([cors.fetch(), httpd.fetch()]).then(function () {
+      this.editCors({
+        origins: cors.get('origins'),
+        isEnabled: httpd.corsEnabled(),
         node: node
       });
+    }.bind(this));
+  },
+
+  editCors: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.EDIT_CORS,
+      options: options
+    });
+  },
+
+  toggleEnableCors: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.TOGGLE_ENABLE_CORS
+    });
+  },
+
+  addOrigin: function (origin) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CORS_ADD_ORIGIN,
+      origin: origin
+    });
+  },
+
+  originChange: function (isAllOrigins) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CORS_IS_ALL_ORIGINS,
+      isAllOrigins: isAllOrigins
+    });
+  },
+
+  deleteOrigin: function (origin) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CORS_DELETE_ORIGIN,
+      origin: origin
+    });
+  },
+
+  updateOrigin: function (updatedOrigin, originalOrigin) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CORS_UPDATE_ORIGIN,
+      updatedOrigin: updatedOrigin,
+      originalOrigin: originalOrigin
+    });
+  },
+
+  methodChange: function (httpMethod) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CORS_METHOD_CHANGE,
+      httpMethod: httpMethod
+    });
+  },
+
+  saveEnableCorsToHttpd: function (enableCors, node) {
+    var enableOption = new Resources.ConfigModel({
+      section: 'httpd',
+      attribute: 'enable_cors',
+      value: enableCors.toString(),
+      node: node
+    });
+
+    return enableOption.save();
+  },
+
+  saveCorsOrigins: function (origins, node) {
+    var allowOrigins = new Resources.ConfigModel({
+      section: 'cors',
+      attribute: 'origins',
+      value: origins,
+      node: node
+    });
+
+    return allowOrigins.save();
+  },
+
+  saveCorsCredentials: function (node) {
+    var allowCredentials = new Resources.ConfigModel({
+      section: 'cors',
+      attribute: 'credentials',
+      value: 'true',
+      node: node
+    });
+
+    return allowCredentials.save();
+  },
+
+  saveCorsHeaders: function (node) {
+    var corsHeaders = new Resources.ConfigModel({
+      section: 'cors',
+      attribute: 'headers',
+      value: 'accept, authorization, content-type, origin, referer',
+      node: node
+    });
+
+    return corsHeaders.save();
+  },
+
+  saveCorsMethods: function (node) {
+    var corsMethods = new Resources.ConfigModel({
+      section: 'cors',
+      attribute: 'methods',
+      value: 'GET, PUT, POST, HEAD, DELETE',
+      node: node
+    });
+
+    return corsMethods.save();
+  },
+
+  sanitizeOrigins: function (origins) {
+    if (_.isEmpty(origins)) {
+      return '';
+    }
 
-      return allowOrigins.save();
-    },
+    return origins.join(',');
+  },
 
-    saveCorsCredentials: function (node) {
-      var allowCredentials = new Resources.ConfigModel({
-        section: 'cors',
-        attribute: 'credentials',
-        value: 'true',
-        node: node
-      });
+  toggleLoadingBarsToEnabled: function (state) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CORS_SET_IS_LOADING,
+      isLoading: state
+    });
+  },
 
-      return allowCredentials.save();
-    },
+  saveCors: function (options) {
+    this.toggleLoadingBarsToEnabled(true);
 
-    saveCorsHeaders: function (node) {
-      var corsHeaders = new Resources.ConfigModel({
-        section: 'cors',
-        attribute: 'headers',
-        value: 'accept, authorization, content-type, origin, referer',
-        node: node
-      });
+    var promises = [];
+    promises.push(this.saveEnableCorsToHttpd(options.enableCors, options.node));
 
-      return corsHeaders.save();
-    },
+    if (options.enableCors) {
+      promises.push(this.saveCorsOrigins(this.sanitizeOrigins(options.origins), options.node));
+      promises.push(this.saveCorsCredentials(options.node));
+      promises.push(this.saveCorsHeaders(options.node));
+      promises.push(this.saveCorsMethods(options.node));
+    }
 
-    saveCorsMethods: function (node) {
-      var corsMethods = new Resources.ConfigModel({
-        section: 'cors',
-        attribute: 'methods',
-        value: 'GET, PUT, POST, HEAD, DELETE',
-        node: node
+    FauxtonAPI.when(promises).then(function () {
+      FauxtonAPI.addNotification({
+        msg: 'Cors settings updated.',
+        type: 'success',
+        clear: true
       });
 
-      return corsMethods.save();
-    },
+      this.hideDeleteDomainModal(); // just in case it was already open
+      this.toggleLoadingBarsToEnabled(false);
 
-    sanitizeOrigins: function (origins) {
-      if (_.isEmpty(origins)) {
-        return '';
-      }
-
-      return origins.join(',');
-    },
-
-    toggleLoadingBarsToEnabled: function (state) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CORS_SET_IS_LOADING,
-        isLoading: state
+    }.bind(this), function () {
+      FauxtonAPI.addNotification({
+        msg: 'Error! Could not save your CORS settings. Please try again.',
+        type: 'error',
+        clear: true
       });
-    },
-
-    saveCors: function (options) {
-      this.toggleLoadingBarsToEnabled(true);
-
-      var promises = [];
-      promises.push(this.saveEnableCorsToHttpd(options.enableCors, options.node));
-
-      if (options.enableCors) {
-        promises.push(this.saveCorsOrigins(this.sanitizeOrigins(options.origins), options.node));
-        promises.push(this.saveCorsCredentials(options.node));
-        promises.push(this.saveCorsHeaders(options.node));
-        promises.push(this.saveCorsMethods(options.node));
+      this.toggleLoadingBarsToEnabled(false);
+    }.bind(this));
+  },
+
+  showDeleteDomainModal: function (domain) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.CORS_SHOW_DELETE_DOMAIN_MODAL,
+      options: {
+        domain: domain
       }
+    });
+  },
 
-      FauxtonAPI.when(promises).then(function () {
-        FauxtonAPI.addNotification({
-          msg: 'Cors settings updated.',
-          type: 'success',
-          clear: true
-        });
-
-        this.hideDeleteDomainModal(); // just in case it was already open
-        this.toggleLoadingBarsToEnabled(false);
-
-      }.bind(this), function () {
-        FauxtonAPI.addNotification({
-          msg: 'Error! Could not save your CORS settings. Please try again.',
-          type: 'error',
-          clear: true
-        });
-        this.toggleLoadingBarsToEnabled(false);
-      }.bind(this));
-    },
-
-    showDeleteDomainModal: function (domain) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.CORS_SHOW_DELETE_DOMAIN_MODAL,
-        options: {
-          domain: domain
-        }
-      });
-    },
-
-    hideDeleteDomainModal: function () {
-      FauxtonAPI.dispatch({ type: ActionTypes.CORS_HIDE_DELETE_DOMAIN_MODAL });
-    }
-  };
-});
+  hideDeleteDomainModal: function () {
+    FauxtonAPI.dispatch({ type: ActionTypes.CORS_HIDE_DELETE_DOMAIN_MODAL });
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/actiontypes.js b/app/addons/cors/actiontypes.js
index d75109f..81ebd7f 100644
--- a/app/addons/cors/actiontypes.js
+++ b/app/addons/cors/actiontypes.js
@@ -9,17 +9,15 @@
 // 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([], function () {
-  return {
-    TOGGLE_ENABLE_CORS: 'TOGGLE_ENABLE_CORS',
-    EDIT_CORS: 'EDIT_CORS',
-    CORS_ADD_ORIGIN: 'CORS_ADD_ORIGIN',
-    CORS_IS_ALL_ORIGINS: 'CORS_IS_ALL_ORIGINS',
-    CORS_DELETE_ORIGIN: 'CORS_DELETE_ORIGIN',
-    CORS_UPDATE_ORIGIN: 'CORS_UPDATE_ORIGIN',
-    CORS_METHOD_CHANGE: 'CORS_METHOD_CHANGE',
-    CORS_SET_IS_LOADING: 'CORS_SET_IS_LOADING',
-    CORS_SHOW_DELETE_DOMAIN_MODAL: 'CORS_SHOW_DELETE_DOMAIN_MODAL',
-    CORS_HIDE_DELETE_DOMAIN_MODAL: 'CORS_HIDE_DELETE_DOMAIN_MODAL'
-  };
-});
+export default {
+  TOGGLE_ENABLE_CORS: 'TOGGLE_ENABLE_CORS',
+  EDIT_CORS: 'EDIT_CORS',
+  CORS_ADD_ORIGIN: 'CORS_ADD_ORIGIN',
+  CORS_IS_ALL_ORIGINS: 'CORS_IS_ALL_ORIGINS',
+  CORS_DELETE_ORIGIN: 'CORS_DELETE_ORIGIN',
+  CORS_UPDATE_ORIGIN: 'CORS_UPDATE_ORIGIN',
+  CORS_METHOD_CHANGE: 'CORS_METHOD_CHANGE',
+  CORS_SET_IS_LOADING: 'CORS_SET_IS_LOADING',
+  CORS_SHOW_DELETE_DOMAIN_MODAL: 'CORS_SHOW_DELETE_DOMAIN_MODAL',
+  CORS_HIDE_DELETE_DOMAIN_MODAL: 'CORS_HIDE_DELETE_DOMAIN_MODAL'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/base.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/base.js b/app/addons/cors/base.js
index f3d13d7..6c32bd4 100644
--- a/app/addons/cors/base.js
+++ b/app/addons/cors/base.js
@@ -10,16 +10,11 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  './assets/less/cors.less'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import "./assets/less/cors.less";
+var CORS = FauxtonAPI.addon();
 
-function (app, FauxtonAPI) {
-  var CORS = FauxtonAPI.addon();
+CORS.initialize = function () {};
 
-  CORS.initialize = function () {};
-
-  return CORS;
-});
+export default CORS;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/cors/components.react.jsx b/app/addons/cors/components.react.jsx
index 760f5f6..8cd42d2 100644
--- a/app/addons/cors/components.react.jsx
+++ b/app/addons/cors/components.react.jsx
@@ -10,361 +10,358 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  "react",
-  "./stores",
-  "./resources",
-  "./actions",
-  '../components/react-components.react',
-  '../fauxton/components.react'
-], function (app, FauxtonAPI, React, Stores, Resources, Actions, ReactComponents, FauxtonComponents) {
-  var LoadLines = ReactComponents.LoadLines;
-  var ConfirmationModal = FauxtonComponents.ConfirmationModal;
-
-  var corsStore = Stores.corsStore;
-
-
-  var validateOrigin = function (origin) {
-    if (!Resources.validateCORSDomain(origin)) {
-      FauxtonAPI.addNotification({
-        msg: 'Please enter a valid domain, starting with http/https.',
-        type: 'error',
-        clear: true
-      });
-
-      return false;
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import Stores from "./stores";
+import Resources from "./resources";
+import Actions from "./actions";
+import ReactComponents from "../components/react-components.react";
+import FauxtonComponents from "../fauxton/components.react";
+var LoadLines = ReactComponents.LoadLines;
+var ConfirmationModal = FauxtonComponents.ConfirmationModal;
+
+var corsStore = Stores.corsStore;
+
+
+var validateOrigin = function (origin) {
+  if (!Resources.validateCORSDomain(origin)) {
+    FauxtonAPI.addNotification({
+      msg: 'Please enter a valid domain, starting with http/https.',
+      type: 'error',
+      clear: true
+    });
+
+    return false;
+  }
+
+  return true;
+};
+
+
+var OriginRow = React.createClass({
+
+  getInitialState: function () {
+    return {
+      edit: false,
+      updatedOrigin: this.props.origin
+    };
+  },
+
+  editOrigin: function (e) {
+    e.preventDefault();
+    this.setState({ edit: !this.state.edit });
+  },
+
+  updateOrigin: function (e) {
+    e.preventDefault();
+    if (!validateOrigin(this.state.updatedOrigin)) {
+      return;
     }
+    this.props.updateOrigin(this.state.updatedOrigin, this.props.origin);
+    this.setState({ edit: false });
+  },
+
+  deleteOrigin: function (e) {
+    e.preventDefault();
+    Actions.showDeleteDomainModal(this.props.origin);
+  },
+
+  onInputChange: function (event) {
+    this.setState({ updatedOrigin: event.target.value });
+  },
+
+  onKeyUp: function (e) {
+    if (e.keyCode === 13) {   //enter key
+      return this.updateOrigin(e);
+    }
+  },
 
-    return true;
-  };
-
-
-  var OriginRow = React.createClass({
-
-    getInitialState: function () {
-      return {
-        edit: false,
-        updatedOrigin: this.props.origin
-      };
-    },
-
-    editOrigin: function (e) {
-      e.preventDefault();
-      this.setState({ edit: !this.state.edit });
-    },
-
-    updateOrigin: function (e) {
-      e.preventDefault();
-      if (!validateOrigin(this.state.updatedOrigin)) {
-        return;
-      }
-      this.props.updateOrigin(this.state.updatedOrigin, this.props.origin);
-      this.setState({ edit: false });
-    },
-
-    deleteOrigin: function (e) {
-      e.preventDefault();
-      Actions.showDeleteDomainModal(this.props.origin);
-    },
-
-    onInputChange: function (event) {
-      this.setState({ updatedOrigin: event.target.value });
-    },
-
-    onKeyUp: function (e) {
-      if (e.keyCode === 13) {   //enter key
-        return this.updateOrigin(e);
-      }
-    },
-
-    createOriginDisplay: function () {
-      if (this.state.edit) {
-        return (
-          <div className="input-append edit-domain-section">
-            <input type="text" name="update_origin_domain" onChange={this.onInputChange} onKeyUp={this.onKeyUp} value={this.state.updatedOrigin} />
-            <button onClick={this.updateOrigin} className="btn btn-primary update-origin"> Update </button>
-          </div>
-        );
-      }
-      return <div className="js-url url-display">{this.props.origin}</div>;
-    },
-
-    render: function () {
-      var display = this.createOriginDisplay();
+  createOriginDisplay: function () {
+    if (this.state.edit) {
       return (
-        <tr>
-          <td>
-            {display}
-          </td>
-          <td width="30">
-            <span>
-              <a className="fonticon-pencil" onClick={this.editOrigin} title="Click to edit" />
-            </span>
-          </td>
-          <td width="30">
-            <span>
-              <a href="#" data-bypass="true" className="fonticon-trash" onClick={this.deleteOrigin} title="Click to delete" />
-            </span>
-          </td>
-        </tr>
+        <div className="input-append edit-domain-section">
+          <input type="text" name="update_origin_domain" onChange={this.onInputChange} onKeyUp={this.onKeyUp} value={this.state.updatedOrigin} />
+          <button onClick={this.updateOrigin} className="btn btn-primary update-origin"> Update </button>
+        </div>
       );
     }
+    return <div className="js-url url-display">{this.props.origin}</div>;
+  },
+
+  render: function () {
+    var display = this.createOriginDisplay();
+    return (
+      <tr>
+        <td>
+          {display}
+        </td>
+        <td width="30">
+          <span>
+            <a className="fonticon-pencil" onClick={this.editOrigin} title="Click to edit" />
+          </span>
+        </td>
+        <td width="30">
+          <span>
+            <a href="#" data-bypass="true" className="fonticon-trash" onClick={this.deleteOrigin} title="Click to delete" />
+          </span>
+        </td>
+      </tr>
+    );
+  }
 
-  });
-
-  var OriginTable = React.createClass({
-
-    createRows: function () {
-      return _.map(this.props.origins, function (origin, i) {
-        return <OriginRow
-          updateOrigin={this.props.updateOrigin}
-          key={i} origin={origin} />;
-      }, this);
-    },
+});
 
-    render: function () {
-      if (!this.props.origins) {
-        return null;
-      }
+var OriginTable = React.createClass({
 
-      if (!this.props.isVisible || this.props.origins.length === 0) {
-        return null;
-      }
+  createRows: function () {
+    return _.map(this.props.origins, function (origin, i) {
+      return <OriginRow
+        updateOrigin={this.props.updateOrigin}
+        key={i} origin={origin} />;
+    }, this);
+  },
 
-      var origins = this.createRows();
+  render: function () {
+    if (!this.props.origins) {
+      return null;
+    }
 
-      return (
-        <table id="origin-domain-table" className="table table-striped">
-          <tbody>
-            {origins}
-          </tbody>
-        </table>
-      );
+    if (!this.props.isVisible || this.props.origins.length === 0) {
+      return null;
     }
 
-  });
+    var origins = this.createRows();
 
-  var OriginInput = React.createClass({
-    getInitialState: function () {
-      return {
-        origin: ''
-      };
-    },
+    return (
+      <table id="origin-domain-table" className="table table-striped">
+        <tbody>
+          {origins}
+        </tbody>
+      </table>
+    );
+  }
 
-    onInputChange: function (e) {
-      this.setState({origin: e.target.value});
-    },
+});
 
-    addOrigin: function (event) {
-      event.preventDefault();
-      if (!validateOrigin(this.state.origin)) {
-        return;
-      }
+var OriginInput = React.createClass({
+  getInitialState: function () {
+    return {
+      origin: ''
+    };
+  },
+
+  onInputChange: function (e) {
+    this.setState({origin: e.target.value});
+  },
+
+  addOrigin: function (event) {
+    event.preventDefault();
+    if (!validateOrigin(this.state.origin)) {
+      return;
+    }
 
-      var url = Resources.normalizeUrls(this.state.origin);
+    var url = Resources.normalizeUrls(this.state.origin);
 
-      this.props.addOrigin(url);
-      this.setState({origin: ''});
-    },
+    this.props.addOrigin(url);
+    this.setState({origin: ''});
+  },
 
-    onKeyUp: function (e) {
-      if (e.keyCode == 13) {   //enter key
-        return this.addOrigin(e);
-      }
-    },
+  onKeyUp: function (e) {
+    if (e.keyCode == 13) {   //enter key
+      return this.addOrigin(e);
+    }
+  },
 
-    render: function () {
-      if (!this.props.isVisible) {
-        return null;
-      }
+  render: function () {
+    if (!this.props.isVisible) {
+      return null;
+    }
 
-      return (
-        <div id="origin-domains-container">
-          <div className="origin-domains">
-            <div className="input-append">
-              <input type="text" name="new_origin_domain" onChange={this.onInputChange} onKeyUp={this.onKeyUp} value={this.state.origin} placeholder="e.g., https://site.com"/>
-              <button onClick={this.addOrigin} className="btn btn-primary add-domain"> Add </button>
-            </div>
+    return (
+      <div id="origin-domains-container">
+        <div className="origin-domains">
+          <div className="input-append">
+            <input type="text" name="new_origin_domain" onChange={this.onInputChange} onKeyUp={this.onKeyUp} value={this.state.origin} placeholder="e.g., https://site.com"/>
+            <button onClick={this.addOrigin} className="btn btn-primary add-domain"> Add </button>
           </div>
         </div>
-      );
-    }
+      </div>
+    );
+  }
 
-  });
+});
 
-  var Origins = React.createClass({
+var Origins = React.createClass({
 
-    onOriginChange: function (event) {
-      if (event.target.value === 'all' && this.props.isAllOrigins) {
-        return;   // do nothing if all origins is already selected
-      }
-      if (event.target.value === 'selected' && !this.props.isAllOrigins) {
-        return;   // do nothing if specific origins is already selected
-      }
+  onOriginChange: function (event) {
+    if (event.target.value === 'all' && this.props.isAllOrigins) {
+      return;   // do nothing if all origins is already selected
+    }
+    if (event.target.value === 'selected' && !this.props.isAllOrigins) {
+      return;   // do nothing if specific origins is already selected
+    }
 
-      this.props.originChange(event.target.value === 'all');
-    },
+    this.props.originChange(event.target.value === 'all');
+  },
 
-    render: function () {
+  render: function () {
 
-      if (!this.props.corsEnabled) {
-        return null;
-      }
+    if (!this.props.corsEnabled) {
+      return null;
+    }
 
-      return (
-        <div>
-          <p><strong> Origin Domains </strong> </p>
-          <p>Databases will accept requests from these domains: </p>
-          <label className="radio">
-            <input type="radio" checked={this.props.isAllOrigins} value="all" onChange={this.onOriginChange} name="all-domains"/> All domains ( * )
-          </label>
-          <label className="radio">
-            <input type="radio" checked={!this.props.isAllOrigins} value="selected" onChange={this.onOriginChange} name="selected-domains"/> Restrict to specific domains
-          </label>
-        </div>
-      );
+    return (
+      <div>
+        <p><strong> Origin Domains </strong> </p>
+        <p>Databases will accept requests from these domains: </p>
+        <label className="radio">
+          <input type="radio" checked={this.props.isAllOrigins} value="all" onChange={this.onOriginChange} name="all-domains"/> All domains ( * )
+        </label>
+        <label className="radio">
+          <input type="radio" checked={!this.props.isAllOrigins} value="selected" onChange={this.onOriginChange} name="selected-domains"/> Restrict to specific domains
+        </label>
+      </div>
+    );
+  }
+});
+
+var CORSController = React.createClass({
+
+  getStoreState: function () {
+    return {
+      corsEnabled: corsStore.isEnabled(),
+      origins: corsStore.getOrigins(),
+      isAllOrigins: corsStore.isAllOrigins(),
+      configChanged: corsStore.hasConfigChanged(),
+      shouldSaveChange: corsStore.shouldSaveChange(),
+      node: corsStore.getNode(),
+      isLoading: corsStore.getIsLoading(),
+      deleteDomainModalVisible: corsStore.isDeleteDomainModalVisible(),
+      domainToDelete: corsStore.getDomainToDelete()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    corsStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    corsStore.off('change', this.onChange);
+  },
+
+  componentDidUpdate: function () {
+    if (this.state.shouldSaveChange) {
+      this.save();
     }
-  });
-
-  var CORSController = React.createClass({
-
-    getStoreState: function () {
-      return {
-        corsEnabled: corsStore.isEnabled(),
-        origins: corsStore.getOrigins(),
-        isAllOrigins: corsStore.isAllOrigins(),
-        configChanged: corsStore.hasConfigChanged(),
-        shouldSaveChange: corsStore.shouldSaveChange(),
-        node: corsStore.getNode(),
-        isLoading: corsStore.getIsLoading(),
-        deleteDomainModalVisible: corsStore.isDeleteDomainModalVisible(),
-        domainToDelete: corsStore.getDomainToDelete()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      corsStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      corsStore.off('change', this.onChange);
-    },
-
-    componentDidUpdate: function () {
-      if (this.state.shouldSaveChange) {
-        this.save();
-      }
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    enableCorsChange: function () {
-      if (this.state.corsEnabled && !_.isEmpty(this.state.origins) ) {
-        var result = window.confirm(app.i18n.en_US['cors-disable-cors-prompt']);
-        if (!result) { return; }
-      }
-
-      Actions.toggleEnableCors();
-    },
-
-    save: function () {
-      Actions.saveCors({
-        enableCors: this.state.corsEnabled,
-        origins: this.state.origins,
-        node: this.state.node
-      });
-    },
-
-    originChange: function (isAllOrigins) {
-      if (isAllOrigins && !_.isEmpty(this.state.origins)) {
-        var result = window.confirm('Are you sure? Switching to all origin domains will overwrite your specific origin domains.');
-        if (!result) { return; }
-      }
-
-      Actions.originChange(isAllOrigins);
-    },
-
-    addOrigin: function (origin) {
-      Actions.addOrigin(origin);
-    },
-
-    updateOrigin: function (updatedOrigin, originalOrigin) {
-      Actions.updateOrigin(updatedOrigin, originalOrigin);
-    },
-
-    methodChange: function (httpMethod) {
-      Actions.methodChange(httpMethod);
-    },
-
-    deleteOrigin: function () {
-      Actions.deleteOrigin(this.state.domainToDelete);
-    },
-
-    render: function () {
-      var isVisible = _.all([this.state.corsEnabled, !this.state.isAllOrigins]);
-
-      var originSettings = (
-        <div id={this.state.corsEnabled ? 'collapsing-container' : ''}>
-          <Origins corsEnabled={this.state.corsEnabled} originChange={this.originChange} isAllOrigins={this.state.isAllOrigins}/>
-          <OriginTable updateOrigin={this.updateOrigin} isVisible={isVisible} origins={this.state.origins} />
-          <OriginInput addOrigin={this.addOrigin} isVisible={isVisible} />
-        </div>
-      );
+  },
 
-      if (this.state.isLoading) {
-        originSettings = (<LoadLines />);
-      }
-      var deleteMsg = <span>Are you sure you want to delete <code>{_.escape(this.state.domainToDelete)}</code>?</span>;
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
 
-      return (
-        <div className="cors-page flex-body">
-          <header id="cors-header">
-            <p>{app.i18n.en_US['cors-notice']}</p>
-          </header>
-
-          <form id="corsForm" onSubmit={this.save}>
-            <div className="cors-enable">
-              {this.state.corsEnabled ? 'Cors is currently enabled.' : 'Cors is currently disabled.'}
-              <br />
-              <button
-                type="button"
-                className="enable-disable btn btn-success"
-                onClick={this.enableCorsChange}
-                disabled={this.state.isLoading ? 'disabled' : null}
-              >
-                {this.state.corsEnabled ? 'Disable CORS' : 'Enable CORS'}
-              </button>
-            </div>
-            {originSettings}
-          </form>
-
-          <ConfirmationModal
-            title="Confirm Deletion"
-            visible={this.state.deleteDomainModalVisible}
-            text={deleteMsg}
-            buttonClass="btn-danger"
-            onClose={Actions.hideDeleteDomainModal}
-            onSubmit={this.deleteOrigin}
-            successButtonLabel="Delete Domain" />
-        </div>
-      );
+  enableCorsChange: function () {
+    if (this.state.corsEnabled && !_.isEmpty(this.state.origins) ) {
+      var result = window.confirm(app.i18n.en_US['cors-disable-cors-prompt']);
+      if (!result) { return; }
+    }
+
+    Actions.toggleEnableCors();
+  },
+
+  save: function () {
+    Actions.saveCors({
+      enableCors: this.state.corsEnabled,
+      origins: this.state.origins,
+      node: this.state.node
+    });
+  },
+
+  originChange: function (isAllOrigins) {
+    if (isAllOrigins && !_.isEmpty(this.state.origins)) {
+      var result = window.confirm('Are you sure? Switching to all origin domains will overwrite your specific origin domains.');
+      if (!result) { return; }
     }
-  });
 
+    Actions.originChange(isAllOrigins);
+  },
 
-  return {
-    CORSController: CORSController,
-    OriginInput: OriginInput,
-    Origins: Origins,
-    OriginTable: OriginTable,
-    OriginRow: OriginRow
-  };
+  addOrigin: function (origin) {
+    Actions.addOrigin(origin);
+  },
+
+  updateOrigin: function (updatedOrigin, originalOrigin) {
+    Actions.updateOrigin(updatedOrigin, originalOrigin);
+  },
+
+  methodChange: function (httpMethod) {
+    Actions.methodChange(httpMethod);
+  },
+
+  deleteOrigin: function () {
+    Actions.deleteOrigin(this.state.domainToDelete);
+  },
+
+  render: function () {
+    var isVisible = _.all([this.state.corsEnabled, !this.state.isAllOrigins]);
+
+    var originSettings = (
+      <div id={this.state.corsEnabled ? 'collapsing-container' : ''}>
+        <Origins corsEnabled={this.state.corsEnabled} originChange={this.originChange} isAllOrigins={this.state.isAllOrigins}/>
+        <OriginTable updateOrigin={this.updateOrigin} isVisible={isVisible} origins={this.state.origins} />
+        <OriginInput addOrigin={this.addOrigin} isVisible={isVisible} />
+      </div>
+    );
+
+    if (this.state.isLoading) {
+      originSettings = (<LoadLines />);
+    }
+    var deleteMsg = <span>Are you sure you want to delete <code>{_.escape(this.state.domainToDelete)}</code>?</span>;
+
+    return (
+      <div className="cors-page flex-body">
+        <header id="cors-header">
+          <p>{app.i18n.en_US['cors-notice']}</p>
+        </header>
+
+        <form id="corsForm" onSubmit={this.save}>
+          <div className="cors-enable">
+            {this.state.corsEnabled ? 'Cors is currently enabled.' : 'Cors is currently disabled.'}
+            <br />
+            <button
+              type="button"
+              className="enable-disable btn btn-success"
+              onClick={this.enableCorsChange}
+              disabled={this.state.isLoading ? 'disabled' : null}
+            >
+              {this.state.corsEnabled ? 'Disable CORS' : 'Enable CORS'}
+            </button>
+          </div>
+          {originSettings}
+        </form>
+
+        <ConfirmationModal
+          title="Confirm Deletion"
+          visible={this.state.deleteDomainModalVisible}
+          text={deleteMsg}
+          buttonClass="btn-danger"
+          onClose={Actions.hideDeleteDomainModal}
+          onSubmit={this.deleteOrigin}
+          successButtonLabel="Delete Domain" />
+      </div>
+    );
+  }
 });
+
+
+export default {
+  CORSController: CORSController,
+  OriginInput: OriginInput,
+  Origins: Origins,
+  OriginTable: OriginTable,
+  OriginRow: OriginRow
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/resources.js b/app/addons/cors/resources.js
index 7aa6194..73a2091 100644
--- a/app/addons/cors/resources.js
+++ b/app/addons/cors/resources.js
@@ -10,106 +10,101 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+var CORS = FauxtonAPI.addon();
 
-function (app, FauxtonAPI) {
-  var CORS = FauxtonAPI.addon();
 
+CORS.Config = FauxtonAPI.Model.extend({
+  url: function () {
+    if (!this.get('node')) {
+      throw new Error('node not set');
+    }
 
-  CORS.Config = FauxtonAPI.Model.extend({
-    url: function () {
-      if (!this.get('node')) {
-        throw new Error('node not set');
-      }
+    return window.location.origin + '/_node/' + this.get('node') + '/_config/cors';
+  },
 
-      return window.location.origin + '/_node/' + this.get('node') + '/_config/cors';
-    },
+  parse: function (resp) {
+    var origins = !resp.origins ? [] : resp.origins.split(',');
 
-    parse: function (resp) {
-      var origins = !resp.origins ? [] : resp.origins.split(',');
+    return {
+      origins: origins,
+      methods: resp.methods,
+      credentials: resp.credentials,
+      headers: resp.headers
+   };
+  }
+});
 
-      return {
-        origins: origins,
-        methods: resp.methods,
-        credentials: resp.credentials,
-        headers: resp.headers
-     };
+CORS.Httpd = FauxtonAPI.Model.extend({
+  url: function () {
+    if (!this.get('node')) {
+      throw new Error('node not set');
     }
-  });
-
-  CORS.Httpd = FauxtonAPI.Model.extend({
-    url: function () {
-      if (!this.get('node')) {
-        throw new Error('node not set');
-      }
 
-      return window.location.origin + '/_node/' + this.get('node') + '/_config/httpd';
-    },
+    return window.location.origin + '/_node/' + this.get('node') + '/_config/httpd';
+  },
 
-    corsEnabled: function () {
-      var enabledCors = this.get('enable_cors');
+  corsEnabled: function () {
+    var enabledCors = this.get('enable_cors');
 
-      if (_.isUndefined(enabledCors)) {
-        return false;
-      }
-
-      return enabledCors === 'true';
+    if (_.isUndefined(enabledCors)) {
+      return false;
     }
 
-  });
+    return enabledCors === 'true';
+  }
 
-  CORS.ConfigModel = Backbone.Model.extend({
-    documentation: 'cors',
+});
 
-    url: function () {
-      if (!this.get('node')) {
-        throw new Error('node not set');
-      }
+CORS.ConfigModel = Backbone.Model.extend({
+  documentation: 'cors',
 
-      return app.host + '/_node/' + this.get('node') + '/_config/' +
-        encodeURIComponent(this.get('section')) + '/' + encodeURIComponent(this.get('attribute'));
-    },
+  url: function () {
+    if (!this.get('node')) {
+      throw new Error('node not set');
+    }
 
-    isNew: function () { return false; },
+    return app.host + '/_node/' + this.get('node') + '/_config/' +
+      encodeURIComponent(this.get('section')) + '/' + encodeURIComponent(this.get('attribute'));
+  },
 
-    sync: function (method, model, options) {
+  isNew: function () { return false; },
 
-      var params = {
-        url: model.url(),
-        contentType: 'application/json',
-        dataType: 'json',
-        data: JSON.stringify(model.get('value'))
-      };
+  sync: function (method, model, options) {
 
-      if (method === 'delete') {
-        params.type = 'DELETE';
-      } else {
-        params.type = 'PUT';
-      }
+    var params = {
+      url: model.url(),
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(model.get('value'))
+    };
 
-      return $.ajax(params);
+    if (method === 'delete') {
+      params.type = 'DELETE';
+    } else {
+      params.type = 'PUT';
     }
 
-  });
+    return $.ajax(params);
+  }
 
-  // simple helper function to validate the user entered a valid domain starting with http(s)
-  CORS.validateCORSDomain = function (str) {
-    return (/^https?:\/\/(.*)(:\d{2,5})?$/).test(str);
-  };
+});
 
-  CORS.normalizeUrls = function (url) {
-    var el = document.createElement('a');
-    el.href = url;
+// simple helper function to validate the user entered a valid domain starting with http(s)
+CORS.validateCORSDomain = function (str) {
+  return (/^https?:\/\/(.*)(:\d{2,5})?$/).test(str);
+};
 
-    if (/:/.test(url)) {
-      return el.protocol + '//' + el.host;
-    }
+CORS.normalizeUrls = function (url) {
+  var el = document.createElement('a');
+  el.href = url;
 
-    return el.protocol + '//' + el.hostname;
-  };
+  if (/:/.test(url)) {
+    return el.protocol + '//' + el.host;
+  }
 
-  return CORS;
-});
+  return el.protocol + '//' + el.hostname;
+};
+
+export default CORS;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/stores.js b/app/addons/cors/stores.js
index 4ee27bc..e8fdd62 100644
--- a/app/addons/cors/stores.js
+++ b/app/addons/cors/stores.js
@@ -10,184 +10,181 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../core/api",
-  "./actiontypes"
-], function (FauxtonAPI, ActionTypes) {
-
-  var CorsStore = FauxtonAPI.Store.extend({
-
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._deleteDomainModalVisible = false;
-      this._domainToDelete = '';
-    },
-
-    editCors: function (options) {
-      this._isEnabled = options.isEnabled;
-      this._origins = options.origins;
-      this._configChanged = false;
-      this._shouldSaveChange = false;
-      this._node = options.node;
-      this._isLoading = false;
-    },
-
-    shouldSaveChange: function () {
-      return this._shouldSaveChange;
-    },
-
-    hasConfigChanged: function () {
-      return this._configChanged;
-    },
-
-    setConfigChanged: function () {
-      this._configChanged = true;
-    },
-
-    setConfigSaved: function () {
-      this._configChanged = false;
-    },
-
-    setIsLoading: function (state) {
-      this._isLoading = state;
-      this._shouldSaveChange = false;
-    },
-
-    getIsLoading: function () {
-      return this._isLoading;
-    },
-
-    isEnabled: function () {
-      return this._isEnabled;
-    },
-
-    addOrigin: function (origin) {
-      this._origins.push(origin);
-    },
-
-    deleteOrigin: function (origin) {
-      var index = _.indexOf(this._origins, origin);
-
-      if (index === -1) { return; }
-
-      this._origins.splice(index, 1);
-    },
-
-    originChange: function (isAllOrigins) {
-      if (isAllOrigins) {
-        this._origins = ['*'];
-        return;
-      }
-
-      this._origins = [];
-    },
-
-    getOrigins: function () {
-      return this._origins;
-    },
-
-    getNode: function () {
-      return this._node;
-    },
-
-    isAllOrigins: function () {
-      var origins = this.getOrigins();
-      return _.include(origins, '*');
-    },
-
-    toggleEnableCors: function () {
-      this._isEnabled = !this._isEnabled;
-    },
-
-    updateOrigin: function (updatedOrigin, originalOrigin) {
-      this.deleteOrigin(originalOrigin);
-      this.addOrigin(updatedOrigin);
-    },
-
-    showDeleteDomainModal: function (domain) {
-      this._domainToDelete = domain;
-      this._deleteDomainModalVisible = true;
-      this._shouldSaveChange = false;
-    },
-
-    hideDeleteDomainModal: function () {
-      this._deleteDomainModalVisible = false;
-      this._shouldSaveChange = false;
-    },
-
-    isDeleteDomainModalVisible: function () {
-      return this._deleteDomainModalVisible;
-    },
-
-    getDomainToDelete: function () {
-      return this._domainToDelete;
-    },
-
-    dispatch: function (action) {
-      // it should save after any change is triggered except for EDIT_CORS which is just to update
-      // cors after the first change
-      this._shouldSaveChange = true;
-
-      switch (action.type) {
-        case ActionTypes.EDIT_CORS:
-          this.editCors(action.options);
-        break;
-
-        case ActionTypes.TOGGLE_ENABLE_CORS:
-          this.toggleEnableCors();
-          this.setConfigChanged();
-        break;
-
-        case ActionTypes.CORS_ADD_ORIGIN:
-          this.addOrigin(action.origin);
-          this.setConfigChanged();
-        break;
-
-        case ActionTypes.CORS_IS_ALL_ORIGINS:
-          this.originChange(action.isAllOrigins);
-          this.setConfigChanged();
-        break;
-
-        case ActionTypes.CORS_DELETE_ORIGIN:
-          this.deleteOrigin(action.origin);
-          this.setConfigChanged();
-        break;
-
-        case ActionTypes.CORS_UPDATE_ORIGIN:
-          this.updateOrigin(action.updatedOrigin, action.originalOrigin);
-          this.setConfigChanged();
-        break;
-
-        case ActionTypes.CORS_SET_IS_LOADING:
-          this.setIsLoading(action.isLoading);
-        break;
-
-        case ActionTypes.CORS_SHOW_DELETE_DOMAIN_MODAL:
-          this.showDeleteDomainModal(action.options.domain);
-        break;
-
-        case ActionTypes.CORS_HIDE_DELETE_DOMAIN_MODAL:
-          this.hideDeleteDomainModal();
-        break;
-
-        default:
-        return;
-      }
-
-      this.triggerChange();
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+
+var CorsStore = FauxtonAPI.Store.extend({
+
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._deleteDomainModalVisible = false;
+    this._domainToDelete = '';
+  },
+
+  editCors: function (options) {
+    this._isEnabled = options.isEnabled;
+    this._origins = options.origins;
+    this._configChanged = false;
+    this._shouldSaveChange = false;
+    this._node = options.node;
+    this._isLoading = false;
+  },
+
+  shouldSaveChange: function () {
+    return this._shouldSaveChange;
+  },
+
+  hasConfigChanged: function () {
+    return this._configChanged;
+  },
+
+  setConfigChanged: function () {
+    this._configChanged = true;
+  },
+
+  setConfigSaved: function () {
+    this._configChanged = false;
+  },
+
+  setIsLoading: function (state) {
+    this._isLoading = state;
+    this._shouldSaveChange = false;
+  },
+
+  getIsLoading: function () {
+    return this._isLoading;
+  },
+
+  isEnabled: function () {
+    return this._isEnabled;
+  },
+
+  addOrigin: function (origin) {
+    this._origins.push(origin);
+  },
+
+  deleteOrigin: function (origin) {
+    var index = _.indexOf(this._origins, origin);
+
+    if (index === -1) { return; }
+
+    this._origins.splice(index, 1);
+  },
+
+  originChange: function (isAllOrigins) {
+    if (isAllOrigins) {
+      this._origins = ['*'];
+      return;
     }
 
-  });
+    this._origins = [];
+  },
+
+  getOrigins: function () {
+    return this._origins;
+  },
+
+  getNode: function () {
+    return this._node;
+  },
+
+  isAllOrigins: function () {
+    var origins = this.getOrigins();
+    return _.include(origins, '*');
+  },
+
+  toggleEnableCors: function () {
+    this._isEnabled = !this._isEnabled;
+  },
+
+  updateOrigin: function (updatedOrigin, originalOrigin) {
+    this.deleteOrigin(originalOrigin);
+    this.addOrigin(updatedOrigin);
+  },
+
+  showDeleteDomainModal: function (domain) {
+    this._domainToDelete = domain;
+    this._deleteDomainModalVisible = true;
+    this._shouldSaveChange = false;
+  },
+
+  hideDeleteDomainModal: function () {
+    this._deleteDomainModalVisible = false;
+    this._shouldSaveChange = false;
+  },
+
+  isDeleteDomainModalVisible: function () {
+    return this._deleteDomainModalVisible;
+  },
+
+  getDomainToDelete: function () {
+    return this._domainToDelete;
+  },
+
+  dispatch: function (action) {
+    // it should save after any change is triggered except for EDIT_CORS which is just to update
+    // cors after the first change
+    this._shouldSaveChange = true;
+
+    switch (action.type) {
+      case ActionTypes.EDIT_CORS:
+        this.editCors(action.options);
+      break;
+
+      case ActionTypes.TOGGLE_ENABLE_CORS:
+        this.toggleEnableCors();
+        this.setConfigChanged();
+      break;
+
+      case ActionTypes.CORS_ADD_ORIGIN:
+        this.addOrigin(action.origin);
+        this.setConfigChanged();
+      break;
+
+      case ActionTypes.CORS_IS_ALL_ORIGINS:
+        this.originChange(action.isAllOrigins);
+        this.setConfigChanged();
+      break;
+
+      case ActionTypes.CORS_DELETE_ORIGIN:
+        this.deleteOrigin(action.origin);
+        this.setConfigChanged();
+      break;
+
+      case ActionTypes.CORS_UPDATE_ORIGIN:
+        this.updateOrigin(action.updatedOrigin, action.originalOrigin);
+        this.setConfigChanged();
+      break;
+
+      case ActionTypes.CORS_SET_IS_LOADING:
+        this.setIsLoading(action.isLoading);
+      break;
+
+      case ActionTypes.CORS_SHOW_DELETE_DOMAIN_MODAL:
+        this.showDeleteDomainModal(action.options.domain);
+      break;
+
+      case ActionTypes.CORS_HIDE_DELETE_DOMAIN_MODAL:
+        this.hideDeleteDomainModal();
+      break;
+
+      default:
+      return;
+    }
 
+    this.triggerChange();
+  }
 
-  var corsStore = new CorsStore();
+});
 
-  corsStore.dispatchToken = FauxtonAPI.dispatcher.register(corsStore.dispatch.bind(corsStore));
 
-  return {
-    corsStore: corsStore
-  };
-});
+var corsStore = new CorsStore();
+
+corsStore.dispatchToken = FauxtonAPI.dispatcher.register(corsStore.dispatch.bind(corsStore));
+
+export default {
+  corsStore: corsStore
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/tests/actionsSpecs.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/tests/actionsSpecs.js b/app/addons/cors/tests/actionsSpecs.js
index 47d31c6..9b4fb7a 100644
--- a/app/addons/cors/tests/actionsSpecs.js
+++ b/app/addons/cors/tests/actionsSpecs.js
@@ -9,122 +9,118 @@
 // 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',
-  'testUtils',
-  '../../../core/api',
-  '../actions',
-  'sinon'
-], function (app, testUtils, FauxtonAPI, Actions, sinon) {
-  var assert = testUtils.assert;
+import app from "../../../app";
+import testUtils from "testUtils";
+import FauxtonAPI from "../../../core/api";
+import Actions from "../actions";
+import sinon from "sinon";
+var assert = testUtils.assert;
 
-  describe('CORS actions', function () {
+describe('CORS actions', function () {
 
-    describe('save', function () {
+  describe('save', function () {
 
-      afterEach(function () {
-        Actions.saveCorsOrigins.restore && Actions.saveCorsOrigins.restore();
+    afterEach(function () {
+      Actions.saveCorsOrigins.restore && Actions.saveCorsOrigins.restore();
+    });
+
+    it('should save cors enabled to httpd', function () {
+      var spy = sinon.spy(Actions, 'saveEnableCorsToHttpd');
+
+      Actions.saveCors({
+        enableCors: false
       });
 
-      it('should save cors enabled to httpd', function () {
-        var spy = sinon.spy(Actions, 'saveEnableCorsToHttpd');
+      assert.ok(spy.calledWith(false));
+    });
 
-        Actions.saveCors({
-          enableCors: false
-        });
+    it('does not save cors origins if cors not enabled', function () {
+      var spy = sinon.spy(Actions, 'saveCorsOrigins');
 
-        assert.ok(spy.calledWith(false));
+      Actions.saveCors({
+        enableCors: false,
+        origins: ['*']
       });
 
-      it('does not save cors origins if cors not enabled', function () {
-        var spy = sinon.spy(Actions, 'saveCorsOrigins');
+      assert.notOk(spy.calledOnce);
+    });
 
-        Actions.saveCors({
-          enableCors: false,
-          origins: ['*']
-        });
+    it('saves cors origins', function () {
+      var spy = sinon.spy(Actions, 'saveCorsOrigins');
 
-        assert.notOk(spy.calledOnce);
+      Actions.saveCors({
+        enableCors: true,
+        origins: ['*']
       });
 
-      it('saves cors origins', function () {
-        var spy = sinon.spy(Actions, 'saveCorsOrigins');
+      assert.ok(spy.calledWith('*'));
+    });
 
-        Actions.saveCors({
-          enableCors: true,
-          origins: ['*']
-        });
+    it('saves cors allow credentials', function () {
+      var spy = sinon.spy(Actions, 'saveCorsCredentials');
 
-        assert.ok(spy.calledWith('*'));
+      Actions.saveCors({
+        enableCors: true,
+        origins: ['https://testdomain.com']
       });
 
-      it('saves cors allow credentials', function () {
-        var spy = sinon.spy(Actions, 'saveCorsCredentials');
+      assert.ok(spy.calledOnce);
+    });
 
-        Actions.saveCors({
-          enableCors: true,
-          origins: ['https://testdomain.com']
-        });
+    it('saves cors headers', function () {
+      var spy = sinon.spy(Actions, 'saveCorsHeaders');
 
-        assert.ok(spy.calledOnce);
+      Actions.saveCors({
+        enableCors: true,
+        origins: ['https://testdomain.com']
       });
 
-      it('saves cors headers', function () {
-        var spy = sinon.spy(Actions, 'saveCorsHeaders');
+      assert.ok(spy.calledOnce);
+    });
 
-        Actions.saveCors({
-          enableCors: true,
-          origins: ['https://testdomain.com']
-        });
+    it('saves cors methods', function () {
+      var spy = sinon.spy(Actions, 'saveCorsMethods');
 
-        assert.ok(spy.calledOnce);
+      Actions.saveCors({
+        enableCors: true,
+        origins: ['https://testdomain.com']
       });
 
-      it('saves cors methods', function () {
-        var spy = sinon.spy(Actions, 'saveCorsMethods');
-
-        Actions.saveCors({
-          enableCors: true,
-          origins: ['https://testdomain.com']
-        });
+      assert.ok(spy.calledOnce);
 
-        assert.ok(spy.calledOnce);
+    });
 
-      });
+    it('shows notification on successful save', function () {
+      var stub = sinon.stub(FauxtonAPI, 'when');
+      var spy = sinon.spy(FauxtonAPI, 'addNotification');
+      var promise = FauxtonAPI.Deferred();
+      promise.resolve();
+      stub.returns(promise);
 
-      it('shows notification on successful save', function () {
-        var stub = sinon.stub(FauxtonAPI, 'when');
-        var spy = sinon.spy(FauxtonAPI, 'addNotification');
-        var promise = FauxtonAPI.Deferred();
-        promise.resolve();
-        stub.returns(promise);
-
-        Actions.saveCors({
-          enableCors: true,
-          origins: ['https://testdomain.com']
-        });
-
-        assert.ok(spy.calledOnce);
-        FauxtonAPI.when.restore();
-        FauxtonAPI.addNotification.restore();
+      Actions.saveCors({
+        enableCors: true,
+        origins: ['https://testdomain.com']
       });
 
+      assert.ok(spy.calledOnce);
+      FauxtonAPI.when.restore();
+      FauxtonAPI.addNotification.restore();
     });
 
-    describe('Sanitize origins', function () {
+  });
 
-      it('joins array into string', function () {
-        var origins = ['https://hello.com', 'https://hello2.com'];
+  describe('Sanitize origins', function () {
 
-        assert.deepEqual(Actions.sanitizeOrigins(origins), origins.join(','));
-      });
+    it('joins array into string', function () {
+      var origins = ['https://hello.com', 'https://hello2.com'];
 
-      it('returns empty string for no origins', function () {
-        var origins = [];
+      assert.deepEqual(Actions.sanitizeOrigins(origins), origins.join(','));
+    });
 
-        assert.deepEqual(Actions.sanitizeOrigins(origins), '');
-      });
+    it('returns empty string for no origins', function () {
+      var origins = [];
+
+      assert.deepEqual(Actions.sanitizeOrigins(origins), '');
     });
   });
-
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/react-components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/react-components.react.jsx b/app/addons/components/react-components.react.jsx
index 7e05476..f963dbb 100644
--- a/app/addons/components/react-components.react.jsx
+++ b/app/addons/components/react-components.react.jsx
@@ -10,1624 +10,1617 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  'react-dom',
-  './stores',
-  './actions',
-  '../fauxton/components.react',
-  '../documents/helpers',
-  '../../../assets/js/plugins/beautify',
-  'react-bootstrap',
-  'react-addons-css-transition-group',
-  'brace'
-],
-  function (app, FauxtonAPI, React, ReactDOM, Stores, Actions, FauxtonComponents, Helpers,
-	   beautifyHelper, ReactBootstrap, ReactCSSTransitionGroup, ace) {
-
-  var componentStore = Stores.componentStore;
-  var Modal = ReactBootstrap.Modal;
-
-  var BadgeList = React.createClass({
-
-    propTypes: {
-      elements: React.PropTypes.array.isRequired,
-      removeBadge: React.PropTypes.func.isRequired
-    },
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Stores from "./stores";
+import Actions from "./actions";
+import FauxtonComponents from "../fauxton/components.react";
+import Helpers from "../documents/helpers";
+import beautifyHelper from "../../../assets/js/plugins/beautify";
+import {Modal, Popover, OverlayTrigger} from "react-bootstrap";
+import ReactCSSTransitionGroup from "react-addons-css-transition-group";
+import ace from "brace";
+
+const { componentStore } = Stores;
+
+var BadgeList = React.createClass({
+
+  propTypes: {
+    elements: React.PropTypes.array.isRequired,
+    removeBadge: React.PropTypes.func.isRequired
+  },
+
+  getDefaultProps: function () {
+    return {
+      getLabel: function (el) {
+        return el;
+      },
 
-    getDefaultProps: function () {
-      return {
-        getLabel: function (el) {
-          return el;
-        },
+      getId: function (el) {
+        return el;
+      }
 
-        getId: function (el) {
-          return el;
-        }
+    };
+  },
 
-      };
-    },
+  getBadges: function () {
+    return this.props.elements.map(function (el, i) {
+      return <Badge
+        label={this.props.getLabel(el)}
+        key={i}
+        id={el}
+        remove={this.removeBadge} />;
+    }.bind(this));
+  },
 
-    getBadges: function () {
-      return this.props.elements.map(function (el, i) {
-        return <Badge
-          label={this.props.getLabel(el)}
-          key={i}
-          id={el}
-          remove={this.removeBadge} />;
-      }.bind(this));
-    },
+  removeBadge: function (label, el) {
+    this.props.removeBadge(label, el);
+  },
 
-    removeBadge: function (label, el) {
-      this.props.removeBadge(label, el);
-    },
+  render: function () {
+    return (
+      <ul className="component-badgelist">
+        {this.getBadges()}
+      </ul>
+    );
+  }
+});
 
-    render: function () {
-      return (
-        <ul className="component-badgelist">
-          {this.getBadges()}
-        </ul>
-      );
-    }
-  });
+var Badge = React.createClass({
+  propTypes: {
+    label: React.PropTypes.string.isRequired,
+    remove: React.PropTypes.func.isRequired
+  },
 
-  var Badge = React.createClass({
-    propTypes: {
-      label: React.PropTypes.string.isRequired,
-      remove: React.PropTypes.func.isRequired
-    },
+  remove: function (e) {
+    e.preventDefault();
+    this.props.remove(this.props.label, this.props.id);
+  },
 
-    remove: function (e) {
-      e.preventDefault();
-      this.props.remove(this.props.label, this.props.id);
-    },
+  render: function () {
+    return (
+      <li className="component-badge">
+        <span className="label label-info">{this.props.label}</span>
+        <a
+          href="#"
+          className="label label-info js-remove-filter"
+          onClick={this.remove} data-bypass="true"
+        >
+          &times;
+        </a>
+      </li>
+    );
+  }
+});
 
-    render: function () {
-      return (
-        <li className="component-badge">
-          <span className="label label-info">{this.props.label}</span>
-          <a
-            href="#"
-            className="label label-info js-remove-filter"
-            onClick={this.remove} data-bypass="true"
-          >
-            &times;
-          </a>
-        </li>
-      );
+var ToggleHeaderButton = React.createClass({
+  getDefaultProps: function () {
+    return {
+      innerClasses: '',
+      fonticon: '',
+      containerClasses: '',
+      selected: false,
+      title: '',
+      disabled: false,
+      toggleCallback: null,
+      text: '',
+      iconDefaultClass: 'icon'
+    };
+  },
+
+  render: function () {
+    var iconClasses = this.props.iconDefaultClass + ' ' + this.props.fonticon + ' ' + this.props.innerClasses,
+        containerClasses = 'button ' + this.props.containerClasses;
+
+    if (this.props.selected) {
+      containerClasses = containerClasses + ' js-headerbar-togglebutton-selected';
     }
-  });
 
-  var ToggleHeaderButton = React.createClass({
-    getDefaultProps: function () {
-      return {
-        innerClasses: '',
-        fonticon: '',
-        containerClasses: '',
-        selected: false,
-        title: '',
-        disabled: false,
-        toggleCallback: null,
-        text: '',
-        iconDefaultClass: 'icon'
-      };
-    },
+    return (
+      <button
+        title={this.props.title}
+        disabled={this.props.disabled}
+        onClick={this.props.toggleCallback}
+        className={containerClasses}
+        >
+        <i className={iconClasses}></i><span>{this.props.text}</span>
+      </button>
+    );
+  }
+});
 
-    render: function () {
-      var iconClasses = this.props.iconDefaultClass + ' ' + this.props.fonticon + ' ' + this.props.innerClasses,
-          containerClasses = 'button ' + this.props.containerClasses;
 
-      if (this.props.selected) {
-        containerClasses = containerClasses + ' js-headerbar-togglebutton-selected';
-      }
+var BulkActionComponent = React.createClass({
+
+  propTypes: {
+    hasSelectedItem: React.PropTypes.bool.isRequired,
+    removeItem: React.PropTypes.func.isRequired,
+    selectAll: React.PropTypes.func,
+    toggleSelect: React.PropTypes.func.isRequired,
+    isChecked: React.PropTypes.bool.isRequired,
+    disabled: React.PropTypes.bool
+  },
+
+  getDefaultProps: function () {
+    return {
+      disabled: false,
+      title: 'Select rows that can be...',
+      bulkIcon: 'fonticon-trash',
+      buttonTitle: 'Delete all selected',
+      dropdownContentText: 'Deleted',
+      enableOverlay: false
+    };
+  },
+
+  render: function () {
+    return (
+      <div className="bulk-action-component">
+        <div className="bulk-action-component-selector-group">
+          {this.getMasterSelector()}
+          {this.getMultiSelectOptions()}
+        </div>
+      </div>
+    );
+  },
 
-      return (
-        <button
-          title={this.props.title}
-          disabled={this.props.disabled}
-          onClick={this.props.toggleCallback}
-          className={containerClasses}
-          >
-          <i className={iconClasses}></i><span>{this.props.text}</span>
-        </button>
-      );
+  getMultiSelectOptions: function () {
+    if (!this.props.hasSelectedItem) {
+      return null;
     }
-  });
-
 
-  var BulkActionComponent = React.createClass({
+    return (
+      <button
+        onClick={this.props.removeItem}
+        className={'fonticon ' + this.props.bulkIcon}
+        title={this.props.buttonTitle} />
+    );
+  },
 
-    propTypes: {
-      hasSelectedItem: React.PropTypes.bool.isRequired,
-      removeItem: React.PropTypes.func.isRequired,
-      selectAll: React.PropTypes.func,
-      toggleSelect: React.PropTypes.func.isRequired,
-      isChecked: React.PropTypes.bool.isRequired,
-      disabled: React.PropTypes.bool
-    },
+  getPopupContent: function () {
+    return (
+      <ul className="bulk-action-component-popover-actions">
+        <li onClick={this.selectAll} >
+          <i className="icon fonticon-cancel"></i> {this.props.dropdownContentText}
+        </li>
+      </ul>
+    );
+  },
 
-    getDefaultProps: function () {
-      return {
-        disabled: false,
-        title: 'Select rows that can be...',
-        bulkIcon: 'fonticon-trash',
-        buttonTitle: 'Delete all selected',
-        dropdownContentText: 'Deleted',
-        enableOverlay: false
-      };
-    },
+  selectAll: function () {
+    this.refs.bulkActionPopover.hide();
+    this.props.selectAll();
+  },
 
-    render: function () {
-      return (
-        <div className="bulk-action-component">
-          <div className="bulk-action-component-selector-group">
-            {this.getMasterSelector()}
-            {this.getMultiSelectOptions()}
-          </div>
+  getOverlay: function () {
+    return (
+      <OverlayTrigger
+        ref="bulkActionPopover"
+        trigger="click"
+        placement="bottom"
+        rootClose={true}
+        overlay={
+          <Popover id="bulk-action-component-popover" title={this.props.title}>
+            {this.getPopupContent()}
+          </Popover>
+        }>
+        <div className="arrow-button">
+          <i className="fonticon fonticon-play"></i>
         </div>
-      );
-    },
+      </OverlayTrigger>
+    );
+  },
 
-    getMultiSelectOptions: function () {
-      if (!this.props.hasSelectedItem) {
-        return null;
-      }
+  getMasterSelector: function () {
+    return (
+      <div className="bulk-action-component-panel">
+        <input type="checkbox"
+          checked={this.props.isChecked}
+          onChange={this.props.toggleSelect}
+          disabled={this.props.disabled} />
+        {this.props.enableOverlay ? <div className="separator"></div> : null}
+        {this.props.enableOverlay ? this.getOverlay() : null}
+      </div>
+    );
+  },
 
-      return (
-        <button
-          onClick={this.props.removeItem}
-          className={'fonticon ' + this.props.bulkIcon}
-          title={this.props.buttonTitle} />
-      );
-    },
+});
 
-    getPopupContent: function () {
-      return (
-        <ul className="bulk-action-component-popover-actions">
-          <li onClick={this.selectAll} >
-            <i className="icon fonticon-cancel"></i> {this.props.dropdownContentText}
-          </li>
-        </ul>
-      );
-    },
+var StyledSelect = React.createClass({
+  propTypes: {
+    selectValue: React.PropTypes.string.isRequired,
+    selectId: React.PropTypes.string.isRequired,
+    selectChange: React.PropTypes.func.isRequired
+  },
 
-    selectAll: function () {
-      this.refs.bulkActionPopover.hide();
-      this.props.selectAll();
-    },
+  render: function () {
+    return (
+      <div className="styled-select">
+        <label htmlFor={this.props.selectId}>
+          <i className="fonticon-down-dir"></i>
+          <select
+            value={this.props.selectValue}
+            id={this.props.selectId}
+            className={this.props.selectValue}
+            onChange={this.props.selectChange}
+          >
+            {this.props.selectContent}
+          </select>
+        </label>
+      </div>
+    );
+  }
+});
 
-    getOverlay: function () {
-      return (
-        <ReactBootstrap.OverlayTrigger
-          ref="bulkActionPopover"
-          trigger="click"
-          placement="bottom"
-          rootClose={true}
-          overlay={
-            <ReactBootstrap.Popover id="bulk-action-component-popover" title={this.props.title}>
-              {this.getPopupContent()}
-            </ReactBootstrap.Popover>
-          }>
-          <div className="arrow-button">
-            <i className="fonticon fonticon-play"></i>
-          </div>
-        </ReactBootstrap.OverlayTrigger>
-      );
-    },
 
-    getMasterSelector: function () {
-      return (
-        <div className="bulk-action-component-panel">
-          <input type="checkbox"
-            checked={this.props.isChecked}
-            onChange={this.props.toggleSelect}
-            disabled={this.props.disabled} />
-          {this.props.enableOverlay ? <div className="separator"></div> : null}
-          {this.props.enableOverlay ? this.getOverlay() : null}
-        </div>
-      );
-    },
+/**
+ * A pre-packaged JS editor panel for use on the Edit Index / Mango pages. Includes options for a title, zen mode
+ * icon and beautify button.
+ */
+var CodeEditorPanel = React.createClass({
+  getDefaultProps: function () {
+    return {
+      id: 'code-editor',
+      className: '',
+      defaultCode: '',
+      title: '',
+      docLink: '',
+      allowZenMode: true,
+      blur: function () {}
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      zenModeEnabled: false,
+      code: this.props.defaultCode
+    };
+  },
+
+  componentWillReceiveProps: function (nextProps) {
+    if (nextProps.defaultCode !== this.props.defaultCode) {
+      this.setState({ code: nextProps.defaultCode });
+    }
+  },
 
-  });
+  // list of JSHINT errors to ignore: gets around problem of anonymous functions not being valid
+  ignorableErrors: [
+    'Missing name in function declaration.',
+    "['{a}'] is better written in dot notation."
+  ],
 
-  var StyledSelect = React.createClass({
-    propTypes: {
-      selectValue: React.PropTypes.string.isRequired,
-      selectId: React.PropTypes.string.isRequired,
-      selectChange: React.PropTypes.func.isRequired
-    },
+  getZenModeIcon: function () {
+    if (this.props.allowZenMode) {
+      return <span className="fonticon fonticon-resize-full zen-editor-icon" title="Enter Zen mode" onClick={this.enterZenMode}></span>;
+    }
+  },
 
-    render: function () {
+  getDocIcon: function () {
+    if (this.props.docLink) {
       return (
-        <div className="styled-select">
-          <label htmlFor={this.props.selectId}>
-            <i className="fonticon-down-dir"></i>
-            <select
-              value={this.props.selectValue}
-              id={this.props.selectId}
-              className={this.props.selectValue}
-              onChange={this.props.selectChange}
-            >
-              {this.props.selectContent}
-            </select>
-          </label>
-        </div>
+        <a className="help-link"
+          data-bypass="true"
+          href={this.props.docLink}
+          target="_blank"
+        >
+          <i className="icon-question-sign"></i>
+        </a>
       );
     }
-  });
-
-
-  /**
-   * A pre-packaged JS editor panel for use on the Edit Index / Mango pages. Includes options for a title, zen mode
-   * icon and beautify button.
-   */
-  var CodeEditorPanel = React.createClass({
-    getDefaultProps: function () {
-      return {
-        id: 'code-editor',
-        className: '',
-        defaultCode: '',
-        title: '',
-        docLink: '',
-        allowZenMode: true,
-        blur: function () {}
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        zenModeEnabled: false,
-        code: this.props.defaultCode
-      };
-    },
-
-    componentWillReceiveProps: function (nextProps) {
-      if (nextProps.defaultCode !== this.props.defaultCode) {
-        this.setState({ code: nextProps.defaultCode });
-      }
-    },
-
-    // list of JSHINT errors to ignore: gets around problem of anonymous functions not being valid
-    ignorableErrors: [
-      'Missing name in function declaration.',
-      "['{a}'] is better written in dot notation."
-    ],
-
-    getZenModeIcon: function () {
-      if (this.props.allowZenMode) {
-        return <span className="fonticon fonticon-resize-full zen-editor-icon" title="Enter Zen mode" onClick={this.enterZenMode}></span>;
-      }
-    },
-
-    getDocIcon: function () {
-      if (this.props.docLink) {
-        return (
-          <a className="help-link"
-            data-bypass="true"
-            href={this.props.docLink}
-            target="_blank"
-          >
-            <i className="icon-question-sign"></i>
-          </a>
-        );
-      }
-    },
-
-    getZenModeOverlay: function () {
-      if (this.state.zenModeEnabled) {
-        return (
-          <ZenModeOverlay
-            defaultCode={this.state.code}
-            mode={this.props.mode}
-            ignorableErrors={this.ignorableErrors}
-            onExit={this.exitZenMode} />
-        );
-      }
-    },
-
-    enterZenMode: function () {
-      this.setState({
-        zenModeEnabled: true,
-        code: this.refs.codeEditor.getValue()
-      });
-    },
-
-    exitZenMode: function (content) {
-      this.setState({ zenModeEnabled: false });
-      this.getEditor().setValue(content);
-    },
-
-    getEditor: function () {
-      return this.refs.codeEditor;
-    },
-
-    getValue: function () {
-      return this.getEditor().getValue();
-    },
-
-    beautify: function (code) {
-      this.setState({ code: code });
-      this.getEditor().setValue(code);
-    },
+  },
 
-    update: function () {
-      this.getEditor().setValue(this.state.code);
-    },
-
-    render: function () {
-      var classes = 'control-group';
-      if (this.props.className) {
-        classes += ' ' + this.props.className;
-      }
+  getZenModeOverlay: function () {
+    if (this.state.zenModeEnabled) {
       return (
-        <div className={classes}>
-          <label>
-            <span>{this.props.title}</span>
-            {this.getDocIcon()}
-            {this.getZenModeIcon()}
-          </label>
-          <CodeEditor
-            id={this.props.id}
-            ref="codeEditor"
-            mode="javascript"
-            defaultCode={this.state.code}
-            showGutter={true}
-            ignorableErrors={this.ignorableErrors}
-            setHeightToLineCount={true}
-            blur={this.props.blur}
-          />
-          <Beautify code={this.state.code} beautifiedCode={this.beautify} />
-          {this.getZenModeOverlay()}
-        </div>
+        <ZenModeOverlay
+          defaultCode={this.state.code}
+          mode={this.props.mode}
+          ignorableErrors={this.ignorableErrors}
+          onExit={this.exitZenMode} />
       );
     }
-  });
-
-
-  require('brace/mode/javascript');
-  require('brace/mode/json');
-  require('brace/theme/idle_fingers');
-
-  var CodeEditor = React.createClass({
-    getDefaultProps: function () {
-      return {
-        id: 'code-editor',
-        mode: 'javascript',
-        theme: 'idle_fingers',
-        fontSize: 13,
-
-        // this sets the default value for the editor. On the fly changes are stored in state in this component only. To
-        // change the editor content after initial construction use CodeEditor.setValue()
-        defaultCode: '',
-
-        showGutter: true,
-        highlightActiveLine: true,
-        showPrintMargin: false,
-        autoScrollEditorIntoView: true,
-        autoFocus: false,
-        stringEditModalEnabled: false,
-
-        // these two options create auto-resizeable code editors, with a maximum number of lines
-        setHeightToLineCount: false,
-        maxLines: 10,
-
-        // optional editor key commands (e.g. specific save action)
-        editorCommands: [],
-
-        // notifies users that there is unsaved changes in the editor when navigating away from the page
-        notifyUnsavedChanges: false,
-
-        // an optional array of ignorable Ace errors. Lets us filter out errors based on context
-        ignorableErrors: [],
-
-        // un-Reacty, but the code editor is a self-contained component and it's helpful to be able to tie into
-        // editor specific events like content changes and leaving the editor
-        change: function () {},
-        blur: function () {}
-      };
-    },
-
-    getInitialState: function () {
-      return {
-        originalCode: this.props.defaultCode,
-
-        // these are all related to the (optional) string edit modal
-        stringEditModalVisible: false,
-        stringEditIconVisible: false,
-        stringEditIconStyle: {},
-        stringEditModalValue: ''
-      };
-    },
-
-    hasChanged: function () {
-      return !_.isEqual(this.state.originalCode, this.getValue());
-    },
-
-    clearChanges: function () {
-      this.setState({
-        originalCode: this.getValue()
-      });
-    },
-
-    setupAce: function (props, shouldUpdateCode) {
-      this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.ace));
-
-      // suppresses an Ace editor error
-      this.editor.$blockScrolling = Infinity;
-
-      if (shouldUpdateCode) {
-        this.setValue(props.defaultCode);
-      }
-
-      this.editor.setShowPrintMargin(props.showPrintMargin);
-      this.editor.autoScrollEditorIntoView = props.autoScrollEditorIntoView;
-
-      this.editor.setOption('highlightActiveLine', this.props.highlightActiveLine);
-
-      if (this.props.setHeightToLineCount) {
-        this.setHeightToLineCount();
-      }
+  },
 
-      if (this.props.ignorableErrors) {
-        this.removeIgnorableAnnotations();
-      }
-
-      this.addCommands();
-      this.editor.getSession().setMode('ace/mode/' + props.mode);
-      this.editor.setTheme('ace/theme/' + props.theme);
-      this.editor.setFontSize(props.fontSize);
-      this.editor.getSession().setTabSize(2);
-      this.editor.getSession().setUseSoftTabs(true);
+  enterZenMode: function () {
+    this.setState({
+      zenModeEnabled: true,
+      code: this.refs.codeEditor.getValue()
+    });
+  },
+
+  exitZenMode: function (content) {
+    this.setState({ zenModeEnabled: false });
+    this.getEditor().setValue(content);
+  },
+
+  getEditor: function () {
+    return this.refs.codeEditor;
+  },
+
+  getValue: function () {
+    return this.getEditor().getValue();
+  },
+
+  beautify: function (code) {
+    this.setState({ code: code });
+    this.getEditor().setValue(code);
+  },
+
+  update: function () {
+    this.getEditor().setValue(this.state.code);
+  },
+
+  render: function () {
+    var classes = 'control-group';
+    if (this.props.className) {
+      classes += ' ' + this.props.className;
+    }
+    return (
+      <div className={classes}>
+        <label>
+          <span>{this.props.title}</span>
+          {this.getDocIcon()}
+          {this.getZenModeIcon()}
+        </label>
+        <CodeEditor
+          id={this.props.id}
+          ref="codeEditor"
+          mode="javascript"
+          defaultCode={this.state.code}
+          showGutter={true}
+          ignorableErrors={this.ignorableErrors}
+          setHeightToLineCount={true}
+          blur={this.props.blur}
+        />
+        <Beautify code={this.state.code} beautifiedCode={this.beautify} />
+        {this.getZenModeOverlay()}
+      </div>
+    );
+  }
+});
 
-      if (this.props.autoFocus) {
-        this.editor.focus();
-      }
-    },
 
-    addCommands: function () {
-      _.each(this.props.editorCommands, function (command) {
-        this.editor.commands.addCommand(command);
-      }, this);
-    },
+require('brace/mode/javascript');
+require('brace/mode/json');
+require('brace/theme/idle_fingers');
+
+var CodeEditor = React.createClass({
+  getDefaultProps: function () {
+    return {
+      id: 'code-editor',
+      mode: 'javascript',
+      theme: 'idle_fingers',
+      fontSize: 13,
+
+      // this sets the default value for the editor. On the fly changes are stored in state in this component only. To
+      // change the editor content after initial construction use CodeEditor.setValue()
+      defaultCode: '',
+
+      showGutter: true,
+      highlightActiveLine: true,
+      showPrintMargin: false,
+      autoScrollEditorIntoView: true,
+      autoFocus: false,
+      stringEditModalEnabled: false,
+
+      // these two options create auto-resizeable code editors, with a maximum number of lines
+      setHeightToLineCount: false,
+      maxLines: 10,
+
+      // optional editor key commands (e.g. specific save action)
+      editorCommands: [],
+
+      // notifies users that there is unsaved changes in the editor when navigating away from the page
+      notifyUnsavedChanges: false,
+
+      // an optional array of ignorable Ace errors. Lets us filter out errors based on context
+      ignorableErrors: [],
+
+      // un-Reacty, but the code editor is a self-contained component and it's helpful to be able to tie into
+      // editor specific events like content changes and leaving the editor
+      change: function () {},
+      blur: function () {}
+    };
+  },
+
+  getInitialState: function () {
+    return {
+      originalCode: this.props.defaultCode,
+
+      // these are all related to the (optional) string edit modal
+      stringEditModalVisible: false,
+      stringEditIconVisible: false,
+      stringEditIconStyle: {},
+      stringEditModalValue: ''
+    };
+  },
+
+  hasChanged: function () {
+    return !_.isEqual(this.state.originalCode, this.getValue());
+  },
+
+  clearChanges: function () {
+    this.setState({
+      originalCode: this.getValue()
+    });
+  },
 
-    setupEvents: function () {
-      this.editor.on('blur', _.bind(this.onBlur, this));
-      this.editor.on('change', _.bind(this.onContentChange, this));
+  setupAce: function (props, shouldUpdateCode) {
+    this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.ace));
 
-      if (this.props.stringEditModalEnabled) {
-        this.editor.on('changeSelection', _.bind(this.showHideEditStringGutterIcon, this));
-        this.editor.getSession().on('changeBackMarker', _.bind(this.showHideEditStringGutterIcon, this));
-        this.editor.getSession().on('changeScrollTop', _.bind(this.updateEditStringGutterIconPosition, this));
-      }
+    // suppresses an Ace editor error
+    this.editor.$blockScrolling = Infinity;
 
-      if (this.props.notifyUnsavedChanges) {
-        $(window).on('beforeunload.editor_' + this.props.id, _.bind(this.quitWarningMsg));
-        FauxtonAPI.beforeUnload('editor_' + this.props.id, _.bind(this.quitWarningMsg, this));
-      }
-    },
+    if (shouldUpdateCode) {
+      this.setValue(props.defaultCode);
+    }
 
-    onBlur: function () {
-      this.props.blur(this.getValue());
-    },
+    this.editor.setShowPrintMargin(props.showPrintMargin);
+    this.editor.autoScrollEditorIntoView = props.autoScrollEditorIntoView;
 
-    onContentChange: function () {
-      if (this.props.setHeightToLineCount) {
-        this.setHeightToLineCount();
-      }
-      this.props.change(this.getValue());
-    },
+    this.editor.setOption('highlightActiveLine', this.props.highlightActiveLine);
 
-    quitWarningMsg: function () {
-      if (this.hasChanged()) {
-        return 'Your changes have not been saved. Click Cancel to return to the document, or OK to proceed.';
-      }
-    },
+    if (this.props.setHeightToLineCount) {
+      this.setHeightToLineCount();
+    }
 
-    removeEvents: function () {
-      if (this.props.notifyUnsavedChanges) {
-        $(window).off('beforeunload.editor_' + this.props.id);
-        FauxtonAPI.removeBeforeUnload('editor_' + this.props.id);
-      }
-    },
+    if (this.props.ignorableErrors) {
+      this.removeIgnorableAnnotations();
+    }
 
-    setHeightToLineCount: function () {
-      var numLines = this.editor.getSession().getDocument().getLength();
-      var maxLines = (numLines > this.props.maxLines) ? this.props.maxLines : numLines;
-      this.editor.setOptions({
-        maxLines: maxLines
-      });
-    },
+    this.addCommands();
+    this.editor.getSession().setMode('ace/mode/' + props.mode);
+    this.editor.setTheme('ace/theme/' + props.theme);
+    this.editor.setFontSize(props.fontSize);
+    this.editor.getSession().setTabSize(2);
+    this.editor.getSession().setUseSoftTabs(true);
 
-    componentDidMount: function () {
-      this.setupAce(this.props, true);
-      this.setupEvents();
+    if (this.props.autoFocus) {
+      this.editor.focus();
+    }
+  },
+
+  addCommands: function () {
+    _.each(this.props.editorCommands, function (command) {
+      this.editor.commands.addCommand(command);
+    }, this);
+  },
+
+  setupEvents: function () {
+    this.editor.on('blur', _.bind(this.onBlur, this));
+    this.editor.on('change', _.bind(this.onContentChange, this));
+
+    if (this.props.stringEditModalEnabled) {
+      this.editor.on('changeSelection', _.bind(this.showHideEditStringGutterIcon, this));
+      this.editor.getSession().on('changeBackMarker', _.bind(this.showHideEditStringGutterIcon, this));
+      this.editor.getSession().on('changeScrollTop', _.bind(this.updateEditStringGutterIconPosition, this));
+    }
 
-      if (this.props.autoFocus) {
-        this.editor.focus();
-      }
-    },
+    if (this.props.notifyUnsavedChanges) {
+      $(window).on('beforeunload.editor_' + this.props.id, _.bind(this.quitWarningMsg));
+      FauxtonAPI.beforeUnload('editor_' + this.props.id, _.bind(this.quitWarningMsg, this));
+    }
+  },
 
-    componentWillUnmount: function () {
-      this.removeEvents();
-      this.editor.destroy();
-    },
+  onBlur: function () {
+    this.props.blur(this.getValue());
+  },
 
-    componentWillReceiveProps: function (nextProps) {
-      this.setupAce(nextProps, false);
-    },
+  onContentChange: function () {
+    if (this.props.setHeightToLineCount) {
+      this.setHeightToLineCount();
+    }
+    this.props.change(this.getValue());
+  },
 
-    getAnnotations: function () {
-      return this.editor.getSession().getAnnotations();
-    },
+  quitWarningMsg: function () {
+    if (this.hasChanged()) {
+      return 'Your changes have not been saved. Click Cancel to return to the document, or OK to proceed.';
+    }
+  },
 
-    isIgnorableError: function (msg) {
-      return _.contains(this.props.ignorableErrors, msg);
-    },
+  removeEvents: function () {
+    if (this.props.notifyUnsavedChanges) {
+      $(window).off('beforeunload.editor_' + this.props.id);
+      FauxtonAPI.removeBeforeUnload('editor_' + this.props.id);
+    }
+  },
 
-    removeIgnorableAnnotations: function () {
-      var isIgnorableError = this.isIgnorableError;
-      this.editor.getSession().on('changeAnnotation', function () {
-        var annotations = this.editor.getSession().getAnnotations();
-        var newAnnotations = _.reduce(annotations, function (annotations, error) {
-          if (!isIgnorableError(error.raw)) {
-            annotations.push(error);
-          }
-          return annotations;
-        }, []);
-
-        if (annotations.length !== newAnnotations.length) {
-          this.editor.getSession().setAnnotations(newAnnotations);
-        }
-      }.bind(this));
-    },
+  setHeightToLineCount: function () {
+    var numLines = this.editor.getSession().getDocument().getLength();
+    var maxLines = (numLines > this.props.maxLines) ? this.props.maxLines : numLines;
+    this.editor.setOptions({
+      maxLines: maxLines
+    });
+  },
 
-    showHideEditStringGutterIcon: function (e) {
-      if (this.hasErrors() || !this.parseLineForStringMatch()) {
-        this.setState({ stringEditIconVisible: false });
-        return false;
-      }
+  componentDidMount: function () {
+    this.setupAce(this.props, true);
+    this.setupEvents();
 
-      this.setState({
-        stringEditIconVisible: true,
-        stringEditIconStyle: {
-          top: this.getGutterIconPosition()
+    if (this.props.autoFocus) {
+      this.editor.focus();
+    }
+  },
+
+  componentWillUnmount: function () {
+    this.removeEvents();
+    this.editor.destroy();
+  },
+
+  componentWillReceiveProps: function (nextProps) {
+    this.setupAce(nextProps, false);
+  },
+
+  getAnnotations: function () {
+    return this.editor.getSession().getAnnotations();
+  },
+
+  isIgnorableError: function (msg) {
+    return _.contains(this.props.ignorableErrors, msg);
+  },
+
+  removeIgnorableAnnotations: function () {
+    var isIgnorableError = this.isIgnorableError;
+    this.editor.getSession().on('changeAnnotation', function () {
+      var annotations = this.editor.getSession().getAnnotations();
+      var newAnnotations = _.reduce(annotations, function (annotations, error) {
+        if (!isIgnorableError(error.raw)) {
+          annotations.push(error);
         }
-      });
-
-      return true;
-    },
+        return annotations;
+      }, []);
 
-    updateEditStringGutterIconPosition: function () {
-      if (!this.state.stringEditIconVisible) {
-        return;
+      if (annotations.length !== newAnnotations.length) {
+        this.editor.getSession().setAnnotations(newAnnotations);
       }
-      this.setState({
-        stringEditIconStyle: {
-          top: this.getGutterIconPosition()
-        }
-      });
-    },
+    }.bind(this));
+  },
 
-    getGutterIconPosition: function () {
-      var rowHeight = this.getRowHeight();
-      var scrollTop = this.editor.session.getScrollTop();
-      var positionFromTop = (rowHeight * this.documentToScreenRow(this.getSelectionStart().row)) - scrollTop;
-      return positionFromTop + 'px';
-    },
-
-    parseLineForStringMatch: function () {
-      var selStart = this.getSelectionStart().row;
-      var selEnd   = this.getSelectionEnd().row;
-
-      // one JS(ON) string can't span more than one line - we edit one string, so ensure we don't select several lines
-      if (selStart >= 0 && selEnd >= 0 && selStart === selEnd && this.isRowExpanded(selStart)) {
-        var editLine = this.getLine(selStart),
-            editMatch = editLine.match(/^([ \t]*)("[a-zA-Z0-9_]*["|']: )?(["|'].*",?[ \t]*)$/);
-
-        if (editMatch) {
-          return editMatch;
-        }
-      }
+  showHideEditStringGutterIcon: function (e) {
+    if (this.hasErrors() || !this.parseLineForStringMatch()) {
+      this.setState({ stringEditIconVisible: false });
       return false;
-    },
-
-    openStringEditModal: function () {
-      var matches = this.parseLineForStringMatch();
-      var string = matches[3];
-      var lastChar = string.length - 1;
-      if (string.substring(string.length - 1) === ',') {
-        lastChar = string.length - 2;
-      }
-      string = string.substring(1, lastChar);
-
-      this.setState({
-        stringEditModalVisible: true,
-        stringEditModalValue: string
-      });
-    },
-
-    saveStringEditModal: function (newString) {
-      // replace the string on the selected line
-      var line = this.parseLineForStringMatch();
-      var indent = line[1] || '',
-          key = line[2] || '',
-          originalString = line[3],
-          comma = '';
-      if (originalString.substring(originalString.length - 1) === ',') {
-        comma = ',';
-      }
-      this.replaceCurrentLine(indent + key + JSON.stringify(newString) + comma + '\n');
-      this.closeStringEditModal();
-    },
-
-    closeStringEditModal: function () {
-      this.setState({
-        stringEditModalVisible: false
-      });
-    },
-
-    hasErrors: function () {
-      return !_.every(this.getAnnotations(), function (error) {
-        return this.isIgnorableError(error.raw);
-      }, this);
-    },
-
-    setReadOnly: function (readonly) {
-      this.editor.setReadOnly(readonly);
-    },
-
-    setValue: function (code, lineNumber) {
-      lineNumber = lineNumber ? lineNumber : -1;
-      this.editor.setValue(code, lineNumber);
-    },
-
-    getValue: function () {
-      return this.editor.getValue();
-    },
-
-    getEditor: function () {
-      return this;
-    },
-
-    getLine: function (lineNum) {
-      return this.editor.session.getLine(lineNum);
-    },
-
-    getSelectionStart: function () {
-      return this.editor.getSelectionRange().start;
-    },
-
-    getSelectionEnd: function () {
-      return this.editor.getSelectionRange().end;
-    },
-
-    getRowHeight: function () {
-      return this.editor.renderer.layerConfig.lineHeight;
-    },
-
-    isRowExpanded: function (row) {
-      return !this.editor.getSession().isRowFolded(row);
-    },
-
-    documentToScreenRow: function (row) {
-      return this.editor.getSession().documentToScreenRow(row, 0);
-    },
-
-    replaceCurrentLine: function (replacement) {
-      this.editor.getSelection().selectLine();
-      this.editor.insert(replacement);
-      this.editor.getSelection().moveCursorUp();
-    },
-
-    render: function () {
-      return (
-        <div>
-          <div ref="ace" className="js-editor" id={this.props.id}></div>
-          <button ref="stringEditIcon" className="btn string-edit" title="Edit string" disabled={!this.state.stringEditIconVisible}
-            style={this.state.stringEditIconStyle} onClick={this.openStringEditModal}>
-            <i className="icon icon-edit"></i>
-          </button>
-          <StringEditModal
-            ref="stringEditModal"
-            visible={this.state.stringEditModalVisible}
-            value={this.state.stringEditModalValue}
-            onSave={this.saveStringEditModal}
-            onClose={this.closeStringEditModal} />
-        </div>
-      );
     }
-  });
-
-
-  // this appears when the cursor is over a string. It shows an icon in the gutter that opens the modal.
-  var StringEditModal = React.createClass({
-
-    propTypes: {
-      value: React.PropTypes.string.isRequired,
-      visible: React.PropTypes.bool.isRequired,
-      onClose: React.PropTypes.func.isRequired,
-      onSave: React.PropTypes.func.isRequired
-    },
-
-    getDefaultProps: function () {
-      return {
-        visible: false,
-        onClose: function () { },
-        onSave: function () { }
-      };
-    },
 
-    componentDidMount: function () {
-      if (!this.props.visible) {
-        return;
-      }
-      this.initEditor(this.props.value);
-    },
-
-    componentDidUpdate: function (prevProps) {
-      if (!this.props.visible) {
-        return;
+    this.setState({
+      stringEditIconVisible: true,
+      stringEditIconStyle: {
+        top: this.getGutterIconPosition()
       }
-      var val = '';
-      if (!prevProps.visible && this.props.visible) {
-        val = Helpers.parseJSON(this.props.value);
-      }
-
-      this.initEditor(val);
-    },
-
-    initEditor: function (val) {
-      this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.stringEditor));
-      this.editor.$blockScrolling = Infinity; // suppresses an Ace editor error
-      this.editor.setShowPrintMargin(false);
-      this.editor.setOption('highlightActiveLine', true);
-      this.editor.setTheme('ace/theme/idle_fingers');
-      this.editor.setValue(val, -1);
-    },
-
-    closeModal: function () {
-      this.props.onClose();
-    },
-
-    save: function () {
-      this.props.onSave(this.editor.getValue());
-    },
-
-    render: function () {
-      return (
-        <Modal dialogClassName="string-editor-modal" show={this.props.visible} onHide={this.closeModal}>
-          <Modal.Header closeButton={true}>
-            <Modal.Title>Edit text <span id="string-edit-header"></span></Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-            <div id="modal-error" className="hide alert alert-error"/>
-            <div id="string-editor-wrapper"><div ref="stringEditor" className="doc-code"></div></div>
-          </Modal.Body>
-          <Modal.Footer>
-            <button className="cancel-button btn" onClick={this.closeModal}><i className="icon fonticon-circle-x"></i> Cancel</button>
-            <button id="string-edit-save-btn" onClick={this.save} className="btn btn-success save">
-              <i className="fonticon-circle-check"></i> Save
-            </button>
-          </Modal.Footer>
-        </Modal>
-      );
-    }
-  });
-
-
-  // Zen mode editing has very few options:
-  // - It covers the full screen, hiding everything else
-  // - Two themes: light & dark (choice stored in local storage)
-  // - No save option, but has a 1-1 map with a <CodeEditor /> element which gets updated when the user leaves
-  // - [Escape] closes the mode, as does clicking the shrink icon at the top right
-  var ZenModeOverlay = React.createClass({
-    getDefaultProps: function () {
-      return {
-        mode: 'javascript',
-        defaultCode: '',
-        ignorableErrors: [],
-        onExit: null,
-        highlightActiveLine: false
-      };
-    },
-
-    themes: {
-      dark: 'idle_fingers',
-      light: 'dawn'
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        theme: this.getZenTheme(),
-        code: this.props.defaultCode
-      };
-    },
-
-    getZenTheme: function () {
-      var selectedTheme = app.utils.localStorageGet('zenTheme');
-      return _.isUndefined(selectedTheme) ? 'dark' : selectedTheme;
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    componentDidMount: function () {
-      $(ReactDOM.findDOMNode(this.refs.exit)).tooltip({ placement: 'left' });
-      $(ReactDOM.findDOMNode(this.refs.theme)).tooltip({ placement: 'left' });
-    },
-
-    exitZenMode: function () {
-      this.props.onExit(this.getValue());
-    },
-
-    getValue: function () {
-      return this.refs.ace.getValue();
-    },
-
-    toggleTheme: function () {
-      var newTheme = (this.state.theme === 'dark') ? 'light' : 'dark';
-      this.setState({
-        theme: newTheme,
-        code: this.getValue()
-      });
-      app.utils.localStorageSet('zenTheme', newTheme);
-    },
-
-    setValue: function (code, lineNumber) {
-      lineNumber = lineNumber ? lineNumber : -1;
-      this.editor.setValue(code, lineNumber);
-    },
-
-    render: function () {
-      var classes = 'full-page-editor-modal-wrapper zen-theme-' + this.state.theme;
+    });
 
-      var editorCommands = [{
-        name: 'close',
-        bindKey: { win: 'ESC', mac: 'ESC' },
-        exec: this.exitZenMode
-      }];
+    return true;
+  },
 
-      return (
-        <div className={classes}>
-          <div className="zen-mode-controls">
-            <ul>
-              <li>
-                <span ref="exit"
-                  className="fonticon fonticon-resize-small js-exit-zen-mode"
-                  data-toggle="tooltip"
-                  data-container=".zen-mode-controls .tooltips"
-                  title="Exit zen mode (`esc`)"
-                  onClick={this.exitZenMode}></span>
-              </li>
-              <li>
-                <span ref="theme"
-                  className="fonticon fonticon-picture js-toggle-theme"
-                  data-toggle="tooltip"
-                  data-container=".zen-mode-controls .tooltips"
-                  title="Switch zen theme"
-                  onClick={this.toggleTheme}></span>
-              </li>
-            </ul>
-            <div className="tooltips"></div>
-          </div>
-          <CodeEditor
-            ref="ace"
-            autoFocus={true}
-            theme={this.themes[this.state.theme]}
-            defaultCode={this.props.defaultCode}
-            editorCommands={editorCommands}
-            ignorableErrors={this.props.ignorableErrors}
-            highlightActiveLine={this.props.highlightActiveLine}
-          />
-        </div>
-      );
+  updateEditStringGutterIconPosition: function () {
+    if (!this.state.stringEditIconVisible) {
+      return;
     }
-  });
-
-
-  var Beautify = React.createClass({
-    noOfLines: function () {
-      return this.props.code.split(/\r\n|\r|\n/).length;
-    },
-
-    canBeautify: function () {
-      return this.noOfLines() === 1;
-    },
-
-    addTooltip: function () {
-      if (this.canBeautify) {
-        $('.beautify-tooltip').tooltip({ placement: 'right' });
+    this.setState({
+      stringEditIconStyle: {
+        top: this.getGutterIconPosition()
       }
-    },
-
-    componentDidMount: function () {
-      this.addTooltip();
-    },
-
-    beautify: function (event) {
-      event.preventDefault();
-      var beautifiedCode = beautifyHelper(this.props.code);
-      this.props.beautifiedCode(beautifiedCode);
-      $('.beautify-tooltip').tooltip('hide');
-    },
-
-    render: function () {
-      if (!this.canBeautify()) {
-        return null;
+    });
+  },
+
+  getGutterIconPosition: function () {
+    var rowHeight = this.getRowHeight();
+    var scrollTop = this.editor.session.getScrollTop();
+    var positionFromTop = (rowHeight * this.documentToScreenRow(this.getSelectionStart().row)) - scrollTop;
+    return positionFromTop + 'px';
+  },
+
+  parseLineForStringMatch: function () {
+    var selStart = this.getSelectionStart().row;
+    var selEnd   = this.getSelectionEnd().row;
+
+    // one JS(ON) string can't span more than one line - we edit one string, so ensure we don't select several lines
+    if (selStart >= 0 && selEnd >= 0 && selStart === selEnd && this.isRowExpanded(selStart)) {
+      var editLine = this.getLine(selStart),
+          editMatch = editLine.match(/^([ \t]*)("[a-zA-Z0-9_]*["|']: )?(["|'].*",?[ \t]*)$/);
+
+      if (editMatch) {
+        return editMatch;
       }
-
-      return (
-        <button
-          onClick={this.beautify}
-          className="beautify beautify_map btn btn-primary btn-small beautify-tooltip"
-          type="button"
-          data-toggle="tooltip"
-          title="Reformat your minified code to make edits to it."
-        >
-          beautify this code
-        </button>
-      );
     }
-  });
-
-  var PaddedBorderedBox = React.createClass({
-    render: function () {
-      return (
-        <div className="bordered-box">
-          <div className="padded-box">
-            {this.props.children}
-          </div>
-        </div>
-      );
+    return false;
+  },
+
+  openStringEditModal: function () {
+    var matches = this.parseLineForStringMatch();
+    var string = matches[3];
+    var lastChar = string.length - 1;
+    if (string.substring(string.length - 1) === ',') {
+      lastChar = string.length - 2;
     }
-  });
-
-  var Document = React.createClass({
-    propTypes: {
-      docIdentifier: React.PropTypes.string.isRequired,
-      docChecked: React.PropTypes.func.isRequired,
-      truncate: React.PropTypes.bool,
-      maxRows: React.PropTypes.number
-    },
-
-    getDefaultProps: function () {
-      return {
-        truncate: true,
-        maxRows: 500
-      };
-    },
-
-    onChange: function (e) {
-      e.preventDefault();
-      this.props.docChecked(this.props.doc.id, this.props.doc._rev);
-    },
+    string = string.substring(1, lastChar);
 
-    getUrlFragment: function () {
-      if (!this.props.children) {
-        return '';
-      }
-
-      return (
-        <div className="doc-edit-symbol pull-right" title="Edit document">
-          {this.props.children}
-        </div>
-      );
-    },
-
-    getExtensionIcons: function () {
-      var extensions = FauxtonAPI.getExtensions('DocList:icons');
-      return _.map(extensions, function (Extension, i) {
-        return (<Extension doc={this.props.doc} key={i} />);
-      }, this);
-    },
-
-    getCheckbox: function () {
-      if (!this.props.isDeletable) {
-        return <div className="checkbox-dummy"></div>;
-      }
-
-      return (
-        <div className="checkbox inline">
-          <input
-            id={'checkbox-' + this.props.docIdentifier}
-            checked={this.props.checked}
-            data-checked={this.props.checked}
-            type="checkbox"
-            onChange={this.onChange}
-            className="js-row-select" />
-          <label onClick={this.onChange}
-            className="label-checkbox-doclist"
-            htmlFor={'checkbox-' + this.props.docIdentifier} />
-        </div>
-      );
-    },
+    this.setState({
+      stringEditModalVisible: true,
+      stringEditModalValue: string
+    });
+  },
+
+  saveStringEditModal: function (newString) {
+    // replace the string on the selected line
+    var line = this.parseLineForStringMatch();
+    var indent = line[1] || '',
+        key = line[2] || '',
+        originalString = line[3],
+        comma = '';
+    if (originalString.substring(originalString.length - 1) === ',') {
+      comma = ',';
+    }
+    this.replaceCurrentLine(indent + key + JSON.stringify(newString) + comma + '\n');
+    this.closeStringEditModal();
+  },
 
-    onDoubleClick: function (e) {
-      this.props.onDoubleClick(this.props.docIdentifier, this.props.doc, e);
-    },
+  closeStringEditModal: function () {
+    this.setState({
+      stringEditModalVisible: false
+    });
+  },
+
+  hasErrors: function () {
+    return !_.every(this.getAnnotations(), function (error) {
+      return this.isIgnorableError(error.raw);
+    }, this);
+  },
+
+  setReadOnly: function (readonly) {
+    this.editor.setReadOnly(readonly);
+  },
+
+  setValue: function (code, lineNumber) {
+    lineNumber = lineNumber ? lineNumber : -1;
+    this.editor.setValue(code, lineNumber);
+  },
+
+  getValue: function () {
+    return this.editor.getValue();
+  },
+
+  getEditor: function () {
+    return this;
+  },
+
+  getLine: function (lineNum) {
+    return this.editor.session.getLine(lineNum);
+  },
+
+  getSelectionStart: function () {
+    return this.editor.getSelectionRange().start;
+  },
+
+  getSelectionEnd: function () {
+    return this.editor.getSelectionRange().end;
+  },
+
+  getRowHeight: function () {
+    return this.editor.renderer.layerConfig.lineHeight;
+  },
+
+  isRowExpanded: function (row) {
+    return !this.editor.getSession().isRowFolded(row);
+  },
+
+  documentToScreenRow: function (row) {
+    return this.editor.getSession().documentToScreenRow(row, 0);
+  },
+
+  replaceCurrentLine: function (replacement) {
+    this.editor.getSelection().selectLine();
+    this.editor.insert(replacement);
+    this.editor.getSelection().moveCursorUp();
+  },
+
+  render: function () {
+    return (
+      <div>
+        <div ref="ace" className="js-editor" id={this.props.id}></div>
+        <button ref="stringEditIcon" className="btn string-edit" title="Edit string" disabled={!this.state.stringEditIconVisible}
+          style={this.state.stringEditIconStyle} onClick={this.openStringEditModal}>
+          <i className="icon icon-edit"></i>
+        </button>
+        <StringEditModal
+          ref="stringEditModal"
+          visible={this.state.stringEditModalVisible}
+          value={this.state.stringEditModalValue}
+          onSave={this.saveStringEditModal}
+          onClose={this.closeStringEditModal} />
+      </div>
+    );
+  }
+});
 
-    getDocContent: function () {
-      if (_.isEmpty(this.props.docContent)) {
-        return null;
-      }
 
-      // if need be, truncate the document
-      var content = this.props.docContent;
-      var isTruncated = false;
-      if (this.props.truncate) {
-        var result = Helpers.truncateDoc(this.props.docContent, this.props.maxRows);
-        isTruncated = result.isTruncated;
-        content = result.content;
-      }
+// this appears when the cursor is over a string. It shows an icon in the gutter that opens the modal.
+var StringEditModal = React.createClass({
 
-      return (
-        <div className="doc-data">
-          <pre className="prettyprint">{content}</pre>
-          {isTruncated ? <div className="doc-content-truncated">(truncated)</div> : null}
-        </div>
-      );
-    },
+  propTypes: {
+    value: React.PropTypes.string.isRequired,
+    visible: React.PropTypes.bool.isRequired,
+    onClose: React.PropTypes.func.isRequired,
+    onSave: React.PropTypes.func.isRequired
+  },
 
-    render: function () {
-      return (
-        <div data-id={this.props.docIdentifier} onDoubleClick={this.onDoubleClick} className="doc-row">
-          <div className="custom-inputs">
-            {this.getCheckbox()}
-          </div>
-          <div className="doc-item">
-            <header>
-              <span className="header-keylabel">
-                {this.props.keylabel}
-              </span>
-              <span className="header-doc-id">
-                {this.props.header ? '"' + this.props.header + '"' : null}
-              </span>
-              {this.getUrlFragment()}
-              <div className="doc-item-extension-icons pull-right">{this.getExtensionIcons()}</div>
-            </header>
-            {this.getDocContent()}
-          </div>
-          <div className="clearfix"></div>
-        </div>
-      );
-    }
-  });
+  getDefaultProps: function () {
+    return {
+      visible: false,
+      onClose: function () { },
+      onSave: function () { }
+    };
+  },
 
-  var LoadLines = React.createClass({
-    render: function () {
-      return (
-        <div className="loading-lines">
-          <div id="line1"> </div>
-          <div id="line2"> </div>
-          <div id="line3"> </div>
-          <div id="line4"> </div>
-        </div>
-      );
+  componentDidMount: function () {
+    if (!this.props.visible) {
+      return;
     }
-  });
-
-  var ConfirmButton = React.createClass({
-    propTypes: {
-      showIcon: React.PropTypes.bool,
-      id: React.PropTypes.string,
-      customIcon: React.PropTypes.string,
-      style: React.PropTypes.object,
-      buttonType: React.PropTypes.string,
-      'data-id': React.PropTypes.string,
-      onClick: React.PropTypes.func
-    },
-
-    getDefaultProps: function () {
-      return {
-        showIcon: true,
-        customIcon: 'fonticon-ok-circled',
-        buttonType: 'btn-success',
-        style: {},
-        'data-id': null,
-        onClick: function () { }
-      };
-    },
-
-    getIcon: function () {
-      if (!this.props.showIcon) {
-        return null;
-      }
-      return (
-        <i className={"icon " + this.props.customIcon} />
-      );
-    },
+    this.initEditor(this.props.value);
+  },
 
-    render: function () {
-      const { onClick, buttonType, id, style, text } = this.props;
-      return (
-        <button
-          onClick={onClick}
-          type="submit"
-          data-id={this.props['data-id']}
-          className={'btn save ' + buttonType}
-          id={id}
-          style={style}
-        >
-          {this.getIcon()}
-          {text}
-        </button>
-      );
+  componentDidUpdate: function (prevProps) {
+    if (!this.props.visible) {
+      return;
+    }
+    var val = '';
+    if (!prevProps.visible && this.props.visible) {
+      val = Helpers.parseJSON(this.props.value);
     }
-  });
 
-  var MenuDropDown = React.createClass({
+    this.initEditor(val);
+  },
 
-    getDefaultProps: function () {
-      return {
-        icon: 'fonticon-plus-circled'
-      };
-    },
+  initEditor: function (val) {
+    this.editor = ace.edit(ReactDOM.findDOMNode(this.refs.stringEditor));
+    this.editor.$blockScrolling = Infinity; // suppresses an Ace editor error
+    this.editor.setShowPrintMargin(false);
+    this.editor.setOption('highlightActiveLine', true);
+    this.editor.setTheme('ace/theme/idle_fingers');
+    this.editor.setValue(val, -1);
+  },
 
-    createSectionLinks: function (links) {
-      if (!links) { return null; }
+  closeModal: function () {
+    this.props.onClose();
+  },
 
-      return links.map(function (link, key) {
-        return this.createEntry(link, key);
-      }.bind(this));
-    },
+  save: function () {
+    this.props.onSave(this.editor.getValue());
+  },
 
-    createEntry: function (link, key) {
-      return (
-        <li key={key}>
-          <a className={link.icon ? 'icon ' + link.icon : ''}
-            data-bypass={link.external ? 'true' : ''}
-            href={link.url}
-            onClick={link.onClick}
-            target={link.external ? '_blank' : ''}>
-            {link.title}
-          </a>
-        </li>
-      );
-    },
+  render: function () {
+    return (
+      <Modal dialogClassName="string-editor-modal" show={this.props.visible} onHide={this.closeModal}>
+        <Modal.Header closeButton={true}>
+          <Modal.Title>Edit text <span id="string-edit-header"></span></Modal.Title>
+        </Modal.Header>
+        <Modal.Body>
+          <div id="modal-error" className="hide alert alert-error"/>
+          <div id="string-editor-wrapper"><div ref="stringEditor" className="doc-code"></div></div>
+        </Modal.Body>
+        <Modal.Footer>
+          <button className="cancel-button btn" onClick={this.closeModal}><i className="icon fonticon-circle-x"></i> Cancel</button>
+          <button id="string-edit-save-btn" onClick={this.save} className="btn btn-success save">
+            <i className="fonticon-circle-check"></i> Save
+          </button>
+        </Modal.Footer>
+      </Modal>
+    );
+  }
+});
 
-    createSectionTitle: function (title) {
-      if (!title) {
-        return null;
-      }
 
-      return (
-        <li className="header-label">{title}</li>
-      );
-    },
+// Zen mode editing has very few options:
+// - It covers the full screen, hiding everything else
+// - Two themes: light & dark (choice stored in local storage)
+// - No save option, but has a 1-1 map with a <CodeEditor /> element which gets updated when the user leaves
+// - [Escape] closes the mode, as does clicking the shrink icon at the top right
+var ZenModeOverlay = React.createClass({
+  getDefaultProps: function () {
+    return {
+      mode: 'javascript',
+      defaultCode: '',
+      ignorableErrors: [],
+      onExit: null,
+      highlightActiveLine: false
+    };
+  },
+
+  themes: {
+    dark: 'idle_fingers',
+    light: 'dawn'
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      theme: this.getZenTheme(),
+      code: this.props.defaultCode
+    };
+  },
+
+  getZenTheme: function () {
+    var selectedTheme = app.utils.localStorageGet('zenTheme');
+    return _.isUndefined(selectedTheme) ? 'dark' : selectedTheme;
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidMount: function () {
+    $(ReactDOM.findDOMNode(this.refs.exit)).tooltip({ placement: 'left' });
+    $(ReactDOM.findDOMNode(this.refs.theme)).tooltip({ placement: 'left' });
+  },
+
+  exitZenMode: function () {
+    this.props.onExit(this.getValue());
+  },
+
+  getValue: function () {
+    return this.refs.ace.getValue();
+  },
+
+  toggleTheme: function () {
+    var newTheme = (this.state.theme === 'dark') ? 'light' : 'dark';
+    this.setState({
+      theme: newTheme,
+      code: this.getValue()
+    });
+    app.utils.localStorageSet('zenTheme', newTheme);
+  },
 
-    createSection: function () {
-      return this.props.links.map(function (linkSection, key) {
-        if (linkSection.title && linkSection.links) {
-          return ([
-            this.createSectionTitle(linkSection.title),
-            this.createSectionLinks(linkSection.links)
-          ]);
-        }
+  setValue: function (code, lineNumber) {
+    lineNumber = lineNumber ? lineNumber : -1;
+    this.editor.setValue(code, lineNumber);
+  },
 
-        return this.createEntry(linkSection, 'el' + key);
+  render: function () {
+    var classes = 'full-page-editor-modal-wrapper zen-theme-' + this.state.theme;
 
-      }.bind(this));
-    },
+    var editorCommands = [{
+      name: 'close',
+      bindKey: { win: 'ESC', mac: 'ESC' },
+      exec: this.exitZenMode
+    }];
 
-    render: function () {
-      return (
-        <div className="dropdown">
-          <a className={"dropdown-toggle icon " + this.props.icon}
-          data-toggle="dropdown"
-          href="#"
-          data-bypass="true"></a>
-          <ul className="dropdown-menu arrow" role="menu" aria-labelledby="dLabel">
-            {this.createSection()}
+    return (
+      <div className={classes}>
+        <div className="zen-mode-controls">
+          <ul>
+            <li>
+              <span ref="exit"
+                className="fonticon fonticon-resize-small js-exit-zen-mode"
+                data-toggle="tooltip"
+                data-container=".zen-mode-controls .tooltips"
+                title="Exit zen mode (`esc`)"
+                onClick={this.exitZenMode}></span>
+            </li>
+            <li>
+              <span ref="theme"
+                className="fonticon fonticon-picture js-toggle-theme"
+                data-toggle="tooltip"
+                data-container=".zen-mode-controls .tooltips"
+                title="Switch zen theme"
+                onClick={this.toggleTheme}></span>
+            </li>
           </ul>
+          <div className="tooltips"></div>
         </div>
-      );
-    }
-  });
+        <CodeEditor
+          ref="ace"
+          autoFocus={true}
+          theme={this.themes[this.state.theme]}
+          defaultCode={this.props.defaultCode}
+          editorCommands={editorCommands}
+          ignorableErrors={this.props.ignorableErrors}
+          highlightActiveLine={this.props.highlightActiveLine}
+        />
+      </div>
+    );
+  }
+});
 
-  var TrayContents = React.createClass({
-    getChildren: function () {
-      var className = "tray show-tray " + this.props.className;
-      return (
-        <div key={1} id={this.props.id} className={className}>
-          {this.props.children}
-        </div>);
-    },
 
-    render: function () {
-      return (
-        <ReactCSSTransitionGroup transitionName="tray" transitionAppear={true} component="div" transitionAppearTimeout={500}
-          transitionEnterTimeout={500} transitionLeaveTimeout={300}>
-          {this.getChildren()}
-        </ReactCSSTransitionGroup>
-      );
-    }
-  });
+var Beautify = React.createClass({
+  noOfLines: function () {
+    return this.props.code.split(/\r\n|\r|\n/).length;
+  },
 
+  canBeautify: function () {
+    return this.noOfLines() === 1;
+  },
 
-  function connectToStores (Component, stores, getStateFromStores) {
+  addTooltip: function () {
+    if (this.canBeautify) {
+      $('.beautify-tooltip').tooltip({ placement: 'right' });
+    }
+  },
+
+  componentDidMount: function () {
+    this.addTooltip();
+  },
+
+  beautify: function (event) {
+    event.preventDefault();
+    var beautifiedCode = beautifyHelper(this.props.code);
+    this.props.beautifiedCode(beautifiedCode);
+    $('.beautify-tooltip').tooltip('hide');
+  },
+
+  render: function () {
+    if (!this.canBeautify()) {
+      return null;
+    }
 
-    var WrappingElement = React.createClass({
+    return (
+      <button
+        onClick={this.beautify}
+        className="beautify beautify_map btn btn-primary btn-small beautify-tooltip"
+        type="button"
+        data-toggle="tooltip"
+        title="Reformat your minified code to make edits to it."
+      >
+        beautify this code
+      </button>
+    );
+  }
+});
 
-      componentDidMount: function () {
-        stores.forEach(function (store) {
-          store.on('change', this.onChange, this);
-        }.bind(this));
-      },
+var PaddedBorderedBox = React.createClass({
+  render: function () {
+    return (
+      <div className="bordered-box">
+        <div className="padded-box">
+          {this.props.children}
+        </div>
+      </div>
+    );
+  }
+});
 
-      componentWillUnmount: function () {
-        stores.forEach(function (store) {
-          store.off('change', this.onChange);
-        }.bind(this));
-      },
+var Document = React.createClass({
+  propTypes: {
+    docIdentifier: React.PropTypes.string.isRequired,
+    docChecked: React.PropTypes.func.isRequired,
+    truncate: React.PropTypes.bool,
+    maxRows: React.PropTypes.number
+  },
+
+  getDefaultProps: function () {
+    return {
+      truncate: true,
+      maxRows: 500
+    };
+  },
+
+  onChange: function (e) {
+    e.preventDefault();
+    this.props.docChecked(this.props.doc.id, this.props.doc._rev);
+  },
+
+  getUrlFragment: function () {
+    if (!this.props.children) {
+      return '';
+    }
 
-      getInitialState: function () {
-        return getStateFromStores(this.props);
-      },
+    return (
+      <div className="doc-edit-symbol pull-right" title="Edit document">
+        {this.props.children}
+      </div>
+    );
+  },
+
+  getExtensionIcons: function () {
+    var extensions = FauxtonAPI.getExtensions('DocList:icons');
+    return _.map(extensions, function (Extension, i) {
+      return (<Extension doc={this.props.doc} key={i} />);
+    }, this);
+  },
+
+  getCheckbox: function () {
+    if (!this.props.isDeletable) {
+      return <div className="checkbox-dummy"></div>;
+    }
 
-      onChange: function () {
-        if (!this.isMounted()) {
-          return;
-        }
+    return (
+      <div className="checkbox inline">
+        <input
+          id={'checkbox-' + this.props.docIdentifier}
+          checked={this.props.checked}
+          data-checked={this.props.checked}
+          type="checkbox"
+          onChange={this.onChange}
+          className="js-row-select" />
+        <label onClick={this.onChange}
+          className="label-checkbox-doclist"
+          htmlFor={'checkbox-' + this.props.docIdentifier} />
+      </div>
+    );
+  },
 
-        this.setState(getStateFromStores(this.props));
-      },
+  onDoubleClick: function (e) {
+    this.props.onDoubleClick(this.props.docIdentifier, this.props.doc, e);
+  },
 
-      handleStoresChanged: function () {
-        if (this.isMounted()) {
-          this.setState(getStateFromStores(this.props));
-        }
-      },
+  getDocContent: function () {
+    if (_.isEmpty(this.props.docContent)) {
+      return null;
+    }
 
-      render: function () {
-        return <Component {...this.state} {...this.props} />;
-      }
+    // if need be, truncate the document
+    var content = this.props.docContent;
+    var isTruncated = false;
+    if (this.props.truncate) {
+      var result = Helpers.truncateDoc(this.props.docContent, this.props.maxRows);
+      isTruncated = result.isTruncated;
+      content = result.content;
+    }
 
-    });
+    return (
+      <div className="doc-data">
+        <pre className="prettyprint">{content}</pre>
+        {isTruncated ? <div className="doc-content-truncated">(truncated)</div> : null}
+      </div>
+    );
+  },
 
-    return WrappingElement;
+  render: function () {
+    return (
+      <div data-id={this.props.docIdentifier} onDoubleClick={this.onDoubleClick} className="doc-row">
+        <div className="custom-inputs">
+          {this.getCheckbox()}
+        </div>
+        <div className="doc-item">
+          <header>
+            <span className="header-keylabel">
+              {this.props.keylabel}
+            </span>
+            <span className="header-doc-id">
+              {this.props.header ? '"' + this.props.header + '"' : null}
+            </span>
+            {this.getUrlFragment()}
+            <div className="doc-item-extension-icons pull-right">{this.getExtensionIcons()}</div>
+          </header>
+          {this.getDocContent()}
+        </div>
+        <div className="clearfix"></div>
+      </div>
+    );
   }
+});
 
-  var TrayWrapper = React.createClass({
-    getDefaultProps: function () {
-      return {
-        className: ''
-      };
-    },
+var LoadLines = React.createClass({
+  render: function () {
+    return (
+      <div className="loading-lines">
+        <div id="line1"> </div>
+        <div id="line2"> </div>
+        <div id="line3"> </div>
+        <div id="line4"> </div>
+      </div>
+    );
+  }
+});
 
-    renderChildren: function () {
-      return React.Children.map(this.props.children, function (child, key) {
+var ConfirmButton = React.createClass({
+  propTypes: {
+    showIcon: React.PropTypes.bool,
+    id: React.PropTypes.string,
+    customIcon: React.PropTypes.string,
+    style: React.PropTypes.object,
+    buttonType: React.PropTypes.string,
+    'data-id': React.PropTypes.string,
+    onClick: React.PropTypes.func
+  },
+
+  getDefaultProps: function () {
+    return {
+      showIcon: true,
+      customIcon: 'fonticon-ok-circled',
+      buttonType: 'btn-success',
+      style: {},
+      'data-id': null,
+      onClick: function () { }
+    };
+  },
+
+  getIcon: function () {
+    if (!this.props.showIcon) {
+      return null;
+    }
+    return (
+      <i className={"icon " + this.props.customIcon} />
+    );
+  },
 
-        const props = {};
-        Object.keys(this.props).filter((k) => {
-          return this.props.hasOwnProperty(k);
-        }).map((k) => {
-          return props[k] = this.props[k];
-        });
+  render: function () {
+    const { onClick, buttonType, id, style, text } = this.props;
+    return (
+      <button
+        onClick={onClick}
+        type="submit"
+        data-id={this.props['data-id']}
+        className={'btn save ' + buttonType}
+        id={id}
+        style={style}
+      >
+        {this.getIcon()}
+        {text}
+      </button>
+    );
+  }
+});
 
-        return React.cloneElement(child, props);
-      }.bind(this));
-    },
+var MenuDropDown = React.createClass({
 
-    render: function () {
-      return (
-        <div>
-          {this.renderChildren()}
-        </div>
-      );
-    }
-  });
+  getDefaultProps: function () {
+    return {
+      icon: 'fonticon-plus-circled'
+    };
+  },
 
-  var APIBar = React.createClass({
-    propTypes: {
-      buttonVisible: React.PropTypes.bool.isRequired,
-      contentVisible: React.PropTypes.bool.isRequired,
-      docURL: React.PropTypes.string,
-      endpoint: React.PropTypes.string
-    },
+  createSectionLinks: function (links) {
+    if (!links) { return null; }
 
-    showCopiedMessage: function () {
-      FauxtonAPI.addNotification({
-        msg: 'The API URL has been copied to the clipboard.',
-        type: 'success',
-        clear: true
-      });
-    },
+    return links.map(function (link, key) {
+      return this.createEntry(link, key);
+    }.bind(this));
+  },
 
-    getDocIcon: function () {
-      if (!this.props.docURL) {
-        return null;
-      }
-      return (
-        <a
-          className="help-link"
-          data-bypass="true"
-          href={this.props.docURL}
-          target="_blank"
-        >
-          <i className="icon icon-question-sign"></i>
+  createEntry: function (link, key) {
+    return (
+      <li key={key}>
+        <a className={link.icon ? 'icon ' + link.icon : ''}
+          data-bypass={link.external ? 'true' : ''}
+          href={link.url}
+          onClick={link.onClick}
+          target={link.external ? '_blank' : ''}>
+          {link.title}
         </a>
-      );
-    },
+      </li>
+    );
+  },
+
+  createSectionTitle: function (title) {
+    if (!title) {
+      return null;
+    }
 
-    getTray: function () {
-      if (!this.props.contentVisible) {
-        return null;
+    return (
+      <li className="header-label">{title}</li>
+    );
+  },
+
+  createSection: function () {
+    return this.props.links.map(function (linkSection, key) {
+      if (linkSection.title && linkSection.links) {
+        return ([
+          this.createSectionTitle(linkSection.title),
+          this.createSectionLinks(linkSection.links)
+        ]);
       }
 
-      return (
-        <TrayContents className="tray show-tray api-bar-tray">
-          <div className="input-prepend input-append">
-            <span className="add-on">
-              API URL
-              {this.getDocIcon()}
-            </span>
+      return this.createEntry(linkSection, 'el' + key);
 
-            <FauxtonComponents.ClipboardWithTextField
-              onClipBoardClick={this.showCopiedMessage}
-              text="Copy URL"
-              textToCopy={this.props.endpoint}
-              showCopyIcon={false}
-              uniqueKey="clipboard-apiurl" />
-
-            <div className="add-on">
-              <a
-                data-bypass="true"
-                href={this.props.endpoint}
-                target="_blank"
-                className="btn"
-              >
-                View JSON
-              </a>
-            </div>
-          </div>
-        </TrayContents>
-      );
-    },
+    }.bind(this));
+  },
 
-    toggleTrayVisibility: function () {
-      Actions.toggleApiBarVisibility(!this.props.contentVisible);
-    },
+  render: function () {
+    return (
+      <div className="dropdown">
+        <a className={"dropdown-toggle icon " + this.props.icon}
+        data-toggle="dropdown"
+        href="#"
+        data-bypass="true"></a>
+        <ul className="dropdown-menu arrow" role="menu" aria-labelledby="dLabel">
+          {this.createSection()}
+        </ul>
+      </div>
+    );
+  }
+});
+
+var TrayContents = React.createClass({
+  getChildren: function () {
+    var className = "tray show-tray " + this.props.className;
+    return (
+      <div key={1} id={this.props.id} className={className}>
+        {this.props.children}
+      </div>);
+  },
+
+  render: function () {
+    return (
+      <ReactCSSTransitionGroup transitionName="tray" transitionAppear={true} component="div" transitionAppearTimeout={500}
+        transitionEnterTimeout={500} transitionLeaveTimeout={300}>
+        {this.getChildren()}
+      </ReactCSSTransitionGroup>
+    );
+  }
+});
+
+
+function connectToStores (Component, stores, getStateFromStores) {
+
+  var WrappingElement = React.createClass({
 
     componentDidMount: function () {
-      $('body').on('click.APIBar', function (e) {
-        if ($(e.target).closest('.api-bar-tray,.control-toggle-api-url').length === 0) {
-          Actions.toggleApiBarVisibility(false);
-        }
+      stores.forEach(function (store) {
+        store.on('change', this.onChange, this);
       }.bind(this));
     },
 
     componentWillUnmount: function () {
-      $('body').off('click.APIBar');
+      stores.forEach(function (store) {
+        store.off('change', this.onChange);
+      }.bind(this));
     },
 
-    render: function () {
-      if (!this.props.buttonVisible || !this.props.endpoint) {
-        return null;
+    getInitialState: function () {
+      return getStateFromStores(this.props);
+    },
+
+    onChange: function () {
+      if (!this.isMounted()) {
+        return;
       }
 
-      return (
-        <div>
-          <ToggleHeaderButton
-            containerClasses="header-control-box control-toggle-api-url"
-            title="API URL"
-            fonticon="fonticon-link"
-            text="API"
-            toggleCallback={this.toggleTrayVisibility} />
-
-          {this.getTray()}
-        </div>
-      );
+      this.setState(getStateFromStores(this.props));
+    },
+
+    handleStoresChanged: function () {
+      if (this.isMounted()) {
+        this.setState(getStateFromStores(this.props));
+      }
+    },
+
+    render: function () {
+      return <Component {...this.state} {...this.props} />;
     }
+
   });
 
-  var ApiBarController = React.createClass({
+  return WrappingElement;
+}
+
+var TrayWrapper = React.createClass({
+  getDefaultProps: function () {
+    return {
+      className: ''
+    };
+  },
+
+  renderChildren: function () {
+    return React.Children.map(this.props.children, function (child, key) {
 
-    getWrap: function () {
-      return connectToStores(TrayWrapper, [componentStore], function () {
-        return {
-          buttonVisible: componentStore.getIsAPIBarButtonVisible(),
-          contentVisible: componentStore.getIsAPIBarVisible(),
-          endpoint: componentStore.getEndpoint(),
-          docURL: componentStore.getDocURL()
-        };
+      const props = {};
+      Object.keys(this.props).filter((k) => {
+        return this.props.hasOwnProperty(k);
+      }).map((k) => {
+        return props[k] = this.props[k];
       });
-    },
 
-    render: function () {
-      var TrayWrapper = this.getWrap();
-      return (
-        <TrayWrapper>
-          <APIBar buttonVisible={true} contentVisible={false} />
-        </TrayWrapper>
-      );
+      return React.cloneElement(child, props);
+    }.bind(this));
+  },
+
+  render: function () {
+    return (
+      <div>
+        {this.renderChildren()}
+      </div>
+    );
+  }
+});
+
+var APIBar = React.createClass({
+  propTypes: {
+    buttonVisible: React.PropTypes.bool.isRequired,
+    contentVisible: React.PropTypes.bool.isRequired,
+    docURL: React.PropTypes.string,
+    endpoint: React.PropTypes.string
+  },
+
+  showCopiedMessage: function () {
+    FauxtonAPI.addNotification({
+      msg: 'The API URL has been copied to the clipboard.',
+      type: 'success',
+      clear: true
+    });
+  },
+
+  getDocIcon: function () {
+    if (!this.props.docURL) {
+      return null;
     }
-  });
+    return (
+      <a
+        className="help-link"
+        data-bypass="true"
+        href={this.props.docURL}
+        target="_blank"
+      >
+        <i className="icon icon-question-sign"></i>
+      </a>
+    );
+  },
 
-  var DeleteDatabaseModal = React.createClass({
+  getTray: function () {
+    if (!this.props.contentVisible) {
+      return null;
+    }
 
-    getInitialState: function () {
-      return {
-        inputValue: '',
-        disableSubmit: true
-      };
-    },
+    return (
+      <TrayContents className="tray show-tray api-bar-tray">
+        <div className="input-prepend input-append">
+          <span className="add-on">
+            API URL
+            {this.getDocIcon()}
+          </span>
+
+          <FauxtonComponents.ClipboardWithTextField
+            onClipBoardClick={this.showCopiedMessage}
+            text="Copy URL"
+            textToCopy={this.props.endpoint}
+            showCopyIcon={false}
+            uniqueKey="clipboard-apiurl" />
+
+          <div className="add-on">
+            <a
+              data-bypass="true"
+              href={this.props.endpoint}
+              target="_blank"
+              className="btn"
+            >
+              View JSON
+            </a>
+          </div>
+        </div>
+      </TrayContents>
+    );
+  },
 
-    propTypes: {
-      showHide: React.PropTypes.func.isRequired,
-      modalProps: React.PropTypes.object
-    },
+  toggleTrayVisibility: function () {
+    Actions.toggleApiBarVisibility(!this.props.contentVisible);
+  },
 
-    close: function (e) {
-      if (e) {
-        e.preventDefault();
+  componentDidMount: function () {
+    $('body').on('click.APIBar', function (e) {
+      if ($(e.target).closest('.api-bar-tray,.control-toggle-api-url').length === 0) {
+        Actions.toggleApiBarVisibility(false);
       }
+    }.bind(this));
+  },
 
-      this.setState({
-        inputValue: '',
-        disableSubmit: true
-      });
+  componentWillUnmount: function () {
+    $('body').off('click.APIBar');
+  },
 
-      this.props.showHide({showModal: false});
-    },
+  render: function () {
+    if (!this.props.buttonVisible || !this.props.endpoint) {
+      return null;
+    }
 
-    open: function () {
-      this.props.showHide({showModal: true});
-    },
+    return (
+      <div>
+        <ToggleHeaderButton
+          containerClasses="header-control-box control-toggle-api-url"
+          title="API URL"
+          fonticon="fonticon-link"
+          text="API"
+          toggleCallback={this.toggleTrayVisibility} />
+
+        {this.getTray()}
+      </div>
+    );
+  }
+});
 
-    getDatabaseName: function () {
-      return this.props.modalProps.dbId.trim();
-    },
+var ApiBarController = React.createClass({
 
-    onInputChange: function (e) {
-      var val = encodeURIComponent(e.target.value.trim());
+  getWrap: function () {
+    return connectToStores(TrayWrapper, [componentStore], function () {
+      return {
+        buttonVisible: componentStore.getIsAPIBarButtonVisible(),
+        contentVisible: componentStore.getIsAPIBarVisible(),
+        endpoint: componentStore.getEndpoint(),
+        docURL: componentStore.getDocURL()
+      };
+    });
+  },
 
-      this.setState({
-        inputValue: val
-      });
+  render: function () {
+    var TrayWrapper = this.getWrap();
+    return (
+      <TrayWrapper>
+        <APIBar buttonVisible={true} contentVisible={false} />
+      </TrayWrapper>
+    );
+  }
+});
 
-      this.setState({
-        disableSubmit: val !== this.getDatabaseName()
-      });
-    },
+var DeleteDatabaseModal = React.createClass({
+
+  getInitialState: function () {
+    return {
+      inputValue: '',
+      disableSubmit: true
+    };
+  },
+
+  propTypes: {
+    showHide: React.PropTypes.func.isRequired,
+    modalProps: React.PropTypes.object
+  },
 
-    onDeleteClick: function (e) {
+  close: function (e) {
+    if (e) {
       e.preventDefault();
+    }
 
-      Actions.deleteDatabase(this.getDatabaseName());
-    },
+    this.setState({
+      inputValue: '',
+      disableSubmit: true
+    });
 
-    onInputKeypress: function (e) {
-      if (e.keyCode === 13 && this.state.disableSubmit !== true) {
-        Actions.deleteDatabase(this.getDatabaseName());
-      }
-    },
+    this.props.showHide({showModal: false});
+  },
 
-    render: function () {
-      var isSystemDatabase = this.props.modalProps.isSystemDatabase;
-      var showDeleteModal = this.props.modalProps.showDeleteModal;
-      var dbId = this.props.modalProps.dbId;
+  open: function () {
+    this.props.showHide({showModal: true});
+  },
 
-      var warning = isSystemDatabase ? (
-        <p style={{color: '#d14'}} className="warning">
-          <b>You are about to delete a system database, be careful!</b>
-        </p>
-      ) : null;
+  getDatabaseName: function () {
+    return this.props.modalProps.dbId.trim();
+  },
 
-      return (
-        <Modal dialogClassName="delete-db-modal" show={showDeleteModal} onHide={this.close}>
-          <Modal.Header closeButton={true}>
-            <Modal.Title>Delete Database</Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-            {warning}
-            <p>
-              Warning: This action will permanently delete <code>{dbId}</code>.
-              To confirm the deletion of the database and all of the
-              database's documents, you must enter the database's name.
-            </p>
-            <input
-              type="text"
-              className="input-block-level"
-              onKeyUp={this.onInputKeypress}
-              onChange={this.onInputChange}
-              autoFocus={true} />
-          </Modal.Body>
-          <Modal.Footer>
-            <a href="#" onClick={this.close} data-bypass="true" className="cancel-link">Cancel</a>
-            <button
-              disabled={this.state.disableSubmit}
-              onClick={this.onDeleteClick}
-              className="btn btn-danger delete">
-              <i className="icon fonticon-cancel-circled" /> Delete
-            </button>
-          </Modal.Footer>
-        </Modal>
-      );
-    }
-  });
+  onInputChange: function (e) {
+    var val = encodeURIComponent(e.target.value.trim());
 
-  const TabElement = ({selected, text, onChange, iconClass}) => {
+    this.setState({
+      inputValue: val
+    });
 
-    const additionalClass = selected ? 'tab-element-checked' : '';
+    this.setState({
+      disableSubmit: val !== this.getDatabaseName()
+    });
+  },
 
-    return (
-      <li className={`component-tab-element ${additionalClass}`}>
+  onDeleteClick: function (e) {
+    e.preventDefault();
 
-        <label>
-          <div className="tab-element-indicator-wrapper">
-            <div className="tab-element-indicator"></div>
-          </div>
-          <div className="tab-element-content">
-            <i className={iconClass}></i>
-            <input
-              type="radio"
-              value={text}
-              checked={selected}
-              onChange={onChange} />
-
-              {text}
-          </div>
-        </label>
-      </li>
+    Actions.deleteDatabase(this.getDatabaseName());
+  },
+
+  onInputKeypress: function (e) {
+    if (e.keyCode === 13 && this.state.disableSubmit !== true) {
+      Actions.deleteDatabase(this.getDatabaseName());
+    }
+  },
+
+  render: function () {
+    var isSystemDatabase = this.props.modalProps.isSystemDatabase;
+    var showDeleteModal = this.props.modalProps.showDeleteModal;
+    var dbId = this.props.modalProps.dbId;
+
+    var warning = isSystemDatabase ? (
+      <p style={{color: '#d14'}} className="warning">
+        <b>You are about to delete a system database, be careful!</b>
+      </p>
+    ) : null;
 
-    );
-  };
-  TabElement.propTypes = {
-    selected: React.PropTypes.bool.isRequired,
-    text: React.PropTypes.string.isRequired,
-    onChange: React.PropTypes.func.isRequired,
-    iconClass: React.PropTypes.string,
-  };
-
-  const TabElementWrapper = ({children}) => {
     return (
-      <ul className="nav nav-tabs component-tab-element-wrapper">
-        {children}
-      </ul>
+      <Modal dialogClassName="delete-db-modal" show={showDeleteModal} onHide={this.close}>
+        <Modal.Header closeButton={true}>
+          <Modal.Title>Delete Database</Modal.Title>
+        </Modal.Header>
+        <Modal.Body>
+          {warning}
+          <p>
+            Warning: This action will permanently delete <code>{dbId}</code>.
+            To confirm the deletion of the database and all of the
+            database's documents, you must enter the database's name.
+          </p>
+          <input
+            type="text"
+            className="input-block-level"
+            onKeyUp={this.onInputKeypress}
+            onChange={this.onInputChange}
+            autoFocus={true} />
+        </Modal.Body>
+        <Modal.Footer>
+          <a href="#" onClick={this.close} data-bypass="true" className="cancel-link">Cancel</a>
+          <button
+            disabled={this.state.disableSubmit}
+            onClick={this.onDeleteClick}
+            className="btn btn-danger delete">
+            <i className="icon fonticon-cancel-circled" /> Delete
+          </button>
+        </Modal.Footer>
+      </Modal>
     );
-  };
-
-
-  return {
-    BadgeList: BadgeList,
-    Badge: Badge,
-    BulkActionComponent: BulkActionComponent,
-    ConfirmButton: ConfirmButton,
-    ToggleHeaderButton: ToggleHeaderButton,
-    StyledSelect: StyledSelect,
-    CodeEditorPanel: CodeEditorPanel,
-    CodeEditor: CodeEditor,
-    StringEditModal: StringEditModal,
-    ZenModeOverlay: ZenModeOverlay,
-    Beautify: Beautify,
-    PaddedBorderedBox: PaddedBorderedBox,
-    Document: Document,
-    LoadLines: LoadLines,
-    MenuDropDown: MenuDropDown,
-    TrayContents: TrayContents,
-    TrayWrapper: TrayWrapper,
-    connectToStores: connectToStores,
-    ApiBarController: ApiBarController,
-    renderMenuDropDown: function (el, opts) {
-      ReactDOM.render(<MenuDropDown icon="fonticon-vertical-ellipsis" links={opts.links} />, el);
-    },
-    removeMenuDropDown: function (el) {
-      ReactDOM.unmountComponentAtNode(el);
-    },
-    DeleteDatabaseModal: DeleteDatabaseModal,
-    TabElement: TabElement,
-    TabElementWrapper: TabElementWrapper
-  };
-
+  }
 });
+
+const TabElement = ({selected, text, onChange, iconClass}) => {
+
+  const additionalClass = selected ? 'tab-element-checked' : '';
+
+  return (
+    <li className={`component-tab-element ${additionalClass}`}>
+
+      <label>
+        <div className="tab-element-indicator-wrapper">
+          <div className="tab-element-indicator"></div>
+        </div>
+        <div className="tab-element-content">
+          <i className={iconClass}></i>
+          <input
+            type="radio"
+            value={text}
+            checked={selected}
+            onChange={onChange} />
+
+            {text}
+        </div>
+      </label>
+    </li>
+
+  );
+};
+TabElement.propTypes = {
+  selected: React.PropTypes.bool.isRequired,
+  text: React.PropTypes.string.isRequired,
+  onChange: React.PropTypes.func.isRequired,
+  iconClass: React.PropTypes.string,
+};
+
+const TabElementWrapper = ({children}) => {
+  return (
+    <ul className="nav nav-tabs component-tab-element-wrapper">
+      {children}
+    </ul>
+  );
+};
+
+
+export default {
+  BadgeList: BadgeList,
+  Badge: Badge,
+  BulkActionComponent: BulkActionComponent,
+  ConfirmButton: ConfirmButton,
+  ToggleHeaderButton: ToggleHeaderButton,
+  StyledSelect: StyledSelect,
+  CodeEditorPanel: CodeEditorPanel,
+  CodeEditor: CodeEditor,
+  StringEditModal: StringEditModal,
+  ZenModeOverlay: ZenModeOverlay,
+  Beautify: Beautify,
+  PaddedBorderedBox: PaddedBorderedBox,
+  Document: Document,
+  LoadLines: LoadLines,
+  MenuDropDown: MenuDropDown,
+  TrayContents: TrayContents,
+  TrayWrapper: TrayWrapper,
+  connectToStores: connectToStores,
+  ApiBarController: ApiBarController,
+  renderMenuDropDown: function (el, opts) {
+    ReactDOM.render(<MenuDropDown icon="fonticon-vertical-ellipsis" links={opts.links} />, el);
+  },
+  removeMenuDropDown: function (el) {
+    ReactDOM.unmountComponentAtNode(el);
+  },
+  DeleteData

<TRUNCATED>

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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-editor/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/actions.js b/app/addons/documents/index-editor/actions.js
index 01e3cf6..48d1c21 100644
--- a/app/addons/documents/index-editor/actions.js
+++ b/app/addons/documents/index-editor/actions.js
@@ -10,291 +10,286 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  '../resources',
-  './actiontypes',
-  '../index-results/actions',
-  '../sidebar/actions',
-  '../sidebar/actiontypes'
-],
-function (app, FauxtonAPI, Documents, ActionTypes, IndexResultsActions, SidebarActions, SidebarActionTypes) {
-
-
-  function selectReduceChanged (reduceOption) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.SELECT_REDUCE_CHANGE,
-      reduceSelectedOption: reduceOption
-    });
-  }
-
-  function changeViewName (name) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.VIEW_NAME_CHANGE,
-      name: name
-    });
-  }
-
-  function editIndex (options) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.EDIT_INDEX,
-      options: options
-    });
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import Documents from "../resources";
+import ActionTypes from "./actiontypes";
+import IndexResultsActions from "../index-results/actions";
+import SidebarActions from "../sidebar/actions";
+import SidebarActionTypes from "../sidebar/actiontypes";
+
+
+function selectReduceChanged (reduceOption) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SELECT_REDUCE_CHANGE,
+    reduceSelectedOption: reduceOption
+  });
+}
+
+function changeViewName (name) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.VIEW_NAME_CHANGE,
+    name: name
+  });
+}
+
+function editIndex (options) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.EDIT_INDEX,
+    options: options
+  });
+}
+
+function clearIndex () {
+  FauxtonAPI.dispatch({ type: ActionTypes.CLEAR_INDEX });
+}
+
+function fetchDesignDocsBeforeEdit (options) {
+  options.designDocs.fetch({reset: true}).then(function () {
+    this.editIndex(options);
+  }.bind(this));
+}
+
+function saveView (viewInfo) {
+  var designDoc = viewInfo.designDoc;
+  designDoc.setDdocView(viewInfo.viewName, viewInfo.map, viewInfo.reduce);
+
+  FauxtonAPI.addNotification({
+    msg: 'Saving View...',
+    type: 'info',
+    clear: true
+  });
+
+  // if the view name just changed and it's in the SAME design doc, remove the old one before saving the doc
+  if (viewInfo.originalDesignDocName === viewInfo.designDocId && viewInfo.originalViewName !== viewInfo.viewName) {
+    designDoc.removeDdocView(viewInfo.originalViewName);
   }
 
-  function clearIndex () {
-    FauxtonAPI.dispatch({ type: ActionTypes.CLEAR_INDEX });
-  }
-
-  function fetchDesignDocsBeforeEdit (options) {
-    options.designDocs.fetch({reset: true}).then(function () {
-      this.editIndex(options);
-    }.bind(this));
-  }
-
-  function saveView (viewInfo) {
-    var designDoc = viewInfo.designDoc;
-    designDoc.setDdocView(viewInfo.viewName, viewInfo.map, viewInfo.reduce);
-
+  designDoc.save().then(function () {
     FauxtonAPI.addNotification({
-      msg: 'Saving View...',
-      type: 'info',
+      msg: 'View Saved.',
+      type: 'success',
       clear: true
     });
 
-    // if the view name just changed and it's in the SAME design doc, remove the old one before saving the doc
-    if (viewInfo.originalDesignDocName === viewInfo.designDocId && viewInfo.originalViewName !== viewInfo.viewName) {
-      designDoc.removeDdocView(viewInfo.originalViewName);
-    }
-
-    designDoc.save().then(function () {
-      FauxtonAPI.addNotification({
-        msg: 'View Saved.',
-        type: 'success',
-        clear: true
+    // if the user just saved the view to a different design doc, remove the view from the old design doc and
+    // delete if it's empty
+    if (viewInfo.originalDesignDocName !== viewInfo.designDocId) {
+      var oldDesignDoc = findDesignDoc(viewInfo.designDocs, viewInfo.originalDesignDocName);
+      safeDeleteIndex(oldDesignDoc, viewInfo.designDocs, 'views', viewInfo.originalViewName, {
+        onSuccess: function () {
+          SidebarActions.updateDesignDocs(viewInfo.designDocs);
+        }
       });
+    }
 
-      // if the user just saved the view to a different design doc, remove the view from the old design doc and
-      // delete if it's empty
-      if (viewInfo.originalDesignDocName !== viewInfo.designDocId) {
-        var oldDesignDoc = findDesignDoc(viewInfo.designDocs, viewInfo.originalDesignDocName);
-        safeDeleteIndex(oldDesignDoc, viewInfo.designDocs, 'views', viewInfo.originalViewName, {
-          onSuccess: function () {
-            SidebarActions.updateDesignDocs(viewInfo.designDocs);
-          }
-        });
-      }
-
-      if (viewInfo.designDocId === 'new-doc') {
-        addDesignDoc(designDoc);
-      }
-
-      FauxtonAPI.dispatch({ type: ActionTypes.VIEW_SAVED });
-      var fragment = FauxtonAPI.urls('view', 'showView', viewInfo.database.safeID(), designDoc.safeID(), app.utils.safeURLName(viewInfo.viewName));
-      FauxtonAPI.navigate(fragment, { trigger: true });
-    });
-  }
-
-  function addDesignDoc (designDoc) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.VIEW_ADD_DESIGN_DOC,
-      designDoc: designDoc.toJSON()
-    });
-  }
-
-  function deleteView (options) {
-
-    function onSuccess () {
+    if (viewInfo.designDocId === 'new-doc') {
+      addDesignDoc(designDoc);
+    }
 
-      // if the user was on the index that was just deleted, redirect them back to all docs
-      if (options.isOnIndex) {
-        var url = FauxtonAPI.urls('allDocs', 'app', options.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT);
-        FauxtonAPI.navigate(url);
-      }
+    FauxtonAPI.dispatch({ type: ActionTypes.VIEW_SAVED });
+    var fragment = FauxtonAPI.urls('view', 'showView', viewInfo.database.safeID(), designDoc.safeID(), app.utils.safeURLName(viewInfo.viewName));
+    FauxtonAPI.navigate(fragment, { trigger: true });
+  });
+}
 
-      SidebarActions.updateDesignDocs(options.designDocs);
+function addDesignDoc (designDoc) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.VIEW_ADD_DESIGN_DOC,
+    designDoc: designDoc.toJSON()
+  });
+}
 
-      FauxtonAPI.addNotification({
-        msg: 'The <code>' + _.escape(options.indexName) + '</code> view has been deleted.',
-        type: 'info',
-        escape: false,
-        clear: true
-      });
-      FauxtonAPI.dispatch({ type: SidebarActionTypes.SIDEBAR_HIDE_DELETE_INDEX_MODAL });
-    }
+function deleteView (options) {
 
-    safeDeleteIndex(options.designDoc, options.designDocs, 'views', options.indexName, { onSuccess: onSuccess });
-  }
+  function onSuccess () {
 
-  function cloneView (params) {
-    var targetDesignDoc = getDesignDoc(params.designDocs, params.targetDesignDocName, params.newDesignDocName, params.database);
-    var indexes = targetDesignDoc.get('views');
-    if (indexes && _.has(indexes, params.newIndexName)) {
-      FauxtonAPI.addNotification({
-        msg: 'That index name is already used in this design doc. Please enter a new name.',
-        type: 'error',
-        clear: true
-      });
-      return;
+    // if the user was on the index that was just deleted, redirect them back to all docs
+    if (options.isOnIndex) {
+      var url = FauxtonAPI.urls('allDocs', 'app', options.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT);
+      FauxtonAPI.navigate(url);
     }
-    if (!indexes) {
-      indexes = {};
-    }
-    var sourceDesignDoc = findDesignDoc(params.designDocs, '_design/' + params.sourceDesignDocName);
-    var sourceDesignDocJSON = sourceDesignDoc.toJSON();
 
-    // this sets whatever content is in the source index into the target design doc under the new index name
-    indexes[params.newIndexName] = sourceDesignDocJSON.views[params.sourceIndexName];
-    targetDesignDoc.set({ views: indexes });
+    SidebarActions.updateDesignDocs(options.designDocs);
 
-    targetDesignDoc.save().then(function () {
-      params.onComplete();
-      FauxtonAPI.addNotification({
-        msg: 'The index has been cloned.',
-        type: 'success',
-        clear: true
-      });
-      SidebarActions.updateDesignDocs(params.designDocs);
-    },
-    function (xhr) {
-      params.onComplete();
-      var responseText = JSON.parse(xhr.responseText).reason;
-      FauxtonAPI.addNotification({
-        msg: 'Clone failed: ' + responseText,
-        type: 'error',
-        clear: true
-      });
+    FauxtonAPI.addNotification({
+      msg: 'The <code>' + _.escape(options.indexName) + '</code> view has been deleted.',
+      type: 'info',
+      escape: false,
+      clear: true
     });
+    FauxtonAPI.dispatch({ type: SidebarActionTypes.SIDEBAR_HIDE_DELETE_INDEX_MODAL });
   }
 
-  function gotoEditViewPage (databaseName, designDocName, indexName) {
-    FauxtonAPI.navigate('#' + FauxtonAPI.urls('view', 'edit', databaseName, designDocName, indexName));
-  }
+  safeDeleteIndex(options.designDoc, options.designDocs, 'views', options.indexName, { onSuccess: onSuccess });
+}
 
-  function updateMapCode (code) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.VIEW_UPDATE_MAP_CODE,
-      code: code
+function cloneView (params) {
+  var targetDesignDoc = getDesignDoc(params.designDocs, params.targetDesignDocName, params.newDesignDocName, params.database);
+  var indexes = targetDesignDoc.get('views');
+  if (indexes && _.has(indexes, params.newIndexName)) {
+    FauxtonAPI.addNotification({
+      msg: 'That index name is already used in this design doc. Please enter a new name.',
+      type: 'error',
+      clear: true
     });
+    return;
   }
-
-  function updateReduceCode (code) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.VIEW_UPDATE_REDUCE_CODE,
-      code: code
-    });
+  if (!indexes) {
+    indexes = {};
   }
+  var sourceDesignDoc = findDesignDoc(params.designDocs, '_design/' + params.sourceDesignDocName);
+  var sourceDesignDocJSON = sourceDesignDoc.toJSON();
 
-  function selectDesignDoc (designDoc) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.DESIGN_DOC_CHANGE,
-      options: {
-        value: designDoc
-      }
-    });
-  }
+  // this sets whatever content is in the source index into the target design doc under the new index name
+  indexes[params.newIndexName] = sourceDesignDocJSON.views[params.sourceIndexName];
+  targetDesignDoc.set({ views: indexes });
 
-  function updateNewDesignDocName (designDocName) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.DESIGN_DOC_NEW_NAME_UPDATED,
-      options: {
-        value: designDocName
-      }
+  targetDesignDoc.save().then(function () {
+    params.onComplete();
+    FauxtonAPI.addNotification({
+      msg: 'The index has been cloned.',
+      type: 'success',
+      clear: true
     });
-  }
-
-  // safely deletes an index of any type. It only deletes the actual design doc if there are no
-  // other indexes of any type left in the doc
-  function safeDeleteIndex (designDoc, designDocs, indexPropName, indexName, options) {
-    var opts = _.extend({
-      onSuccess: function () { },
-      onError: function (xhr) {
-        var responseText = JSON.parse(xhr.responseText).reason;
-        FauxtonAPI.addNotification({
-          msg: 'Delete failed: ' + responseText,
-          type: 'error',
-          clear: true
-        });
-      }
-    }, options);
-
-    var indexes = designDoc.get(indexPropName) || {};
-    delete indexes[indexName];
-    var newIndexes = {};
-    newIndexes[indexPropName] = indexes;
-    designDoc.set(newIndexes);
-
-    // we either save the design doc with the now-removed index, or we remove it altogether if there are no indexes
-    // of any type left in the design doc
-    var indexTypePropNames = FauxtonAPI.getIndexTypePropNames();
-    var hasRemainingIndex = _.some(indexTypePropNames, function (propName) {
-      return designDoc.get(propName) && _.keys(designDoc.get(propName)).length > 0;
+    SidebarActions.updateDesignDocs(params.designDocs);
+  },
+  function (xhr) {
+    params.onComplete();
+    var responseText = JSON.parse(xhr.responseText).reason;
+    FauxtonAPI.addNotification({
+      msg: 'Clone failed: ' + responseText,
+      type: 'error',
+      clear: true
     });
-
-    var promise;
-    var deleteDesignDoc = false;
-    if (hasRemainingIndex) {
-      promise = designDoc.save();
-    } else {
-      promise = designDoc.destroy();
-      deleteDesignDoc = true;
+  });
+}
+
+function gotoEditViewPage (databaseName, designDocName, indexName) {
+  FauxtonAPI.navigate('#' + FauxtonAPI.urls('view', 'edit', databaseName, designDocName, indexName));
+}
+
+function updateMapCode (code) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.VIEW_UPDATE_MAP_CODE,
+    code: code
+  });
+}
+
+function updateReduceCode (code) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.VIEW_UPDATE_REDUCE_CODE,
+    code: code
+  });
+}
+
+function selectDesignDoc (designDoc) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.DESIGN_DOC_CHANGE,
+    options: {
+      value: designDoc
+    }
+  });
+}
+
+function updateNewDesignDocName (designDocName) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.DESIGN_DOC_NEW_NAME_UPDATED,
+    options: {
+      value: designDocName
+    }
+  });
+}
+
+// safely deletes an index of any type. It only deletes the actual design doc if there are no
+// other indexes of any type left in the doc
+function safeDeleteIndex (designDoc, designDocs, indexPropName, indexName, options) {
+  var opts = _.extend({
+    onSuccess: function () { },
+    onError: function (xhr) {
+      var responseText = JSON.parse(xhr.responseText).reason;
+      FauxtonAPI.addNotification({
+        msg: 'Delete failed: ' + responseText,
+        type: 'error',
+        clear: true
+      });
     }
-    promise.then(function () {
-      if (deleteDesignDoc) {
-        designDocs.remove(designDoc.id);
-      }
-      opts.onSuccess();
-    }, opts.onError);
+  }, options);
+
+  var indexes = designDoc.get(indexPropName) || {};
+  delete indexes[indexName];
+  var newIndexes = {};
+  newIndexes[indexPropName] = indexes;
+  designDoc.set(newIndexes);
+
+  // we either save the design doc with the now-removed index, or we remove it altogether if there are no indexes
+  // of any type left in the design doc
+  var indexTypePropNames = FauxtonAPI.getIndexTypePropNames();
+  var hasRemainingIndex = _.some(indexTypePropNames, function (propName) {
+    return designDoc.get(propName) && _.keys(designDoc.get(propName)).length > 0;
+  });
+
+  var promise;
+  var deleteDesignDoc = false;
+  if (hasRemainingIndex) {
+    promise = designDoc.save();
+  } else {
+    promise = designDoc.destroy();
+    deleteDesignDoc = true;
   }
+  promise.then(function () {
+    if (deleteDesignDoc) {
+      designDocs.remove(designDoc.id);
+    }
+    opts.onSuccess();
+  }, opts.onError);
+}
 
 
 
-  // ---- helpers ----
+// ---- helpers ----
 
-  function findDesignDoc (designDocs, designDocName) {
-    return designDocs.find(function (doc) {
-      return doc.id === designDocName;
-    }).dDocModel();
-  }
+function findDesignDoc (designDocs, designDocName) {
+  return designDocs.find(function (doc) {
+    return doc.id === designDocName;
+  }).dDocModel();
+}
 
-  function getDesignDoc (designDocs, targetDesignDocName, newDesignDocName, database) {
-    if (targetDesignDocName === 'new-doc') {
-      var doc = {
-        "_id": "_design/" + newDesignDocName,
-        "views": {},
-        "language": "javascript"
-      };
-      return new Documents.Doc(doc, { database: database });
-    }
-
-    var foundDoc = designDocs.find(function (ddoc) {
-      return ddoc.id === targetDesignDocName;
-    });
-    return (!foundDoc) ? null : foundDoc.dDocModel();
+function getDesignDoc (designDocs, targetDesignDocName, newDesignDocName, database) {
+  if (targetDesignDocName === 'new-doc') {
+    var doc = {
+      "_id": "_design/" + newDesignDocName,
+      "views": {},
+      "language": "javascript"
+    };
+    return new Documents.Doc(doc, { database: database });
   }
 
-
-  return {
-    helpers: {
-      findDesignDoc: findDesignDoc,
-      getDesignDoc: getDesignDoc
-    },
-    safeDeleteIndex: safeDeleteIndex,
-    selectReduceChanged: selectReduceChanged,
-    changeViewName: changeViewName,
-    editIndex: editIndex,
-    clearIndex: clearIndex,
-    fetchDesignDocsBeforeEdit: fetchDesignDocsBeforeEdit,
-    saveView: saveView,
-    addDesignDoc: addDesignDoc,
-    deleteView: deleteView,
-    cloneView: cloneView,
-    gotoEditViewPage: gotoEditViewPage,
-    updateMapCode: updateMapCode,
-    updateReduceCode: updateReduceCode,
-    selectDesignDoc: selectDesignDoc,
-    updateNewDesignDocName: updateNewDesignDocName
-  };
-
-});
+  var foundDoc = designDocs.find(function (ddoc) {
+    return ddoc.id === targetDesignDocName;
+  });
+  return (!foundDoc) ? null : foundDoc.dDocModel();
+}
+
+
+export default {
+  helpers: {
+    findDesignDoc: findDesignDoc,
+    getDesignDoc: getDesignDoc
+  },
+  safeDeleteIndex: safeDeleteIndex,
+  selectReduceChanged: selectReduceChanged,
+  changeViewName: changeViewName,
+  editIndex: editIndex,
+  clearIndex: clearIndex,
+  fetchDesignDocsBeforeEdit: fetchDesignDocsBeforeEdit,
+  saveView: saveView,
+  addDesignDoc: addDesignDoc,
+  deleteView: deleteView,
+  cloneView: cloneView,
+  gotoEditViewPage: gotoEditViewPage,
+  updateMapCode: updateMapCode,
+  updateReduceCode: updateReduceCode,
+  selectDesignDoc: selectDesignDoc,
+  updateNewDesignDocName: updateNewDesignDocName
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-editor/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/actiontypes.js b/app/addons/documents/index-editor/actiontypes.js
index d4c1fa1..920bd9f 100644
--- a/app/addons/documents/index-editor/actiontypes.js
+++ b/app/addons/documents/index-editor/actiontypes.js
@@ -10,20 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    CLEAR_INDEX: 'CLEAR_INDEX',
-    EDIT_INDEX: 'EDIT_INDEX',
-    EDIT_NEW_INDEX: 'EDIT_NEW_INDEX',
-    SELECT_REDUCE_CHANGE: 'SELECT_REDUCE_CHANGE',
-    VIEW_SAVED: 'VIEW_SAVED',
-    VIEW_CREATED: 'VIEW_CREATED',
-    DESIGN_DOC_CHANGE: 'DESIGN_DOC_CHANGE',
-    DESIGN_DOC_NEW_NAME_UPDATED: 'DESIGN_DOC_NEW_NAME_UPDATED',
-    NEW_DESIGN_DOC: 'NEW_DESIGN_DOC',
-    VIEW_NAME_CHANGE: 'VIEW_NAME_CHANGE',
-    VIEW_ADD_DESIGN_DOC: 'VIEW_ADD_DESIGN_DOC',
-    VIEW_UPDATE_MAP_CODE: 'VIEW_UPDATE_MAP_CODE',
-    VIEW_UPDATE_REDUCE_CODE: 'VIEW_UPDATE_REDUCE_CODE'
-  };
-});
+export default {
+  CLEAR_INDEX: 'CLEAR_INDEX',
+  EDIT_INDEX: 'EDIT_INDEX',
+  EDIT_NEW_INDEX: 'EDIT_NEW_INDEX',
+  SELECT_REDUCE_CHANGE: 'SELECT_REDUCE_CHANGE',
+  VIEW_SAVED: 'VIEW_SAVED',
+  VIEW_CREATED: 'VIEW_CREATED',
+  DESIGN_DOC_CHANGE: 'DESIGN_DOC_CHANGE',
+  DESIGN_DOC_NEW_NAME_UPDATED: 'DESIGN_DOC_NEW_NAME_UPDATED',
+  NEW_DESIGN_DOC: 'NEW_DESIGN_DOC',
+  VIEW_NAME_CHANGE: 'VIEW_NAME_CHANGE',
+  VIEW_ADD_DESIGN_DOC: 'VIEW_ADD_DESIGN_DOC',
+  VIEW_UPDATE_MAP_CODE: 'VIEW_UPDATE_MAP_CODE',
+  VIEW_UPDATE_REDUCE_CODE: 'VIEW_UPDATE_REDUCE_CODE'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/components.react.jsx b/app/addons/documents/index-editor/components.react.jsx
index dba5fb8..ff01e3a 100644
--- a/app/addons/documents/index-editor/components.react.jsx
+++ b/app/addons/documents/index-editor/components.react.jsx
@@ -10,390 +10,384 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  'react-dom',
-  './stores',
-  './actions',
-  '../../fauxton/components',
-  '../../components/react-components.react'
-],
-
-function (app, FauxtonAPI, React, ReactDOM, Stores, Actions, Components, ReactComponents) {
-
-  var store = Stores.indexEditorStore;
-  var getDocUrl = app.helpers.getDocUrl;
-  var StyledSelect = ReactComponents.StyledSelect;
-  var CodeEditorPanel = ReactComponents.CodeEditorPanel;
-  var ConfirmButton = ReactComponents.ConfirmButton;
-  var LoadLines = ReactComponents.LoadLines;
-
-
-  var DesignDocSelector = React.createClass({
-    propTypes: {
-      designDocList: React.PropTypes.array.isRequired,
-      onSelectDesignDoc: React.PropTypes.func.isRequired,
-      onChangeNewDesignDocName: React.PropTypes.func.isRequired,
-      selectedDesignDocName: React.PropTypes.string.isRequired,
-      newDesignDocName: React.PropTypes.string.isRequired,
-      designDocLabel: React.PropTypes.string,
-      docURL: React.PropTypes.string
-    },
-
-    getDefaultProps: function () {
-      return {
-        designDocLabel: 'Design Document'
-      };
-    },
-
-    validate: function () {
-      if (this.props.selectedDesignDocName === 'new-doc' && this.props.newDesignDocName === '') {
-        FauxtonAPI.addNotification({
-          msg: 'Please name your design doc.',
-          type: 'error'
-        });
-        ReactDOM.findDOMNode(this.refs.newDesignDoc).focus();
-        return false;
-      }
-      return true;
-    },
-
-    getDocList: function () {
-      return _.map(this.props.designDocList, function (designDoc) {
-        return (<option key={designDoc} value={designDoc}>{designDoc}</option>);
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Stores from "./stores";
+import Actions from "./actions";
+import Components from "../../fauxton/components";
+import ReactComponents from "../../components/react-components.react";
+
+var store = Stores.indexEditorStore;
+var getDocUrl = app.helpers.getDocUrl;
+var StyledSelect = ReactComponents.StyledSelect;
+var CodeEditorPanel = ReactComponents.CodeEditorPanel;
+var ConfirmButton = ReactComponents.ConfirmButton;
+var LoadLines = ReactComponents.LoadLines;
+
+
+var DesignDocSelector = React.createClass({
+  propTypes: {
+    designDocList: React.PropTypes.array.isRequired,
+    onSelectDesignDoc: React.PropTypes.func.isRequired,
+    onChangeNewDesignDocName: React.PropTypes.func.isRequired,
+    selectedDesignDocName: React.PropTypes.string.isRequired,
+    newDesignDocName: React.PropTypes.string.isRequired,
+    designDocLabel: React.PropTypes.string,
+    docURL: React.PropTypes.string
+  },
+
+  getDefaultProps: function () {
+    return {
+      designDocLabel: 'Design Document'
+    };
+  },
+
+  validate: function () {
+    if (this.props.selectedDesignDocName === 'new-doc' && this.props.newDesignDocName === '') {
+      FauxtonAPI.addNotification({
+        msg: 'Please name your design doc.',
+        type: 'error'
       });
-    },
-
-    selectDesignDoc: function (e) {
-      this.props.onSelectDesignDoc(e.target.value);
-    },
-
-    updateDesignDocName: function (e) {
-      this.props.onChangeNewDesignDocName(e.target.value);
-    },
-
-    getNewDDocField: function () {
-      if (this.props.selectedDesignDocName !== 'new-doc') {
-        return;
-      }
-      return (
-        <div id="new-ddoc-section" className="span5">
-          <label className="control-label" htmlFor="new-ddoc">_design/</label>
-          <div className="controls">
-            <input type="text" ref="newDesignDoc" id="new-ddoc" placeholder="newDesignDoc"
-               onChange={this.updateDesignDocName}/>
-          </div>
+      ReactDOM.findDOMNode(this.refs.newDesignDoc).focus();
+      return false;
+    }
+    return true;
+  },
+
+  getDocList: function () {
+    return _.map(this.props.designDocList, function (designDoc) {
+      return (<option key={designDoc} value={designDoc}>{designDoc}</option>);
+    });
+  },
+
+  selectDesignDoc: function (e) {
+    this.props.onSelectDesignDoc(e.target.value);
+  },
+
+  updateDesignDocName: function (e) {
+    this.props.onChangeNewDesignDocName(e.target.value);
+  },
+
+  getNewDDocField: function () {
+    if (this.props.selectedDesignDocName !== 'new-doc') {
+      return;
+    }
+    return (
+      <div id="new-ddoc-section" className="span5">
+        <label className="control-label" htmlFor="new-ddoc">_design/</label>
+        <div className="controls">
+          <input type="text" ref="newDesignDoc" id="new-ddoc" placeholder="newDesignDoc"
+             onChange={this.updateDesignDocName}/>
         </div>
-      );
-    },
-
-    getDocLink: function () {
-      if (!this.props.docLink) {
-        return null;
-      }
-      return (
-        <a className="help-link" data-bypass="true" href={this.props.docLink} target="_blank">
-          <i className="icon-question-sign" />
-        </a>
-      );
-    },
+      </div>
+    );
+  },
 
-    render: function () {
-      return (
-        <div className="design-doc-group control-group">
-          <div className="span3">
-            <label htmlFor="ddoc">{this.props.designDocLabel}
-              {this.getDocLink()}
+  getDocLink: function () {
+    if (!this.props.docLink) {
+      return null;
+    }
+    return (
+      <a className="help-link" data-bypass="true" href={this.props.docLink} target="_blank">
+        <i className="icon-question-sign" />
+      </a>
+    );
+  },
+
+  render: function () {
+    return (
+      <div className="design-doc-group control-group">
+        <div className="span3">
+          <label htmlFor="ddoc">{this.props.designDocLabel}
+            {this.getDocLink()}
+          </label>
+          <div className="styled-select">
+            <label htmlFor="js-backup-list-select">
+              <i className="fonticon-down-dir" />
+              <select id="ddoc" onChange={this.selectDesignDoc} value={this.props.selectedDesignDocName}>
+                <optgroup label="Select a document">
+                  <option value="new-doc">New document</option>
+                  {this.getDocList()}
+                </optgroup>
+              </select>
             </label>
-            <div className="styled-select">
-              <label htmlFor="js-backup-list-select">
-                <i className="fonticon-down-dir" />
-                <select id="ddoc" onChange={this.selectDesignDoc} value={this.props.selectedDesignDocName}>
-                  <optgroup label="Select a document">
-                    <option value="new-doc">New document</option>
-                    {this.getDocList()}
-                  </optgroup>
-                </select>
-              </label>
-            </div>
           </div>
-          {this.getNewDDocField()}
         </div>
-      );
+        {this.getNewDDocField()}
+      </div>
+    );
+  }
+});
+
+
+var ReduceEditor = React.createClass({
+
+  getStoreState: function () {
+    return {
+      reduce: store.getReduce(),
+      reduceOptions: store.reduceOptions(),
+      reduceSelectedOption: store.reduceSelectedOption(),
+      hasCustomReduce: store.hasCustomReduce(),
+      hasReduce: store.hasReduce()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getOptionsList: function () {
+    return _.map(this.state.reduceOptions, function (reduce, i) {
+      return <option key={i} value={reduce}>{reduce}</option>;
+    }, this);
+  },
+
+  getReduceValue: function () {
+    if (!this.state.hasReduce) {
+      return null;
     }
-  });
-
-
-  var ReduceEditor = React.createClass({
-
-    getStoreState: function () {
-      return {
-        reduce: store.getReduce(),
-        reduceOptions: store.reduceOptions(),
-        reduceSelectedOption: store.reduceSelectedOption(),
-        hasCustomReduce: store.hasCustomReduce(),
-        hasReduce: store.hasReduce()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getOptionsList: function () {
-      return _.map(this.state.reduceOptions, function (reduce, i) {
-        return <option key={i} value={reduce}>{reduce}</option>;
-      }, this);
-    },
-
-    getReduceValue: function () {
-      if (!this.state.hasReduce) {
-        return null;
-      }
-
-      if (!this.state.hasCustomReduce) {
-        return this.state.reduce;
-      }
-
-      return this.refs.reduceEditor.getValue();
-    },
-
-    getEditor: function () {
-      return this.refs.reduceEditor.getEditor();
-    },
-
-    render: function () {
-      var reduceOptions = this.getOptionsList(),
-          customReduceSection;
-
-      if (this.state.hasCustomReduce) {
-        customReduceSection = <CodeEditorPanel
-          ref='reduceEditor'
-          id='reduce-function'
-          title={'Custom Reduce function'}
-          defaultCode={this.state.reduce}
-          allowZenMode={false}
-          blur={this.updateReduceCode}
-        />;
-      }
 
-      return (
-        <div>
-          <div className="control-group">
-            <label htmlFor="reduce-function-selector">
-              <span>Reduce (optional)</span>
-              <a
-                className="help-link"
-                data-bypass="true"
-                href={getDocUrl('REDUCE_FUNCS')}
-                target="_blank"
-              >
-                <i className="icon-question-sign"></i>
-              </a>
-            </label>
-            <StyledSelect
-              selectContent={reduceOptions}
-              selectChange={this.selectChange}
-              selectId="reduce-function-selector"
-              selectValue={this.state.reduceSelectedOption} />
-          </div>
+    if (!this.state.hasCustomReduce) {
+      return this.state.reduce;
+    }
+
+    return this.refs.reduceEditor.getValue();
+  },
+
+  getEditor: function () {
+    return this.refs.reduceEditor.getEditor();
+  },
+
+  render: function () {
+    var reduceOptions = this.getOptionsList(),
+        customReduceSection;
+
+    if (this.state.hasCustomReduce) {
+      customReduceSection = <CodeEditorPanel
+        ref='reduceEditor'
+        id='reduce-function'
+        title={'Custom Reduce function'}
+        defaultCode={this.state.reduce}
+        allowZenMode={false}
+        blur={this.updateReduceCode}
+      />;
+    }
 
-          {customReduceSection}
+    return (
+      <div>
+        <div className="control-group">
+          <label htmlFor="reduce-function-selector">
+            <span>Reduce (optional)</span>
+            <a
+              className="help-link"
+              data-bypass="true"
+              href={getDocUrl('REDUCE_FUNCS')}
+              target="_blank"
+            >
+              <i className="icon-question-sign"></i>
+            </a>
+          </label>
+          <StyledSelect
+            selectContent={reduceOptions}
+            selectChange={this.selectChange}
+            selectId="reduce-function-selector"
+            selectValue={this.state.reduceSelectedOption} />
         </div>
-      );
-    },
 
-    updateReduceCode: function (code) {
-      Actions.updateReduceCode(code);
-    },
+        {customReduceSection}
+      </div>
+    );
+  },
 
-    selectChange: function (event) {
-      Actions.selectReduceChanged(event.target.value);
-    },
+  updateReduceCode: function (code) {
+    Actions.updateReduceCode(code);
+  },
 
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
+  selectChange: function (event) {
+    Actions.selectReduceChanged(event.target.value);
+  },
+
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
+    }
+  },
+
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+  }
+});
 
-    componentDidMount: function () {
-      store.on('change', this.onChange, this);
-    },
 
-    componentWillUnmount: function () {
-      store.off('change', this.onChange);
+var EditorController = React.createClass({
+
+  getStoreState: function () {
+    return {
+      database: store.getDatabase(),
+      isNewView: store.isNewView(),
+      viewName: store.getViewName(),
+      designDocs: store.getDesignDocs(),
+      designDocList: store.getAvailableDesignDocs(),
+      originalViewName: store.getOriginalViewName(),
+      originalDesignDocName: store.getOriginalDesignDocName(),
+      newDesignDoc: store.isNewDesignDoc(),
+      designDocId: store.getDesignDocId(),
+      newDesignDocName: store.getNewDesignDocName(),
+      saveDesignDoc: store.getSaveDesignDoc(),
+      map: store.getMap(),
+      isLoading: store.isLoading()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
     }
-  });
-
-
-  var EditorController = React.createClass({
-
-    getStoreState: function () {
-      return {
-        database: store.getDatabase(),
-        isNewView: store.isNewView(),
-        viewName: store.getViewName(),
-        designDocs: store.getDesignDocs(),
-        designDocList: store.getAvailableDesignDocs(),
-        originalViewName: store.getOriginalViewName(),
-        originalDesignDocName: store.getOriginalDesignDocName(),
-        newDesignDoc: store.isNewDesignDoc(),
-        designDocId: store.getDesignDocId(),
-        newDesignDocName: store.getNewDesignDocName(),
-        saveDesignDoc: store.getSaveDesignDoc(),
-        map: store.getMap(),
-        isLoading: store.isLoading()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
-
-    componentDidMount: function () {
-      store.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      store.off('change', this.onChange);
-    },
-
-    // the code editor is a standalone component, so if the user goes from one edit view page to another, we need to
-    // force an update of the editor panel
-    componentDidUpdate: function (prevProps, prevState) {
-      if (this.state.map !== prevState.map && this.refs.mapEditor) {
-        this.refs.mapEditor.update();
-      }
-    },
-
-    hasErrors: function () {
-      var mapEditorErrors = this.refs.mapEditor.getEditor().hasErrors();
-      var customReduceErrors = (store.hasCustomReduce()) ? this.refs.reduceEditor.getEditor().hasErrors() : false;
-      return mapEditorErrors || customReduceErrors;
-    },
-
-    saveView: function (e) {
-      e.preventDefault();
-
-      if (!this.refs.designDocSelector.validate()) {
-        return;
-      }
-
-      if (this.hasErrors()) {
-        FauxtonAPI.addNotification({
-          msg: 'Please fix the Javascript errors and try again.',
-          type: 'error',
-          clear: true
-        });
-        return;
-      }
-
-      Actions.saveView({
-        database: this.state.database,
-        newView: this.state.isNewView,
-        viewName: this.state.viewName,
-        designDoc: this.state.saveDesignDoc,
-        designDocId: this.state.designDocId,
-        newDesignDoc: this.state.newDesignDoc,
-        originalViewName: this.state.originalViewName,
-        originalDesignDocName: this.state.originalDesignDocName,
-        map: this.refs.mapEditor.getValue(),
-        reduce: this.refs.reduceEditor.getReduceValue(),
-        designDocs: this.state.designDocs
-      });
-    },
+  },
 
-    viewChange: function (e) {
-      Actions.changeViewName(e.target.value);
-    },
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+  },
 
-    updateMapCode: function (code) {
-      Actions.updateMapCode(code);
-    },
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+  },
 
-    render: function () {
-      if (this.state.isLoading) {
-        return (
-          <div className="define-view">
-            <LoadLines />
-          </div>
-        );
-      }
+  // the code editor is a standalone component, so if the user goes from one edit view page to another, we need to
+  // force an update of the editor panel
+  componentDidUpdate: function (prevProps, prevState) {
+    if (this.state.map !== prevState.map && this.refs.mapEditor) {
+      this.refs.mapEditor.update();
+    }
+  },
+
+  hasErrors: function () {
+    var mapEditorErrors = this.refs.mapEditor.getEditor().hasErrors();
+    var customReduceErrors = (store.hasCustomReduce()) ? this.refs.reduceEditor.getEditor().hasErrors() : false;
+    return mapEditorErrors || customReduceErrors;
+  },
 
-      var pageHeader = (this.state.isNewView) ? 'New View' : 'Edit View';
-      var btnLabel = (this.state.isNewView) ? 'Create Document and Build Index' : 'Save Document and Build Index';
+  saveView: function (e) {
+    e.preventDefault();
 
-      var cancelLink = '#' + FauxtonAPI.urls('view', 'showView', this.state.database.id, this.state.designDocId, this.state.viewName);
+    if (!this.refs.designDocSelector.validate()) {
+      return;
+    }
+
+    if (this.hasErrors()) {
+      FauxtonAPI.addNotification({
+        msg: 'Please fix the Javascript errors and try again.',
+        type: 'error',
+        clear: true
+      });
+      return;
+    }
+
+    Actions.saveView({
+      database: this.state.database,
+      newView: this.state.isNewView,
+      viewName: this.state.viewName,
+      designDoc: this.state.saveDesignDoc,
+      designDocId: this.state.designDocId,
+      newDesignDoc: this.state.newDesignDoc,
+      originalViewName: this.state.originalViewName,
+      originalDesignDocName: this.state.originalDesignDocName,
+      map: this.refs.mapEditor.getValue(),
+      reduce: this.refs.reduceEditor.getReduceValue(),
+      designDocs: this.state.designDocs
+    });
+  },
+
+  viewChange: function (e) {
+    Actions.changeViewName(e.target.value);
+  },
+
+  updateMapCode: function (code) {
+    Actions.updateMapCode(code);
+  },
+
+  render: function () {
+    if (this.state.isLoading) {
       return (
         <div className="define-view">
-          <form className="form-horizontal view-query-save" onSubmit={this.saveView}>
-            <h3 className="simple-header">{pageHeader}</h3>
-
-            <div className="new-ddoc-section">
-              <DesignDocSelector
-                ref="designDocSelector"
-                designDocList={this.state.designDocList}
-                selectedDesignDocName={this.state.designDocId}
-                newDesignDocName={this.state.newDesignDocName}
-                onSelectDesignDoc={Actions.selectDesignDoc}
-                onChangeNewDesignDocName={Actions.updateNewDesignDocName}
-                docLink={getDocUrl('DESIGN_DOCS')} />
-            </div>
-
-            <div className="control-group">
-              <label htmlFor="index-name">
-                <span>Index name</span>
-                <a
-                  className="help-link"
-                  data-bypass="true"
-                  href={getDocUrl('VIEW_FUNCS')}
-                  target="_blank">
-                  <i className="icon-question-sign"></i>
-                </a>
-              </label>
-              <input
-                type="text"
-                id="index-name"
-                value={this.state.viewName}
-                onChange={this.viewChange}
-                placeholder="Index name" />
-            </div>
-            <CodeEditorPanel
-              id={'map-function'}
-              ref="mapEditor"
-              title={"Map function"}
-              docLink={getDocUrl('MAP_FUNCS')}
-              blur={this.updateMapCode}
-              allowZenMode={false}
-              defaultCode={this.state.map} />
-            <ReduceEditor ref="reduceEditor" />
-            <div className="padded-box">
-              <div className="control-group">
-                <ConfirmButton id="save-view" text={btnLabel} />
-                <a href={cancelLink} className="index-cancel-link">Cancel</a>
-              </div>
-            </div>
-          </form>
+          <LoadLines />
         </div>
       );
     }
-  });
-
 
-  return {
-    EditorController: EditorController,
-    ReduceEditor: ReduceEditor,
-    DesignDocSelector: DesignDocSelector,
-    StyledSelect: StyledSelect
-  };
+    var pageHeader = (this.state.isNewView) ? 'New View' : 'Edit View';
+    var btnLabel = (this.state.isNewView) ? 'Create Document and Build Index' : 'Save Document and Build Index';
+
+    var cancelLink = '#' + FauxtonAPI.urls('view', 'showView', this.state.database.id, this.state.designDocId, this.state.viewName);
+    return (
+      <div className="define-view">
+        <form className="form-horizontal view-query-save" onSubmit={this.saveView}>
+          <h3 className="simple-header">{pageHeader}</h3>
+
+          <div className="new-ddoc-section">
+            <DesignDocSelector
+              ref="designDocSelector"
+              designDocList={this.state.designDocList}
+              selectedDesignDocName={this.state.designDocId}
+              newDesignDocName={this.state.newDesignDocName}
+              onSelectDesignDoc={Actions.selectDesignDoc}
+              onChangeNewDesignDocName={Actions.updateNewDesignDocName}
+              docLink={getDocUrl('DESIGN_DOCS')} />
+          </div>
 
+          <div className="control-group">
+            <label htmlFor="index-name">
+              <span>Index name</span>
+              <a
+                className="help-link"
+                data-bypass="true"
+                href={getDocUrl('VIEW_FUNCS')}
+                target="_blank">
+                <i className="icon-question-sign"></i>
+              </a>
+            </label>
+            <input
+              type="text"
+              id="index-name"
+              value={this.state.viewName}
+              onChange={this.viewChange}
+              placeholder="Index name" />
+          </div>
+          <CodeEditorPanel
+            id={'map-function'}
+            ref="mapEditor"
+            title={"Map function"}
+            docLink={getDocUrl('MAP_FUNCS')}
+            blur={this.updateMapCode}
+            allowZenMode={false}
+            defaultCode={this.state.map} />
+          <ReduceEditor ref="reduceEditor" />
+          <div className="padded-box">
+            <div className="control-group">
+              <ConfirmButton id="save-view" text={btnLabel} />
+              <a href={cancelLink} className="index-cancel-link">Cancel</a>
+            </div>
+          </div>
+        </form>
+      </div>
+    );
+  }
 });
+
+
+export default {
+  EditorController: EditorController,
+  ReduceEditor: ReduceEditor,
+  DesignDocSelector: DesignDocSelector,
+  StyledSelect: StyledSelect
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-editor/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/stores.js b/app/addons/documents/index-editor/stores.js
index e5071db..b327d74 100644
--- a/app/addons/documents/index-editor/stores.js
+++ b/app/addons/documents/index-editor/stores.js
@@ -10,261 +10,255 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  './actiontypes',
-  '../resources'
-],
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import Resources from "../resources";
+var Stores = {};
+
+Stores.IndexEditorStore = FauxtonAPI.Store.extend({
+
+  defaultMap: 'function (doc) {\n  emit(doc._id, 1);\n}',
+  defaultReduce: 'function (keys, values, rereduce) {\n  if (rereduce) {\n    return sum(values);\n  } else {\n    return values.length;\n  }\n}',
+
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._designDocs = [];
+    this._isLoading = true;
+    this._view = { reduce: '', map: this.defaultMap };
+    this._database = { id: '0' };
+  },
+
+  editIndex: function (options) {
+    this._database = options.database;
+    this._newView = options.newView;
+    this._viewName = options.viewName || 'viewName';
+    this._newDesignDoc = options.newDesignDoc || false;
+    this._newDesignDocName = '';
+    this._designDocs = options.designDocs;
+    this._designDocId = options.designDocId;
+    this._originalViewName = this._viewName;
+    this._originalDesignDocName = options.designDocId;
+    this.setView();
+
+    this._isLoading = false;
+  },
+
+  isLoading: function () {
+    return this._isLoading;
+  },
+
+  setView: function () {
+    if (this._newView || this._newDesignDoc) {
+      this._view = { reduce: '', map: this.defaultMap };
+    } else {
+      this._view = this.getDesignDoc().get('views')[this._viewName];
+    }
+  },
+
+  getDatabase: function () {
+    return this._database;
+  },
+
+  getMap: function () {
+    return this._view.map;
+  },
+
+  setMap: function (map) {
+    this._view.map = map;
+  },
+
+  getReduce: function () {
+    return this._view.reduce;
+  },
+
+  setReduce: function (reduce) {
+    this._view.reduce = reduce;
+  },
+
+  getDesignDoc: function () {
+    return this._designDocs.find(function (ddoc) {
+      return this._designDocId == ddoc.id;
+    }, this).dDocModel();
+  },
+
+  getDesignDocs: function () {
+    return this._designDocs;
+  },
+
+  // returns a simple array of design doc IDs. Omits mango docs
+  getAvailableDesignDocs: function () {
+    var availableDocs = this.getDesignDocs().filter(function (doc) {
+      return !doc.isMangoDoc();
+    });
+    return _.map(availableDocs, function (doc) {
+      return doc.id;
+    });
+  },
+
+  getDesignDocId: function () {
+    return this._designDocId;
+  },
+
+  setDesignDocId: function (designDocId) {
+    this._designDocId = designDocId;
+  },
+
+  isNewDesignDoc: function () {
+    return this._newDesignDoc;
+  },
+
+  isNewView: function () {
+    return this._newView;
+  },
+
+  getViewName: function () {
+    return this._viewName;
+  },
+
+  setViewName: function (name) {
+    this._viewName = name;
+  },
+
+  hasCustomReduce: function () {
+    if (!this.hasReduce()) {
+      return false;
+    }
+    return !_.contains(this.builtInReduces(), this.getReduce());
+  },
 
-function (FauxtonAPI, ActionTypes, Resources) {
-  var Stores = {};
+  hasReduce: function () {
+    if (!this.getReduce()) {
+      return false;
+    }
+    return true;
+  },
 
-  Stores.IndexEditorStore = FauxtonAPI.Store.extend({
+  getOriginalViewName: function () {
+    return this._originalViewName;
+  },
 
-    defaultMap: 'function (doc) {\n  emit(doc._id, 1);\n}',
-    defaultReduce: 'function (keys, values, rereduce) {\n  if (rereduce) {\n    return sum(values);\n  } else {\n    return values.length;\n  }\n}',
+  getOriginalDesignDocName: function () {
+    return this._originalDesignDocName;
+  },
 
-    initialize: function () {
-      this.reset();
-    },
+  builtInReduces: function () {
+    return ['_sum', '_count', '_stats'];
+  },
 
-    reset: function () {
-      this._designDocs = [];
-      this._isLoading = true;
-      this._view = { reduce: '', map: this.defaultMap };
-      this._database = { id: '0' };
-    },
-
-    editIndex: function (options) {
-      this._database = options.database;
-      this._newView = options.newView;
-      this._viewName = options.viewName || 'viewName';
-      this._newDesignDoc = options.newDesignDoc || false;
-      this._newDesignDocName = '';
-      this._designDocs = options.designDocs;
-      this._designDocId = options.designDocId;
-      this._originalViewName = this._viewName;
-      this._originalDesignDocName = options.designDocId;
-      this.setView();
-
-      this._isLoading = false;
-    },
-
-    isLoading: function () {
-      return this._isLoading;
-    },
-
-    setView: function () {
-      if (this._newView || this._newDesignDoc) {
-        this._view = { reduce: '', map: this.defaultMap };
-      } else {
-        this._view = this.getDesignDoc().get('views')[this._viewName];
-      }
-    },
-
-    getDatabase: function () {
-      return this._database;
-    },
-
-    getMap: function () {
-      return this._view.map;
-    },
-
-    setMap: function (map) {
-      this._view.map = map;
-    },
-
-    getReduce: function () {
-      return this._view.reduce;
-    },
-
-    setReduce: function (reduce) {
-      this._view.reduce = reduce;
-    },
-
-    getDesignDoc: function () {
-      return this._designDocs.find(function (ddoc) {
-        return this._designDocId == ddoc.id;
-      }, this).dDocModel();
-    },
-
-    getDesignDocs: function () {
-      return this._designDocs;
-    },
-
-    // returns a simple array of design doc IDs. Omits mango docs
-    getAvailableDesignDocs: function () {
-      var availableDocs = this.getDesignDocs().filter(function (doc) {
-        return !doc.isMangoDoc();
-      });
-      return _.map(availableDocs, function (doc) {
-        return doc.id;
-      });
-    },
-
-    getDesignDocId: function () {
-      return this._designDocId;
-    },
-
-    setDesignDocId: function (designDocId) {
-      this._designDocId = designDocId;
-    },
-
-    isNewDesignDoc: function () {
-      return this._newDesignDoc;
-    },
-
-    isNewView: function () {
-      return this._newView;
-    },
-
-    getViewName: function () {
-      return this._viewName;
-    },
-
-    setViewName: function (name) {
-      this._viewName = name;
-    },
-
-    hasCustomReduce: function () {
-      if (!this.hasReduce()) {
-        return false;
-      }
-      return !_.contains(this.builtInReduces(), this.getReduce());
-    },
-
-    hasReduce: function () {
-      if (!this.getReduce()) {
-        return false;
-      }
-      return true;
-    },
-
-    getOriginalViewName: function () {
-      return this._originalViewName;
-    },
-
-    getOriginalDesignDocName: function () {
-      return this._originalDesignDocName;
-    },
-
-    builtInReduces: function () {
-      return ['_sum', '_count', '_stats'];
-    },
-
-    reduceSelectedOption: function () {
-      if (!this.hasReduce()) {
-        return 'NONE';
-      }
-      if (this.hasCustomReduce()) {
-        return 'CUSTOM';
-      }
-      return this.getReduce();
-    },
-
-    reduceOptions: function () {
-      return this.builtInReduces().concat(['CUSTOM', 'NONE']);
-    },
-
-    updateReduceFromSelect: function (selectedReduce) {
-      if (selectedReduce === 'NONE') {
-        this.setReduce(null);
-        return;
-      }
-      if (selectedReduce === 'CUSTOM') {
-        this.setReduce(this.defaultReduce);
-        return;
-      }
-      this.setReduce(selectedReduce);
-    },
-
-    addDesignDoc: function (designDoc) {
-      this._designDocs.add(designDoc, { merge: true });
-      this._designDocId = designDoc._id;
-    },
-
-    getNewDesignDocName: function () {
-      return this._newDesignDocName;
-    },
-
-    getSaveDesignDoc: function () {
-      if (this._designDocId === 'new-doc') {
-        var doc = {
-          _id: '_design/' + this._newDesignDocName,
-          views: {},
-          language: 'javascript'
-        };
-        return new Resources.Doc(doc, { database: this._database });
-      }
-
-      var foundDoc = this._designDocs.find(function (ddoc) {
-        return ddoc.id === this._designDocId;
-      }.bind(this));
-
-      return (!foundDoc) ? null : foundDoc.dDocModel();
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.CLEAR_INDEX:
-          this.reset();
-        break;
-
-        case ActionTypes.EDIT_INDEX:
-          this.editIndex(action.options);
-        break;
-
-        case ActionTypes.VIEW_NAME_CHANGE:
-          this.setViewName(action.name);
-        break;
-
-        case ActionTypes.EDIT_NEW_INDEX:
-          this.editIndex(action.options);
-        break;
-
-        case ActionTypes.SELECT_REDUCE_CHANGE:
-          this.updateReduceFromSelect(action.reduceSelectedOption);
-        break;
-
-        case ActionTypes.DESIGN_DOC_CHANGE:
-          this.setDesignDocId(action.options.value);
-        break;
-
-        case ActionTypes.VIEW_SAVED:
-        break;
-
-        case ActionTypes.VIEW_CREATED:
-        break;
-
-        case ActionTypes.VIEW_ADD_DESIGN_DOC:
-          this.addDesignDoc(action.designDoc);
-          this.setView();
-        break;
-
-        case ActionTypes.VIEW_UPDATE_MAP_CODE:
-          this.setMap(action.code);
-        break;
-
-        case ActionTypes.VIEW_UPDATE_REDUCE_CODE:
-          this.setReduce(action.code);
-        break;
-
-        case ActionTypes.DESIGN_DOC_NEW_NAME_UPDATED:
-          this._newDesignDocName = action.options.value;
-        break;
-
-        default:
-        return;
-      }
-
-      this.triggerChange();
+  reduceSelectedOption: function () {
+    if (!this.hasReduce()) {
+      return 'NONE';
+    }
+    if (this.hasCustomReduce()) {
+      return 'CUSTOM';
+    }
+    return this.getReduce();
+  },
+
+  reduceOptions: function () {
+    return this.builtInReduces().concat(['CUSTOM', 'NONE']);
+  },
+
+  updateReduceFromSelect: function (selectedReduce) {
+    if (selectedReduce === 'NONE') {
+      this.setReduce(null);
+      return;
+    }
+    if (selectedReduce === 'CUSTOM') {
+      this.setReduce(this.defaultReduce);
+      return;
+    }
+    this.setReduce(selectedReduce);
+  },
+
+  addDesignDoc: function (designDoc) {
+    this._designDocs.add(designDoc, { merge: true });
+    this._designDocId = designDoc._id;
+  },
+
+  getNewDesignDocName: function () {
+    return this._newDesignDocName;
+  },
+
+  getSaveDesignDoc: function () {
+    if (this._designDocId === 'new-doc') {
+      var doc = {
+        _id: '_design/' + this._newDesignDocName,
+        views: {},
+        language: 'javascript'
+      };
+      return new Resources.Doc(doc, { database: this._database });
     }
 
-  });
+    var foundDoc = this._designDocs.find(function (ddoc) {
+      return ddoc.id === this._designDocId;
+    }.bind(this));
+
+    return (!foundDoc) ? null : foundDoc.dDocModel();
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.CLEAR_INDEX:
+        this.reset();
+      break;
+
+      case ActionTypes.EDIT_INDEX:
+        this.editIndex(action.options);
+      break;
 
-  Stores.indexEditorStore = new Stores.IndexEditorStore();
-  Stores.indexEditorStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.indexEditorStore.dispatch);
+      case ActionTypes.VIEW_NAME_CHANGE:
+        this.setViewName(action.name);
+      break;
 
-  return Stores;
+      case ActionTypes.EDIT_NEW_INDEX:
+        this.editIndex(action.options);
+      break;
+
+      case ActionTypes.SELECT_REDUCE_CHANGE:
+        this.updateReduceFromSelect(action.reduceSelectedOption);
+      break;
+
+      case ActionTypes.DESIGN_DOC_CHANGE:
+        this.setDesignDocId(action.options.value);
+      break;
+
+      case ActionTypes.VIEW_SAVED:
+      break;
+
+      case ActionTypes.VIEW_CREATED:
+      break;
+
+      case ActionTypes.VIEW_ADD_DESIGN_DOC:
+        this.addDesignDoc(action.designDoc);
+        this.setView();
+      break;
+
+      case ActionTypes.VIEW_UPDATE_MAP_CODE:
+        this.setMap(action.code);
+      break;
+
+      case ActionTypes.VIEW_UPDATE_REDUCE_CODE:
+        this.setReduce(action.code);
+      break;
+
+      case ActionTypes.DESIGN_DOC_NEW_NAME_UPDATED:
+        this._newDesignDocName = action.options.value;
+      break;
+
+      default:
+      return;
+    }
+
+    this.triggerChange();
+  }
 
 });
+
+Stores.indexEditorStore = new Stores.IndexEditorStore();
+Stores.indexEditorStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.indexEditorStore.dispatch);
+
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-editor/tests/actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/tests/actionsSpec.js b/app/addons/documents/index-editor/tests/actionsSpec.js
index 16e2eee..be13898 100644
--- a/app/addons/documents/index-editor/tests/actionsSpec.js
+++ b/app/addons/documents/index-editor/tests/actionsSpec.js
@@ -10,133 +10,129 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../actions',
-  '../../resources',
-  '../actiontypes',
-  '../stores',
-  '../../../../../test/mocha/testUtils',
-  '../../index-results/actions',
-  'sinon',
-  '../../../documents/base'
-], function (FauxtonAPI, Actions, Documents, ActionTypes, Stores, testUtils, IndexResultsActions, sinon) {
-  var assert = testUtils.assert;
-  var restore = testUtils.restore;
-
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
-
-
-  describe('Index Editor Actions', function () {
-
-    describe('delete view', function () {
-      var designDocs, database, designDoc, designDocCollection, designDocId, viewName;
-      beforeEach(function () {
-        database = {
-          safeID: function () { return 'safeid';}
-        };
-
-        viewName = 'test-view';
-        designDocId = '_design/test-doc';
-        designDocCollection = new Documents.AllDocs([{
-          _id: designDocId,
-          _rev: '1-231',
-          views: {
-              'test-view': {
-                map: 'function () {};'
-              },
-              'test-view2': {
-                map: 'function () {};'
-              }
+import FauxtonAPI from "../../../../core/api";
+import Actions from "../actions";
+import Documents from "../../resources";
+import ActionTypes from "../actiontypes";
+import Stores from "../stores";
+import testUtils from "../../../../../test/mocha/testUtils";
+import IndexResultsActions from "../../index-results/actions";
+import sinon from "sinon";
+import "../../../documents/base";
+var assert = testUtils.assert;
+var restore = testUtils.restore;
+
+FauxtonAPI.router = new FauxtonAPI.Router([]);
+
+
+describe('Index Editor Actions', function () {
+
+  describe('delete view', function () {
+    var designDocs, database, designDoc, designDocCollection, designDocId, viewName;
+    beforeEach(function () {
+      database = {
+        safeID: function () { return 'safeid';}
+      };
+
+      viewName = 'test-view';
+      designDocId = '_design/test-doc';
+      designDocCollection = new Documents.AllDocs([{
+        _id: designDocId,
+        _rev: '1-231',
+        views: {
+            'test-view': {
+              map: 'function () {};'
+            },
+            'test-view2': {
+              map: 'function () {};'
             }
-          }], {
-          params: { limit: 10 },
-          database: database
-        });
-        designDocs = designDocCollection.models;
-        designDoc = _.first(designDocs);
+          }
+        }], {
+        params: { limit: 10 },
+        database: database
       });
+      designDocs = designDocCollection.models;
+      designDoc = _.first(designDocs);
+    });
 
-      afterEach(function () {
-        restore(FauxtonAPI.navigate);
-        restore(FauxtonAPI.triggerRouteEvent);
-      });
+    afterEach(function () {
+      restore(FauxtonAPI.navigate);
+      restore(FauxtonAPI.triggerRouteEvent);
+    });
 
-      it('saves design doc if has other views', function () {
-        designDoc.save = function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        };
-        var saveSpy = sinon.spy(designDoc, 'save');
-        designDocs.fetch = function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        };
-
-        Actions.deleteView({
-          indexName: viewName,
-          database: database,
-          designDocs: designDocs,
-          designDoc: designDoc
-        });
-
-        assert.ok(saveSpy.calledOnce);
+    it('saves design doc if has other views', function () {
+      designDoc.save = function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      };
+      var saveSpy = sinon.spy(designDoc, 'save');
+      designDocs.fetch = function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      };
+
+      Actions.deleteView({
+        indexName: viewName,
+        database: database,
+        designDocs: designDocs,
+        designDoc: designDoc
       });
 
-      it('deletes design doc if has no other views', function () {
-        designDoc.removeDdocView('test-view2');
-
-        designDoc.destroy = function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        };
-        var destroySpy = sinon.spy(designDoc, 'destroy');
-        designDocs.remove = function () {};
-        designDocs.fetch = function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        };
-
-        Actions.deleteView({
-          indexName: viewName,
-          database: database,
-          designDocs: designDocs,
-          designDoc: designDoc
-        });
-
-        assert.ok(destroySpy.calledOnce);
+      assert.ok(saveSpy.calledOnce);
+    });
+
+    it('deletes design doc if has no other views', function () {
+      designDoc.removeDdocView('test-view2');
+
+      designDoc.destroy = function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      };
+      var destroySpy = sinon.spy(designDoc, 'destroy');
+      designDocs.remove = function () {};
+      designDocs.fetch = function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      };
+
+      Actions.deleteView({
+        indexName: viewName,
+        database: database,
+        designDocs: designDocs,
+        designDoc: designDoc
       });
 
-      it('navigates to all docs if was on view', function () {
-        var spy = sinon.spy(FauxtonAPI, 'navigate');
-
-        designDoc.save = function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        };
-        designDocs.fetch = function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        };
-        Actions.deleteView({
-          indexName: viewName,
-          database: database,
-          designDocs: designDocs,
-          designDoc: designDoc,
-          isOnIndex: true
-        });
-
-        assert.ok(spy.getCall(0).args[0].match(/_all_docs/));
-        assert.ok(spy.calledOnce);
+      assert.ok(destroySpy.calledOnce);
+    });
+
+    it('navigates to all docs if was on view', function () {
+      var spy = sinon.spy(FauxtonAPI, 'navigate');
+
+      designDoc.save = function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      };
+      designDocs.fetch = function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      };
+      Actions.deleteView({
+        indexName: viewName,
+        database: database,
+        designDocs: designDocs,
+        designDoc: designDoc,
+        isOnIndex: true
       });
 
+      assert.ok(spy.getCall(0).args[0].match(/_all_docs/));
+      assert.ok(spy.calledOnce);
     });
-  });
 
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-editor/tests/storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/tests/storesSpec.js b/app/addons/documents/index-editor/tests/storesSpec.js
index bdd8dc9..a77fa52 100644
--- a/app/addons/documents/index-editor/tests/storesSpec.js
+++ b/app/addons/documents/index-editor/tests/storesSpec.js
@@ -10,259 +10,131 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../stores',
-  '../actiontypes',
-  '../../../documents/resources',
-  '../../../../../test/mocha/testUtils',
-], function (FauxtonAPI, Stores, ActionTypes, Documents, testUtils) {
-  var assert = testUtils.assert;
-  var store;
-  var dispatchToken;
-
-  describe('IndexEditorStore', function () {
-
-    beforeEach(function () {
-      store = new Stores.IndexEditorStore();
-      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
-    });
-
-    afterEach(function () {
-      FauxtonAPI.dispatcher.unregister(dispatchToken);
-    });
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../stores";
+import ActionTypes from "../actiontypes";
+import Documents from "../../../documents/resources";
+import testUtils from "../../../../../test/mocha/testUtils";
+var assert = testUtils.assert;
+var store;
+var dispatchToken;
+
+describe('IndexEditorStore', function () {
+
+  beforeEach(function () {
+    store = new Stores.IndexEditorStore();
+    dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+  });
 
-    describe('map editor', function () {
+  afterEach(function () {
+    FauxtonAPI.dispatcher.unregister(dispatchToken);
+  });
 
-      describe('new view', function () {
+  describe('map editor', function () {
 
-        beforeEach(function () {
+    describe('new view', function () {
 
-          FauxtonAPI.dispatch({
-            type: ActionTypes.EDIT_NEW_INDEX,
-            options: {
-              newView: true
-            }
-          });
-        });
+      beforeEach(function () {
 
-        it('returns default map', function () {
-          assert.equal(store.getMap(), 'function (doc) {\n  emit(doc._id, 1);\n}');
+        FauxtonAPI.dispatch({
+          type: ActionTypes.EDIT_NEW_INDEX,
+          options: {
+            newView: true
+          }
         });
       });
 
+      it('returns default map', function () {
+        assert.equal(store.getMap(), 'function (doc) {\n  emit(doc._id, 1);\n}');
+      });
     });
 
-    describe('reduce editor', function () {
-
-      describe('has custom reduce', function () {
-
-        it('is false for no reduce', function () {
-          var designDoc = {
-            _id: '_design/test-doc',
-            views: {
-              'test-view': {
-                map: 'function () {};'
-              }
-            }
-          };
-
-          var designDocs = new Documents.AllDocs([designDoc], {
-            params: { limit: 10 },
-            database: {
-              safeID: function () { return 'id';}
-            }
-          });
-
-          FauxtonAPI.dispatch({
-            type: ActionTypes.EDIT_NEW_INDEX,
-            options: {
-              newView: false,
-              viewName: 'test-view',
-              designDocs: designDocs,
-              designDocId: designDoc._id
-            }
-          });
+  });
 
-          assert.notOk(store.hasCustomReduce());
-        });
+  describe('reduce editor', function () {
 
-        it('is false for built in reduce', function () {
-          var designDoc = {
-            _id: '_design/test-doc',
-            views: {
-              'test-view': {
-                map: 'function () {};',
-                reduce: '_sum'
-              }
-            }
-          };
+    describe('has custom reduce', function () {
 
-          var designDocs = new Documents.AllDocs([designDoc], {
-            params: { limit: 10 },
-            database: {
-              safeID: function () { return 'id';}
-            }
-          });
-          FauxtonAPI.dispatch({
-            type: ActionTypes.EDIT_NEW_INDEX,
-            options: {
-              newView: false,
-              viewName: 'test-view',
-              designDocs: designDocs,
-              designDocId: designDoc._id
+      it('is false for no reduce', function () {
+        var designDoc = {
+          _id: '_design/test-doc',
+          views: {
+            'test-view': {
+              map: 'function () {};'
             }
-          });
+          }
+        };
 
-          assert.notOk(store.hasCustomReduce());
+        var designDocs = new Documents.AllDocs([designDoc], {
+          params: { limit: 10 },
+          database: {
+            safeID: function () { return 'id';}
+          }
         });
 
-        it('is true for custom reduce', function () {
-          var designDoc = {
-            _id: '_design/test-doc',
-            views: {
-              'test-view': {
-                map: 'function () {};',
-                reduce: 'function (reduce) { reduce(); }'
-              }
-            }
-          };
-
-          var designDocs = new Documents.AllDocs([designDoc], {
-            params: { limit: 10 },
-            database: {
-              safeID: function () { return 'id';}
-            }
-          });
-
-          FauxtonAPI.dispatch({
-            type: ActionTypes.EDIT_NEW_INDEX,
-            options: {
-              newView: false,
-              viewName: 'test-view',
-              designDocs: designDocs,
-              designDocId: designDoc._id
-            }
-          });
-
-          assert.ok(store.hasCustomReduce());
+        FauxtonAPI.dispatch({
+          type: ActionTypes.EDIT_NEW_INDEX,
+          options: {
+            newView: false,
+            viewName: 'test-view',
+            designDocs: designDocs,
+            designDocId: designDoc._id
+          }
         });
 
+        assert.notOk(store.hasCustomReduce());
       });
 
-      //show default reduce
-      describe('SELECT_REDUCE_CHANGE', function () {
-
-        beforeEach(function () {
-          var designDoc = {
-            _id: '_design/test-doc',
-            views: {
-              'test-view': {
-                map: 'function () {};'
-              }
-            }
-          };
-
-          var designDocs = new Documents.AllDocs([designDoc], {
-            params: { limit: 10 },
-            database: {
-              safeID: function () { return 'id';}
-            }
-          });
-
-          FauxtonAPI.dispatch({
-            type: ActionTypes.EDIT_NEW_INDEX,
-            options: {
-              newView: false,
-              viewName: 'test-view',
-              designDocs: designDocs,
-              designDocId: designDoc._id
+      it('is false for built in reduce', function () {
+        var designDoc = {
+          _id: '_design/test-doc',
+          views: {
+            'test-view': {
+              map: 'function () {};',
+              reduce: '_sum'
             }
-          });
-        });
+          }
+        };
 
-        it('NONE returns null reduce', function () {
-          FauxtonAPI.dispatch({
-            type: ActionTypes.SELECT_REDUCE_CHANGE,
-            reduceSelectedOption: 'NONE'
-          });
-          assert.ok(_.isNull(store.getReduce()));
+        var designDocs = new Documents.AllDocs([designDoc], {
+          params: { limit: 10 },
+          database: {
+            safeID: function () { return 'id';}
+          }
         });
-
-        it('builtin returns bultin reduce', function () {
-          FauxtonAPI.dispatch({
-            type: ActionTypes.SELECT_REDUCE_CHANGE,
-            reduceSelectedOption: '_sum'
-          });
-          assert.equal(store.getReduce(), '_sum');
+        FauxtonAPI.dispatch({
+          type: ActionTypes.EDIT_NEW_INDEX,
+          options: {
+            newView: false,
+            viewName: 'test-view',
+            designDocs: designDocs,
+            designDocId: designDoc._id
+          }
         });
 
-        it('custom returns custom reduce', function () {
-          FauxtonAPI.dispatch({
-            type: ActionTypes.SELECT_REDUCE_CHANGE,
-            reduceSelectedOption: 'CUSTOM'
-          });
-          assert.equal(store.getReduce(), 'function (keys, values, rereduce) {\n  if (rereduce) {\n    return sum(values);\n  } else {\n    return values.length;\n  }\n}');
-        });
+        assert.notOk(store.hasCustomReduce());
       });
-    });
 
-
-    describe('design doc selector', function () {
-      var designDoc;
-
-      beforeEach(function () {
-        designDoc = {
+      it('is true for custom reduce', function () {
+        var designDoc = {
           _id: '_design/test-doc',
           views: {
             'test-view': {
-              map: 'boom'
-            }
-          }
-        };
-
-        var mangoDoc = {
-          "_id": "_design/123mango",
-          "id": "_design/123mango",
-          "key": "_design/123mango",
-          "value": {
-            "rev": "20-9e4bc8b76fd7d752d620bbe6e0ea9a80"
-          },
-          "doc": {
-            "_id": "_design/123mango",
-            "_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"
-              }
-            },
-            "language": "query",
-            "indexes": {
-              "newSearch": {
-                "analyzer": "standard",
-                "index": "function(doc){\n index(\"default\", doc._id);\n}"
-              }
+              map: 'function () {};',
+              reduce: 'function (reduce) { reduce(); }'
             }
           }
         };
 
-        var designDocArray = _.map([designDoc, mangoDoc], function (doc) {
-          return Documents.Doc.prototype.parse(doc);
-        });
-
-        var designDocs = new Documents.AllDocs(designDocArray, {
+        var designDocs = new Documents.AllDocs([designDoc], {
           params: { limit: 10 },
           database: {
-            safeID: function () { return 'id'; }
+            safeID: function () { return 'id';}
           }
         });
 
         FauxtonAPI.dispatch({
-          type: ActionTypes.EDIT_INDEX,
+          type: ActionTypes.EDIT_NEW_INDEX,
           options: {
             newView: false,
             viewName: 'test-view',
@@ -270,73 +142,198 @@ define([
             designDocId: designDoc._id
           }
         });
-      });
 
-      afterEach(function () {
-        store.reset();
+        assert.ok(store.hasCustomReduce());
       });
 
-      it('DESIGN_DOC_CHANGE changes design doc id', function () {
-        var designDocId = 'another-one';
-        FauxtonAPI.dispatch({
-          type: ActionTypes.DESIGN_DOC_CHANGE,
-          options: {
-            value: designDocId
-          }
-        });
-        assert.equal(store.getDesignDocId(), designDocId);
-      });
-
-      it('only filters mango docs', function () {
-        var designDocs = store.getAvailableDesignDocs();
-        assert.equal(designDocs.length, 1);
-        assert.equal(designDocs[0], '_design/test-doc');
-      });
     });
 
-    describe('EDIT_INDEX', function () {
-      var designDoc, designDocs;
+    //show default reduce
+    describe('SELECT_REDUCE_CHANGE', function () {
 
       beforeEach(function () {
-        designDoc = {
+        var designDoc = {
           _id: '_design/test-doc',
           views: {
             'test-view': {
-              map: 'boom'
+              map: 'function () {};'
             }
           }
         };
 
-        designDocs = new Documents.AllDocs([designDoc], {
+        var designDocs = new Documents.AllDocs([designDoc], {
           params: { limit: 10 },
           database: {
             safeID: function () { return 'id';}
           }
         });
 
-      });
-
-      it('can set reduce for new design doc', function () {
         FauxtonAPI.dispatch({
-          type: ActionTypes.EDIT_INDEX,
+          type: ActionTypes.EDIT_NEW_INDEX,
           options: {
-            newView: true,
-            newDesignDoc: true,
+            newView: false,
             viewName: 'test-view',
             designDocs: designDocs,
-            designDocId: undefined
+            designDocId: designDoc._id
           }
         });
+      });
 
+      it('NONE returns null reduce', function () {
         FauxtonAPI.dispatch({
           type: ActionTypes.SELECT_REDUCE_CHANGE,
-          reduceSelectedOption: '_sum'
+          reduceSelectedOption: 'NONE'
         });
+        assert.ok(_.isNull(store.getReduce()));
+      });
 
+      it('builtin returns bultin reduce', function () {
+        FauxtonAPI.dispatch({
+          type: ActionTypes.SELECT_REDUCE_CHANGE,
+          reduceSelectedOption: '_sum'
+        });
         assert.equal(store.getReduce(), '_sum');
       });
 
+      it('custom returns custom reduce', function () {
+        FauxtonAPI.dispatch({
+          type: ActionTypes.SELECT_REDUCE_CHANGE,
+          reduceSelectedOption: 'CUSTOM'
+        });
+        assert.equal(store.getReduce(), 'function (keys, values, rereduce) {\n  if (rereduce) {\n    return sum(values);\n  } else {\n    return values.length;\n  }\n}');
+      });
+    });
+  });
+
+
+  describe('design doc selector', function () {
+    var designDoc;
+
+    beforeEach(function () {
+      designDoc = {
+        _id: '_design/test-doc',
+        views: {
+          'test-view': {
+            map: 'boom'
+          }
+        }
+      };
+
+      var mangoDoc = {
+        "_id": "_design/123mango",
+        "id": "_design/123mango",
+        "key": "_design/123mango",
+        "value": {
+          "rev": "20-9e4bc8b76fd7d752d620bbe6e0ea9a80"
+        },
+        "doc": {
+          "_id": "_design/123mango",
+          "_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"
+            }
+          },
+          "language": "query",
+          "indexes": {
+            "newSearch": {
+              "analyzer": "standard",
+              "index": "function(doc){\n index(\"default\", doc._id);\n}"
+            }
+          }
+        }
+      };
+
+      var designDocArray = _.map([designDoc, mangoDoc], function (doc) {
+        return Documents.Doc.prototype.parse(doc);
+      });
+
+      var designDocs = new Documents.AllDocs(designDocArray, {
+        params: { limit: 10 },
+        database: {
+          safeID: function () { return 'id'; }
+        }
+      });
+
+      FauxtonAPI.dispatch({
+        type: ActionTypes.EDIT_INDEX,
+        options: {
+          newView: false,
+          viewName: 'test-view',
+          designDocs: designDocs,
+          designDocId: designDoc._id
+        }
+      });
+    });
+
+    afterEach(function () {
+      store.reset();
+    });
+
+    it('DESIGN_DOC_CHANGE changes design doc id', function () {
+      var designDocId = 'another-one';
+      FauxtonAPI.dispatch({
+        type: ActionTypes.DESIGN_DOC_CHANGE,
+        options: {
+          value: designDocId
+        }
+      });
+      assert.equal(store.getDesignDocId(), designDocId);
+    });
+
+    it('only filters mango docs', function () {
+      var designDocs = store.getAvailableDesignDocs();
+      assert.equal(designDocs.length, 1);
+      assert.equal(designDocs[0], '_design/test-doc');
+    });
+  });
+
+  describe('EDIT_INDEX', function () {
+    var designDoc, designDocs;
+
+    beforeEach(function () {
+      designDoc = {
+        _id: '_design/test-doc',
+        views: {
+          'test-view': {
+            map: 'boom'
+          }
+        }
+      };
+
+      designDocs = new Documents.AllDocs([designDoc], {
+        params: { limit: 10 },
+        database: {
+          safeID: function () { return 'id';}
+        }
+      });
+
+    });
+
+    it('can set reduce for new design doc', function () {
+      FauxtonAPI.dispatch({
+        type: ActionTypes.EDIT_INDEX,
+        options: {
+          newView: true,
+          newDesignDoc: true,
+          viewName: 'test-view',
+          designDocs: designDocs,
+          designDocId: undefined
+        }
+      });
+
+      FauxtonAPI.dispatch({
+        type: ActionTypes.SELECT_REDUCE_CHANGE,
+        reduceSelectedOption: '_sum'
+      });
+
+      assert.equal(store.getReduce(), '_sum');
     });
 
   });
+
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/changes/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/components.react.jsx b/app/addons/documents/changes/components.react.jsx
index 9c6f90e..4836125 100644
--- a/app/addons/documents/changes/components.react.jsx
+++ b/app/addons/documents/changes/components.react.jsx
@@ -10,450 +10,445 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  'react-dom',
-  './actions',
-  './stores',
-  '../../fauxton/components.react',
-  '../../components/react-components.react',
-
-  'react-addons-css-transition-group',
-  '../../../../assets/js/plugins/prettify',
-], function (app, FauxtonAPI, React, ReactDOM, Actions, Stores, Components, ReactComponents, ReactCSSTransitionGroup) {
-
-  var changesStore = Stores.changesStore;
-
-  var BadgeList = ReactComponents.BadgeList;
-
-  // the top-level component for the Changes Filter section. Handles hiding/showing of the filters form
-  var ChangesHeaderController = React.createClass({
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        showTabContent: changesStore.isTabVisible()
-      };
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    componentDidMount: function () {
-      changesStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      changesStore.off('change', this.onChange);
-    },
-
-    toggleFilterSection: function () {
-      Actions.toggleTabVisibility();
-    },
-
-    render: function () {
-      var tabContent = '';
-      if (this.state.showTabContent) {
-        tabContent = <ChangesTabContent key="changesFilterSection" />;
-      }
-
-      return (
-        <div className="changes-header-section">
-          <ChangesHeaderTab onToggle={this.toggleFilterSection} />
-          <ReactCSSTransitionGroup transitionName="toggle-changes-filter" component="div" className="changes-tab-content"
-             transitionEnterTimeout={500} transitionLeaveTimeout={300}>
-            {tabContent}
-          </ReactCSSTransitionGroup>
-        </div>
-      );
-    }
-  });
-
-
-  var ChangesHeaderTab = React.createClass({
-    propTypes: {
-      onToggle: React.PropTypes.func.isRequired
-    },
-
-    render: function () {
-      return (
-        <div className="dashboard-upper-menu">
-          <ul className="nav nav-tabs" id="db-views-tabs-nav">
-            <li>
-              <a href="#filter" onClick={this.props.onToggle} data-bypass="true" data-toggle="tab">
-                <i className="fonticon fonticon-plus"></i> Filter
-              </a>
-            </li>
-          </ul>
-        </div>
-      );
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Actions from "./actions";
+import Stores from "./stores";
+import Components from "../../fauxton/components.react";
+import ReactComponents from "../../components/react-components.react";
+import ReactCSSTransitionGroup from "react-addons-css-transition-group";
+import "../../../../assets/js/plugins/prettify";
+
+var changesStore = Stores.changesStore;
+
+var BadgeList = ReactComponents.BadgeList;
+
+// the top-level component for the Changes Filter section. Handles hiding/showing of the filters form
+var ChangesHeaderController = React.createClass({
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      showTabContent: changesStore.isTabVisible()
+    };
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidMount: function () {
+    changesStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    changesStore.off('change', this.onChange);
+  },
+
+  toggleFilterSection: function () {
+    Actions.toggleTabVisibility();
+  },
+
+  render: function () {
+    var tabContent = '';
+    if (this.state.showTabContent) {
+      tabContent = <ChangesTabContent key="changesFilterSection" />;
     }
-  });
 
+    return (
+      <div className="changes-header-section">
+        <ChangesHeaderTab onToggle={this.toggleFilterSection} />
+        <ReactCSSTransitionGroup transitionName="toggle-changes-filter" component="div" className="changes-tab-content"
+           transitionEnterTimeout={500} transitionLeaveTimeout={300}>
+          {tabContent}
+        </ReactCSSTransitionGroup>
+      </div>
+    );
+  }
+});
 
-  var ChangesTabContent = React.createClass({
-    getStoreState: function () {
-      return {
-        filters: changesStore.getFilters(),
-        pollingEnabled: changesStore.pollingEnabled()
-      };
-    },
 
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
+var ChangesHeaderTab = React.createClass({
+  propTypes: {
+    onToggle: React.PropTypes.func.isRequired
+  },
+
+  render: function () {
+    return (
+      <div className="dashboard-upper-menu">
+        <ul className="nav nav-tabs" id="db-views-tabs-nav">
+          <li>
+            <a href="#filter" onClick={this.props.onToggle} data-bypass="true" data-toggle="tab">
+              <i className="fonticon fonticon-plus"></i> Filter
+            </a>
+          </li>
+        </ul>
+      </div>
+    );
+  }
+});
 
-    componentDidMount: function () {
-      changesStore.on('change', this.onChange, this);
-    },
 
-    componentWillUnmount: function () {
-      changesStore.off('change', this.onChange);
-    },
+var ChangesTabContent = React.createClass({
+  getStoreState: function () {
+    return {
+      filters: changesStore.getFilters(),
+      pollingEnabled: changesStore.pollingEnabled()
+    };
+  },
 
-    getInitialState: function () {
-      return this.getStoreState();
-    },
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
 
-    removeFilter: function (label) {
-      Actions.removeFilter(label);
-    },
+  componentDidMount: function () {
+    changesStore.on('change', this.onChange, this);
+  },
 
-    addFilter: function (newFilter) {
-      if (_.isEmpty(newFilter)) {
-        return;
-      }
-      Actions.addFilter(newFilter);
-    },
+  componentWillUnmount: function () {
+    changesStore.off('change', this.onChange);
+  },
 
-    hasFilter: function (filter) {
-      return changesStore.hasFilter(filter);
-    },
+  getInitialState: function () {
+    return this.getStoreState();
+  },
 
-    togglePolling: function () {
-      Actions.togglePolling();
-    },
+  removeFilter: function (label) {
+    Actions.removeFilter(label);
+  },
 
-    render: function () {
-      return (
-        <div className="tab-content">
-          <div className="tab-pane active" ref="filterTab">
-            <div className="changes-header js-filter">
-              <div className="changes-polling">
-                <input
-                  type="checkbox"
-                  id="changes-toggle-polling"
-                  checked={this.state.pollingEnabled}
-                  onChange={this.togglePolling}
-                />
-                <label htmlFor="changes-toggle-polling">Auto-update changes list</label>
-              </div>
-              <AddFilterForm tooltip={this.props.tooltip} filter={this.state.filter} addFilter={this.addFilter}
-                hasFilter={this.hasFilter} />
-              <BadgeList elements={this.state.filters} removeBadge={this.removeFilter} />
-            </div>
-            <div className="changes-auto-update">
+  addFilter: function (newFilter) {
+    if (_.isEmpty(newFilter)) {
+      return;
+    }
+    Actions.addFilter(newFilter);
+  },
+
+  hasFilter: function (filter) {
+    return changesStore.hasFilter(filter);
+  },
+
+  togglePolling: function () {
+    Actions.togglePolling();
+  },
+
+  render: function () {
+    return (
+      <div className="tab-content">
+        <div className="tab-pane active" ref="filterTab">
+          <div className="changes-header js-filter">
+            <div className="changes-polling">
+              <input
+                type="checkbox"
+                id="changes-toggle-polling"
+                checked={this.state.pollingEnabled}
+                onChange={this.togglePolling}
+              />
+              <label htmlFor="changes-toggle-polling">Auto-update changes list</label>
             </div>
+            <AddFilterForm tooltip={this.props.tooltip} filter={this.state.filter} addFilter={this.addFilter}
+              hasFilter={this.hasFilter} />
+            <BadgeList elements={this.state.filters} removeBadge={this.removeFilter} />
+          </div>
+          <div className="changes-auto-update">
           </div>
         </div>
-      );
+      </div>
+    );
+  }
+});
+
+
+var AddFilterForm = React.createClass({
+  propTypes: {
+    addFilter: React.PropTypes.func.isRequired,
+    hasFilter: React.PropTypes.func.isRequired
+  },
+
+  getInitialState: function () {
+    return {
+      filter: '',
+      error: false
+    };
+  },
+
+  getDefaultProps: function () {
+    return {
+      tooltip: ''
+    };
+  },
+
+  submitForm: function (e) {
+    e.preventDefault();
+    e.stopPropagation();
+
+    if (this.props.hasFilter(this.state.filter)) {
+      this.setState({ error: true });
+
+      // Yuck. This removes the class after the effect has completed so it can occur again. The
+      // other option is to use jQuery to add the flash. This seemed slightly less crumby
+      var component = this;
+      setTimeout(function () {
+        component.setState({ error: false });
+      }, 1000);
+    } else {
+      this.props.addFilter(this.state.filter);
+      this.setState({ filter: '', error: false });
     }
-  });
-
-
-  var AddFilterForm = React.createClass({
-    propTypes: {
-      addFilter: React.PropTypes.func.isRequired,
-      hasFilter: React.PropTypes.func.isRequired
-    },
-
-    getInitialState: function () {
-      return {
-        filter: '',
-        error: false
-      };
-    },
-
-    getDefaultProps: function () {
-      return {
-        tooltip: ''
-      };
-    },
-
-    submitForm: function (e) {
-      e.preventDefault();
-      e.stopPropagation();
-
-      if (this.props.hasFilter(this.state.filter)) {
-        this.setState({ error: true });
-
-        // Yuck. This removes the class after the effect has completed so it can occur again. The
-        // other option is to use jQuery to add the flash. This seemed slightly less crumby
-        var component = this;
-        setTimeout(function () {
-          component.setState({ error: false });
-        }, 1000);
-      } else {
-        this.props.addFilter(this.state.filter);
-        this.setState({ filter: '', error: false });
-      }
-    },
-
-    componentDidMount: function () {
-      this.focusFilterField();
-    },
-
-    componentDidUpdate: function () {
-      this.focusFilterField();
-    },
-
-    focusFilterField: function () {
-      ReactDOM.findDOMNode(this.refs.addItem).focus();
-    },
-
-    onChangeFilter: function (e) {
-      this.setState({ filter: e.target.value });
-    },
-
-    inputClassNames: function () {
-      var className = 'js-changes-filter-field';
-      if (this.state.error) {
-        className += ' errorHighlight';
-      }
-      return className;
-    },
-
-    render: function () {
-      return (
-        <form className="form-inline js-filter-form" onSubmit={this.submitForm}>
-          <fieldset>
-            <input type="text" ref="addItem" className={this.inputClassNames()} placeholder="Type a filter"
-              onChange={this.onChangeFilter} value={this.state.filter} />
-            <button type="submit" className="btn btn-primary">Filter</button>
-            <div className="help-block">
-              <strong ref="helpText">e.g. _design or document ID</strong>
-              {' '}
-              <FilterTooltip tooltip={this.props.tooltip} />
-            </div>
-          </fieldset>
-        </form>
-      );
+  },
+
+  componentDidMount: function () {
+    this.focusFilterField();
+  },
+
+  componentDidUpdate: function () {
+    this.focusFilterField();
+  },
+
+  focusFilterField: function () {
+    ReactDOM.findDOMNode(this.refs.addItem).focus();
+  },
+
+  onChangeFilter: function (e) {
+    this.setState({ filter: e.target.value });
+  },
+
+  inputClassNames: function () {
+    var className = 'js-changes-filter-field';
+    if (this.state.error) {
+      className += ' errorHighlight';
     }
-  });
+    return className;
+  },
+
+  render: function () {
+    return (
+      <form className="form-inline js-filter-form" onSubmit={this.submitForm}>
+        <fieldset>
+          <input type="text" ref="addItem" className={this.inputClassNames()} placeholder="Type a filter"
+            onChange={this.onChangeFilter} value={this.state.filter} />
+          <button type="submit" className="btn btn-primary">Filter</button>
+          <div className="help-block">
+            <strong ref="helpText">e.g. _design or document ID</strong>
+            {' '}
+            <FilterTooltip tooltip={this.props.tooltip} />
+          </div>
+        </fieldset>
+      </form>
+    );
+  }
+});
 
 
-  var FilterTooltip = React.createClass({
-    componentDidMount: function () {
-      if (this.props.tooltip) {
-        $(ReactDOM.findDOMNode(this.refs.tooltip)).tooltip();
-      }
-    },
+var FilterTooltip = React.createClass({
+  componentDidMount: function () {
+    if (this.props.tooltip) {
+      $(ReactDOM.findDOMNode(this.refs.tooltip)).tooltip();
+    }
+  },
 
-    render: function () {
-      if (!this.props.tooltip) {
-        return false;
-      }
-      return (
-        <i ref="tooltip" className="icon icon-question-sign js-filter-tooltip" data-toggle="tooltip"
-          data-original-title={this.props.tooltip}></i>
-      );
+  render: function () {
+    if (!this.props.tooltip) {
+      return false;
     }
-  });
-
-  var ChangesController = React.createClass({
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        changes: changesStore.getChanges(),
-        loaded: changesStore.isLoaded(),
-        databaseName: changesStore.getDatabaseName(),
-        isShowingSubset: changesStore.isShowingSubset()
-      };
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    componentDidMount: function () {
-      changesStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      changesStore.off('change', this.onChange);
-    },
-
-    showingSubsetMsg: function () {
-      var msg = '';
-      if (this.state.isShowingSubset) {
-        var numChanges = this.state.changes.length;
-        msg = <p className="changes-result-limit">Limiting results to latest <b>{numChanges}</b> changes.</p>;
-      }
-      return msg;
-    },
-
-    getRows: function () {
-      if (!this.state.changes.length && this.state.loaded) {
-        return (
-          <p>
-            No document changes have occurred in this database.
-          </p>
-        );
-      }
-
-      return _.map(this.state.changes, function (change) {
-        var key = change.id + '-' + change.seq;
-        return <ChangeRow change={change} key={key} databaseName={this.state.databaseName} />;
-      }, this);
-    },
-
-    render: function () {
+    return (
+      <i ref="tooltip" className="icon icon-question-sign js-filter-tooltip" data-toggle="tooltip"
+        data-original-title={this.props.tooltip}></i>
+    );
+  }
+});
+
+var ChangesController = React.createClass({
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      changes: changesStore.getChanges(),
+      loaded: changesStore.isLoaded(),
+      databaseName: changesStore.getDatabaseName(),
+      isShowingSubset: changesStore.isShowingSubset()
+    };
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidMount: function () {
+    changesStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    changesStore.off('change', this.onChange);
+  },
+
+  showingSubsetMsg: function () {
+    var msg = '';
+    if (this.state.isShowingSubset) {
+      var numChanges = this.state.changes.length;
+      msg = <p className="changes-result-limit">Limiting results to latest <b>{numChanges}</b> changes.</p>;
+    }
+    return msg;
+  },
+
+  getRows: function () {
+    if (!this.state.changes.length && this.state.loaded) {
       return (
-        <div className="js-changes-view">
-          {this.showingSubsetMsg()}
-          {this.getRows()}
-        </div>
+        <p>
+          No document changes have occurred in this database.
+        </p>
       );
     }
-  });
-
-
-  var ChangeRow = React.createClass({
-    propTypes: function () {
-      return {
-        change: React.PropTypes.object,
-        databaseName: React.PropTypes.string.isRequired
-      };
-    },
-
-    getInitialState: function () {
-      return {
-        codeVisible: false
-      };
-    },
-
-    toggleJSON: function (e) {
-      e.preventDefault();
-      this.setState({ codeVisible: !this.state.codeVisible });
-    },
-
-    getChangesCode: function () {
-      var json = '';
-      if (this.state.codeVisible) {
-        json = <Components.CodeFormat key="changesCodeSection" code={this.getChangeCode()} />;
-      }
-      return json;
-    },
-
-    getChangeCode: function () {
-      return {
-        changes: this.props.change.changes,
-        doc: this.props.change.doc
-      };
-    },
-
-    onClipboardClick: function (target) {
-      var msg = 'The document ID has been copied to your clipboard.';
-      if (target === 'seq') {
-        msg = 'The document seq number has been copied to your clipboard.';
-      }
-      FauxtonAPI.addNotification({
-        msg: msg,
-        type: 'info',
-        clear: true
-      });
-    },
-
-    render: function () {
-      var jsonBtnClasses = 'btn btn-small' + (this.state.codeVisible ? ' btn-secondary' : ' btn-primary');
-      var wrapperClass = 'change-wrapper' + (this.props.change.isNew ? ' new-change-row' : '');
 
-      return (
-        <div className={wrapperClass}>
-          <div className="change-box" data-id={this.props.change.id}>
-            <div className="row-fluid">
-              <div className="span2">seq</div>
-              <div className="span8 change-sequence">{this.props.change.seq}</div>
-              <div className="span2 text-right">
-                <Components.Clipboard text={this.props.change.seq} onClipboardClick={() => this.onClipboardClick('seq')} />
-              </div>
+    return _.map(this.state.changes, function (change) {
+      var key = change.id + '-' + change.seq;
+      return <ChangeRow change={change} key={key} databaseName={this.state.databaseName} />;
+    }, this);
+  },
+
+  render: function () {
+    return (
+      <div className="js-changes-view">
+        {this.showingSubsetMsg()}
+        {this.getRows()}
+      </div>
+    );
+  }
+});
+
+
+var ChangeRow = React.createClass({
+  propTypes: function () {
+    return {
+      change: React.PropTypes.object,
+      databaseName: React.PropTypes.string.isRequired
+    };
+  },
+
+  getInitialState: function () {
+    return {
+      codeVisible: false
+    };
+  },
+
+  toggleJSON: function (e) {
+    e.preventDefault();
+    this.setState({ codeVisible: !this.state.codeVisible });
+  },
+
+  getChangesCode: function () {
+    var json = '';
+    if (this.state.codeVisible) {
+      json = <Components.CodeFormat key="changesCodeSection" code={this.getChangeCode()} />;
+    }
+    return json;
+  },
+
+  getChangeCode: function () {
+    return {
+      changes: this.props.change.changes,
+      doc: this.props.change.doc
+    };
+  },
+
+  onClipboardClick: function (target) {
+    var msg = 'The document ID has been copied to your clipboard.';
+    if (target === 'seq') {
+      msg = 'The document seq number has been copied to your clipboard.';
+    }
+    FauxtonAPI.addNotification({
+      msg: msg,
+      type: 'info',
+      clear: true
+    });
+  },
+
+  render: function () {
+    var jsonBtnClasses = 'btn btn-small' + (this.state.codeVisible ? ' btn-secondary' : ' btn-primary');
+    var wrapperClass = 'change-wrapper' + (this.props.change.isNew ? ' new-change-row' : '');
+
+    return (
+      <div className={wrapperClass}>
+        <div className="change-box" data-id={this.props.change.id}>
+          <div className="row-fluid">
+            <div className="span2">seq</div>
+            <div className="span8 change-sequence">{this.props.change.seq}</div>
+            <div className="span2 text-right">
+              <Components.Clipboard text={this.props.change.seq} onClipboardClick={() => this.onClipboardClick('seq')} />
             </div>
+          </div>
 
-            <div className="row-fluid">
-              <div className="span2">id</div>
-              <div className="span8">
-                <ChangeID id={this.props.change.id} deleted={this.props.change.deleted} databaseName={this.props.databaseName} />
-              </div>
-              <div className="span2 text-right">
-                <Components.Clipboard text={this.props.change.id} onClipboardClick={() => this.onClipboardClick('id')} />
-              </div>
+          <div className="row-fluid">
+            <div className="span2">id</div>
+            <div className="span8">
+              <ChangeID id={this.props.change.id} deleted={this.props.change.deleted} databaseName={this.props.databaseName} />
             </div>
+            <div className="span2 text-right">
+              <Components.Clipboard text={this.props.change.id} onClipboardClick={() => this.onClipboardClick('id')} />
+            </div>
+          </div>
 
-            <div className="row-fluid">
-              <div className="span2">changes</div>
-              <div className="span10">
-                <button type="button" className={jsonBtnClasses} onClick={this.toggleJSON}>
-                  {this.state.codeVisible ? 'Close JSON' : 'View JSON'}
-                </button>
-              </div>
+          <div className="row-fluid">
+            <div className="span2">changes</div>
+            <div className="span10">
+              <button type="button" className={jsonBtnClasses} onClick={this.toggleJSON}>
+                {this.state.codeVisible ? 'Close JSON' : 'View JSON'}
+              </button>
             </div>
+          </div>
 
-            <ReactCSSTransitionGroup transitionName="toggle-changes-code" component="div" className="changesCodeSectionWrapper"
-              transitionEnterTimeout={500} transitionLeaveTimeout={300}>
-              {this.getChangesCode()}
-            </ReactCSSTransitionGroup>
+          <ReactCSSTransitionGroup transitionName="toggle-changes-code" component="div" className="changesCodeSectionWrapper"
+            transitionEnterTimeout={500} transitionLeaveTimeout={300}>
+            {this.getChangesCode()}
+          </ReactCSSTransitionGroup>
 
-            <div className="row-fluid">
-              <div className="span2">deleted</div>
-              <div className="span10">{this.props.change.deleted ? 'True' : 'False'}</div>
-            </div>
+          <div className="row-fluid">
+            <div className="span2">deleted</div>
+            <div className="span10">{this.props.change.deleted ? 'True' : 'False'}</div>
           </div>
         </div>
+      </div>
+    );
+  }
+});
+
+
+var ChangeID = React.createClass({
+  render: function () {
+    if (this.props.deleted) {
+      return (
+        <span className="js-doc-id">{this.props.id}</span>
+      );
+    } else {
+      var link = '#' + FauxtonAPI.urls('document', 'app', this.props.databaseName, this.props.id);
+      return (
+        <a href={link} className="js-doc-link">{this.props.id}</a>
       );
     }
-  });
-
-
-  var ChangeID = React.createClass({
-    render: function () {
-      if (this.props.deleted) {
-        return (
-          <span className="js-doc-id">{this.props.id}</span>
-        );
-      } else {
-        var link = '#' + FauxtonAPI.urls('document', 'app', this.props.databaseName, this.props.id);
-        return (
-          <a href={link} className="js-doc-link">{this.props.id}</a>
-        );
-      }
-    }
-  });
-
-
-  return {
-    renderHeader: function (el) {
-      ReactDOM.render(<ChangesHeaderController />, el);
-    },
-    renderChanges: function (el) {
-      ReactDOM.render(<ChangesController />, el);
-    },
-    remove: function (el) {
-      ReactDOM.unmountComponentAtNode(el);
-    },
-
-    ChangesHeaderController: ChangesHeaderController,
-    ChangesHeaderTab: ChangesHeaderTab,
-    ChangesTabContent: ChangesTabContent,
-    ChangesController: ChangesController,
-    ChangeRow: ChangeRow
-  };
-
+  }
 });
+
+
+export default {
+  renderHeader: function (el) {
+    ReactDOM.render(<ChangesHeaderController />, el);
+  },
+  renderChanges: function (el) {
+    ReactDOM.render(<ChangesController />, el);
+  },
+  remove: function (el) {
+    ReactDOM.unmountComponentAtNode(el);
+  },
+
+  ChangesHeaderController: ChangesHeaderController,
+  ChangesHeaderTab: ChangesHeaderTab,
+  ChangesTabContent: ChangesTabContent,
+  ChangesController: ChangesController,
+  ChangeRow: ChangeRow
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/changes/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/stores.js b/app/addons/documents/changes/stores.js
index 4730ed9..2f64cb2 100644
--- a/app/addons/documents/changes/stores.js
+++ b/app/addons/documents/changes/stores.js
@@ -10,179 +10,176 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  './actiontypes',
-  '../helpers'
-], function (FauxtonAPI, ActionTypes, Helpers) {
-
-
-  var ChangesStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._isLoaded = false;
-      this._tabVisible = false;
-      this._filters = [];
-      this._changes = [];
-      this._databaseName = '';
-      this._maxChangesListed = 100;
-      this._showingSubset = false;
-      this._pollingEnabled = false;
-      this._lastSequenceNum = null;
-    },
-
-    initChanges: function (options) {
-      this.reset();
-      this._databaseName = options.databaseName;
-    },
-
-    isLoaded: function () {
-      return this._isLoaded;
-    },
-
-    updateChanges: function (seqNum, changes) {
-
-      // make a note of the most recent sequence number. This is used for a point of reference for polling for new changes
-      this._lastSequenceNum = seqNum;
-
-      // mark any additional changes that come after first page load as "new" so we can add a nice highlight effect
-      // when the new row is rendered
-      var firstBatch = this._changes.length === 0;
-      _.each(this._changes, function (change) {
-        change.isNew = false;
-      });
-
-      var newChanges = _.map(changes, function (change) {
-        var seq = Helpers.getSeqNum(change.seq);
-        return {
-          id: change.id,
-          seq: seq,
-          deleted: _.has(change, 'deleted') ? change.deleted : false,
-          changes: change.changes,
-          doc: change.doc, // only populated with ?include_docs=true
-          isNew: !firstBatch
-        };
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import Helpers from "../helpers";
+
+
+var ChangesStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._isLoaded = false;
+    this._tabVisible = false;
+    this._filters = [];
+    this._changes = [];
+    this._databaseName = '';
+    this._maxChangesListed = 100;
+    this._showingSubset = false;
+    this._pollingEnabled = false;
+    this._lastSequenceNum = null;
+  },
+
+  initChanges: function (options) {
+    this.reset();
+    this._databaseName = options.databaseName;
+  },
+
+  isLoaded: function () {
+    return this._isLoaded;
+  },
+
+  updateChanges: function (seqNum, changes) {
+
+    // make a note of the most recent sequence number. This is used for a point of reference for polling for new changes
+    this._lastSequenceNum = seqNum;
+
+    // mark any additional changes that come after first page load as "new" so we can add a nice highlight effect
+    // when the new row is rendered
+    var firstBatch = this._changes.length === 0;
+    _.each(this._changes, function (change) {
+      change.isNew = false;
+    });
+
+    var newChanges = _.map(changes, function (change) {
+      var seq = Helpers.getSeqNum(change.seq);
+      return {
+        id: change.id,
+        seq: seq,
+        deleted: _.has(change, 'deleted') ? change.deleted : false,
+        changes: change.changes,
+        doc: change.doc, // only populated with ?include_docs=true
+        isNew: !firstBatch
+      };
+    });
+
+    // add the new changes to the start of the list
+    this._changes = newChanges.concat(this._changes);
+    this._isLoaded = true;
+  },
+
+  getChanges: function () {
+    this._showingSubset = false;
+    var numMatches = 0;
+
+    return _.filter(this._changes, function (change) {
+      if (numMatches >= this._maxChangesListed) {
+        this._showingSubset = true;
+        return false;
+      }
+      var changeStr = JSON.stringify(change);
+      var match = _.every(this._filters, function (filter) {
+        return new RegExp(filter, 'i').test(changeStr);
       });
 
-      // add the new changes to the start of the list
-      this._changes = newChanges.concat(this._changes);
-      this._isLoaded = true;
-    },
-
-    getChanges: function () {
-      this._showingSubset = false;
-      var numMatches = 0;
-
-      return _.filter(this._changes, function (change) {
-        if (numMatches >= this._maxChangesListed) {
-          this._showingSubset = true;
-          return false;
-        }
-        var changeStr = JSON.stringify(change);
-        var match = _.every(this._filters, function (filter) {
-          return new RegExp(filter, 'i').test(changeStr);
-        });
-
-        if (match) {
-          numMatches++;
-        }
-        return match;
-      }, this);
-    },
-
-    toggleTabVisibility: function () {
-      this._tabVisible = !this._tabVisible;
-    },
-
-    isTabVisible: function () {
-      return this._tabVisible;
-    },
-
-    addFilter: function (filter) {
-      this._filters.push(filter);
-    },
-
-    removeFilter: function (filter) {
-      this._filters = _.without(this._filters, filter);
-    },
-
-    getFilters: function () {
-      return this._filters;
-    },
-
-    hasFilter: function (filter) {
-      return _.contains(this._filters, filter);
-    },
-
-    getDatabaseName: function () {
-      return this._databaseName;
-    },
-
-    isShowingSubset: function () {
-      return this._showingSubset;
-    },
-
-    // added to speed up the tests
-    setMaxChanges: function (num) {
-      this._maxChangesListed = num;
-    },
-
-    togglePolling: function () {
-      this._pollingEnabled = !this._pollingEnabled;
-
-      // if polling was just enabled, reset the last sequence num to 'now' so only future changes will appear
-      this._lastSequenceNum = 'now';
-    },
-
-    pollingEnabled: function () {
-      return this._pollingEnabled;
-    },
-
-    getLastSeqNum: function () {
-      return this._lastSequenceNum;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.INIT_CHANGES:
-          this.initChanges(action.options);
-        break;
-
-        case ActionTypes.UPDATE_CHANGES:
-          this.updateChanges(action.seqNum, action.changes);
-        break;
-
-        case ActionTypes.TOGGLE_CHANGES_TAB_VISIBILITY:
-          this.toggleTabVisibility();
-        break;
-
-        case ActionTypes.ADD_CHANGES_FILTER_ITEM:
-          this.addFilter(action.filter);
-        break;
-
-        case ActionTypes.REMOVE_CHANGES_FILTER_ITEM:
-          this.removeFilter(action.filter);
-        break;
-
-        case ActionTypes.TOGGLE_CHANGES_POLLING:
-          this.togglePolling();
-        break;
-
-        default:
-          return;
+      if (match) {
+        numMatches++;
       }
-
-      this.triggerChange();
+      return match;
+    }, this);
+  },
+
+  toggleTabVisibility: function () {
+    this._tabVisible = !this._tabVisible;
+  },
+
+  isTabVisible: function () {
+    return this._tabVisible;
+  },
+
+  addFilter: function (filter) {
+    this._filters.push(filter);
+  },
+
+  removeFilter: function (filter) {
+    this._filters = _.without(this._filters, filter);
+  },
+
+  getFilters: function () {
+    return this._filters;
+  },
+
+  hasFilter: function (filter) {
+    return _.contains(this._filters, filter);
+  },
+
+  getDatabaseName: function () {
+    return this._databaseName;
+  },
+
+  isShowingSubset: function () {
+    return this._showingSubset;
+  },
+
+  // added to speed up the tests
+  setMaxChanges: function (num) {
+    this._maxChangesListed = num;
+  },
+
+  togglePolling: function () {
+    this._pollingEnabled = !this._pollingEnabled;
+
+    // if polling was just enabled, reset the last sequence num to 'now' so only future changes will appear
+    this._lastSequenceNum = 'now';
+  },
+
+  pollingEnabled: function () {
+    return this._pollingEnabled;
+  },
+
+  getLastSeqNum: function () {
+    return this._lastSequenceNum;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.INIT_CHANGES:
+        this.initChanges(action.options);
+      break;
+
+      case ActionTypes.UPDATE_CHANGES:
+        this.updateChanges(action.seqNum, action.changes);
+      break;
+
+      case ActionTypes.TOGGLE_CHANGES_TAB_VISIBILITY:
+        this.toggleTabVisibility();
+      break;
+
+      case ActionTypes.ADD_CHANGES_FILTER_ITEM:
+        this.addFilter(action.filter);
+      break;
+
+      case ActionTypes.REMOVE_CHANGES_FILTER_ITEM:
+        this.removeFilter(action.filter);
+      break;
+
+      case ActionTypes.TOGGLE_CHANGES_POLLING:
+        this.togglePolling();
+      break;
+
+      default:
+        return;
     }
-  });
 
+    this.triggerChange();
+  }
+});
 
-  var Stores = {};
-  Stores.changesStore = new ChangesStore();
-  Stores.changesStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.changesStore.dispatch);
 
-  return Stores;
-});
+var Stores = {};
+Stores.changesStore = new ChangesStore();
+Stores.changesStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.changesStore.dispatch);
+
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx b/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
index b77e262..9179b4a 100644
--- a/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
+++ b/app/addons/documents/changes/tests/changes.componentsSpec.react.jsx
@@ -10,370 +10,366 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../app',
-  '../../../../core/api',
-  'react',
-  'react-dom',
-  '../components.react',
-  '../stores',
-  '../actions',
-  '../../../../../test/mocha/testUtils',
-  'react-addons-test-utils',
-  'sinon'
-], function (app, FauxtonAPI, React, ReactDOM, Changes, Stores, Actions, utils, TestUtils, sinon) {
-
-  var assert = utils.assert;
-
-  describe('ChangesHeader', function () {
-    var container, tab, spy;
-
-    describe('Testing DOM', function () {
-      beforeEach(function () {
-        spy = sinon.spy(Actions, 'toggleTabVisibility');
-        container = document.createElement('div');
-        tab = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, container);
-      });
-
-      afterEach(function () {
-        spy.restore();
-        Stores.changesStore.reset();
-        ReactDOM.unmountComponentAtNode(container);
-      });
-
-      // similar as previous, except it confirms that the action gets fired, not the custom toggle func
-      it('calls toggleTabVisibility action on selecting a tab', function () {
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(tab)).find('a')[0]);
-        assert.ok(spy.calledOnce);
-      });
-    });
-  });
-
-  describe('ChangesHeaderTab', function () {
-    var container, tab, toggleTabVisibility;
-
+import app from "../../../../app";
+import FauxtonAPI from "../../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Changes from "../components.react";
+import Stores from "../stores";
+import Actions from "../actions";
+import utils from "../../../../../test/mocha/testUtils";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+
+var assert = utils.assert;
+
+describe('ChangesHeader', function () {
+  var container, tab, spy;
+
+  describe('Testing DOM', function () {
     beforeEach(function () {
-      toggleTabVisibility = sinon.spy();
+      spy = sinon.spy(Actions, 'toggleTabVisibility');
       container = document.createElement('div');
-      tab = TestUtils.renderIntoDocument(<Changes.ChangesHeaderTab onToggle={toggleTabVisibility} />, container);
+      tab = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, container);
     });
 
     afterEach(function () {
+      spy.restore();
       Stores.changesStore.reset();
       ReactDOM.unmountComponentAtNode(container);
     });
 
-    it('should call toggle function on clicking tab', function () {
+    // similar as previous, except it confirms that the action gets fired, not the custom toggle func
+    it('calls toggleTabVisibility action on selecting a tab', function () {
       TestUtils.Simulate.click($(ReactDOM.findDOMNode(tab)).find('a')[0]);
-      assert.ok(toggleTabVisibility.calledOnce);
+      assert.ok(spy.calledOnce);
     });
   });
+});
 
+describe('ChangesHeaderTab', function () {
+  var container, tab, toggleTabVisibility;
 
-  describe('ChangesTabContent', function () {
-    var container, changesFilterEl;
+  beforeEach(function () {
+    toggleTabVisibility = sinon.spy();
+    container = document.createElement('div');
+    tab = TestUtils.renderIntoDocument(<Changes.ChangesHeaderTab onToggle={toggleTabVisibility} />, container);
+  });
 
-    beforeEach(function () {
-      container = document.createElement('div');
-      changesFilterEl = TestUtils.renderIntoDocument(<Changes.ChangesTabContent />, container);
-    });
+  afterEach(function () {
+    Stores.changesStore.reset();
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    afterEach(function () {
-      Stores.changesStore.reset();
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  it('should call toggle function on clicking tab', function () {
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(tab)).find('a')[0]);
+    assert.ok(toggleTabVisibility.calledOnce);
+  });
+});
 
-    it('should add filter markup', function () {
-      var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
-          submitBtn = $el.find('[type="submit"]')[0],
-          addItemField = $el.find('.js-changes-filter-field')[0];
 
-      addItemField.value = 'I wandered lonely as a filter';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+describe('ChangesTabContent', function () {
+  var container, changesFilterEl;
 
-      addItemField.value = 'A second filter';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+  beforeEach(function () {
+    container = document.createElement('div');
+    changesFilterEl = TestUtils.renderIntoDocument(<Changes.ChangesTabContent />, container);
+  });
 
-      assert.equal(2, $el.find('.js-remove-filter').length);
-    });
+  afterEach(function () {
+    Stores.changesStore.reset();
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('should call addFilter action on click', function () {
-      var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
+  it('should add filter markup', function () {
+    var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
         submitBtn = $el.find('[type="submit"]')[0],
         addItemField = $el.find('.js-changes-filter-field')[0];
 
-      var spy = sinon.spy(Actions, 'addFilter');
+    addItemField.value = 'I wandered lonely as a filter';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      addItemField.value = 'I wandered lonely as a filter';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+    addItemField.value = 'A second filter';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      assert.ok(spy.calledOnce);
-    });
+    assert.equal(2, $el.find('.js-remove-filter').length);
+  });
 
-    it('should remove filter markup', function () {
-      var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
-        submitBtn = $el.find('[type="submit"]')[0],
-        addItemField = $el.find('.js-changes-filter-field')[0];
+  it('should call addFilter action on click', function () {
+    var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
+      submitBtn = $el.find('[type="submit"]')[0],
+      addItemField = $el.find('.js-changes-filter-field')[0];
 
-      addItemField.value = 'Bloop';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+    var spy = sinon.spy(Actions, 'addFilter');
 
-      addItemField.value = 'Flibble';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+    addItemField.value = 'I wandered lonely as a filter';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      // clicks ALL 'remove' elements
-      TestUtils.Simulate.click($el.find('.js-remove-filter')[0]);
-      TestUtils.Simulate.click($el.find('.js-remove-filter')[0]);
+    assert.ok(spy.calledOnce);
+  });
 
-      assert.equal(0, $el.find('.js-remove-filter').length);
-    });
+  it('should remove filter markup', function () {
+    var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
+      submitBtn = $el.find('[type="submit"]')[0],
+      addItemField = $el.find('.js-changes-filter-field')[0];
 
-    it('should call removeFilter action on click', function () {
-      var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
-        submitBtn = $el.find('[type="submit"]')[0],
-        addItemField = $el.find('.js-changes-filter-field')[0];
+    addItemField.value = 'Bloop';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      var spy = sinon.spy(Actions, 'removeFilter');
+    addItemField.value = 'Flibble';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      addItemField.value = 'I wandered lonely as a filter';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
-      TestUtils.Simulate.click($el.find('.js-remove-filter')[0]);
+    // clicks ALL 'remove' elements
+    TestUtils.Simulate.click($el.find('.js-remove-filter')[0]);
+    TestUtils.Simulate.click($el.find('.js-remove-filter')[0]);
 
-      assert.ok(spy.calledOnce);
-    });
+    assert.equal(0, $el.find('.js-remove-filter').length);
+  });
 
-    it('should not add empty filters', function () {
-      var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
-        submitBtn = $el.find('[type="submit"]')[0],
-        addItemField = $el.find('.js-changes-filter-field')[0];
+  it('should call removeFilter action on click', function () {
+    var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
+      submitBtn = $el.find('[type="submit"]')[0],
+      addItemField = $el.find('.js-changes-filter-field')[0];
 
-      addItemField.value = '';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+    var spy = sinon.spy(Actions, 'removeFilter');
 
-      assert.equal(0, $el.find('.js-remove-filter').length);
-    });
+    addItemField.value = 'I wandered lonely as a filter';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
+    TestUtils.Simulate.click($el.find('.js-remove-filter')[0]);
 
-    it('should not add tooltips by default', function () {
-      assert.equal(0, $(ReactDOM.findDOMNode(changesFilterEl)).find('.js-remove-filter').length);
-    });
+    assert.ok(spy.calledOnce);
+  });
 
-    it('should not add the same filter twice', function () {
-      var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
-          submitBtn = $el.find('[type="submit"]')[0],
-          addItemField = $el.find('.js-changes-filter-field')[0];
+  it('should not add empty filters', function () {
+    var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
+      submitBtn = $el.find('[type="submit"]')[0],
+      addItemField = $el.find('.js-changes-filter-field')[0];
 
-      var filter = 'I am unique in the whole wide world';
-      addItemField.value = filter;
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+    addItemField.value = '';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      addItemField.value = filter;
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+    assert.equal(0, $el.find('.js-remove-filter').length);
+  });
 
-      assert.equal(1, $el.find('.js-remove-filter').length);
-    });
+  it('should not add tooltips by default', function () {
+    assert.equal(0, $(ReactDOM.findDOMNode(changesFilterEl)).find('.js-remove-filter').length);
   });
 
+  it('should not add the same filter twice', function () {
+    var $el = $(ReactDOM.findDOMNode(changesFilterEl)),
+        submitBtn = $el.find('[type="submit"]')[0],
+        addItemField = $el.find('.js-changes-filter-field')[0];
 
-  // tests Changes Controller; includes tests in conjunction with ChangesHeaderController
-  describe('ChangesController', function () {
-    var container, container2, headerEl, $headerEl, changesEl, $changesEl;
-
-    var results = [
-      { id: 'doc_1', seq: 4, deleted: false, changes: { code: 'here' } },
-      { id: 'doc_2', seq: 1, deleted: false, changes: { code: 'here' } },
-      { id: 'doc_3', seq: 6, deleted: true, changes: { code: 'here' } },
-      { id: 'doc_4', seq: 7, deleted: false, changes: { code: 'here' } },
-      { id: 'doc_5', seq: 1, deleted: true, changes: { code: 'here' } }
-    ];
-    var changesResponse = {
-      last_seq: 123,
-      'results': results
-    };
+    var filter = 'I am unique in the whole wide world';
+    addItemField.value = filter;
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-    beforeEach(function () {
-      container = document.createElement('div');
-      container2 = document.createElement('div');
-      Actions.initChanges({ databaseName: 'testDatabase' });
-      headerEl  = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, container);
-      $headerEl = $(ReactDOM.findDOMNode(headerEl));
-      changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, container2);
-      $changesEl = $(ReactDOM.findDOMNode(changesEl));
-      Actions.updateChanges(changesResponse);
-    });
+    addItemField.value = filter;
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-    afterEach(function () {
-      Stores.changesStore.reset();
-      ReactDOM.unmountComponentAtNode(container);
-      ReactDOM.unmountComponentAtNode(container2);
-    });
+    assert.equal(1, $el.find('.js-remove-filter').length);
+  });
+});
 
 
-    it('should list the right number of changes', function () {
-      assert.equal(results.length, $changesEl.find('.change-box').length);
-    });
+// tests Changes Controller; includes tests in conjunction with ChangesHeaderController
+describe('ChangesController', function () {
+  var container, container2, headerEl, $headerEl, changesEl, $changesEl;
+
+  var results = [
+    { id: 'doc_1', seq: 4, deleted: false, changes: { code: 'here' } },
+    { id: 'doc_2', seq: 1, deleted: false, changes: { code: 'here' } },
+    { id: 'doc_3', seq: 6, deleted: true, changes: { code: 'here' } },
+    { id: 'doc_4', seq: 7, deleted: false, changes: { code: 'here' } },
+    { id: 'doc_5', seq: 1, deleted: true, changes: { code: 'here' } }
+  ];
+  var changesResponse = {
+    last_seq: 123,
+    'results': results
+  };
+
+  beforeEach(function () {
+    container = document.createElement('div');
+    container2 = document.createElement('div');
+    Actions.initChanges({ databaseName: 'testDatabase' });
+    headerEl  = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, container);
+    $headerEl = $(ReactDOM.findDOMNode(headerEl));
+    changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, container2);
+    $changesEl = $(ReactDOM.findDOMNode(changesEl));
+    Actions.updateChanges(changesResponse);
+  });
 
+  afterEach(function () {
+    Stores.changesStore.reset();
+    ReactDOM.unmountComponentAtNode(container);
+    ReactDOM.unmountComponentAtNode(container2);
+  });
 
-    it('"false"/"true" filter strings should apply to change deleted status', function () {
-      // expand the header
-      TestUtils.Simulate.click($headerEl.find('a')[0]);
 
-      // add a filter
-      var addItemField = $headerEl.find('.js-changes-filter-field')[0];
-      var submitBtn = $headerEl.find('[type="submit"]')[0];
-      addItemField.value = 'true';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+  it('should list the right number of changes', function () {
+    assert.equal(results.length, $changesEl.find('.change-box').length);
+  });
 
-      // confirm only the two deleted items shows up and the IDs maps to the deleted rows
-      assert.equal(2, $changesEl.find('.change-box').length);
-      assert.equal('doc_3', $($changesEl.find('.js-doc-id').get(0)).html());
-      assert.equal('doc_5', $($changesEl.find('.js-doc-id').get(1)).html());
-    });
 
+  it('"false"/"true" filter strings should apply to change deleted status', function () {
+    // expand the header
+    TestUtils.Simulate.click($headerEl.find('a')[0]);
 
-    it('confirms that a filter affects the actual search results', function () {
-      // expand the header
-      TestUtils.Simulate.click($headerEl.find('a')[0]);
+    // add a filter
+    var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+    var submitBtn = $headerEl.find('[type="submit"]')[0];
+    addItemField.value = 'true';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      // add a filter
-      var addItemField = $headerEl.find('.js-changes-filter-field')[0];
-      var submitBtn = $headerEl.find('[type="submit"]')[0];
-      addItemField.value = '6'; // should match doc_3's sequence ID
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+    // confirm only the two deleted items shows up and the IDs maps to the deleted rows
+    assert.equal(2, $changesEl.find('.change-box').length);
+    assert.equal('doc_3', $($changesEl.find('.js-doc-id').get(0)).html());
+    assert.equal('doc_5', $($changesEl.find('.js-doc-id').get(1)).html());
+  });
 
-      // confirm only one item shows up and the ID maps to what we'd expect
-      assert.equal(1, $changesEl.find('.change-box').length);
-      assert.equal('doc_3', $($changesEl.find('.js-doc-id').get(0)).html());
-    });
 
+  it('confirms that a filter affects the actual search results', function () {
+    // expand the header
+    TestUtils.Simulate.click($headerEl.find('a')[0]);
 
-    // confirms that if there are multiple filters, ALL are applied to return the subset of results that match
-    // all filters
-    it('multiple filters should all be applied to results', function () {
-      TestUtils.Simulate.click($headerEl.find('a')[0]);
+    // add a filter
+    var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+    var submitBtn = $headerEl.find('[type="submit"]')[0];
+    addItemField.value = '6'; // should match doc_3's sequence ID
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
-      // add the filters
-      var addItemField = $headerEl.find('.js-changes-filter-field')[0];
-      var submitBtn = $headerEl.find('[type="submit"]')[0];
+    // confirm only one item shows up and the ID maps to what we'd expect
+    assert.equal(1, $changesEl.find('.change-box').length);
+    assert.equal('doc_3', $($changesEl.find('.js-doc-id').get(0)).html());
+  });
 
-      // *** should match doc_1, doc_2 and doc_5
-      addItemField.value = '1';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
 
-      // *** should match doc_3 and doc_5
-      addItemField.value = 'true';
-      TestUtils.Simulate.change(addItemField);
-      TestUtils.Simulate.submit(submitBtn);
+  // confirms that if there are multiple filters, ALL are applied to return the subset of results that match
+  // all filters
+  it('multiple filters should all be applied to results', function () {
+    TestUtils.Simulate.click($headerEl.find('a')[0]);
 
-      // confirm only one item shows up and that it's doc_5
-      assert.equal(1, $changesEl.find('.change-box').length);
-      assert.equal('doc_5', $($changesEl.find('.js-doc-id').get(0)).html());
-    });
+    // add the filters
+    var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+    var submitBtn = $headerEl.find('[type="submit"]')[0];
 
-    it('shows a No Docs Found message if no docs', function () {
-      Stores.changesStore.reset();
-      Actions.updateChanges({ last_seq: 124, results: [] });
-      assert.ok(/No\sdocument\schanges\shave\soccurred/.test($changesEl[0].outerHTML));
-    });
+    // *** should match doc_1, doc_2 and doc_5
+    addItemField.value = '1';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
+
+    // *** should match doc_3 and doc_5
+    addItemField.value = 'true';
+    TestUtils.Simulate.change(addItemField);
+    TestUtils.Simulate.submit(submitBtn);
 
+    // confirm only one item shows up and that it's doc_5
+    assert.equal(1, $changesEl.find('.change-box').length);
+    assert.equal('doc_5', $($changesEl.find('.js-doc-id').get(0)).html());
   });
 
+  it('shows a No Docs Found message if no docs', function () {
+    Stores.changesStore.reset();
+    Actions.updateChanges({ last_seq: 124, results: [] });
+    assert.ok(/No\sdocument\schanges\shave\soccurred/.test($changesEl[0].outerHTML));
+  });
 
-  describe('ChangesController max results', function () {
-    var changesEl;
-    var container;
-    var maxChanges = 10;
+});
 
 
-    beforeEach(function () {
-      container = document.createElement('div');
-      var changes = [];
-      _.times(maxChanges + 10, function (i) {
-        changes.push({ id: 'doc_' + i, seq: 1, changes: { code: 'here' } });
-      });
+describe('ChangesController max results', function () {
+  var changesEl;
+  var container;
+  var maxChanges = 10;
 
-      var response = {
-        last_seq: 1,
-        results: changes
-      };
 
-      Actions.initChanges({ databaseName: 'test' });
+  beforeEach(function () {
+    container = document.createElement('div');
+    var changes = [];
+    _.times(maxChanges + 10, function (i) {
+      changes.push({ id: 'doc_' + i, seq: 1, changes: { code: 'here' } });
+    });
 
-      // to keep the test speedy, override the default value (1000)
-      Stores.changesStore.setMaxChanges(maxChanges);
+    var response = {
+      last_seq: 1,
+      results: changes
+    };
 
-      Actions.updateChanges(response);
-      changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, container);
-    });
+    Actions.initChanges({ databaseName: 'test' });
 
-    afterEach(function () {
-      Stores.changesStore.reset();
-      ReactDOM.unmountComponentAtNode(container);
-    });
+    // to keep the test speedy, override the default value (1000)
+    Stores.changesStore.setMaxChanges(maxChanges);
 
-    it('should truncate the number of results with very large # of changes', function () {
-      // check there's no more than maxChanges results
-      assert.equal(maxChanges, $(ReactDOM.findDOMNode(changesEl)).find('.change-box').length);
-    });
+    Actions.updateChanges(response);
+    changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, container);
+  });
 
-    it('should show a message if the results are truncated', function () {
-      assert.equal(1, $(ReactDOM.findDOMNode(changesEl)).find('.changes-result-limit').length);
-    });
+  afterEach(function () {
+    Stores.changesStore.reset();
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
+  it('should truncate the number of results with very large # of changes', function () {
+    // check there's no more than maxChanges results
+    assert.equal(maxChanges, $(ReactDOM.findDOMNode(changesEl)).find('.change-box').length);
   });
 
+  it('should show a message if the results are truncated', function () {
+    assert.equal(1, $(ReactDOM.findDOMNode(changesEl)).find('.changes-result-limit').length);
+  });
 
-  describe('ChangeRow', function () {
-    var container;
-    var change = {
-      id: '123',
-      seq: 5,
-      deleted: false,
-      changes: { code: 'here' }
-    };
+});
 
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+describe('ChangeRow', function () {
+  var container;
+  var change = {
+    id: '123',
+    seq: 5,
+    deleted: false,
+    changes: { code: 'here' }
+  };
 
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    it('clicking the toggle-json button shows the code section', function () {
-      var changeRow = TestUtils.renderIntoDocument(<Changes.ChangeRow change={change} databaseName="testDatabase" />, container);
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-      // confirm it's hidden by default
-      assert.equal(0, $(ReactDOM.findDOMNode(changeRow)).find('.prettyprint').length);
 
-      // confirm clicking it shows the element
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(changeRow)).find('button.btn')[0]);
-      assert.equal(1, $(ReactDOM.findDOMNode(changeRow)).find('.prettyprint').length);
-    });
+  it('clicking the toggle-json button shows the code section', function () {
+    var changeRow = TestUtils.renderIntoDocument(<Changes.ChangeRow change={change} databaseName="testDatabase" />, container);
 
-    it('deleted docs should not be clickable', function () {
-      change.deleted = true;
-      var changeRow = TestUtils.renderIntoDocument(<Changes.ChangeRow change={change} databaseName="testDatabase" />, container);
-      assert.equal(0, $(ReactDOM.findDOMNode(changeRow)).find('a.js-doc-link').length);
-    });
+    // confirm it's hidden by default
+    assert.equal(0, $(ReactDOM.findDOMNode(changeRow)).find('.prettyprint').length);
 
-    it('non-deleted docs should be clickable', function () {
-      change.deleted = false;
-      var changeRow = TestUtils.renderIntoDocument(<Changes.ChangeRow change={change} databaseName="testDatabase" />, container);
-      assert.equal(1, $(ReactDOM.findDOMNode(changeRow)).find('a.js-doc-link').length);
-    });
+    // confirm clicking it shows the element
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(changeRow)).find('button.btn')[0]);
+    assert.equal(1, $(ReactDOM.findDOMNode(changeRow)).find('.prettyprint').length);
   });
 
+  it('deleted docs should not be clickable', function () {
+    change.deleted = true;
+    var changeRow = TestUtils.renderIntoDocument(<Changes.ChangeRow change={change} databaseName="testDatabase" />, container);
+    assert.equal(0, $(ReactDOM.findDOMNode(changeRow)).find('a.js-doc-link').length);
+  });
+
+  it('non-deleted docs should be clickable', function () {
+    change.deleted = false;
+    var changeRow = TestUtils.renderIntoDocument(<Changes.ChangeRow change={change} databaseName="testDatabase" />, container);
+    assert.equal(1, $(ReactDOM.findDOMNode(changeRow)).find('a.js-doc-link').length);
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/changes/tests/changes.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/tests/changes.storesSpec.js b/app/addons/documents/changes/tests/changes.storesSpec.js
index f571c7b..2daeb33 100644
--- a/app/addons/documents/changes/tests/changes.storesSpec.js
+++ b/app/addons/documents/changes/tests/changes.storesSpec.js
@@ -10,98 +10,94 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../app',
-  '../../../../core/api',
-  '../stores',
-  '../../../../../test/mocha/testUtils',
-], function (app, FauxtonAPI, Stores, utils) {
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
+import app from "../../../../app";
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../stores";
+import utils from "../../../../../test/mocha/testUtils";
+FauxtonAPI.router = new FauxtonAPI.Router([]);
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
 
-  describe('ChangesStore', function () {
+describe('ChangesStore', function () {
 
-    afterEach(function () {
-      Stores.changesStore.reset();
-    });
-
-    it('toggleTabVisibility() changes state in store', function () {
-      assert.ok(Stores.changesStore.isTabVisible() === false);
-      Stores.changesStore.toggleTabVisibility();
-      assert.ok(Stores.changesStore.isTabVisible() === true);
-    });
-
-    it('reset() changes tab visibility to hidden', function () {
-      Stores.changesStore.toggleTabVisibility();
-      Stores.changesStore.reset();
-      assert.ok(Stores.changesStore.isTabVisible() === false);
-    });
+  afterEach(function () {
+    Stores.changesStore.reset();
+  });
 
-    it('addFilter() adds item in store', function () {
-      var filter = 'My filter';
-      Stores.changesStore.addFilter(filter);
-      var filters = Stores.changesStore.getFilters();
-      assert.ok(filters.length === 1);
-      assert.ok(filters[0] === filter);
-    });
+  it('toggleTabVisibility() changes state in store', function () {
+    assert.ok(Stores.changesStore.isTabVisible() === false);
+    Stores.changesStore.toggleTabVisibility();
+    assert.ok(Stores.changesStore.isTabVisible() === true);
+  });
 
-    it('removeFilter() removes item from store', function () {
-      var filter1 = 'My filter 1';
-      var filter2 = 'My filter 2';
-      Stores.changesStore.addFilter(filter1);
-      Stores.changesStore.addFilter(filter2);
-      Stores.changesStore.removeFilter(filter1);
+  it('reset() changes tab visibility to hidden', function () {
+    Stores.changesStore.toggleTabVisibility();
+    Stores.changesStore.reset();
+    assert.ok(Stores.changesStore.isTabVisible() === false);
+  });
 
-      var filters = Stores.changesStore.getFilters();
-      assert.ok(filters.length === 1);
-      assert.ok(filters[0] === filter2);
-    });
+  it('addFilter() adds item in store', function () {
+    var filter = 'My filter';
+    Stores.changesStore.addFilter(filter);
+    var filters = Stores.changesStore.getFilters();
+    assert.ok(filters.length === 1);
+    assert.ok(filters[0] === filter);
+  });
 
-    it('hasFilter() finds item in store', function () {
-      var filter = 'My filter';
-      Stores.changesStore.addFilter(filter);
-      assert.ok(Stores.changesStore.hasFilter(filter) === true);
-    });
+  it('removeFilter() removes item from store', function () {
+    var filter1 = 'My filter 1';
+    var filter2 = 'My filter 2';
+    Stores.changesStore.addFilter(filter1);
+    Stores.changesStore.addFilter(filter2);
+    Stores.changesStore.removeFilter(filter1);
 
-    it('getDatabaseName() returns database name', function () {
-      var dbName = 'hoopoes';
-      Stores.changesStore.initChanges({ databaseName: dbName });
-      assert.equal(Stores.changesStore.getDatabaseName(), dbName);
+    var filters = Stores.changesStore.getFilters();
+    assert.ok(filters.length === 1);
+    assert.ok(filters[0] === filter2);
+  });
 
-      Stores.changesStore.reset();
-      assert.equal(Stores.changesStore.getDatabaseName(), '');
-    });
+  it('hasFilter() finds item in store', function () {
+    var filter = 'My filter';
+    Stores.changesStore.addFilter(filter);
+    assert.ok(Stores.changesStore.hasFilter(filter) === true);
+  });
 
-    it("getChanges() should return a subset if there are a lot of changes", function () {
+  it('getDatabaseName() returns database name', function () {
+    var dbName = 'hoopoes';
+    Stores.changesStore.initChanges({ databaseName: dbName });
+    assert.equal(Stores.changesStore.getDatabaseName(), dbName);
 
-      // to keep the test speedy, we override the default max value
-      var maxChanges = 10;
-      var changes = [];
-      _.times(maxChanges + 10, function (i) {
-        changes.push({ id: 'doc_' + i, seq: 1, changes: {}});
-      });
-      Stores.changesStore.initChanges({ databaseName: "test" });
-      Stores.changesStore.setMaxChanges(maxChanges);
+    Stores.changesStore.reset();
+    assert.equal(Stores.changesStore.getDatabaseName(), '');
+  });
 
-      var seqNum = 123;
-      Stores.changesStore.updateChanges(seqNum, changes);
+  it("getChanges() should return a subset if there are a lot of changes", function () {
 
-      var results = Stores.changesStore.getChanges();
-      assert.equal(maxChanges, results.length);
+    // to keep the test speedy, we override the default max value
+    var maxChanges = 10;
+    var changes = [];
+    _.times(maxChanges + 10, function (i) {
+      changes.push({ id: 'doc_' + i, seq: 1, changes: {}});
     });
+    Stores.changesStore.initChanges({ databaseName: "test" });
+    Stores.changesStore.setMaxChanges(maxChanges);
+
+    var seqNum = 123;
+    Stores.changesStore.updateChanges(seqNum, changes);
 
-    it("tracks last sequence number", function () {
-      assert.equal(null, Stores.changesStore.getLastSeqNum());
+    var results = Stores.changesStore.getChanges();
+    assert.equal(maxChanges, results.length);
+  });
 
-      var seqNum = 123;
-      Stores.changesStore.updateChanges(seqNum, []);
+  it("tracks last sequence number", function () {
+    assert.equal(null, Stores.changesStore.getLastSeqNum());
 
-      // confirm it's been stored
-      assert.equal(seqNum, Stores.changesStore.getLastSeqNum());
-    });
+    var seqNum = 123;
+    Stores.changesStore.updateChanges(seqNum, []);
 
+    // confirm it's been stored
+    assert.equal(seqNum, Stores.changesStore.getLastSeqNum());
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/designdocinfo/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/designdocinfo/actions.js b/app/addons/documents/designdocinfo/actions.js
index 655c38e..7e6ec4a 100644
--- a/app/addons/documents/designdocinfo/actions.js
+++ b/app/addons/documents/designdocinfo/actions.js
@@ -10,51 +10,47 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes',
-  './stores'
-],
-function (app, FauxtonAPI, ActionTypes, Stores) {
-  var store = Stores.designDocInfoStore;
-
-  return {
-    fetchDesignDocInfo: function (options) {
-      var designDocInfo = options.designDocInfo;
-
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DESIGN_FETCHING
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import Stores from "./stores";
+var store = Stores.designDocInfoStore;
+
+export default {
+  fetchDesignDocInfo: function (options) {
+    var designDocInfo = options.designDocInfo;
+
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DESIGN_FETCHING
+    });
+
+    designDocInfo.fetch().then(function () {
+      this.monitorDesignDoc({
+        ddocName: options.ddocName,
+        designDocInfo: designDocInfo
       });
 
-      designDocInfo.fetch().then(function () {
-        this.monitorDesignDoc({
-          ddocName: options.ddocName,
-          designDocInfo: designDocInfo
-        });
+    }.bind(this));
 
-      }.bind(this));
+  },
 
-    },
+  monitorDesignDoc: function (options) {
+    options.intervalId = window.setInterval(_.bind(this.refresh, this), 5000);
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DESIGN_DOC_MONITOR,
+      options: options
+    });
+  },
 
-    monitorDesignDoc: function (options) {
-      options.intervalId = window.setInterval(_.bind(this.refresh, this), 5000);
+  refresh: function () {
+    store.getDesignDocInfo().fetch().then(function () {
       FauxtonAPI.dispatch({
-        type: ActionTypes.DESIGN_DOC_MONITOR,
-        options: options
-      });
-    },
-
-    refresh: function () {
-      store.getDesignDocInfo().fetch().then(function () {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.DESIGN_REFRESH
-        });
+        type: ActionTypes.DESIGN_REFRESH
       });
-    },
+    });
+  },
 
-    stopRefresh: function () {
-      window.clearInterval(store.getIntervalId());
-    }
-  };
-});
+  stopRefresh: function () {
+    window.clearInterval(store.getIntervalId());
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/designdocinfo/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/designdocinfo/actiontypes.js b/app/addons/documents/designdocinfo/actiontypes.js
index d93a8fa..063072e 100644
--- a/app/addons/documents/designdocinfo/actiontypes.js
+++ b/app/addons/documents/designdocinfo/actiontypes.js
@@ -10,10 +10,8 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    DESIGN_DOC_MONITOR: 'DESIGN_DOC_MONITOR',
-    DESIGN_FETCHING: 'DESIGN_FETCHING',
-    DESIGN_REFRESH: 'DESIGN_REFRESH'
-  };
-});
+export default {
+  DESIGN_DOC_MONITOR: 'DESIGN_DOC_MONITOR',
+  DESIGN_FETCHING: 'DESIGN_FETCHING',
+  DESIGN_REFRESH: 'DESIGN_REFRESH'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/designdocinfo/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/designdocinfo/components.react.jsx b/app/addons/documents/designdocinfo/components.react.jsx
index c877dc4..a6909e8 100644
--- a/app/addons/documents/designdocinfo/components.react.jsx
+++ b/app/addons/documents/designdocinfo/components.react.jsx
@@ -10,146 +10,140 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  './stores',
-  './actions',
-  '../../components/react-components.react',
-  '../../fauxton/components.react'
-],
-
-function (app, FauxtonAPI, React, Stores, Actions, ReactComponents, GeneralComponents) {
-  var designDocInfoStore = Stores.designDocInfoStore;
-  var LoadLines = ReactComponents.LoadLines;
-  var Clipboard = GeneralComponents.Clipboard;
-
-
-  var DesignDocInfo = React.createClass({
-    getStoreState: function () {
-      return {
-        viewIndex: designDocInfoStore.getViewIndex(),
-        isLoading: designDocInfoStore.isLoading(),
-        ddocName: designDocInfoStore.getDdocName()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      designDocInfoStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      designDocInfoStore.off('change', this.onChange);
-      Actions.stopRefresh();
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    showCopiedMessage: function () {
-      FauxtonAPI.addNotification({
-        type: 'success',
-        msg: 'The MD5 sha has been copied to your clipboard.',
-        clear: true
-      });
-    },
-
-    render: function () {
-      var getDocUrl = app.helpers.getDocUrl;
-      var viewIndex = this.state.viewIndex;
-
-      if (this.state.isLoading) {
-        return <LoadLines />;
-      }
-
-      var actualSize = (viewIndex.data_size) ? viewIndex.data_size.toLocaleString('en') : 0;
-      var dataSize = (viewIndex.disk_size) ? viewIndex.disk_size.toLocaleString('en') : 0;
-
-      return (
-        <div className="metadata-page">
-          <header>
-            <div className="preheading">Design Document Metadata</div>
-            <h2>_design/{this.state.ddocName}</h2>
-
-            <p className="help">
-              Information about the specified design document, including the index, index size and current status of the
-              design document and associated index information.
-              <a href={getDocUrl('DESIGN_DOC_METADATA')} className="help-link" target="_blank" data-bypass="true">
-                <i className="icon-question-sign" />
-              </a>
-            </p>
-          </header>
-
-          <section className="container">
-            <h3>Index Information</h3>
-
-            <ul>
-              <li>
-                <span className="item-title">Language:</span>
-                <span className="capitalize">{viewIndex.language}</span>
-              </li>
-              <li>
-                <span className="item-title">Currently being updated?</span>
-                {viewIndex.updater_running ? 'Yes' : 'No'}
-              </li>
-              <li>
-                <span className="item-title">Currently running compaction?</span>
-                {viewIndex.compact_running ? 'Yes' : 'No'}
-              </li>
-              <li>
-                <span className="item-title">Waiting for a commit?</span>
-                {viewIndex.waiting_commit ? 'Yes' : 'No'}
-              </li>
-            </ul>
-
-            <ul>
-              <li>
-                <span className="item-title">Clients waiting for the index:</span>
-                {viewIndex.waiting_clients}
-              </li>
-              <li>
-                <span className="item-title">Update sequence on DB:</span>
-                {viewIndex.update_seq}
-              </li>
-              <li>
-                <span className="item-title">Processed purge sequence:</span>
-                {viewIndex.purge_seq}
-              </li>
-              <li>
-                <span className="item-title">Actual data size (bytes):</span>
-                {actualSize}
-              </li>
-              <li>
-                <span className="item-title">Data size on disk (bytes):</span>
-                {dataSize}
-              </li>
-            </ul>
-
-            <ul>
-              <li>
-                <span className="item-title">MD5 Signature:</span>
-                <Clipboard
-                  onClipboardClick={this.showCopiedMessage}
-                  text={viewIndex.signature} />
-              </li>
-            </ul>
-
-          </section>
-
-        </div>
-      );
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import Stores from "./stores";
+import Actions from "./actions";
+import ReactComponents from "../../components/react-components.react";
+import GeneralComponents from "../../fauxton/components.react";
+var designDocInfoStore = Stores.designDocInfoStore;
+var LoadLines = ReactComponents.LoadLines;
+var Clipboard = GeneralComponents.Clipboard;
+
+
+var DesignDocInfo = React.createClass({
+  getStoreState: function () {
+    return {
+      viewIndex: designDocInfoStore.getViewIndex(),
+      isLoading: designDocInfoStore.isLoading(),
+      ddocName: designDocInfoStore.getDdocName()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    designDocInfoStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    designDocInfoStore.off('change', this.onChange);
+    Actions.stopRefresh();
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  showCopiedMessage: function () {
+    FauxtonAPI.addNotification({
+      type: 'success',
+      msg: 'The MD5 sha has been copied to your clipboard.',
+      clear: true
+    });
+  },
+
+  render: function () {
+    var getDocUrl = app.helpers.getDocUrl;
+    var viewIndex = this.state.viewIndex;
+
+    if (this.state.isLoading) {
+      return <LoadLines />;
     }
-  });
 
+    var actualSize = (viewIndex.data_size) ? viewIndex.data_size.toLocaleString('en') : 0;
+    var dataSize = (viewIndex.disk_size) ? viewIndex.disk_size.toLocaleString('en') : 0;
+
+    return (
+      <div className="metadata-page">
+        <header>
+          <div className="preheading">Design Document Metadata</div>
+          <h2>_design/{this.state.ddocName}</h2>
+
+          <p className="help">
+            Information about the specified design document, including the index, index size and current status of the
+            design document and associated index information.
+            <a href={getDocUrl('DESIGN_DOC_METADATA')} className="help-link" target="_blank" data-bypass="true">
+              <i className="icon-question-sign" />
+            </a>
+          </p>
+        </header>
+
+        <section className="container">
+          <h3>Index Information</h3>
+
+          <ul>
+            <li>
+              <span className="item-title">Language:</span>
+              <span className="capitalize">{viewIndex.language}</span>
+            </li>
+            <li>
+              <span className="item-title">Currently being updated?</span>
+              {viewIndex.updater_running ? 'Yes' : 'No'}
+            </li>
+            <li>
+              <span className="item-title">Currently running compaction?</span>
+              {viewIndex.compact_running ? 'Yes' : 'No'}
+            </li>
+            <li>
+              <span className="item-title">Waiting for a commit?</span>
+              {viewIndex.waiting_commit ? 'Yes' : 'No'}
+            </li>
+          </ul>
+
+          <ul>
+            <li>
+              <span className="item-title">Clients waiting for the index:</span>
+              {viewIndex.waiting_clients}
+            </li>
+            <li>
+              <span className="item-title">Update sequence on DB:</span>
+              {viewIndex.update_seq}
+            </li>
+            <li>
+              <span className="item-title">Processed purge sequence:</span>
+              {viewIndex.purge_seq}
+            </li>
+            <li>
+              <span className="item-title">Actual data size (bytes):</span>
+              {actualSize}
+            </li>
+            <li>
+              <span className="item-title">Data size on disk (bytes):</span>
+              {dataSize}
+            </li>
+          </ul>
+
+          <ul>
+            <li>
+              <span className="item-title">MD5 Signature:</span>
+              <Clipboard
+                onClipboardClick={this.showCopiedMessage}
+                text={viewIndex.signature} />
+            </li>
+          </ul>
+
+        </section>
+
+      </div>
+    );
+  }
+});
 
-  return {
-    DesignDocInfo: DesignDocInfo
-  };
 
-});
+export default {
+  DesignDocInfo: DesignDocInfo
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/designdocinfo/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/designdocinfo/stores.js b/app/addons/documents/designdocinfo/stores.js
index 514bdca..4024229 100644
--- a/app/addons/documents/designdocinfo/stores.js
+++ b/app/addons/documents/designdocinfo/stores.js
@@ -10,78 +10,73 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  './actiontypes'
-],
-
-function (FauxtonAPI, ActionTypes) {
-  var Stores = {};
-
-  Stores.DesignDocInfoStore = FauxtonAPI.Store.extend({
-
-    initialize: function () {
-      this._isLoading = true;
-    },
-
-    isLoading: function () {
-      return this._isLoading;
-    },
-
-    getDdocName: function () {
-      return this._ddocName;
-    },
-
-    getDesignDocInfo: function () {
-      return this._designDocInfo;
-    },
-
-    monitorDesignDoc: function (options) {
-      this._isLoading = false;
-      this._designDocInfo = options.designDocInfo;
-      this._ddocName = options.ddocName;
-      this._intervalId = options.intervalId;
-    },
-
-    getIntervalId: function () {
-      return this._intervalId;
-    },
-
-    getViewIndex: function () {
-      if (this._isLoading) {
-        return {};
-      }
-
-      return this._designDocInfo.get('view_index');
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.DESIGN_FETCHING:
-          this._isLoading = true;
-          this.triggerChange();
-        break;
-
-        case ActionTypes.DESIGN_DOC_MONITOR:
-          this.monitorDesignDoc(action.options);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.DESIGN_DOC_REFRESH:
-          this.triggerChange();
-        break;
-
-        default:
-        return;
-        // do nothing
-      }
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+var Stores = {};
+
+Stores.DesignDocInfoStore = FauxtonAPI.Store.extend({
+
+  initialize: function () {
+    this._isLoading = true;
+  },
+
+  isLoading: function () {
+    return this._isLoading;
+  },
+
+  getDdocName: function () {
+    return this._ddocName;
+  },
+
+  getDesignDocInfo: function () {
+    return this._designDocInfo;
+  },
+
+  monitorDesignDoc: function (options) {
+    this._isLoading = false;
+    this._designDocInfo = options.designDocInfo;
+    this._ddocName = options.ddocName;
+    this._intervalId = options.intervalId;
+  },
+
+  getIntervalId: function () {
+    return this._intervalId;
+  },
+
+  getViewIndex: function () {
+    if (this._isLoading) {
+      return {};
     }
 
-  });
+    return this._designDocInfo.get('view_index');
+  },
 
-  Stores.designDocInfoStore = new Stores.DesignDocInfoStore();
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.DESIGN_FETCHING:
+        this._isLoading = true;
+        this.triggerChange();
+      break;
 
-  Stores.designDocInfoStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.designDocInfoStore.dispatch);
+      case ActionTypes.DESIGN_DOC_MONITOR:
+        this.monitorDesignDoc(action.options);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.DESIGN_DOC_REFRESH:
+        this.triggerChange();
+      break;
+
+      default:
+      return;
+      // do nothing
+    }
+  }
 
-  return Stores;
 });
+
+Stores.designDocInfoStore = new Stores.DesignDocInfoStore();
+
+Stores.designDocInfoStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.designDocInfoStore.dispatch);
+
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/designdocinfo/tests/actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/designdocinfo/tests/actionsSpec.js b/app/addons/documents/designdocinfo/tests/actionsSpec.js
index 3735e62..ac54353 100644
--- a/app/addons/documents/designdocinfo/tests/actionsSpec.js
+++ b/app/addons/documents/designdocinfo/tests/actionsSpec.js
@@ -10,43 +10,40 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../actions',
-  '../../../../../test/mocha/testUtils',
-  'sinon'
-], function (FauxtonAPI, Actions, testUtils, sinon) {
-  var assert = testUtils.assert;
-  var restore = testUtils.restore;
+import FauxtonAPI from "../../../../core/api";
+import Actions from "../actions";
+import testUtils from "../../../../../test/mocha/testUtils";
+import sinon from "sinon";
+var assert = testUtils.assert;
+var restore = testUtils.restore;
 
-  describe('DesignDocInfo Actions', function () {
+describe('DesignDocInfo Actions', function () {
 
-    describe('fetchDesignDocInfo', function () {
+  describe('fetchDesignDocInfo', function () {
 
-      afterEach(function () {
-        restore(Actions.monitorDesignDoc);
-      });
-
-      it('calls monitorDesignDoc on successful fetch', function () {
-        var promise = FauxtonAPI.Deferred();
-        promise.resolve();
-        var fakeDesignDocInfo = {
-          fetch: function () {
-            return promise;
-          }
-        };
+    afterEach(function () {
+      restore(Actions.monitorDesignDoc);
+    });
 
-        var spy = sinon.spy(Actions, 'monitorDesignDoc');
+    it('calls monitorDesignDoc on successful fetch', function () {
+      var promise = FauxtonAPI.Deferred();
+      promise.resolve();
+      var fakeDesignDocInfo = {
+        fetch: function () {
+          return promise;
+        }
+      };
 
+      var spy = sinon.spy(Actions, 'monitorDesignDoc');
 
-        Actions.fetchDesignDocInfo({
-          ddocName: 'test-designdoc-info',
-          designDocInfo: fakeDesignDocInfo
-        });
 
-        assert.ok(spy.calledOnce);
+      Actions.fetchDesignDocInfo({
+        ddocName: 'test-designdoc-info',
+        designDocInfo: fakeDesignDocInfo
       });
-    });
 
+      assert.ok(spy.calledOnce);
+    });
   });
+
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 940c388..5dd9c87 100644
--- a/app/addons/documents/index-results/tests/index-results.storesSpec.js
+++ b/app/addons/documents/index-results/tests/index-results.storesSpec.js
@@ -10,736 +10,733 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../stores',
-  '../actiontypes',
-  '../../resources',
-  '../../tests/document-test-helper',
-  '../../../../../test/mocha/testUtils',
-  'sinon'
-], function (FauxtonAPI, Stores, ActionTypes, Documents, documentTestHelper, testUtils, sinon) {
-  var assert = testUtils.assert;
-  var dispatchToken;
-  var store;
-  var opts;
-
-  var createDocColumn = documentTestHelper.createDocColumn;
-  var createMangoIndexDocColumn = documentTestHelper.createMangoIndexDocColumn;
-
-  describe('Index Results Store', function () {
-    beforeEach(function () {
-      store = new Stores.IndexResultsStore();
-      store.dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
-      store.reset();
-      opts = {
-        params: {limit: 10, skip: 0},
-        database: {
-          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' })
-      });
-    });
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../stores";
+import ActionTypes from "../actiontypes";
+import Documents from "../../resources";
+import documentTestHelper from "../../tests/document-test-helper";
+import testUtils from "../../../../../test/mocha/testUtils";
+import sinon from "sinon";
+var assert = testUtils.assert;
+var dispatchToken;
+var store;
+var opts;
+
+var createDocColumn = documentTestHelper.createDocColumn;
+var createMangoIndexDocColumn = documentTestHelper.createMangoIndexDocColumn;
+
+describe('Index Results Store', function () {
+  beforeEach(function () {
+    store = new Stores.IndexResultsStore();
+    store.dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+    store.reset();
+    opts = {
+      params: {limit: 10, skip: 0},
+      database: {
+        safeID: function () { return '1';}
+      }
+    };
 
-    afterEach(function () {
-      FauxtonAPI.dispatcher.unregister(store.dispatchToken);
+    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(store.dispatchToken);
+  });
 
-    it('hasResults returns true for collection', function () {
-      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('hasResults returns true for collection', function () {
+    store.newResults({
+      collection: createDocColumn([
+        {_id: 'testId5', _rev: '1', 'value': 'one'},
+        {_id: 'testId6', _rev: '1', 'value': 'one'}
+      ]),
+      bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: '1' })
     });
 
-    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.ok(store.hasResults());
+  });
 
-      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 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);
+  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');
+  });
 
-      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 = [];
 
-    it('hasResults returns false for empty collection', function () {
-      store._collection = [];
+    assert.notOk(store.hasResults());
+  });
 
-      assert.notOk(store.hasResults());
+  it('getResults has correct doc format', function () {
+    store.newResults({
+      collection: createDocColumn([
+        {_id: 'testId', _rev: '1', 'value': 'one'},
+      ])
     });
 
-    it('getResults has correct doc format', function () {
-      store.newResults({
-        collection: createDocColumn([
-          {_id: 'testId', _rev: '1', 'value': 'one'},
-        ])
-      });
+    var doc = store.getResults().results[0];
+    assert.equal(doc.id, 'testId');
+    assert.equal(doc.keylabel, 'id');
+  });
 
-      var doc = store.getResults().results[0];
-      assert.equal(doc.id, 'testId');
-      assert.equal(doc.keylabel, 'id');
-    });
+  it('tries to guess a pseudo schema for table views', function () {
+    var doclist = [
+      {_id: 'testId1', value: 'one'},
+      {_id: 'testId2', foo: 'one'},
+      {_id: 'testId3', bar: 'one'},
+    ];
 
-    it('tries to guess a pseudo schema for table views', function () {
-      var doclist = [
-        {_id: 'testId1', value: 'one'},
-        {_id: 'testId2', foo: 'one'},
-        {_id: 'testId3', bar: 'one'},
-      ];
+    var schema = store.getPseudoSchema(doclist);
 
-      var schema = store.getPseudoSchema(doclist);
+    assert.ok(schema.indexOf('_id') !== -1);
+    assert.ok(schema.indexOf('value') !== -1);
+    assert.ok(schema.indexOf('foo') !== -1);
+    assert.ok(schema.indexOf('bar') !== -1);
+  });
 
-      assert.ok(schema.indexOf('_id') !== -1);
-      assert.ok(schema.indexOf('value') !== -1);
-      assert.ok(schema.indexOf('foo') !== -1);
-      assert.ok(schema.indexOf('bar') !== -1);
-    });
+  it('uses unique values for the pseudo schema', function () {
+    var doclist = [
+      {_id: 'testId1', foo: 'one'},
+      {_id: 'testId2', foo: 'one'}
+    ];
 
-    it('uses unique values for the pseudo schema', function () {
-      var doclist = [
-        {_id: 'testId1', foo: 'one'},
-        {_id: 'testId2', foo: 'one'}
-      ];
+    var schema = store.getPseudoSchema(doclist);
 
-      var schema = store.getPseudoSchema(doclist);
+    assert.equal(schema.length, 2);
+    assert.equal(schema.length, 2);
+    assert.ok(schema.indexOf('foo') !== -1);
+    assert.ok(schema.indexOf('_id') !== -1);
+  });
 
-      assert.equal(schema.length, 2);
-      assert.equal(schema.length, 2);
-      assert.ok(schema.indexOf('foo') !== -1);
-      assert.ok(schema.indexOf('_id') !== -1);
-    });
+  it('puts the id into the array as first element', function () {
+    var doclist = [
+      {foo: 'one', _id: 'testId1'},
+      {foo: 'one', _id: 'testId2'}
+    ];
 
-    it('puts the id into the array as first element', function () {
-      var doclist = [
-        {foo: 'one', _id: 'testId1'},
-        {foo: 'one', _id: 'testId2'}
-      ];
+    var schema = store.getPseudoSchema(doclist);
 
-      var schema = store.getPseudoSchema(doclist);
+    assert.equal(schema.shift(), '_id');
+  });
 
-      assert.equal(schema.shift(), '_id');
-    });
+  it('normalizes different content from include_docs enabled', function () {
+    var doclist = [
+      {_id: 'testId2', foo: 'one', doc: {"_rev": "1", "ente": "gans", "fuchs": "hase"}},
+      {_id: 'testId3', foo: 'two', doc: {"_rev": "2", "haus": "blau", "tanne": "acht"}}
+    ];
 
-    it('normalizes different content from include_docs enabled', function () {
-      var doclist = [
-        {_id: 'testId2', foo: 'one', doc: {"_rev": "1", "ente": "gans", "fuchs": "hase"}},
-        {_id: 'testId3', foo: 'two', doc: {"_rev": "2", "haus": "blau", "tanne": "acht"}}
-      ];
+    var res = store.normalizeTableData(doclist);
+    assert.deepEqual(res[0], {"_rev": "1", "ente": "gans", "fuchs": "hase"});
+  });
 
-      var res = store.normalizeTableData(doclist);
-      assert.deepEqual(res[0], {"_rev": "1", "ente": "gans", "fuchs": "hase"});
-    });
+  it('returns the fields that occure the most without id and rev', function () {
+    var doclist = [
+      {_rev: '1', _id: '1', id: 'testId2', foo: 'one'},
+      {_rev: '1', _id: '1', id: 'testId3', foo: 'two'}
+    ];
 
-    it('returns the fields that occure the most without id and rev', function () {
-      var doclist = [
-        {_rev: '1', _id: '1', id: 'testId2', foo: 'one'},
-        {_rev: '1', _id: '1', id: 'testId3', foo: 'two'}
-      ];
+    var res = store.getPrioritizedFields(doclist, 10);
+    assert.deepEqual(res, ['foo']);
+  });
 
-      var res = store.getPrioritizedFields(doclist, 10);
-      assert.deepEqual(res, ['foo']);
-    });
+  it('sorts the fields that occure the most', function () {
+    var doclist = [
+      {id: 'testId2', foo: 'one'},
 
-    it('sorts the fields that occure the most', function () {
-      var doclist = [
-        {id: 'testId2', foo: 'one'},
+      {id: 'testId3', bar: 'two'},
+      {id: 'testId3', bar: 'two'},
+      {id: 'testId3', baz: 'two'},
+      {id: 'testId3', baz: 'two'}
+    ];
 
-        {id: 'testId3', bar: 'two'},
-        {id: 'testId3', bar: 'two'},
-        {id: 'testId3', baz: 'two'},
-        {id: 'testId3', baz: 'two'}
-      ];
+    var res = store.getPrioritizedFields(doclist, 10);
+    assert.deepEqual(res, ['bar', 'baz', 'foo']);
+  });
 
-      var res = store.getPrioritizedFields(doclist, 10);
-      assert.deepEqual(res, ['bar', 'baz', 'foo']);
-    });
+  it('limits the fields that occure the most', function () {
+    var doclist = [
+      {id: 'testId2', foo: 'one'},
 
-    it('limits the fields that occure the most', function () {
-      var doclist = [
-        {id: 'testId2', foo: 'one'},
+      {id: 'testId3', bar: 'two'},
+      {id: 'testId3', bar: 'two'},
+      {id: 'testId3', baz: 'two'},
+      {id: 'testId3', baz: 'two'}
+    ];
 
-        {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']);
+  });
 
-      var res = store.getPrioritizedFields(doclist, 2);
-      assert.deepEqual(res, ['bar', 'baz']);
-    });
+  it('if the collection is empty, no docs should be selected', function () {
+    store._collection = new Documents.AllDocs([], opts);
 
-    it('if the collection is empty, no docs should be selected', function () {
-      store._collection = new Documents.AllDocs([], opts);
+    assert.notOk(store.areAllDocumentsSelected());
+  });
 
-      assert.notOk(store.areAllDocumentsSelected());
-    });
+  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'}
+    ]);
 
-    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.selectAllDocuments();
+    store._collection = createDocColumn([
+      {_id: 'testId5', _rev: '1', 'value': 'one'},
+      {_id: 'testId6', _rev: '1', 'value': 'one'}
+    ]);
 
-      store._collection = createDocColumn([
-        {_id: 'testId5', _rev: '1', 'value': 'one'},
-        {_id: 'testId6', _rev: '1', 'value': 'one'}
-      ]);
+    assert.notOk(store.areAllDocumentsSelected());
+  });
 
-      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'}]}}
+    ]);
 
-    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'}]}}
-      ]);
+    store.selectAllDocuments();
 
-      store.selectAllDocuments();
+    assert.ok(store.areAllDocumentsSelected());
+  });
 
-      assert.ok(store.areAllDocumentsSelected());
-    });
+  it('returns true for selected docs less than collection', function () {
+    store._collection = createDocColumn([
+      {_id: 'testId1', _rev: 'foo'},
+      {_id: 'testId2', _rev: 'foo'}
+    ]);
 
-    it('returns true for selected docs less than collection', function () {
-      store._collection = createDocColumn([
-        {_id: 'testId1', _rev: 'foo'},
-        {_id: 'testId2', _rev: 'foo'}
-      ]);
+    store._selectedItems = {'testId1': true};
+    assert.notOk(store.areAllDocumentsSelected());
+  });
 
-      store._selectedItems = {'testId1': true};
-      assert.notOk(store.areAllDocumentsSelected());
-    });
+  it('returns true even with _all_docs (mango)', function () {
+    store._collection = new Documents.AllDocs([
+      {_id: 'testId1'},
+      {_id: 'testId2'},
+      {_id: '_all_docs'}
+    ], opts);
 
-    it('returns true even with _all_docs (mango)', function () {
-      store._collection = new Documents.AllDocs([
-        {_id: 'testId1'},
-        {_id: 'testId2'},
-        {_id: '_all_docs'}
-      ], opts);
+    store._selectedItems = {
+      'testId1': true,
+      'testId2': true
+    };
 
-      store._selectedItems = {
-        'testId1': true,
-        'testId2': true
-      };
+    assert.ok(store.areAllDocumentsSelected());
+  });
 
-      assert.ok(store.areAllDocumentsSelected());
+  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'}
+      ])
     });
 
-    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();
 
-      store.getResults();
+    store.toggleTableView({enable: true});
+    store.getResults();
 
-      store.toggleTableView({enable: true});
-      store.getResults();
+    store.changeTableViewFields({index: 0, newSelectedRow: 'value'});
 
-      store.changeTableViewFields({index: 0, newSelectedRow: 'value'});
+    var stub = sinon.stub(store, 'isIncludeDocsEnabled');
+    stub.returns(true);
 
-      var stub = sinon.stub(store, 'isIncludeDocsEnabled');
-      stub.returns(true);
+    assert.deepEqual(store.getDisplayCountForTableView(), { shown: 2, allFieldCount: 3 });
+  });
 
-      assert.deepEqual(store.getDisplayCountForTableView(), { shown: 2, allFieldCount: 3 });
+  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' })
     });
 
-    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' })
-      });
+    store.toggleTableView({enable: true});
 
-      store.toggleTableView({enable: true});
+    var stub = sinon.stub(store, 'isIncludeDocsEnabled');
+    stub.returns(true);
+    store.getResults();
 
-      var stub = sinon.stub(store, 'isIncludeDocsEnabled');
-      stub.returns(true);
-      store.getResults();
+    assert.deepEqual(store.getDisplayCountForTableView(), { shown: 4, allFieldCount: 4 });
+  });
 
-      assert.deepEqual(store.getDisplayCountForTableView(), { shown: 4, allFieldCount: 4 });
-    });
+  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('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('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);
+  });
 
-    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);
-    });
+  it('selectDoc selects all documents', function () {
+    store._collection = createDocColumn([{_id: 'testId1', _rev: '1', 'value': 'one'}]);
 
-    it('selectDoc selects all documents', function () {
-      store._collection = createDocColumn([{_id: 'testId1', _rev: '1', 'value': 'one'}]);
+    store.selectAllDocuments();
+    assert.ok(store._bulkDeleteDocCollection.get('testId1'));
+  });
 
-      store.selectAllDocuments();
-      assert.ok(store._bulkDeleteDocCollection.get('testId1'));
-    });
+  it('selectDoc does not select all documents if rev is missing', function () {
+    store._collection = createDocColumn([{_id: 'testId1', 'value': 'one'}]);
 
-    it('selectDoc does not select all documents if rev is missing', function () {
-      store._collection = createDocColumn([{_id: 'testId1', 'value': 'one'}]);
+    store.selectAllDocuments();
+    assert.equal(store.getSelectedItemsLength(), 0);
+  });
 
-      store.selectAllDocuments();
-      assert.equal(store.getSelectedItemsLength(), 0);
-    });
+});
+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._bulkDeleteDocCollection.get('testId1'));
+    store.toggleSelectAllDocuments();
+    assert.equal(store.getSelectedItemsLength(), 0);
   });
-  describe('toggleSelectAllDocuments', function () {
 
-    it('deselects all documents', function () {
-      store._collection = new Documents.AllDocs([{_id: 'testId1', _rev: '1', 'value': 'one'}], opts);
+  it('deselects all documents with toggleSelectAllDocuments', function () {
+    store.reset();
+    store._collection = new Documents.AllDocs([{_id: 'testId1', _rev: '1', 'value': 'one'}], opts);
 
-      store.selectAllDocuments();
-      assert.ok(store._bulkDeleteDocCollection.get('testId1'));
-      store.toggleSelectAllDocuments();
-      assert.equal(store.getSelectedItemsLength(), 0);
-    });
+    assert.equal(store._bulkDeleteDocCollection.length, 0);
+    store.toggleSelectAllDocuments();
+    assert.equal(store.getSelectedItemsLength(), 1);
+  });
+});
 
-    it('deselects all documents with toggleSelectAllDocuments', function () {
-      store.reset();
-      store._collection = new Documents.AllDocs([{_id: 'testId1', _rev: '1', 'value': 'one'}], opts);
+describe('#getMangoDoc', function () {
+  beforeEach(function () {
+    store = new Stores.IndexResultsStore();
+    dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+    opts = {
+      params: {},
+      database: {
+        safeID: function () { return '1';}
+      }
+    };
+  });
 
-      assert.equal(store._bulkDeleteDocCollection.length, 0);
-      store.toggleSelectAllDocuments();
-      assert.equal(store.getSelectedItemsLength(), 1);
-    });
+  var fakeMango = {
+    ddoc: '_design/e4d338e5d6f047749f5399ab998b4fa04ba0c816',
+    def: {
+      fields: [
+        {'_id': 'asc'},
+        {'foo': 'bar'},
+        {'ente': 'gans'}
+      ]
+    },
+    name: 'e4d338e5d6f047749f5399ab998b4fa04ba0c816',
+    type: 'json'
+  };
+
+  it('creates a special id from the header fields', function () {
+    var doc = new Documents.MangoIndex(fakeMango, opts);
+    assert.equal(store.getMangoDoc(doc).header, 'json: _id, foo, ente');
   });
 
-  describe('#getMangoDoc', function () {
-    beforeEach(function () {
-      store = new Stores.IndexResultsStore();
-      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
-      opts = {
-        params: {},
-        database: {
-          safeID: function () { return '1';}
-        }
-      };
+  it('supports custom header fields', function () {
+    FauxtonAPI.registerExtension('mango:additionalIndexes', {
+      createHeader: function (doc) {
+        return ['foobar'];
+      }
     });
 
-    var fakeMango = {
+    var doc = new Documents.MangoIndex({
       ddoc: '_design/e4d338e5d6f047749f5399ab998b4fa04ba0c816',
       def: {
-        fields: [
-          {'_id': 'asc'},
-          {'foo': 'bar'},
-          {'ente': 'gans'}
-        ]
+        fields: []
       },
       name: 'e4d338e5d6f047749f5399ab998b4fa04ba0c816',
       type: 'json'
-    };
+    }, opts);
+    assert.equal(store.getMangoDoc(doc).header, 'foobar');
+  });
 
-    it('creates a special id from the header fields', function () {
-      var doc = new Documents.MangoIndex(fakeMango, opts);
-      assert.equal(store.getMangoDoc(doc).header, 'json: _id, foo, ente');
-    });
+  it('removes the name and ddoc field', function () {
+    var doc = new Documents.MangoIndex(fakeMango, opts);
+    assert.ok(doc.get('name'));
+    assert.ok(doc.get('ddoc'));
 
-    it('supports custom header fields', function () {
-      FauxtonAPI.registerExtension('mango:additionalIndexes', {
-        createHeader: function (doc) {
-          return ['foobar'];
-        }
-      });
+    store._allCollapsed = false;
+    var newDoc = store.getMangoDoc(doc);
+    assert.notOk(JSON.parse(newDoc.content).name);
+    assert.notOk(JSON.parse(newDoc.content).ddoc);
+    assert.ok(JSON.parse(newDoc.content).type);
+  });
+});
 
-      var doc = new Documents.MangoIndex({
-        ddoc: '_design/e4d338e5d6f047749f5399ab998b4fa04ba0c816',
-        def: {
-          fields: []
-        },
-        name: 'e4d338e5d6f047749f5399ab998b4fa04ba0c816',
-        type: 'json'
-      }, opts);
-      assert.equal(store.getMangoDoc(doc).header, 'foobar');
-    });
+describe('#getDocId', function () {
 
-    it('removes the name and ddoc field', function () {
-      var doc = new Documents.MangoIndex(fakeMango, opts);
-      assert.ok(doc.get('name'));
-      assert.ok(doc.get('ddoc'));
+  it('returns id if it exists', function () {
+    var doc = new Documents.Doc({
+      _id: 'doc-id'
+    }, opts);
+
+    assert.equal(store.getDocId(doc), 'doc-id');
 
-      store._allCollapsed = false;
-      var newDoc = store.getMangoDoc(doc);
-      assert.notOk(JSON.parse(newDoc.content).name);
-      assert.notOk(JSON.parse(newDoc.content).ddoc);
-      assert.ok(JSON.parse(newDoc.content).type);
-    });
   });
 
-  describe('#getDocId', function () {
+  it('returns key if it exists', function () {
+    var doc = new Documents.Doc({
+      key: 'doc-key'
+    }, opts);
 
-    it('returns id if it exists', function () {
-      var doc = new Documents.Doc({
-        _id: 'doc-id'
-      }, opts);
+    assert.equal(store.getDocId(doc), 'doc-key');
 
-      assert.equal(store.getDocId(doc), 'doc-id');
+  });
 
-    });
+  it('returns empty string if no key or id exists', function () {
+    var doc = new Documents.Doc({
+      key: null,
+      value: 'the-value'
+    }, opts);
 
-    it('returns key if it exists', function () {
-      var doc = new Documents.Doc({
-        key: 'doc-key'
-      }, opts);
+    assert.equal(store.getDocId(doc), '');
 
-      assert.equal(store.getDocId(doc), 'doc-key');
+  });
+});
 
-    });
+describe('isEditable', function () {
+  store = new Stores.IndexResultsStore();
 
-    it('returns empty string if no key or id exists', function () {
-      var doc = new Documents.Doc({
-        key: null,
-        value: 'the-value'
-      }, opts);
+  it('returns false for no collection', function () {
+    store._collection = null;
+    assert.notOk(store.isEditable());
+  });
 
-      assert.equal(store.getDocId(doc), '');
+  it('returns false for empty collection', function () {
+    store._collection = [];
+    assert.notOk(store.isEditable());
+  });
 
-    });
+  it('delegates to collection', function () {
+    store._collection = {
+      attributes: {
+        fields: ["foo"]
+      }
+    };
+    store._collection.isEditable = function () { return {'stub': true}; };
+    assert.deepEqual(store.isEditable(), {'stub': true});
+    store._collection = {};
   });
 
-  describe('isEditable', function () {
-    store = new Stores.IndexResultsStore();
+  it('retuns false for ghost-docs that are filtered away', function () {
+    store._collection = {};
+    assert.equal(store.isEditable({}), false);
+  });
+});
 
-    it('returns false for no collection', function () {
-      store._collection = null;
-      assert.notOk(store.isEditable());
-    });
+describe('isDeletable', function () {
+  store = new Stores.IndexResultsStore();
 
-    it('returns false for empty collection', function () {
-      store._collection = [];
-      assert.notOk(store.isEditable());
-    });
+  it('retuns false for ghost-docs that are filtered away', function () {
+    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);
+  });
 
-    it('delegates to collection', function () {
-      store._collection = {
-        attributes: {
-          fields: ["foo"]
+  describe('#collectionChanged', function () {
+    var collection;
+    beforeEach(function () {
+      collection = new Documents.AllDocs([{id:1}, {id: 2}], {
+        params: {},
+        database: {
+          safeID: function () { return '1';}
         }
-      };
-      store._collection.isEditable = function () { return {'stub': true}; };
-      assert.deepEqual(store.isEditable(), {'stub': true});
-      store._collection = {};
+      });
+      store.reset();
+      store.newResults({
+        collection: collection
+      });
     });
 
-    it('retuns false for ghost-docs that are filtered away', function () {
-      store._collection = {};
-      assert.equal(store.isEditable({}), false);
+    it('sets total rows correctly', function () {
+      assert.equal(store.getTotalRows(), 2);
     });
   });
 
-  describe('isDeletable', function () {
-    store = new Stores.IndexResultsStore();
+  describe('canShowPrevious', function () {
+    it('cannot show previous if disabled', function () {
+      store._enabled = false;
+      assert.notOk(store.canShowPrevious());
+    });
 
-    it('retuns false for ghost-docs that are filtered away', function () {
-      assert.equal(store.isDeletable({}), false);
+    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('Index Pagination', function () {
+  describe('canShowNext', function () {
+    it('cannot show next if disabled', function () {
+      store._enabled = false;
+      assert.notOk(store.canShowNext());
+    });
 
-    beforeEach(function () {
-      store = new Stores.IndexResultsStore();
-      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+    it('cannot show if pageStart and perPage greater than docLimit', function () {
+      store._enabled = true;
+      store._docLimit = 10;
+      store._perPage = 20;
+
+      assert.notOk(store.canShowNext());
     });
 
-    afterEach(function () {
-      FauxtonAPI.dispatcher.unregister(dispatchToken);
+    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('#collectionChanged', function () {
-      var collection;
-      beforeEach(function () {
-        collection = new Documents.AllDocs([{id:1}, {id: 2}], {
+  describe('paginateNext', function () {
+    beforeEach(function () {
+      store.reset();
+
+      store.newResults({
+        collection: new Documents.AllDocs(null, {
           params: {},
           database: {
             safeID: function () { return '1';}
           }
-        });
-        store.reset();
-        store.newResults({
-          collection: collection
-        });
-      });
-
-      it('sets total rows correctly', function () {
-        assert.equal(store.getTotalRows(), 2);
+        })
       });
+      store.setPerPage(20);
     });
 
-    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());
-      });
+    it('should increment page number', function () {
+      store.paginateNext();
 
+      assert.equal(store.getCurrentPage(), 2);
     });
 
-    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;
+    it('should increment page start', function () {
+      store.paginateNext();
 
-        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());
-      });
+      assert.equal(store.getPageStart(), 21);
     });
 
-    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 set correct page end', function () {
+      store._collection.length = 20;
+      store.paginateNext();
 
-      it('should increment page start', function () {
-        store.paginateNext();
+      assert.equal(store.getPageEnd(), 40);
+    });
 
-        assert.equal(store.getPageStart(), 21);
-      });
+    it('should set collection pageSize', function () {
+      store.paginateNext();
 
-      it('should set correct page end', function () {
-        store._collection.length = 20;
-        store.paginateNext();
+      assert.equal(store.getCollection().paging.pageSize, 20);
+    });
+  });
 
-        assert.equal(store.getPageEnd(), 40);
+  describe('paginatePrevious', function () {
+    beforeEach(function () {
+      store.resetPagination();
+      store._collection = new Documents.AllDocs(null, {
+        params: {},
+        database: {
+          safeID: function () { return '1';}
+        }
       });
+    });
 
-      it('should set collection pageSize', function () {
-        store.paginateNext();
+    it('should decrement page number', function () {
+      store.paginateNext();
+      store.paginatePrevious();
 
-        assert.equal(store.getCollection().paging.pageSize, 20);
-      });
+      assert.equal(store.getCurrentPage(), 1);
     });
 
-    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();
+    it('should decrement page start', function () {
+      store.paginateNext();
+      store.paginatePrevious();
 
-        assert.equal(store.getCurrentPage(), 1);
-      });
+      assert.equal(store.getPageStart(), 1);
+    });
 
-      it('should decrement page start', function () {
-        store.paginateNext();
-        store.paginatePrevious();
+    it('should decrement page end', function () {
+      store._collection.length = 20;
+      store.paginateNext();
+      store.paginatePrevious();
 
-        assert.equal(store.getPageStart(), 1);
-      });
+      assert.equal(store.getPageEnd(), 20);
+    });
 
-      it('should decrement page end', function () {
-        store._collection.length = 20;
-        store.paginateNext();
-        store.paginatePrevious();
+    it('should set collection pageSize', function () {
+      store.paginateNext();
+      store.paginatePrevious();
 
-        assert.equal(store.getPageEnd(), 20);
-      });
+      assert.equal(store.getCollection().paging.pageSize, 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);
     });
 
-    describe('totalDocsViewed', function () {
-      beforeEach(function () {
-        store.reset();
-      });
+    it('returns correct count for page 3 and 10 docs per page', function () {
+      store._perPage = 10;
+      store._currentPage = 3;
 
-      it('returns correct count for page 1 and 20 docs per page', function () {
-        assert.equal(store.totalDocsViewed(), 20);
-      });
+      assert.equal(store.totalDocsViewed(), 30);
+    });
+  });
 
-      it('returns correct count for page 3 and 10 docs per page', function () {
-        store._perPage = 10;
-        store._currentPage = 3;
+  describe('documentsLeftToFetch', function () {
+    beforeEach(function () {
+      store.reset();
+    });
 
-        assert.equal(store.totalDocsViewed(), 30);
-      });
+    it('returns 20 documents left', function () {
+      assert.equal(store.documentsLeftToFetch(), 20);
     });
 
-    describe('documentsLeftToFetch', function () {
-      beforeEach(function () {
-        store.reset();
-      });
+    it('returns less if close to limit', function () {
+      store._docLimit = 35;
+      store._perPage = 10;
+      store._currentPage = 3;
+      assert.equal(store.documentsLeftToFetch(), 5);
+    });
 
-      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);
     });
 
-    describe('#initPerPage', function () {
+    it('uses localstorage when available', function () {
+      window.localStorage.setItem('fauxton:perpage', 44);
+      store.initPerPage();
+      assert.equal(store.getPerPage(), 44);
+    });
 
-      it('uses default if no local storage set', function () {
-        window.localStorage.removeItem('fauxton:perpage');
-        store.initPerPage();
-        assert.equal(store.getPerPage(), 20);
-      });
+    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);
+    });
 
-      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);
     });
 
-    describe('#setDocumentLimit', function () {
+    it('sets perPage to doclimit if doclimit less than perPage', function () {
+      store.setPerPage(20);
+      store.setDocumentLimit(1);
+      assert.equal(store._docLimit, 1);
+    });
 
-      it('sets document if exists', function () {
-        store.setDocumentLimit(10);
-        assert.equal(store._docLimit, 10);
-      });
+    it('sets doclimit to 10000 if NaN', function () {
+      store.setDocumentLimit(NaN);
+      assert.equal(store._docLimit, 10000);
+    });
+  });
 
-      it('sets perPage to doclimit if doclimit less than perPage', function () {
-        store.setPerPage(20);
-        store.setDocumentLimit(1);
-        assert.equal(store._docLimit, 1);
+  describe('#setPerPage', function () {
+    beforeEach(function () {
+      store.reset();
+      store._collection = new Documents.AllDocs(null, {
+        params: {},
+        database: {
+          safeID: function () { return '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('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;
+    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);
+      store.setPerPage(testPerPage);
+      assert.equal(spy.getCall(0).args[0], testPerPage);
 
 
-      });
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/jumptodoc.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/jumptodoc.react.jsx b/app/addons/documents/jumptodoc.react.jsx
index 3b27b59..64b2691 100644
--- a/app/addons/documents/jumptodoc.react.jsx
+++ b/app/addons/documents/jumptodoc.react.jsx
@@ -10,48 +10,45 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  'react-dom',
-  'react-select',
-  'lodash'
-], (app, FauxtonAPI, React, ReactDOM, ReactSelect, {debounce}) => {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import ReactSelect from "react-select";
+import "lodash";
 
-  const JumpToDoc = ({database, allDocs}) => {
-    const options = allDocs.map(doc => {
-      return {
-        value: doc.get('_id'),
-        label: doc.get('_id')
-      };
-    });
-    return (
-      <div id="jump-to-doc" class="input-append">
-        <ReactSelect
-          name="jump-to-doc"
-          placeholder="Document ID"
-          className="input-large jump-to-doc"
-          options={options}
-          clearable={false}
-          onChange={({value: docId}) => {
-            const url = FauxtonAPI.urls('document', 'app', app.utils.safeURLName(database.id), app.utils.safeURLName(docId) );
-            FauxtonAPI.navigate(url, {trigger: true});
-          }}
-        />
-      </div>
-    );
-  };
+const JumpToDoc = ({database, allDocs}) => {
+  const options = allDocs.map(doc => {
+    return {
+      value: doc.get('_id'),
+      label: doc.get('_id')
+    };
+  });
+  return (
+    <div id="jump-to-doc" class="input-append">
+      <ReactSelect
+        name="jump-to-doc"
+        placeholder="Document ID"
+        className="input-large jump-to-doc"
+        options={options}
+        clearable={false}
+        onChange={({value: docId}) => {
+          const url = FauxtonAPI.urls('document', 'app', app.utils.safeURLName(database.id), app.utils.safeURLName(docId) );
+          FauxtonAPI.navigate(url, {trigger: true});
+        }}
+      />
+    </div>
+  );
+};
 
-  JumpToDoc.propTypes = {
-    database: React.PropTypes.object.isRequired,
-    allDocs: React.PropTypes.object.isRequired,
-  };
+JumpToDoc.propTypes = {
+  database: React.PropTypes.object.isRequired,
+  allDocs: React.PropTypes.object.isRequired,
+};
 
-  return {
-    JumpToDoc,
-    render: (el, database, allDocs) => {
-      ReactDOM.render(<JumpToDoc database={database} allDocs={allDocs} />, $(el)[0]);
-    }
-  };
-});
+export default {
+  JumpToDoc,
+  render: (el, database, allDocs) => {
+    ReactDOM.render(<JumpToDoc database={database} allDocs={allDocs} />, $(el)[0]);
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 56c5726..28cfd87 100644
--- a/app/addons/documents/mango/mango.actions.js
+++ b/app/addons/documents/mango/mango.actions.js
@@ -10,115 +10,111 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  '../resources',
-  './mango.actiontypes',
-  './mango.stores',
-  '../index-results/stores',
-  '../index-results/actions',
-],
-function (app, FauxtonAPI, Documents, ActionTypes, Stores, IndexResultsStores, IndexResultActions) {
-  var store = Stores.mangoStore;
-
-  return {
-
-    setDatabase: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_SET_DB,
-        options: options
-      });
-    },
-
-    newQueryFindCode: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE,
-        options: options
-      });
-    },
-
-    newQueryCreateIndexCode: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_NEW_QUERY_CREATE_INDEX_CODE,
-        options: options
-      });
-    },
-
-    saveQuery: function (options) {
-      var queryCode = JSON.parse(options.queryCode),
-          mangoIndex = new Documents.MangoIndex(queryCode, {database: options.database});
-
-      FauxtonAPI.addNotification({
-        msg:  'Saving Index for Query...',
-        type: 'info',
-        clear: true
-      });
-
-      mangoIndex
-        .save()
-        .then(function (res) {
-          var url = '#' + FauxtonAPI.urls('mango', 'query-app', options.database.safeID());
-
-          FauxtonAPI.dispatch({
-            type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
-            options: {
-              fields: queryCode.index.fields
-            }
-          });
-
-          var mangoIndexCollection = new Documents.MangoIndexCollection(null, {
-            database: options.database,
-            params: null,
-            paging: {
-              pageSize: IndexResultsStores.indexResultsStore.getPerPage()
-            }
-          });
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import Documents from "../resources";
+import ActionTypes from "./mango.actiontypes";
+import Stores from "./mango.stores";
+import IndexResultsStores from "../index-results/stores";
+import IndexResultActions from "../index-results/actions";
+var store = Stores.mangoStore;
+
+export default {
+
+  setDatabase: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_SET_DB,
+      options: options
+    });
+  },
+
+  newQueryFindCode: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE,
+      options: options
+    });
+  },
+
+  newQueryCreateIndexCode: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_NEW_QUERY_CREATE_INDEX_CODE,
+      options: options
+    });
+  },
+
+  saveQuery: function (options) {
+    var queryCode = JSON.parse(options.queryCode),
+        mangoIndex = new Documents.MangoIndex(queryCode, {database: options.database});
+
+    FauxtonAPI.addNotification({
+      msg:  'Saving Index for Query...',
+      type: 'info',
+      clear: true
+    });
+
+    mangoIndex
+      .save()
+      .then(function (res) {
+        var url = '#' + FauxtonAPI.urls('mango', 'query-app', options.database.safeID());
+
+        FauxtonAPI.dispatch({
+          type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
+          options: {
+            fields: queryCode.index.fields
+          }
+        });
 
-          this.getIndexList({indexList: mangoIndexCollection}).then(function () {
+        var mangoIndexCollection = new Documents.MangoIndexCollection(null, {
+          database: options.database,
+          params: null,
+          paging: {
+            pageSize: IndexResultsStores.indexResultsStore.getPerPage()
+          }
+        });
 
-            IndexResultActions.reloadResultsList();
+        this.getIndexList({indexList: mangoIndexCollection}).then(function () {
 
-            FauxtonAPI.addNotification({
-              msg: 'Index is ready for querying. <a href="' + url + '">Run a Query.</a>',
-              type: 'success',
-              clear: true,
-              escape: false
-            });
-          }.bind(this));
+          IndexResultActions.reloadResultsList();
 
-        }.bind(this))
-        .fail(function (res) {
           FauxtonAPI.addNotification({
-            msg: res.responseJSON.reason,
-            type: 'error',
-            clear: true
+            msg: 'Index is ready for querying. <a href="' + url + '">Run a Query.</a>',
+            type: 'success',
+            clear: true,
+            escape: false
           });
-        });
-    },
+        }.bind(this));
 
-    mangoResetIndexList: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_RESET,
-        options: options
-      });
-    },
-
-    getIndexList: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_NEW_AVAILABLE_INDEXES,
-        options: options
-      });
-
-      return options.indexList.fetch({reset: true}).then(function () {
-        this.mangoResetIndexList({isLoading: false});
-      }.bind(this), function () {
+      }.bind(this))
+      .fail(function (res) {
         FauxtonAPI.addNotification({
-          msg: 'Bad request!',
-          type: "error",
-          clear:  true
-       });
+          msg: res.responseJSON.reason,
+          type: 'error',
+          clear: true
+        });
       });
-    }
-  };
-});
+  },
+
+  mangoResetIndexList: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_RESET,
+      options: options
+    });
+  },
+
+  getIndexList: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_NEW_AVAILABLE_INDEXES,
+      options: options
+    });
+
+    return options.indexList.fetch({reset: true}).then(function () {
+      this.mangoResetIndexList({isLoading: false});
+    }.bind(this), function () {
+      FauxtonAPI.addNotification({
+        msg: 'Bad request!',
+        type: "error",
+        clear:  true
+     });
+    });
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/mango/mango.actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/mango.actiontypes.js b/app/addons/documents/mango/mango.actiontypes.js
index b6bdbcc..2e3014d 100644
--- a/app/addons/documents/mango/mango.actiontypes.js
+++ b/app/addons/documents/mango/mango.actiontypes.js
@@ -10,13 +10,11 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    MANGO_SET_DB: 'MANGO_SET_DB',
-    MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS: 'MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS',
-    MANGO_NEW_QUERY_FIND_CODE: 'MANGO_NEW_QUERY_FIND_CODE',
-    MANGO_NEW_QUERY_CREATE_INDEX_CODE: 'MANGO_NEW_QUERY_CREATE_INDEX_CODE',
-    MANGO_NEW_AVAILABLE_INDEXES: 'MANGO_NEW_AVAILABLE_INDEXES',
-    MANGO_RESET: 'MANGO_RESET'
-  };
-});
+export default {
+  MANGO_SET_DB: 'MANGO_SET_DB',
+  MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS: 'MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS',
+  MANGO_NEW_QUERY_FIND_CODE: 'MANGO_NEW_QUERY_FIND_CODE',
+  MANGO_NEW_QUERY_CREATE_INDEX_CODE: 'MANGO_NEW_QUERY_CREATE_INDEX_CODE',
+  MANGO_NEW_AVAILABLE_INDEXES: 'MANGO_NEW_AVAILABLE_INDEXES',
+  MANGO_RESET: 'MANGO_RESET'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 e88a05b..113a7f9 100644
--- a/app/addons/documents/mango/mango.components.react.jsx
+++ b/app/addons/documents/mango/mango.components.react.jsx
@@ -10,283 +10,276 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  './mango.stores',
-  './mango.actions',
-  '../../components/react-components.react',
-  '../index-results/actions',
-  './mango.helper',
-
-  '../../../../assets/js/plugins/prettify'
-],
-
-function (app, FauxtonAPI, React, Stores, Actions,
-          ReactComponents, IndexResultActions, MangoHelper) {
-
-  var mangoStore = Stores.mangoStore;
-  var getDocUrl = app.helpers.getDocUrl;
-
-  var PaddedBorderedBox = ReactComponents.PaddedBorderedBox;
-  var CodeEditorPanel = ReactComponents.CodeEditorPanel;
-  var ConfirmButton = ReactComponents.ConfirmButton;
-
-  var MangoQueryEditorController = React.createClass({
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        queryCode: mangoStore.getQueryFindCode(),
-        database: mangoStore.getDatabase(),
-        changedQuery: mangoStore.getQueryFindCodeChanged(),
-        availableIndexes: mangoStore.getAvailableQueryIndexes(),
-        additionalIndexes: mangoStore.getAvailableAdditionalIndexes(),
-        isLoading: mangoStore.getLoadingIndexes()
-      };
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    componentDidUpdate: function () {
-      prettyPrint();
-    },
-
-    componentDidMount: function () {
-      prettyPrint();
-      mangoStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      mangoStore.off('change', this.onChange);
-    },
-
-    getMangoEditor: function () {
-      return this.refs.mangoEditor;
-    },
-
-    render: function () {
-      var loadLines;
-      if (this.state.isLoading) {
-        return (
-          <div className="mango-editor-wrapper">
-            <ReactComponents.LoadLines />
-          </div>
-        );
-      }
-
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import Stores from "./mango.stores";
+import Actions from "./mango.actions";
+import ReactComponents from "../../components/react-components.react";
+import IndexResultActions from "../index-results/actions";
+import MangoHelper from "./mango.helper";
+import "../../../../assets/js/plugins/prettify";
+
+var mangoStore = Stores.mangoStore;
+var getDocUrl = app.helpers.getDocUrl;
+
+var PaddedBorderedBox = ReactComponents.PaddedBorderedBox;
+var CodeEditorPanel = ReactComponents.CodeEditorPanel;
+var ConfirmButton = ReactComponents.ConfirmButton;
+
+var MangoQueryEditorController = React.createClass({
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      queryCode: mangoStore.getQueryFindCode(),
+      database: mangoStore.getDatabase(),
+      changedQuery: mangoStore.getQueryFindCodeChanged(),
+      availableIndexes: mangoStore.getAvailableQueryIndexes(),
+      additionalIndexes: mangoStore.getAvailableAdditionalIndexes(),
+      isLoading: mangoStore.getLoadingIndexes()
+    };
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidUpdate: function () {
+    prettyPrint();
+  },
+
+  componentDidMount: function () {
+    prettyPrint();
+    mangoStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    mangoStore.off('change', this.onChange);
+  },
+
+  getMangoEditor: function () {
+    return this.refs.mangoEditor;
+  },
+
+  render: function () {
+    var loadLines;
+    if (this.state.isLoading) {
       return (
-        <MangoEditor
-          ref="mangoEditor"
-          description={this.props.description}
-          dbName={this.state.database.id}
-          onSubmit={this.runQuery}
-          title={this.props.editorTitle}
-          additionalIndexesText={this.props.additionalIndexesText}
-          docs={getDocUrl('MANGO_SEARCH')}
-          exampleCode={this.state.queryCode}
-          changedQuery={this.state.changedQuery}
-          availableIndexes={this.state.availableIndexes}
-          additionalIndexes={this.state.additionalIndexes}
-          confirmbuttonText="Run Query" />
+        <div className="mango-editor-wrapper">
+          <ReactComponents.LoadLines />
+        </div>
       );
-    },
-
-    runQuery: function (event) {
-      event.preventDefault();
-
-      if (this.getMangoEditor().hasErrors()) {
-        FauxtonAPI.addNotification({
-          msg:  'Please fix the Javascript errors and try again.',
-          type: 'error',
-          clear: true
-        });
-        return;
-      }
-
-      IndexResultActions.runMangoFindQuery({
-        database: this.state.database,
-        queryCode: this.getMangoEditor().getEditorValue(),
+    }
 
+    return (
+      <MangoEditor
+        ref="mangoEditor"
+        description={this.props.description}
+        dbName={this.state.database.id}
+        onSubmit={this.runQuery}
+        title={this.props.editorTitle}
+        additionalIndexesText={this.props.additionalIndexesText}
+        docs={getDocUrl('MANGO_SEARCH')}
+        exampleCode={this.state.queryCode}
+        changedQuery={this.state.changedQuery}
+        availableIndexes={this.state.availableIndexes}
+        additionalIndexes={this.state.additionalIndexes}
+        confirmbuttonText="Run Query" />
+    );
+  },
+
+  runQuery: function (event) {
+    event.preventDefault();
+
+    if (this.getMangoEditor().hasErrors()) {
+      FauxtonAPI.addNotification({
+        msg:  'Please fix the Javascript errors and try again.',
+        type: 'error',
+        clear: true
       });
+      return;
     }
-  });
-
-  var MangoEditor = React.createClass({
-    getDefaultProps: function () {
-      return {
-        changedQuery: null,
-        availableIndexes: null,
-        additionalIndexes: null
-      };
-    },
-
-    render: function () {
-      var url = '#/' + FauxtonAPI.urls('allDocs', 'app', this.props.dbName, '');
 
-      return (
-        <div className="mango-editor-wrapper">
-          <PaddedBorderedBox>
-            <div
-              dangerouslySetInnerHTML={{__html: this.props.description}}
-              className="editor-description">
-            </div>
-          </PaddedBorderedBox>
-          <PaddedBorderedBox>
-            <strong>Database</strong>
-            <div className="db-title">
-              <a href={url}>{this.props.dbName}</a>
-            </div>
-          </PaddedBorderedBox>
-          <form className="form-horizontal" onSubmit={this.props.onSubmit}>
-            <PaddedBorderedBox>
-              <CodeEditorPanel
-                id="query-field"
-                ref="field"
-                title={this.props.title}
-                docLink={this.props.docs}
-                defaultCode={this.props.exampleCode} />
-              {this.getChangedQueryText()}
-            </PaddedBorderedBox>
-            {this.getIndexBox()}
-            <div className="padded-box">
-              <div className="control-group">
-                <ConfirmButton text={this.props.confirmbuttonText} id="create-index-btn" showIcon={false} />
-              </div>
-            </div>
-          </form>
-        </div>
-      );
-    },
+    IndexResultActions.runMangoFindQuery({
+      database: this.state.database,
+      queryCode: this.getMangoEditor().getEditorValue(),
 
-    getChangedQueryText: function () {
-      if (!this.props.changedQuery) {
-        return null;
-      }
+    });
+  }
+});
 
-      return (
-        <div className="info-changed-query">
-          <strong>Info:</strong>
-          <div>We changed the default query based on the last Index you created.</div>
-        </div>
-      );
-    },
+var MangoEditor = React.createClass({
+  getDefaultProps: function () {
+    return {
+      changedQuery: null,
+      availableIndexes: null,
+      additionalIndexes: null
+    };
+  },
 
-    getIndexBox: function () {
-      if (!this.props.availableIndexes) {
-        return null;
-      }
+  render: function () {
+    var url = '#/' + FauxtonAPI.urls('allDocs', 'app', this.props.dbName, '');
 
-      return (
+    return (
+      <div className="mango-editor-wrapper">
         <PaddedBorderedBox>
-          <strong>Your available Indexes:</strong>
-          <a className="edit-link" href={'#' + FauxtonAPI.urls('mango', 'index-app', this.props.dbName)}>edit</a>
-          <pre
-            className="mango-available-indexes">
-            {this.getIndexes('index', this.props.availableIndexes)}
-            {this.getIndexes('additonal', this.props.additionalIndexes)}
-          </pre>
+          <div
+            dangerouslySetInnerHTML={{__html: this.props.description}}
+            className="editor-description">
+          </div>
         </PaddedBorderedBox>
-      );
-    },
-
-    getIndexes: function (prefix, indexes) {
-      if (!indexes) {
-        return;
-      }
-
-      return indexes.map(function (index, i) {
-        var name = MangoHelper.getIndexName(index);
-
-        return (
-          <div key={prefix + i}>{name}</div>
-        );
-      });
-    },
-
-    getEditorValue: function () {
-      return this.refs.field.getValue();
-    },
-
-    getEditor: function () {
-      return this.refs.field.getEditor();
-    },
+        <PaddedBorderedBox>
+          <strong>Database</strong>
+          <div className="db-title">
+            <a href={url}>{this.props.dbName}</a>
+          </div>
+        </PaddedBorderedBox>
+        <form className="form-horizontal" onSubmit={this.props.onSubmit}>
+          <PaddedBorderedBox>
+            <CodeEditorPanel
+              id="query-field"
+              ref="field"
+              title={this.props.title}
+              docLink={this.props.docs}
+              defaultCode={this.props.exampleCode} />
+            {this.getChangedQueryText()}
+          </PaddedBorderedBox>
+          {this.getIndexBox()}
+          <div className="padded-box">
+            <div className="control-group">
+              <ConfirmButton text={this.props.confirmbuttonText} id="create-index-btn" showIcon={false} />
+            </div>
+          </div>
+        </form>
+      </div>
+    );
+  },
+
+  getChangedQueryText: function () {
+    if (!this.props.changedQuery) {
+      return null;
+    }
 
-    hasErrors: function () {
-      return this.getEditor().hasErrors();
+    return (
+      <div className="info-changed-query">
+        <strong>Info:</strong>
+        <div>We changed the default query based on the last Index you created.</div>
+      </div>
+    );
+  },
+
+  getIndexBox: function () {
+    if (!this.props.availableIndexes) {
+      return null;
     }
-  });
 
-  var MangoIndexEditorController = React.createClass({
-    getInitialState: function () {
-      return this.getStoreState();
-    },
+    return (
+      <PaddedBorderedBox>
+        <strong>Your available Indexes:</strong>
+        <a className="edit-link" href={'#' + FauxtonAPI.urls('mango', 'index-app', this.props.dbName)}>edit</a>
+        <pre
+          className="mango-available-indexes">
+          {this.getIndexes('index', this.props.availableIndexes)}
+          {this.getIndexes('additonal', this.props.additionalIndexes)}
+        </pre>
+      </PaddedBorderedBox>
+    );
+  },
+
+  getIndexes: function (prefix, indexes) {
+    if (!indexes) {
+      return;
+    }
 
-    getStoreState: function () {
-      return {
-        queryIndexCode: mangoStore.getQueryIndexCode(),
-        database: mangoStore.getDatabase(),
-      };
-    },
+    return indexes.map(function (index, i) {
+      var name = MangoHelper.getIndexName(index);
 
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
+      return (
+        <div key={prefix + i}>{name}</div>
+      );
+    });
+  },
 
-    componentDidMount: function () {
-      mangoStore.on('change', this.onChange, this);
-    },
+  getEditorValue: function () {
+    return this.refs.field.getValue();
+  },
 
-    componentWillUnmount: function () {
-      mangoStore.off('change', this.onChange);
-    },
+  getEditor: function () {
+    return this.refs.field.getEditor();
+  },
 
-    getMangoEditor: function () {
-      return this.refs.mangoEditor;
-    },
+  hasErrors: function () {
+    return this.getEditor().hasErrors();
+  }
+});
 
-    render: function () {
-      return (
-        <MangoEditor
-          ref="mangoEditor"
-          description={this.props.description}
-          dbName={this.state.database.id}
-          onSubmit={this.saveQuery}
-          title="Index"
-          docs={getDocUrl('MANGO_INDEX')}
-          exampleCode={this.state.queryIndexCode}
-          confirmbuttonText="Create Index" />
-      );
-    },
-
-    saveQuery: function (event) {
-      event.preventDefault();
-
-      if (this.getMangoEditor().hasErrors()) {
-        FauxtonAPI.addNotification({
-          msg:  'Please fix the Javascript errors and try again.',
-          type: 'error',
-          clear: true
-        });
-        return;
-      }
-
-      Actions.saveQuery({
-        database: this.state.database,
-        queryCode: this.getMangoEditor().getEditorValue()
+var MangoIndexEditorController = React.createClass({
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      queryIndexCode: mangoStore.getQueryIndexCode(),
+      database: mangoStore.getDatabase(),
+    };
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidMount: function () {
+    mangoStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    mangoStore.off('change', this.onChange);
+  },
+
+  getMangoEditor: function () {
+    return this.refs.mangoEditor;
+  },
+
+  render: function () {
+    return (
+      <MangoEditor
+        ref="mangoEditor"
+        description={this.props.description}
+        dbName={this.state.database.id}
+        onSubmit={this.saveQuery}
+        title="Index"
+        docs={getDocUrl('MANGO_INDEX')}
+        exampleCode={this.state.queryIndexCode}
+        confirmbuttonText="Create Index" />
+    );
+  },
+
+  saveQuery: function (event) {
+    event.preventDefault();
+
+    if (this.getMangoEditor().hasErrors()) {
+      FauxtonAPI.addNotification({
+        msg:  'Please fix the Javascript errors and try again.',
+        type: 'error',
+        clear: true
       });
+      return;
     }
-  });
 
-  var Views = {
-    MangoIndexEditorController: MangoIndexEditorController,
-    MangoQueryEditorController: MangoQueryEditorController
-  };
-
-  return Views;
+    Actions.saveQuery({
+      database: this.state.database,
+      queryCode: this.getMangoEditor().getEditorValue()
+    });
+  }
 });
+
+var Views = {
+  MangoIndexEditorController: MangoIndexEditorController,
+  MangoQueryEditorController: MangoQueryEditorController
+};
+
+export default Views;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/mango/mango.helper.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/mango.helper.js b/app/addons/documents/mango/mango.helper.js
index 5ed0807..4634adb 100644
--- a/app/addons/documents/mango/mango.helper.js
+++ b/app/addons/documents/mango/mango.helper.js
@@ -10,34 +10,30 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api'
-], function (FauxtonAPI) {
+import FauxtonAPI from "../../../core/api";
 
-  function getIndexName (doc) {
-    var nameArray = [],
-        indexes;
+function getIndexName (doc) {
+  var nameArray = [],
+      indexes;
 
-    nameArray = doc.get('def').fields.reduce(function (acc, el, i) {
-      if (i === 0) {
-        acc.push(doc.get('type') + ': ' + Object.keys(el)[0]);
-      } else {
-        acc.push(Object.keys(el)[0]);
-      }
-
-      return acc;
-    }, []);
-
-    if (!nameArray.length) {
-      indexes = FauxtonAPI.getExtensions('mango:additionalIndexes')[0];
-      nameArray = indexes.createHeader(doc);
+  nameArray = doc.get('def').fields.reduce(function (acc, el, i) {
+    if (i === 0) {
+      acc.push(doc.get('type') + ': ' + Object.keys(el)[0]);
+    } else {
+      acc.push(Object.keys(el)[0]);
     }
 
-    return nameArray.join(', ');
+    return acc;
+  }, []);
+
+  if (!nameArray.length) {
+    indexes = FauxtonAPI.getExtensions('mango:additionalIndexes')[0];
+    nameArray = indexes.createHeader(doc);
   }
 
-  return {
-    getIndexName: getIndexName
-  };
+  return nameArray.join(', ');
+}
 
-});
+export default {
+  getIndexName: getIndexName
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/mango/mango.stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/mango.stores.js b/app/addons/documents/mango/mango.stores.js
index 42c4966..7836798 100644
--- a/app/addons/documents/mango/mango.stores.js
+++ b/app/addons/documents/mango/mango.stores.js
@@ -10,157 +10,151 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  './mango.actiontypes'
-],
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./mango.actiontypes";
+
+
+var defaultQueryIndexCode = {
+  "index": {
+    "fields": ["_id"]
+  },
+  "type" : "json"
+};
+
+var defaultQueryFindCode = {
+  "selector": {
+    "_id": {"$gt": null}
+  }
+};
+
+var Stores = {};
+
+Stores.MangoStore = FauxtonAPI.Store.extend({
+
+  initialize: function () {
+    this._queryFindCode = defaultQueryFindCode;
+    this._queryIndexCode = defaultQueryIndexCode;
+    this._queryFindCodeChanged = false;
+    this._availableIndexes = [];
+    this._getLoadingIndexes = true;
+  },
+
+  getQueryIndexCode: function () {
+    return this.formatCode(this._queryIndexCode);
+  },
+
+  setQueryIndexCode: function (options) {
+    this._queryIndexCode = options.code;
+  },
+
+  getQueryFindCode: function () {
+    return this.formatCode(this._queryFindCode);
+  },
+
+  setQueryFindCode: function (options) {
+    this._queryFindCode = options.code;
+  },
+
+  getLoadingIndexes: function () {
+    return this._getLoadingIndexes;
+  },
+
+  setLoadingIndexes: function (options) {
+    this._getLoadingIndexes = options.isLoading;
+  },
+
+  formatCode: function (code) {
+    return JSON.stringify(code, null, '  ');
+  },
+
+  newQueryFindCodeFromFields: function (options) {
+    var fields = options.fields,
+        queryCode = JSON.parse(JSON.stringify(this._queryFindCode)),
+        selectorContent;
+
+    if (!fields) {
+      return;
+    }
+
+    selectorContent = fields.reduce(function (acc, field) {
+      acc[field] = {"$gt": null};
+      return acc;
+    }, {});
+
+    queryCode.selector = selectorContent;
+    this._queryFindCode = queryCode;
+    this._queryFindCodeChanged = true;
+  },
+
+  getQueryFindCodeChanged: function () {
+    return this._queryFindCodeChanged;
+  },
+
+  setDatabase: function (options) {
+    this._database = options.database;
+  },
 
-function (FauxtonAPI, ActionTypes) {
+  getDatabase: function () {
+    return this._database;
+  },
 
+  setAvailableIndexes: function (options) {
+    this._availableIndexes = options.indexList;
+  },
 
-  var defaultQueryIndexCode = {
-    "index": {
-      "fields": ["_id"]
-    },
-    "type" : "json"
-  };
+  getAvailableQueryIndexes: function () {
+    return this._availableIndexes.filter(function (el) {
+      return ['json', 'special'].indexOf(el.get('type')) !== -1;
+    });
+  },
 
-  var defaultQueryFindCode = {
-    "selector": {
-      "_id": {"$gt": null}
+  getAvailableAdditionalIndexes: function () {
+    var indexes = FauxtonAPI.getExtensions('mango:additionalIndexes')[0];
+
+    if (!indexes) {
+      return;
     }
-  };
 
-  var Stores = {};
-
-  Stores.MangoStore = FauxtonAPI.Store.extend({
+    return this._availableIndexes.filter(function (el) {
+      return el.get('type').indexOf(indexes.type) !== -1;
+    });
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
 
-    initialize: function () {
-      this._queryFindCode = defaultQueryFindCode;
-      this._queryIndexCode = defaultQueryIndexCode;
-      this._queryFindCodeChanged = false;
-      this._availableIndexes = [];
-      this._getLoadingIndexes = true;
-    },
+      case ActionTypes.MANGO_SET_DB:
+        this.setDatabase(action.options);
+      break;
 
-    getQueryIndexCode: function () {
-      return this.formatCode(this._queryIndexCode);
-    },
+      case ActionTypes.MANGO_NEW_QUERY_CREATE_INDEX_CODE:
+        this.setQueryIndexCode(action.options);
+      break;
 
-    setQueryIndexCode: function (options) {
-      this._queryIndexCode = options.code;
-    },
-
-    getQueryFindCode: function () {
-      return this.formatCode(this._queryFindCode);
-    },
-
-    setQueryFindCode: function (options) {
-      this._queryFindCode = options.code;
-    },
-
-    getLoadingIndexes: function () {
-      return this._getLoadingIndexes;
-    },
-
-    setLoadingIndexes: function (options) {
-      this._getLoadingIndexes = options.isLoading;
-    },
-
-    formatCode: function (code) {
-      return JSON.stringify(code, null, '  ');
-    },
-
-    newQueryFindCodeFromFields: function (options) {
-      var fields = options.fields,
-          queryCode = JSON.parse(JSON.stringify(this._queryFindCode)),
-          selectorContent;
-
-      if (!fields) {
-        return;
-      }
-
-      selectorContent = fields.reduce(function (acc, field) {
-        acc[field] = {"$gt": null};
-        return acc;
-      }, {});
-
-      queryCode.selector = selectorContent;
-      this._queryFindCode = queryCode;
-      this._queryFindCodeChanged = true;
-    },
-
-    getQueryFindCodeChanged: function () {
-      return this._queryFindCodeChanged;
-    },
-
-    setDatabase: function (options) {
-      this._database = options.database;
-    },
-
-    getDatabase: function () {
-      return this._database;
-    },
-
-    setAvailableIndexes: function (options) {
-      this._availableIndexes = options.indexList;
-    },
-
-    getAvailableQueryIndexes: function () {
-      return this._availableIndexes.filter(function (el) {
-        return ['json', 'special'].indexOf(el.get('type')) !== -1;
-      });
-    },
-
-    getAvailableAdditionalIndexes: function () {
-      var indexes = FauxtonAPI.getExtensions('mango:additionalIndexes')[0];
-
-      if (!indexes) {
-        return;
-      }
-
-      return this._availableIndexes.filter(function (el) {
-        return el.get('type').indexOf(indexes.type) !== -1;
-      });
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-
-        case ActionTypes.MANGO_SET_DB:
-          this.setDatabase(action.options);
-        break;
+      case ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS:
+        this.newQueryFindCodeFromFields(action.options);
+      break;
 
-        case ActionTypes.MANGO_NEW_QUERY_CREATE_INDEX_CODE:
-          this.setQueryIndexCode(action.options);
-        break;
-
-        case ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS:
-          this.newQueryFindCodeFromFields(action.options);
-        break;
-
-        case ActionTypes.MANGO_NEW_QUERY_FIND_CODE:
-          this.setQueryFindCode(action.options);
-        break;
+      case ActionTypes.MANGO_NEW_QUERY_FIND_CODE:
+        this.setQueryFindCode(action.options);
+      break;
 
-        case ActionTypes.MANGO_NEW_AVAILABLE_INDEXES:
-          this.setAvailableIndexes(action.options);
-        break;
+      case ActionTypes.MANGO_NEW_AVAILABLE_INDEXES:
+        this.setAvailableIndexes(action.options);
+      break;
 
-        case ActionTypes.MANGO_RESET:
-          this.setLoadingIndexes(action.options);
-        break;
-      }
-
-      this.triggerChange();
+      case ActionTypes.MANGO_RESET:
+        this.setLoadingIndexes(action.options);
+      break;
     }
 
-  });
+    this.triggerChange();
+  }
 
-  Stores.mangoStore = new Stores.MangoStore();
+});
 
-  Stores.mangoStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.mangoStore.dispatch);
+Stores.mangoStore = new Stores.MangoStore();
 
-  return Stores;
+Stores.mangoStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.mangoStore.dispatch);
 
-});
+export default Stores;


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

Posted by ga...@apache.org.
convert all files to use import


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

Branch: refs/heads/master
Commit: 0ca35da7c9d5479493d118048f9ccaed31d8a0b5
Parents: 2f22a89
Author: Garren Smith <ga...@gmail.com>
Authored: Mon May 30 15:40:56 2016 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue May 31 09:57:32 2016 +0200

----------------------------------------------------------------------
 .babelrc                                        |    3 +-
 .eslintrc                                       |    3 +-
 app/addons/activetasks/actions.js               |  119 +-
 app/addons/activetasks/actiontypes.js           |   20 +-
 app/addons/activetasks/base.js                  |   21 +-
 app/addons/activetasks/components.react.jsx     | 1036 ++++---
 app/addons/activetasks/resources.js             |   59 +-
 app/addons/activetasks/routes.js                |   69 +-
 app/addons/activetasks/stores.js                |  405 ++-
 .../tests/activetasks.componentsSpec.react.jsx  |  191 +-
 .../activetasks/tests/activetasks.storesSpec.js |  273 +-
 .../activetasks/tests/fakeActiveTaskResponse.js |  218 +-
 app/addons/auth/actions.js                      |  201 +-
 app/addons/auth/actiontypes.js                  |   20 +-
 app/addons/auth/base.js                         |  193 +-
 app/addons/auth/components.react.jsx            |  577 ++--
 app/addons/auth/resources.js                    |  321 +-
 app/addons/auth/routes.js                       |  177 +-
 app/addons/auth/stores.js                       |  284 +-
 .../auth/test/auth.componentsSpec.react.jsx     |  252 +-
 app/addons/auth/test/auth.storesSpec.js         |  208 +-
 app/addons/auth/test/baseSpec.js                |  143 +-
 app/addons/cluster/base.js                      |   15 +-
 app/addons/cluster/cluster.actions.js           |   65 +-
 app/addons/cluster/cluster.actiontypes.js       |    8 +-
 app/addons/cluster/cluster.react.jsx            |  100 +-
 app/addons/cluster/cluster.stores.js            |   65 +-
 app/addons/cluster/resources.js                 |   58 +-
 app/addons/cluster/routes.js                    |   57 +-
 app/addons/cluster/tests/clusterSpec.react.jsx  |   85 +-
 app/addons/cluster/tests/resourcesSpec.js       |   89 +-
 app/addons/components/actions.js                |  115 +-
 app/addons/components/actiontypes.js            |   18 +-
 app/addons/components/base.js                   |   13 +-
 .../components/react-components.react.jsx       | 2901 +++++++++---------
 app/addons/components/stores.js                 |  208 +-
 .../tests/apiBarControllerSpec.react.jsx        |  283 +-
 .../components/tests/badgesSpec.react.jsx       |   69 +-
 .../components/tests/beautifySpec.react.jsx     |   91 +-
 .../tests/codeEditorPanelSpec.react.jsx         |  122 +-
 .../components/tests/codeEditorSpec.react.jsx   |  167 +-
 .../tests/confirmButtonSpec.react.jsx           |   95 +-
 .../tests/deleteDatabaseModalSpec.react.jsx     |  100 +-
 app/addons/components/tests/docSpec.react.jsx   |  316 +-
 .../tests/headerTogglebuttonSpec.react.jsx      |   47 +-
 .../tests/paddedBorderedBoxSpec.react.jsx       |   51 +-
 .../tests/stringEditModalSpec.react.jsx         |   63 +-
 .../components/tests/styledSelectSpec.react.jsx |   87 +-
 .../components/tests/zenModeSpec.react.jsx      |   85 +-
 app/addons/config/base.js                       |   34 +-
 app/addons/config/resources.js                  |  164 +-
 app/addons/config/routes.js                     |  169 +-
 app/addons/config/tests/configSpec.js           |  233 +-
 app/addons/config/views.js                      |  466 ++-
 app/addons/cors/actions.js                      |  342 +--
 app/addons/cors/actiontypes.js                  |   26 +-
 app/addons/cors/base.js                         |   17 +-
 app/addons/cors/components.react.jsx            |  641 ++--
 app/addons/cors/resources.js                    |  147 +-
 app/addons/cors/stores.js                       |  347 ++-
 app/addons/cors/tests/actionsSpecs.js           |  156 +-
 app/addons/cors/tests/componentsSpec.react.jsx  |  380 ++-
 app/addons/cors/tests/resourcesSpec.js          |  105 +-
 app/addons/cors/tests/storesSpec.js             |  118 +-
 app/addons/databases/actions.js                 |  205 +-
 app/addons/databases/actiontypes.js             |   16 +-
 app/addons/databases/base.js                    |  113 +-
 app/addons/databases/components.react.jsx       |  716 +++--
 app/addons/databases/resources.js               |  392 ++-
 app/addons/databases/routes.js                  |   87 +-
 app/addons/databases/stores.js                  |  221 +-
 app/addons/databases/tests/actionsSpec.js       |  436 ++-
 .../databases/tests/componentsSpec.react.jsx    |  556 ++--
 .../tests/nightwatch/checkDatabaseTooltip.js    |   12 +
 .../tests/nightwatch/createsDatabase.js         |   12 +
 .../tests/nightwatch/deletesDatabase.js         |   12 +
 .../nightwatch/deletesDatabaseSpecialChars.js   |   12 +
 .../tests/nightwatch/switchDatabase.js          |   12 +
 .../databases/tests/nightwatch/zeroclipboard.js |   12 +
 app/addons/databases/tests/resourcesSpec.js     |   81 +-
 app/addons/databases/tests/storesSpec.js        |   88 +-
 app/addons/documentation/base.js                |   35 +-
 app/addons/documentation/components.react.jsx   |  100 +-
 app/addons/documentation/resources.js           |    7 +-
 app/addons/documentation/routes.js              |   45 +-
 app/addons/documentation/stores.js              |  138 +-
 .../tests/nightwatch/checksDocsPage.js          |   12 +
 app/addons/documents/base.js                    |  315 +-
 app/addons/documents/changes/actions.js         |  161 +-
 app/addons/documents/changes/actiontypes.js     |   22 +-
 .../documents/changes/components.react.jsx      |  815 +++--
 app/addons/documents/changes/stores.js          |  335 +-
 .../tests/changes.componentsSpec.react.jsx      |  544 ++--
 .../changes/tests/changes.storesSpec.js         |  142 +-
 app/addons/documents/designdocinfo/actions.js   |   76 +-
 .../documents/designdocinfo/actiontypes.js      |   12 +-
 .../designdocinfo/components.react.jsx          |  272 +-
 app/addons/documents/designdocinfo/stores.js    |  133 +-
 .../designdocinfo/tests/actionsSpec.js          |   55 +-
 app/addons/documents/doc-editor/actions.js      |  419 ++-
 app/addons/documents/doc-editor/actiontypes.js  |   36 +-
 .../documents/doc-editor/components.react.jsx   |  824 +++--
 app/addons/documents/doc-editor/stores.js       |  383 ++-
 .../tests/doc-editor.componentsSpec.react.jsx   |  372 ++-
 .../doc-editor/tests/doc-editor.storesSpec.js   |  113 +-
 app/addons/documents/header/header.actions.js   |   63 +-
 .../documents/header/header.actiontypes.js      |    8 +-
 app/addons/documents/header/header.react.jsx    |  187 +-
 app/addons/documents/helpers.js                 |  189 +-
 app/addons/documents/index-editor/actions.js    |  499 ++-
 .../documents/index-editor/actiontypes.js       |   32 +-
 .../documents/index-editor/components.react.jsx |  710 +++--
 app/addons/documents/index-editor/stores.js     |  488 ++-
 .../documents/index-editor/tests/actionsSpec.js |  230 +-
 .../documents/index-editor/tests/storesSpec.js  |  485 ++-
 .../tests/viewIndex.componentsSpec.react.jsx    |  465 ++-
 app/addons/documents/index-results/actions.js   |  346 ++-
 .../documents/index-results/actiontypes.js      |   22 +-
 .../index-results.components.react.jsx          |  882 +++---
 app/addons/documents/index-results/stores.js    | 1304 ++++----
 .../tests/index-results.actionsSpec.js          |  172 +-
 .../index-results.componentsSpec.react.jsx      |  491 ++-
 .../tests/index-results.storesSpec.js           | 1105 ++++---
 app/addons/documents/jumptodoc.react.jsx        |   81 +-
 app/addons/documents/mango/mango.actions.js     |  202 +-
 app/addons/documents/mango/mango.actiontypes.js |   18 +-
 .../documents/mango/mango.components.react.jsx  |  503 ++-
 app/addons/documents/mango/mango.helper.js      |   44 +-
 app/addons/documents/mango/mango.stores.js      |  266 +-
 .../mango/tests/mango.componentsSpec.react.jsx  |  339 +-
 .../documents/mango/tests/mango.storesSpec.js   |  146 +-
 app/addons/documents/pagination/actions.js      |  126 +-
 app/addons/documents/pagination/actiontypes.js  |   16 +-
 .../documents/pagination/pagination.react.jsx   |  502 ++-
 .../tests/pagination.componentSpec.react.jsx    |  171 +-
 app/addons/documents/queryoptions/actions.js    |  193 +-
 .../documents/queryoptions/actiontypes.js       |   32 +-
 .../queryoptions/queryoptions.react.jsx         |  773 +++--
 app/addons/documents/queryoptions/stores.js     |  488 ++-
 .../tests/queryoptions.componentsSpec.react.jsx |  319 +-
 .../tests/queryoptions.storesSpec.js            |  173 +-
 app/addons/documents/resources.js               |  933 +++---
 .../rev-browser/rev-browser.actions.js          |  299 +-
 .../rev-browser/rev-browser.actiontypes.js      |   14 +-
 .../rev-browser.components.react.jsx            |  694 ++---
 .../documents/rev-browser/rev-browser.stores.js |  161 +-
 .../documents/rev-browser/tests/fixtures.js     |  109 +-
 .../tests/rev-browser.actionsSpec.js            |  124 +-
 app/addons/documents/routes-doc-editor.js       |  252 +-
 app/addons/documents/routes-documents.js        |  379 ++-
 app/addons/documents/routes-index-editor.js     |  317 +-
 app/addons/documents/routes-mango.js            |  291 +-
 app/addons/documents/routes.js                  |   32 +-
 app/addons/documents/shared-resources.js        |  509 ++-
 app/addons/documents/shared-routes.js           |  264 +-
 app/addons/documents/sidebar/actions.js         |  265 +-
 app/addons/documents/sidebar/actiontypes.js     |   32 +-
 app/addons/documents/sidebar/sidebar.react.jsx  | 1248 ++++----
 app/addons/documents/sidebar/stores.react.jsx   |  606 ++--
 .../tests/sidebar.componentsSpec.react.jsx      |  176 +-
 .../sidebar/tests/sidebar.storesSpec.js         |   97 +-
 .../documents/tests/document-test-helper.js     |   52 +-
 app/addons/documents/tests/helpersSpec.js       |   58 +-
 .../documents/tests/nightwatch/bulkDelete.js    |   12 +
 .../documents/tests/nightwatch/changes.js       |   12 +
 .../documents/tests/nightwatch/changesFilter.js |   12 +
 .../tests/nightwatch/checkSidebarBehavior.js    |   12 +
 .../tests/nightwatch/createsDocument.js         |   12 +
 .../nightwatch/createsDocumentWithoutId.js      |   12 +
 .../tests/nightwatch/deleteDatabaseModal.js     |   12 +
 .../tests/nightwatch/deletesDocuments.js        |   12 +
 .../tests/nightwatch/designDocInfoPresent.js    |   12 +
 .../tests/nightwatch/doubleEmitResults.js       |   12 +
 .../tests/nightwatch/editDocumentsFromView.js   |   12 +
 .../tests/nightwatch/fixRegressionTableView.js  |   12 +
 .../documents/tests/nightwatch/jsonView.js      |    1 +
 .../documents/tests/nightwatch/lookaheadTray.js |   12 +
 .../documents/tests/nightwatch/mangoIndex.js    |   12 +
 .../documents/tests/nightwatch/mangoQuery.js    |   12 +
 ...AfterEditingDocShouldShowAConfirmationBox.js |   12 +
 .../tests/nightwatch/navigateFromNewDoc.js      |   12 +
 .../tests/nightwatch/navigateToNewView.js       |   12 +
 .../tests/nightwatch/paginateAllDocs.js         |   12 +
 .../documents/tests/nightwatch/paginateView.js  |   12 +
 .../tests/nightwatch/previousButton.js          |   12 +
 .../documents/tests/nightwatch/queryOptions.js  |   12 +
 .../tests/nightwatch/queryOptionsCloseBug.js    |   12 +
 .../documents/tests/nightwatch/revBrowser.js    |   12 +
 .../tests/nightwatch/selectDocViaTypeahead.js   |   12 +
 .../switchDatabaseViaLookaheadTray.js           |   12 +
 .../documents/tests/nightwatch/tableView.js     |   12 +
 .../tests/nightwatch/tableViewConflicts.js      |   12 +
 .../tests/nightwatch/uploadAttachment.js        |   12 +
 .../documents/tests/nightwatch/viewClone.js     |   12 +
 .../documents/tests/nightwatch/viewCreate.js    |   12 +
 .../tests/nightwatch/viewCreateBadView.js       |   12 +
 .../documents/tests/nightwatch/viewDelete.js    |   12 +
 .../documents/tests/nightwatch/viewEdit.js      |   12 +
 .../tests/nightwatch/viewQueryOptions.js        |   12 +
 app/addons/documents/tests/resourcesSpec.js     |  725 +++--
 app/addons/documents/tests/routeSpec.js         |   67 +-
 app/addons/documents/views.js                   |  163 +-
 app/addons/fauxton/base.js                      |  182 +-
 app/addons/fauxton/components.js                | 1025 +++----
 app/addons/fauxton/components.react.jsx         |  765 +++--
 app/addons/fauxton/navigation/actions.js        |  106 +-
 app/addons/fauxton/navigation/actiontypes.js    |   24 +-
 .../fauxton/navigation/components.react.jsx     |  302 +-
 app/addons/fauxton/navigation/stores.js         |  309 +-
 .../navigation/tests/componentsSpec.react.jsx   |   97 +-
 .../fauxton/navigation/tests/storeSpec.js       |  381 ++-
 app/addons/fauxton/notifications/actions.js     |  135 +-
 app/addons/fauxton/notifications/actiontypes.js |   24 +-
 .../notifications/notifications.react.jsx       |  781 +++--
 app/addons/fauxton/notifications/stores.js      |  306 +-
 .../fauxton/notifications/tests/actionsSpec.js  |   60 +-
 .../tests/componentsSpec.react.jsx              |  342 +--
 .../fauxton/notifications/tests/storesSpec.js   |  128 +-
 app/addons/fauxton/tests/baseSpec.js            |  128 +-
 app/addons/fauxton/tests/breadcrumbsSpec.js     |  119 +-
 app/addons/fauxton/tests/breadcrumbsViewSpec.js |  137 +-
 app/addons/fauxton/tests/componentsSpec.js      |   40 +-
 .../fauxton/tests/componentsSpec.react.jsx      |  416 ++-
 .../tests/nightwatch/highlightsidebar.js        |   12 +
 .../tests/nightwatch/notificationCenter.js      |   12 +
 .../nightwatch/updatesUrlsSameRouteobject.js    |   12 +
 app/addons/permissions/actions.js               |  116 +-
 app/addons/permissions/actiontypes.js           |   17 +-
 app/addons/permissions/base.js                  |   17 +-
 app/addons/permissions/components.react.jsx     |  427 ++-
 app/addons/permissions/resources.js             |  128 +-
 app/addons/permissions/routes.js                |  164 +-
 app/addons/permissions/stores.js                |  179 +-
 app/addons/permissions/tests/actionsSpec.js     |  171 +-
 .../permissions/tests/componentsSpec.react.jsx  |  283 +-
 app/addons/permissions/tests/resourceSpec.js    |   82 +-
 app/addons/replication/base.js                  |   31 +-
 app/addons/replication/resources.js             |   99 +-
 app/addons/replication/route.js                 |   74 +-
 app/addons/replication/tests/replicationSpec.js |   45 +-
 app/addons/replication/views.js                 |  608 ++--
 app/addons/setup/base.js                        |   29 +-
 app/addons/setup/resources.js                   |   59 +-
 app/addons/setup/route.js                       |   90 +-
 app/addons/setup/setup.actions.js               |  470 ++-
 app/addons/setup/setup.actiontypes.js           |   27 +-
 app/addons/setup/setup.react.jsx                |  657 ++--
 app/addons/setup/setup.stores.js                |  250 +-
 .../setup/tests/setupComponentsSpec.react.jsx   |  228 +-
 app/addons/setup/tests/setupSpec.js             |   91 +-
 app/addons/styletests/base.js                   |   31 +-
 app/addons/styletests/routes.js                 |   42 +-
 app/addons/styletests/styletests.react.jsx      |  903 +++---
 app/addons/verifyinstall/actions.js             |  174 +-
 app/addons/verifyinstall/actiontypes.js         |   14 +-
 app/addons/verifyinstall/base.js                |   31 +-
 app/addons/verifyinstall/components.react.jsx   |  245 +-
 app/addons/verifyinstall/constants.js           |   25 +-
 app/addons/verifyinstall/resources.js           |  289 +-
 app/addons/verifyinstall/routes.js              |   42 +-
 app/addons/verifyinstall/stores.js              |  156 +-
 app/addons/verifyinstall/tests/actionsSpec.js   |   28 +-
 .../tests/componentsSpec.react.jsx              |  192 +-
 .../tests/verifyinstall.storesSpec.js           |   52 +-
 app/app.js                                      |  215 +-
 app/constants.js                                |   82 +-
 app/core/api.js                                 |  168 +-
 app/core/auth.js                                |   76 +-
 app/core/base.js                                |  231 +-
 app/core/couchdbSession.js                      |   90 +-
 app/core/layout.js                              |  152 +-
 app/core/routeObject.js                         |  628 ++--
 app/core/router.js                              |  183 +-
 app/core/store.js                               |   29 +-
 app/core/tests/apiSpec.js                       |   46 +-
 app/core/tests/couchdbSessionSpec.js            |   52 +-
 app/core/tests/layoutSpec.js                    |  155 +-
 app/core/tests/routeObjectSpec.js               |  357 ++-
 app/core/tests/utilsSpec.js                     |  126 +-
 app/core/utils.js                               |  210 +-
 app/helpers.js                                  |   81 +-
 app/initialize.js.underscore                    |   27 +-
 app/load_addons.js.underscore                   |   18 +-
 app/main.js                                     |   79 +-
 import.md                                       |    9 +
 package.json                                    |    5 +-
 test/mocha/testUtils.js                         |   77 +-
 287 files changed, 28608 insertions(+), 29115 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/.babelrc
----------------------------------------------------------------------
diff --git a/.babelrc b/.babelrc
index e7bacab..539cd51 100644
--- a/.babelrc
+++ b/.babelrc
@@ -2,5 +2,6 @@
   "presets": [
     "react",
     "es2015"
-  ]
+  ],
+  "plugins": ["transform-object-assign"]
 }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/.eslintrc
----------------------------------------------------------------------
diff --git a/.eslintrc b/.eslintrc
index 6974475..d94a612 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -2,7 +2,8 @@
   "root": true,
 
   "ecmaFeatures": {
-    "jsx": true
+    "jsx": true,
+    "modules": true
   },
 
   "rules-todo": {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/actions.js b/app/addons/activetasks/actions.js
index c76da48..76032fe 100644
--- a/app/addons/activetasks/actions.js
+++ b/app/addons/activetasks/actions.js
@@ -9,67 +9,64 @@
 // 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',
-  './actiontypes'
-],
-function (FauxtonAPI, ActionTypes) {
-  return {
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
 
-    init: function (activeTasks) {
+export default {
+
+  init: function (activeTasks) {
+    this.fetchAndSetActiveTasks(activeTasks.table, activeTasks);
+    FauxtonAPI.when(activeTasks.fetch()).then(function () {
       this.fetchAndSetActiveTasks(activeTasks.table, activeTasks);
-      FauxtonAPI.when(activeTasks.fetch()).then(function () {
-        this.fetchAndSetActiveTasks(activeTasks.table, activeTasks);
-        this.setActiveTaskIsLoading(false);
-      }.bind(this));
-    },
+      this.setActiveTaskIsLoading(false);
+    }.bind(this));
+  },
 
-    fetchAndSetActiveTasks: function (collection, backboneCollection) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ACTIVE_TASKS_FETCH_AND_SET,
-        options: {
-          collectionTable: collection,
-          backboneCollection: backboneCollection
-        }
-      });
-    },
-    changePollingInterval: function (interval) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL,
-        options: interval
-      });
-    },
-    switchTab: function (tab) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ACTIVE_TASKS_SWITCH_TAB,
-        options: tab
-      });
-    },
-    setCollection: function (collection) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ACTIVE_TASKS_SET_COLLECTION,
-        options: collection
-      });
-    },
-    setSearchTerm: function (searchTerm) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM,
-        options: searchTerm
-      });
-    },
-    sortByColumnHeader: function (columnName) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER,
-        options: {
-          columnName: columnName
-        }
-      });
-    },
-    setActiveTaskIsLoading: function (boolean) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ACTIVE_TASKS_SET_IS_LOADING,
-        options: boolean
-      });
-    }
-  };
-});
+  fetchAndSetActiveTasks: function (collection, backboneCollection) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ACTIVE_TASKS_FETCH_AND_SET,
+      options: {
+        collectionTable: collection,
+        backboneCollection: backboneCollection
+      }
+    });
+  },
+  changePollingInterval: function (interval) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL,
+      options: interval
+    });
+  },
+  switchTab: function (tab) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ACTIVE_TASKS_SWITCH_TAB,
+      options: tab
+    });
+  },
+  setCollection: function (collection) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ACTIVE_TASKS_SET_COLLECTION,
+      options: collection
+    });
+  },
+  setSearchTerm: function (searchTerm) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM,
+      options: searchTerm
+    });
+  },
+  sortByColumnHeader: function (columnName) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER,
+      options: {
+        columnName: columnName
+      }
+    });
+  },
+  setActiveTaskIsLoading: function (boolean) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ACTIVE_TASKS_SET_IS_LOADING,
+      options: boolean
+    });
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/actiontypes.js b/app/addons/activetasks/actiontypes.js
index cdba87d..d934cb8 100644
--- a/app/addons/activetasks/actiontypes.js
+++ b/app/addons/activetasks/actiontypes.js
@@ -9,14 +9,12 @@
 // 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([], function () {
-  return {
-    ACTIVE_TASKS_CHANGE_POLLING_INTERVAL: 'ACTIVE_TASKS_CHANGE_POLLING_INTERVAL',
-    ACTIVE_TASKS_SWITCH_TAB: 'ACTIVE_TASKS_SWITCH_TAB',
-    ACTIVE_TASKS_SET_COLLECTION: 'ACTIVE_TASKS_SET_COLLECTION',
-    ACTIVE_TASKS_SET_SEARCH_TERM: 'ACTIVE_TASKS_SET_SEARCH_TERM',
-    ACTIVE_TASKS_SORT_BY_COLUMN_HEADER: 'ACTIVE_TASKS_SORT_BY_COLUMN_HEADER',
-    ACTIVE_TASKS_FETCH_AND_SET: 'ACTIVE_TASKS_FETCH_AND_SET',
-    ACTIVE_TASKS_SET_IS_LOADING: 'ACTIVE_TASKS_SET_IS_LOADING'
-  };
-});
+export default {
+  ACTIVE_TASKS_CHANGE_POLLING_INTERVAL: 'ACTIVE_TASKS_CHANGE_POLLING_INTERVAL',
+  ACTIVE_TASKS_SWITCH_TAB: 'ACTIVE_TASKS_SWITCH_TAB',
+  ACTIVE_TASKS_SET_COLLECTION: 'ACTIVE_TASKS_SET_COLLECTION',
+  ACTIVE_TASKS_SET_SEARCH_TERM: 'ACTIVE_TASKS_SET_SEARCH_TERM',
+  ACTIVE_TASKS_SORT_BY_COLUMN_HEADER: 'ACTIVE_TASKS_SORT_BY_COLUMN_HEADER',
+  ACTIVE_TASKS_FETCH_AND_SET: 'ACTIVE_TASKS_FETCH_AND_SET',
+  ACTIVE_TASKS_SET_IS_LOADING: 'ACTIVE_TASKS_SET_IS_LOADING'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/base.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/base.js b/app/addons/activetasks/base.js
index aa4b54a..6c99fb0 100644
--- a/app/addons/activetasks/base.js
+++ b/app/addons/activetasks/base.js
@@ -10,18 +10,13 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './routes',
-  './assets/less/activetasks.less'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Activetasks from "./routes";
+import "./assets/less/activetasks.less";
 
-function (app, FauxtonAPI, Activetasks) {
+Activetasks.initialize = function () {
+  FauxtonAPI.addHeaderLink({title: 'Active Tasks', icon: 'fonticon-activetasks', href: '#/activetasks'});
+};
 
-  Activetasks.initialize = function () {
-    FauxtonAPI.addHeaderLink({title: 'Active Tasks', icon: 'fonticon-activetasks', href: '#/activetasks'});
-  };
-
-  return Activetasks;
-});
+export default Activetasks;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/components.react.jsx b/app/addons/activetasks/components.react.jsx
index 67cef26..2add311 100644
--- a/app/addons/activetasks/components.react.jsx
+++ b/app/addons/activetasks/components.react.jsx
@@ -10,576 +10,570 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  'react-dom',
-  './stores',
-  './resources',
-  './actions',
-
-  '../components/react-components.react',
-  '../fauxton/components.react',
-  'react-addons-css-transition-group'
-], (app, FauxtonAPI, React, ReactDOM, Stores, Resources, Actions,
-  Components, ComponentsReact, ReactCSSTransitionGroup) => {
-
-  const TabElementWrapper = Components.TabElementWrapper;
-  const TabElement = Components.TabElement;
-
-  var activeTasksStore = Stores.activeTasksStore;
-
-  var ActiveTasksController = React.createClass({
-
-    getStoreState: function () {
-      return {
-        collection: activeTasksStore.getCollection(),
-        searchTerm: activeTasksStore.getSearchTerm(),
-        selectedRadio: activeTasksStore.getSelectedRadio(),
-
-        sortByHeader: activeTasksStore.getSortByHeader(),
-        headerIsAscending: activeTasksStore.getHeaderIsAscending(),
-
-        setPolling: activeTasksStore.setPolling,
-        clearPolling: activeTasksStore.clearPolling
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      this.state.setPolling();
-      activeTasksStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      this.state.clearPolling();
-      activeTasksStore.off('change', this.onChange, this);
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    setNewSearchTerm: function (searchTerm) {
-      Actions.setSearchTerm(searchTerm);
-    },
-
-    switchTab: function (newRadioButton) {  //tabs buttons
-      Actions.switchTab(newRadioButton);
-    },
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Stores from "./stores";
+import Resources from "./resources";
+import Actions from "./actions";
+import Components from "../components/react-components.react";
+import ComponentsReact from "../fauxton/components.react";
+import ReactCSSTransitionGroup from "react-addons-css-transition-group";
+
+const TabElementWrapper = Components.TabElementWrapper;
+const TabElement = Components.TabElement;
+
+var activeTasksStore = Stores.activeTasksStore;
+
+var ActiveTasksController = React.createClass({
+
+  getStoreState: function () {
+    return {
+      collection: activeTasksStore.getCollection(),
+      searchTerm: activeTasksStore.getSearchTerm(),
+      selectedRadio: activeTasksStore.getSelectedRadio(),
+
+      sortByHeader: activeTasksStore.getSortByHeader(),
+      headerIsAscending: activeTasksStore.getHeaderIsAscending(),
+
+      setPolling: activeTasksStore.setPolling,
+      clearPolling: activeTasksStore.clearPolling
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    this.state.setPolling();
+    activeTasksStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    this.state.clearPolling();
+    activeTasksStore.off('change', this.onChange, this);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  setNewSearchTerm: function (searchTerm) {
+    Actions.setSearchTerm(searchTerm);
+  },
+
+  switchTab: function (newRadioButton) {  //tabs buttons
+    Actions.switchTab(newRadioButton);
+  },
+
+  tableHeaderOnClick: function (headerClicked) {
+    Actions.sortByColumnHeader(headerClicked);
+  },
+
+  render: function () {
+    var collection = this.state.collection;
+    var searchTerm = this.state.searchTerm;
+    var selectedRadio = this.state.selectedRadio;
+    var sortByHeader = this.state.sortByHeader;
+    var headerIsAscending = this.state.headerIsAscending;
+
+    var setSearchTerm = this.setNewSearchTerm;
+    var onTableHeaderClick = this.tableHeaderOnClick;
+
+    return (
+      <div id="active-tasks-page" className="scrollable">
+        <div className="inner">
+          <ActiveTasksFilterTabs
+            searchTerm={searchTerm}
+            selectedRadio={selectedRadio}
+            onSearch={setSearchTerm}
+            onRadioClick={this.switchTab}/>
+          <ActiveTaskTable
+            collection={collection}
+            searchTerm={searchTerm}
+            selectedRadio={selectedRadio}
+            onTableHeaderClick={onTableHeaderClick}
+            sortByHeader={sortByHeader}
+            headerIsAscending={headerIsAscending} />
+        </div>
+      </div>
+    );
+  }
+});
 
-    tableHeaderOnClick: function (headerClicked) {
-      Actions.sortByColumnHeader(headerClicked);
-    },
+var ActiveTasksFilterTabs = React.createClass({
+  getDefaultProps: function () {
+    return {
+      radioNames : [
+        'All Tasks',
+        'Replication',
+        'Database Compaction',
+        'Indexer',
+        'View Compaction'
+      ]
+    };
+  },
+
+  checked: function (radioName) {
+    return this.props.selectedRadio === radioName;
+  },
+
+  onRadioClick: function (e) {
+    var radioName = e.target.value;
+    this.props.onRadioClick(radioName);
+  },
+
+  createFilterTabs: function () {
+    return (
+      this.props.radioNames.map((radioName, i) => {
+        const checked = this.checked(radioName);
 
-    render: function () {
-      var collection = this.state.collection;
-      var searchTerm = this.state.searchTerm;
-      var selectedRadio = this.state.selectedRadio;
-      var sortByHeader = this.state.sortByHeader;
-      var headerIsAscending = this.state.headerIsAscending;
+        return (
+          <TabElement
+            key={i}
+            selected={checked}
+            text={radioName}
+            onChange={this.onRadioClick} />
+        );
+      })
+    );
+  },
+
+  searchTermChange: function (e) {
+    var searchTerm = e.target.value;
+    this.props.onSearch(searchTerm);
+  },
+
+  render: function () {
+    const filterTabs = this.createFilterTabs();
+    return (
+      <TabElementWrapper>
+        {filterTabs}
+        <li>
+          <input
+            id="active-tasks-search-box"
+            className="searchbox"
+            type="text"
+            name="search"
+            placeholder="Search for databases..."
+            value={this.props.searchTerm}
+            onChange={this.searchTermChange} />
+        </li>
+      </TabElementWrapper>
+    );
+  }
+});
 
-      var setSearchTerm = this.setNewSearchTerm;
-      var onTableHeaderClick = this.tableHeaderOnClick;
+var ActiveTaskTable = React.createClass({
+  render: function () {
+    var collection = this.props.collection;
+    var selectedRadio = this.props.selectedRadio;
+    var searchTerm = this.props.searchTerm;
+    var sortByHeader = this.props.sortByHeader;
+    var onTableHeaderClick = this.props.onTableHeaderClick;
+    var headerIsAscending = this.props.headerIsAscending;
+
+    return (
+      <div id="dashboard-lower-content">
+        <table id="active-tasks-table" className="table table-bordered table-striped active-tasks">
+          <ActiveTasksTableHeader
+            onTableHeaderClick={onTableHeaderClick}
+            sortByHeader={sortByHeader}
+            headerIsAscending={headerIsAscending}/>
+          <ActiveTasksTableBody
+            collection={collection}
+            selectedRadio={selectedRadio}
+            searchTerm={searchTerm}/>
+        </table>
+      </div>
+    );
+  }
+});
 
-      return (
-        <div id="active-tasks-page" className="scrollable">
-          <div className="inner">
-            <ActiveTasksFilterTabs
-              searchTerm={searchTerm}
-              selectedRadio={selectedRadio}
-              onSearch={setSearchTerm}
-              onRadioClick={this.switchTab}/>
-            <ActiveTaskTable
-              collection={collection}
-              searchTerm={searchTerm}
-              selectedRadio={selectedRadio}
-              onTableHeaderClick={onTableHeaderClick}
-              sortByHeader={sortByHeader}
-              headerIsAscending={headerIsAscending} />
-          </div>
-        </div>
-      );
-    }
-  });
-
-  var ActiveTasksFilterTabs = React.createClass({
-    getDefaultProps: function () {
-      return {
-        radioNames : [
-          'All Tasks',
-          'Replication',
-          'Database Compaction',
-          'Indexer',
-          'View Compaction'
-        ]
-      };
-    },
-
-    checked: function (radioName) {
-      return this.props.selectedRadio === radioName;
-    },
-
-    onRadioClick: function (e) {
-      var radioName = e.target.value;
-      this.props.onRadioClick(radioName);
-    },
-
-    createFilterTabs: function () {
-      return (
-        this.props.radioNames.map((radioName, i) => {
-          const checked = this.checked(radioName);
-
-          return (
-            <TabElement
-              key={i}
-              selected={checked}
-              text={radioName}
-              onChange={this.onRadioClick} />
-          );
-        })
-      );
-    },
+var ActiveTasksTableHeader = React.createClass({
+  getDefaultProps: function () {
+    return {
+      headerNames : [
+        ['type', 'Type'],
+        ['database', 'Database'],
+        ['started-on', 'Started on'],
+        ['updated-on', 'Updated on'],
+        ['pid', 'PID'],
+        ['progress', 'Status']
+      ]
+    };
+  },
+
+  createTableHeadingFields: function () {
+    var onTableHeaderClick = this.props.onTableHeaderClick;
+    var sortByHeader = this.props.sortByHeader;
+    var headerIsAscending = this.props.headerIsAscending;
+    return this.props.headerNames.map(function (header) {
+      return <TableHeader
+        headerName={header[0]}
+        displayName={header[1]}
+        key={header[0]}
+        onTableHeaderClick={onTableHeaderClick}
+        sortByHeader={sortByHeader}
+        headerIsAscending={headerIsAscending} />;
+    });
+  },
+
+  render: function () {
+    return (
+      <thead>
+        <tr>{this.createTableHeadingFields()}</tr>
+      </thead>
+    );
+  }
+});
 
-    searchTermChange: function (e) {
-      var searchTerm = e.target.value;
-      this.props.onSearch(searchTerm);
-    },
+var TableHeader = React.createClass({
+  arrow: function () {
+    var sortBy = this.props.sortByHeader;
+    var currentName = this.props.headerName;
+    var headerIsAscending = this.props.headerIsAscending;
+    var arrow = headerIsAscending ? 'icon icon-caret-up' : 'icon icon-caret-down';
 
-    render: function () {
-      const filterTabs = this.createFilterTabs();
-      return (
-        <TabElementWrapper>
-          {filterTabs}
-          <li>
-            <input
-              id="active-tasks-search-box"
-              className="searchbox"
-              type="text"
-              name="search"
-              placeholder="Search for databases..."
-              value={this.props.searchTerm}
-              onChange={this.searchTermChange} />
-          </li>
-        </TabElementWrapper>
-      );
+    if (sortBy === currentName) {
+      return <i className={arrow}></i>;
     }
-  });
-
-  var ActiveTaskTable = React.createClass({
-    render: function () {
-      var collection = this.props.collection;
-      var selectedRadio = this.props.selectedRadio;
-      var searchTerm = this.props.searchTerm;
-      var sortByHeader = this.props.sortByHeader;
-      var onTableHeaderClick = this.props.onTableHeaderClick;
-      var headerIsAscending = this.props.headerIsAscending;
+  },
+
+  onTableHeaderClick: function (e) {
+    var headerSelected = e.target.value;
+    this.props.onTableHeaderClick(headerSelected);
+  },
+
+  render: function () {
+    var arrow = this.arrow();
+    var th_class = 'header-field ' + this.props.headerName;
+
+    return (
+      <td className={th_class + " tableheader"} value={this.props.headerName}>
+        <input
+          type="radio"
+          name="header-field"
+          id={this.props.headerName}
+          value={this.props.headerName}
+          className="header-field radio"
+          onChange={this.onTableHeaderClick} />
+        <label
+          className="header-field label-text active-tasks-header noselect"
+          htmlFor={this.props.headerName}>
+          {this.props.displayName} {arrow}
+        </label>
+      </td>
+    );
+  }
+});
 
-      return (
-        <div id="dashboard-lower-content">
-          <table id="active-tasks-table" className="table table-bordered table-striped active-tasks">
-            <ActiveTasksTableHeader
-              onTableHeaderClick={onTableHeaderClick}
-              sortByHeader={sortByHeader}
-              headerIsAscending={headerIsAscending}/>
-            <ActiveTasksTableBody
-              collection={collection}
-              selectedRadio={selectedRadio}
-              searchTerm={searchTerm}/>
-          </table>
-        </div>
-      );
-    }
-  });
-
-  var ActiveTasksTableHeader = React.createClass({
-    getDefaultProps: function () {
-      return {
-        headerNames : [
-          ['type', 'Type'],
-          ['database', 'Database'],
-          ['started-on', 'Started on'],
-          ['updated-on', 'Updated on'],
-          ['pid', 'PID'],
-          ['progress', 'Status']
-        ]
-      };
-    },
-
-    createTableHeadingFields: function () {
-      var onTableHeaderClick = this.props.onTableHeaderClick;
-      var sortByHeader = this.props.sortByHeader;
-      var headerIsAscending = this.props.headerIsAscending;
-      return this.props.headerNames.map(function (header) {
-        return <TableHeader
-          headerName={header[0]}
-          displayName={header[1]}
-          key={header[0]}
-          onTableHeaderClick={onTableHeaderClick}
-          sortByHeader={sortByHeader}
-          headerIsAscending={headerIsAscending} />;
-      });
-    },
-
-    render: function () {
-      return (
-        <thead>
-          <tr>{this.createTableHeadingFields()}</tr>
-        </thead>
-      );
-    }
-  });
+var ActiveTasksTableBody = React.createClass({
 
-  var TableHeader = React.createClass({
-    arrow: function () {
-      var sortBy = this.props.sortByHeader;
-      var currentName = this.props.headerName;
-      var headerIsAscending = this.props.headerIsAscending;
-      var arrow = headerIsAscending ? 'icon icon-caret-up' : 'icon icon-caret-down';
+  getStoreState: function () {
+    return {
+      filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
+    };
+  },
 
-      if (sortBy === currentName) {
-        return <i className={arrow}></i>;
-      }
-    },
+  getInitialState: function () {
+    return this.getStoreState();
+  },
 
-    onTableHeaderClick: function (e) {
-      var headerSelected = e.target.value;
-      this.props.onTableHeaderClick(headerSelected);
-    },
+  componentWillReceiveProps: function (nextProps) {
+    this.setState({
+      filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
+    });
+  },
 
-    render: function () {
-      var arrow = this.arrow();
-      var th_class = 'header-field ' + this.props.headerName;
+  createRows: function () {
+    var isThereASearchTerm = this.props.searchTerm.trim() === "";
 
-      return (
-        <td className={th_class + " tableheader"} value={this.props.headerName}>
-          <input
-            type="radio"
-            name="header-field"
-            id={this.props.headerName}
-            value={this.props.headerName}
-            className="header-field radio"
-            onChange={this.onTableHeaderClick} />
-          <label
-            className="header-field label-text active-tasks-header noselect"
-            htmlFor={this.props.headerName}>
-            {this.props.displayName} {arrow}
-          </label>
-        </td>
-      );
+    if (this.state.filteredTable.length === 0) {
+      return isThereASearchTerm ? this.noActiveTasks() : this.noActiveTasksMatchFilter();
     }
-  });
-
-  var ActiveTasksTableBody = React.createClass({
-
-    getStoreState: function () {
-      return {
-        filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
-      };
-    },
 
-    getInitialState: function () {
-      return this.getStoreState();
-    },
+    return _.map(this.state.filteredTable, function (item, key) {
+      return <ActiveTaskTableBodyContents key={key} item={item} />;
+    });
+  },
 
-    componentWillReceiveProps: function (nextProps) {
-      this.setState({
-        filteredTable: activeTasksStore.getFilteredTable(this.props.collection)
-      });
-    },
-
-    createRows: function () {
-      var isThereASearchTerm = this.props.searchTerm.trim() === "";
-
-      if (this.state.filteredTable.length === 0) {
-        return isThereASearchTerm ? this.noActiveTasks() : this.noActiveTasksMatchFilter();
-      }
+  noActiveTasks: function () {
+    var type = this.props.selectedRadio;
+    if (type === "All Tasks") {
+      type = "";
+    }
 
-      return _.map(this.state.filteredTable, function (item, key) {
-        return <ActiveTaskTableBodyContents key={key} item={item} />;
-      });
-    },
+    return (
+      <tr className="no-matching-database-on-search">
+        <td  colSpan="6">No active {type} tasks.</td>
+      </tr>
+    );
+  },
+
+  noActiveTasksMatchFilter: function () {
+    var type = this.props.selectedRadio;
+    if (type === "All Tasks") {
+      type = "";
+    }
 
-    noActiveTasks: function () {
-      var type = this.props.selectedRadio;
-      if (type === "All Tasks") {
-        type = "";
-      }
+    return (
+      <tr className="no-matching-database-on-search">
+        <td colSpan="6">No active {type} tasks match with filter: "{this.props.searchTerm}"</td>
+      </tr>
+    );
+  },
+
+  render: function () {
+    return (
+      <tbody className="js-tasks-go-here">
+      {this.createRows()}
+      </tbody>
+    );
+  }
+});
 
-      return (
-        <tr className="no-matching-database-on-search">
-          <td  colSpan="6">No active {type} tasks.</td>
-        </tr>
-      );
-    },
+var ActiveTaskTableBodyContents = React.createClass({
+  getInfo: function (item) {
+    return {
+      type : item.type,
+      objectField: activeTasksHelpers.getDatabaseFieldMessage(item),
+      started_on: activeTasksHelpers.getTimeInfo(item.started_on),
+      updated_on: activeTasksHelpers.getTimeInfo(item.updated_on),
+      pid: item.pid.replace(/[<>]/g, ''),
+      progress: activeTasksHelpers.getProgressMessage(item),
+    };
+  },
+
+  multilineMessage: function (messageArray, optionalClassName) {
+
+    if (!optionalClassName) {
+      optionalClassName = '';
+    }
+    var cssClasses = 'multiline-active-tasks-message ' + optionalClassName;
+
+    return messageArray.map(function (msgLine, iterator) {
+      return <p key={iterator} className={cssClasses}>{msgLine}</p>;
+    });
+  },
+
+  render: function () {
+    var rowData =  this.getInfo(this.props.item);
+    var objectFieldMsg = this.multilineMessage(rowData.objectField, 'to-from-database');
+    var startedOnMsg = this.multilineMessage(rowData.started_on, 'time');
+    var updatedOnMsg = this.multilineMessage(rowData.updated_on, 'time');
+    var progressMsg = this.multilineMessage(rowData.progress);
+
+    return (
+      <tr>
+        <td>{rowData.type}</td>
+        <td>{objectFieldMsg}</td>
+        <td>{startedOnMsg}</td>
+        <td>{updatedOnMsg}</td>
+        <td>{rowData.pid}</td>
+        <td>{progressMsg}<ActiveTasksViewSourceSequence item={this.props.item}/></td>
+      </tr>
+    );
+  }
+});
 
-    noActiveTasksMatchFilter: function () {
-      var type = this.props.selectedRadio;
-      if (type === "All Tasks") {
-        type = "";
+var ActiveTasksViewSourceSequence = React.createClass({
+  onTrayToggle: function (e) {
+    e.preventDefault();
+    this.refs.view_source_sequence_btn.toggle(function (shown) {
+      if (shown) {
+        ReactDOM.findDOMNode(this.refs.view_source_sequence_btn).focus();
       }
+    }.bind(this));
+  },
 
-      return (
-        <tr className="no-matching-database-on-search">
-          <td colSpan="6">No active {type} tasks match with filter: "{this.props.searchTerm}"</td>
-        </tr>
-      );
-    },
+  sequences: function (item) {
+    if (_.isNumber(item) || _.isString(item)) {
+      return <ComponentsReact.ClipboardWithTextField textToCopy={item} uniqueKey={item}/>;
+    }
 
-    render: function () {
-      return (
-        <tbody className="js-tasks-go-here">
-        {this.createRows()}
-        </tbody>
-      );
+    if (_.isArray(item)) {
+      return _.map(item, function (seq, i) {
+          return <ComponentsReact.ClipboardWithTextField textToCopy={seq} uniqueKey={i + Math.random(100)} key={i}/>;
+        });
     }
-  });
-
-  var ActiveTaskTableBodyContents = React.createClass({
-    getInfo: function (item) {
-      return {
-        type : item.type,
-        objectField: activeTasksHelpers.getDatabaseFieldMessage(item),
-        started_on: activeTasksHelpers.getTimeInfo(item.started_on),
-        updated_on: activeTasksHelpers.getTimeInfo(item.updated_on),
-        pid: item.pid.replace(/[<>]/g, ''),
-        progress: activeTasksHelpers.getProgressMessage(item),
-      };
-    },
-
-    multilineMessage: function (messageArray, optionalClassName) {
-
-      if (!optionalClassName) {
-        optionalClassName = '';
-      }
-      var cssClasses = 'multiline-active-tasks-message ' + optionalClassName;
 
-      return messageArray.map(function (msgLine, iterator) {
-        return <p key={iterator} className={cssClasses}>{msgLine}</p>;
-      });
-    },
+    return  <ComponentsReact.ClipboardWithTextField textToCopy="???" uniqueKey='unknownRevision'/>;
+  },
 
-    render: function () {
-      var rowData =  this.getInfo(this.props.item);
-      var objectFieldMsg = this.multilineMessage(rowData.objectField, 'to-from-database');
-      var startedOnMsg = this.multilineMessage(rowData.started_on, 'time');
-      var updatedOnMsg = this.multilineMessage(rowData.updated_on, 'time');
-      var progressMsg = this.multilineMessage(rowData.progress);
+  render: function () {
 
+    if (_.has(this.props.item, 'source_seq')) {
+      var sequences = this.sequences(this.props.item.source_seq);
       return (
-        <tr>
-          <td>{rowData.type}</td>
-          <td>{objectFieldMsg}</td>
-          <td>{startedOnMsg}</td>
-          <td>{updatedOnMsg}</td>
-          <td>{rowData.pid}</td>
-          <td>{progressMsg}<ActiveTasksViewSourceSequence item={this.props.item}/></td>
-        </tr>
+        <div>
+          Current source sequence:
+          <a href="#"
+            className="view-source-sequence-btn"
+            onClick={this.onTrayToggle}
+            data-bypass="true">
+            View
+          </a>
+          <ComponentsReact.Tray ref="view_source_sequence_btn" className="view-source-sequence-tray">
+            <span className="add-on">Source Sequence</span>
+            {sequences}
+          </ComponentsReact.Tray>
+        </div>
       );
     }
-  });
-
-  var ActiveTasksViewSourceSequence = React.createClass({
-    onTrayToggle: function (e) {
-      e.preventDefault();
-      this.refs.view_source_sequence_btn.toggle(function (shown) {
-        if (shown) {
-          ReactDOM.findDOMNode(this.refs.view_source_sequence_btn).focus();
-        }
-      }.bind(this));
-    },
-
-    sequences: function (item) {
-      if (_.isNumber(item) || _.isString(item)) {
-        return <ComponentsReact.ClipboardWithTextField textToCopy={item} uniqueKey={item}/>;
-      }
+    return null;
+  }
+});
 
-      if (_.isArray(item)) {
-        return _.map(item, function (seq, i) {
-            return <ComponentsReact.ClipboardWithTextField textToCopy={seq} uniqueKey={i + Math.random(100)} key={i}/>;
-          });
-      }
+var ActiveTasksPollingWidgetController = React.createClass({
 
-      return  <ComponentsReact.ClipboardWithTextField textToCopy="???" uniqueKey='unknownRevision'/>;
-    },
+  getStoreState: function () {
+    return {
+      pollingInterval:  activeTasksStore.getPollingInterval(),
+      isLoading: activeTasksStore.isLoading()
+    };
+  },
 
-    render: function () {
+  getInitialState: function () {
+    return this.getStoreState();
+  },
 
-      if (_.has(this.props.item, 'source_seq')) {
-        var sequences = this.sequences(this.props.item.source_seq);
-        return (
-          <div>
-            Current source sequence:
-            <a href="#"
-              className="view-source-sequence-btn"
-              onClick={this.onTrayToggle}
-              data-bypass="true">
-              View
-            </a>
-            <ComponentsReact.Tray ref="view_source_sequence_btn" className="view-source-sequence-tray">
-              <span className="add-on">Source Sequence</span>
-              {sequences}
-            </ComponentsReact.Tray>
-          </div>
-        );
-      }
-      return null;
-    }
-  });
-
-  var ActiveTasksPollingWidgetController = React.createClass({
+  componentDidMount: function () {
+    activeTasksStore.on('change', this.onChange, this);
+  },
 
-    getStoreState: function () {
-      return {
-        pollingInterval:  activeTasksStore.getPollingInterval(),
-        isLoading: activeTasksStore.isLoading()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
+    }
+  },
+
+  pollingIntervalChange: function (event) {
+    Actions.changePollingInterval(event.target.value);
+  },
+
+  getPluralForLabel: function () {
+    return this.state.pollingInterval === "1" ? '' : 's';
+  },
+
+  createPollingWidget: function () {
+    var pollingInterval = this.state.pollingInterval;
+    var s = this.getPluralForLabel();
+    var onChangeHandle = this.pollingIntervalChange;
+
+    return (
+      <ul className="polling-interval-widget">
+        <li className="polling-interval-name">Polling interval
+          <label className="polling-interval-time-label" htmlFor="polling-range">
+            <span>{pollingInterval}</span> second{s}
+          </label>
+        </li>
+        <li>
+          <input
+            id="polling-range"
+            type="range"
+            min="1"
+            max="30"
+            step="1"
+            value={pollingInterval}
+            onChange={onChangeHandle}/>
+        </li>
+      </ul>
+    );
+  },
+
+  render: function () {
+    var pollingWidget = this.createPollingWidget();
+    var loadLines = null;
+
+    if (this.state.isLoading || this.state.pollingInterval === "1") {
+      // show loading lines constantly if the polling interval is
+      // 1 second, so that the lines aren't choppy
+      loadLines = <Components.LoadLines />;
+    }
 
-    componentDidMount: function () {
-      activeTasksStore.on('change', this.onChange, this);
-    },
+    return (
+      <div className="active-tasks-loading-lines-container">
+        <span className="active-tasks-loading-lines">
+          {loadLines}
+        </span>
+        {pollingWidget}
+      </div>
+    );
+  }
+});
 
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
+var activeTasksHelpers = {
+  getTimeInfo: function (timeStamp) {
+    var timeMessage = [
+        app.helpers.formatDate(timeStamp),
+        app.helpers.getDateFromNow(timeStamp)
+      ];
+    return timeMessage;
+  },
+
+  getDatabaseFieldMessage: function (item) {
+    var type = item.type;
+    var databaseFieldMessage = [];
+
+    if (type === 'replication') {
+      databaseFieldMessage.push('From: ' + item.source);
+      databaseFieldMessage.push('To: ' + item.target);
+    } else if (type === 'indexer') {
+      databaseFieldMessage.push(item.database);
+      databaseFieldMessage.push('(View: ' + item.design_document + ')');
+    } else {
+      databaseFieldMessage.push(item.database);
+    }
 
-    pollingIntervalChange: function (event) {
-      Actions.changePollingInterval(event.target.value);
-    },
+    return databaseFieldMessage;
+  },
 
-    getPluralForLabel: function () {
-      return this.state.pollingInterval === "1" ? '' : 's';
-    },
+  getProgressMessage: function (item) {
+    var progressMessage = [];
+    var type = item.type;
 
-    createPollingWidget: function () {
-      var pollingInterval = this.state.pollingInterval;
-      var s = this.getPluralForLabel();
-      var onChangeHandle = this.pollingIntervalChange;
+    if (_.has(item, 'progress')) {
+      progressMessage.push('Progress: ' + item.progress + '%');
+    }
 
-      return (
-        <ul className="polling-interval-widget">
-          <li className="polling-interval-name">Polling interval
-            <label className="polling-interval-time-label" htmlFor="polling-range">
-              <span>{pollingInterval}</span> second{s}
-            </label>
-          </li>
-          <li>
-            <input
-              id="polling-range"
-              type="range"
-              min="1"
-              max="30"
-              step="1"
-              value={pollingInterval}
-              onChange={onChangeHandle}/>
-          </li>
-        </ul>
+    if (type === 'indexer') {
+      progressMessage.push(
+        'Processed ' + item.changes_done + ' of ' + item.total_changes + ' changes.'
       );
-    },
+    } else if (type === 'replication') {
+      progressMessage.push(item.docs_written + ' docs written.');
 
-    render: function () {
-      var pollingWidget = this.createPollingWidget();
-      var loadLines = null;
-
-      if (this.state.isLoading || this.state.pollingInterval === "1") {
-        // show loading lines constantly if the polling interval is
-        // 1 second, so that the lines aren't choppy
-        loadLines = <Components.LoadLines />;
+      if (_.has(item, 'changes_pending')) {
+        progressMessage.push(item.changes_pending + ' pending changes.');
       }
-
-      return (
-        <div className="active-tasks-loading-lines-container">
-          <span className="active-tasks-loading-lines">
-            {loadLines}
-          </span>
-          {pollingWidget}
-        </div>
-      );
     }
-  });
-
-  var activeTasksHelpers = {
-    getTimeInfo: function (timeStamp) {
-      var timeMessage = [
-          app.helpers.formatDate(timeStamp),
-          app.helpers.getDateFromNow(timeStamp)
-        ];
-      return timeMessage;
-    },
-
-    getDatabaseFieldMessage: function (item) {
-      var type = item.type;
-      var databaseFieldMessage = [];
-
-      if (type === 'replication') {
-        databaseFieldMessage.push('From: ' + item.source);
-        databaseFieldMessage.push('To: ' + item.target);
-      } else if (type === 'indexer') {
-        databaseFieldMessage.push(item.database);
-        databaseFieldMessage.push('(View: ' + item.design_document + ')');
-      } else {
-        databaseFieldMessage.push(item.database);
-      }
-
-      return databaseFieldMessage;
-    },
-
-    getProgressMessage: function (item) {
-      var progressMessage = [];
-      var type = item.type;
 
-      if (_.has(item, 'progress')) {
-        progressMessage.push('Progress: ' + item.progress + '%');
-      }
-
-      if (type === 'indexer') {
-        progressMessage.push(
-          'Processed ' + item.changes_done + ' of ' + item.total_changes + ' changes.'
-        );
-      } else if (type === 'replication') {
-        progressMessage.push(item.docs_written + ' docs written.');
-
-        if (_.has(item, 'changes_pending')) {
-          progressMessage.push(item.changes_pending + ' pending changes.');
-        }
-      }
-
-      if (_.has(item, 'changes_done')) {
-        progressMessage.push(item.changes_done + ' Changes done.');
-      }
-
-      return progressMessage;
-    },
-
-    getSourceSequence: function (item) {
-      return item.source_seq;
+    if (_.has(item, 'changes_done')) {
+      progressMessage.push(item.changes_done + ' Changes done.');
     }
 
-  };
+    return progressMessage;
+  },
 
-  return {
-    ActiveTasksController: ActiveTasksController,
-    ActiveTasksFilterTabs: ActiveTasksFilterTabs,
+  getSourceSequence: function (item) {
+    return item.source_seq;
+  }
 
-    ActiveTaskTable: ActiveTaskTable,
-    ActiveTasksTableHeader: ActiveTasksTableHeader,
-    TableHeader: TableHeader,
-    ActiveTasksTableBody: ActiveTasksTableBody,
-    ActiveTaskTableBodyContents: ActiveTaskTableBodyContents,
-    ActiveTasksViewSourceSequence: ActiveTasksViewSourceSequence,
+};
 
-    ActiveTasksPollingWidgetController: ActiveTasksPollingWidgetController
-  };
+export default {
+  ActiveTasksController: ActiveTasksController,
+  ActiveTasksFilterTabs: ActiveTasksFilterTabs,
 
-});
+  ActiveTaskTable: ActiveTaskTable,
+  ActiveTasksTableHeader: ActiveTasksTableHeader,
+  TableHeader: TableHeader,
+  ActiveTasksTableBody: ActiveTasksTableBody,
+  ActiveTaskTableBodyContents: ActiveTaskTableBodyContents,
+  ActiveTasksViewSourceSequence: ActiveTasksViewSourceSequence,
+
+  ActiveTasksPollingWidgetController: ActiveTasksPollingWidgetController
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/resources.js b/app/addons/activetasks/resources.js
index b70ce39..ea559de 100644
--- a/app/addons/activetasks/resources.js
+++ b/app/addons/activetasks/resources.js
@@ -10,44 +10,39 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './actions'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Actions from "./actions";
+var Active = {};
 
-function (app, FauxtonAPI, Actions) {
-  var Active = {};
+Active.AllTasks = Backbone.Collection.extend({
 
-  Active.AllTasks = Backbone.Collection.extend({
+  url: function () {
+    return app.host + '/_active_tasks';
+  },
 
-    url: function () {
-      return app.host + '/_active_tasks';
-    },
+  pollingFetch: function () { //still need this for the polling
+    this.fetch({reset: true, parse: true});
+    Actions.setActiveTaskIsLoading(true);
+    return this;
+  },
 
-    pollingFetch: function () { //still need this for the polling
-      this.fetch({reset: true, parse: true});
-      Actions.setActiveTaskIsLoading(true);
-      return this;
-    },
+  parse: function (resp) {
+    //no more backbone models, collection is converted into an array of objects
+    Actions.setActiveTaskIsLoading(false);
+    var collectionTable = [];
 
-    parse: function (resp) {
-      //no more backbone models, collection is converted into an array of objects
-      Actions.setActiveTaskIsLoading(false);
-      var collectionTable = [];
+    _.each(resp, function (item) {
+      collectionTable.push(item);
+    });
 
-      _.each(resp, function (item) {
-        collectionTable.push(item);
-      });
+    //collection is an array of objects
+    this.table = collectionTable;
+    return resp;
+  },
 
-      //collection is an array of objects
-      this.table = collectionTable;
-      return resp;
-    },
+  table: []
 
-    table: []
-
-  });
-
-  return Active;
 });
+
+export default Active;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/routes.js b/app/addons/activetasks/routes.js
index 951531a..3aed827 100644
--- a/app/addons/activetasks/routes.js
+++ b/app/addons/activetasks/routes.js
@@ -10,43 +10,38 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './resources',
-  './components.react',
-  './actions'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import ActiveTasksResources from "./resources";
+import ActiveTasksComponents from "./components.react";
+import Actions from "./actions";
 
-function (app, FauxtonAPI, ActiveTasksResources, ActiveTasksComponents, Actions) {
-
-  var ActiveTasksRouteObject = FauxtonAPI.RouteObject.extend({
-    selectedHeader: 'Active Tasks',
-    layout: 'one_pane',
-    disableLoader: true,
-    routes: {
-      'activetasks/:id': 'showActiveTasks',
-      'activetasks': 'showActiveTasks'
-    },
-    crumbs: [
-      {'name': 'Active Tasks', 'link': 'activetasks'}
-    ],
-    apiUrl: function () {
-      var apiurl = window.location.origin + '/_active_tasks';
-      return [apiurl, FauxtonAPI.constants.DOC_URLS.ACTIVE_TASKS];
-    },
-    roles: ['_admin'],
-    initialize: function () {
-      this.allTasks = new ActiveTasksResources.AllTasks();
-    },
-    showActiveTasks: function () {
-      Actions.init(this.allTasks);
-      this.setComponent('#dashboard-content', ActiveTasksComponents.ActiveTasksController);
-      this.setComponent('#right-header', ActiveTasksComponents.ActiveTasksPollingWidgetController);
-    }
-  });
+var ActiveTasksRouteObject = FauxtonAPI.RouteObject.extend({
+  selectedHeader: 'Active Tasks',
+  layout: 'one_pane',
+  disableLoader: true,
+  routes: {
+    'activetasks/:id': 'showActiveTasks',
+    'activetasks': 'showActiveTasks'
+  },
+  crumbs: [
+    {'name': 'Active Tasks', 'link': 'activetasks'}
+  ],
+  apiUrl: function () {
+    var apiurl = window.location.origin + '/_active_tasks';
+    return [apiurl, FauxtonAPI.constants.DOC_URLS.ACTIVE_TASKS];
+  },
+  roles: ['_admin'],
+  initialize: function () {
+    this.allTasks = new ActiveTasksResources.AllTasks();
+  },
+  showActiveTasks: function () {
+    Actions.init(this.allTasks);
+    this.setComponent('#dashboard-content', ActiveTasksComponents.ActiveTasksController);
+    this.setComponent('#right-header', ActiveTasksComponents.ActiveTasksPollingWidgetController);
+  }
+});
 
-  ActiveTasksResources.RouteObjects = [ActiveTasksRouteObject];
+ActiveTasksResources.RouteObjects = [ActiveTasksRouteObject];
 
-  return ActiveTasksResources;
-});
+export default ActiveTasksResources;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/stores.js b/app/addons/activetasks/stores.js
index f0bd85b..547e8fd 100644
--- a/app/addons/activetasks/stores.js
+++ b/app/addons/activetasks/stores.js
@@ -10,236 +10,233 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './actiontypes'
-], function (app, FauxtonAPI, ActionTypes) {
-
-  var ActiveTasksStore = FauxtonAPI.Store.extend({
-
-    initAfterFetching: function (collectionTable, backboneCollection) {
-      this._prevSortbyHeader = 'started-on';
-      this._headerIsAscending = true;
-      this._selectedRadio = 'All Tasks';
-      this._sortByHeader = 'started-on';
-      this._searchTerm = '';
-      this._collection = collectionTable;
-      this._pollingIntervalSeconds = 5;
-      this.sortCollectionByColumnHeader(this._sortByHeader);
-      this._backboneCollection = backboneCollection;
-      this.setIsLoading(true, new Date());
-    },
-
-    isLoading: function () {
-      return this._isLoading;
-    },
-
-    setIsLoading: function (bool, time) {
-      if (bool) {
-        this._startTimeForLoading = time;
-        this._isLoading = true;
-      } else {
-        var stoptime = time;
-        var responseTime = stoptime - this._startTimeForLoading;
-        if (responseTime < 800) {
-          setTimeout(function () {
-            this._isLoading = false;
-            this.triggerChange();
-          }.bind(this), 800);  //stop after 800ms for smooth animation
-        } else {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+
+var ActiveTasksStore = FauxtonAPI.Store.extend({
+
+  initAfterFetching: function (collectionTable, backboneCollection) {
+    this._prevSortbyHeader = 'started-on';
+    this._headerIsAscending = true;
+    this._selectedRadio = 'All Tasks';
+    this._sortByHeader = 'started-on';
+    this._searchTerm = '';
+    this._collection = collectionTable;
+    this._pollingIntervalSeconds = 5;
+    this.sortCollectionByColumnHeader(this._sortByHeader);
+    this._backboneCollection = backboneCollection;
+    this.setIsLoading(true, new Date());
+  },
+
+  isLoading: function () {
+    return this._isLoading;
+  },
+
+  setIsLoading: function (bool, time) {
+    if (bool) {
+      this._startTimeForLoading = time;
+      this._isLoading = true;
+    } else {
+      var stoptime = time;
+      var responseTime = stoptime - this._startTimeForLoading;
+      if (responseTime < 800) {
+        setTimeout(function () {
           this._isLoading = false;
-        }
+          this.triggerChange();
+        }.bind(this), 800);  //stop after 800ms for smooth animation
+      } else {
+        this._isLoading = false;
       }
-    },
-
-    getSelectedRadio: function () {
-      return this._selectedRadio;
-    },
-
-    setSelectedRadio: function (selectedRadio) {
-      this._selectedRadio = selectedRadio;
-    },
-
-    getPollingInterval: function () {
-      return this._pollingIntervalSeconds;
-    },
-
-    setPollingInterval: function (pollingInterval) {
-      this._pollingIntervalSeconds = pollingInterval;
-    },
-
-    setPolling: function () {
-      this.clearPolling();
-      var id = setInterval(function () {
-        this._backboneCollection.pollingFetch();
-        this.setCollection(this._backboneCollection.table);
-        this.sortCollectionByColumnHeader(this._prevSortbyHeader, false);
-        this.triggerChange();
-      }.bind(this), this.getPollingInterval() * 1000);
-
-      this.setIntervalID(id);
-    },
-
-    clearPolling: function () {
-      clearInterval(this.getIntervalID());
-    },
-
-    getIntervalID: function () {
-      return this._intervalID;
-    },
-
-    setIntervalID: function (id) {
-      this._intervalID = id;
-    },
-
-    setCollection: function (collection) {
-      this._collection = collection;
-    },
-
-    getCollection: function () {
-      return this._collection;
-    },
-
-    setSearchTerm: function (searchTerm) {
-      this._searchTerm = searchTerm;
-    },
-
-    getSearchTerm: function () {
-      return this._searchTerm;
-    },
-
-    getSortByHeader: function () {
-      return this._sortByHeader;
-    },
+    }
+  },
+
+  getSelectedRadio: function () {
+    return this._selectedRadio;
+  },
+
+  setSelectedRadio: function (selectedRadio) {
+    this._selectedRadio = selectedRadio;
+  },
+
+  getPollingInterval: function () {
+    return this._pollingIntervalSeconds;
+  },
+
+  setPollingInterval: function (pollingInterval) {
+    this._pollingIntervalSeconds = pollingInterval;
+  },
+
+  setPolling: function () {
+    this.clearPolling();
+    var id = setInterval(function () {
+      this._backboneCollection.pollingFetch();
+      this.setCollection(this._backboneCollection.table);
+      this.sortCollectionByColumnHeader(this._prevSortbyHeader, false);
+      this.triggerChange();
+    }.bind(this), this.getPollingInterval() * 1000);
+
+    this.setIntervalID(id);
+  },
+
+  clearPolling: function () {
+    clearInterval(this.getIntervalID());
+  },
+
+  getIntervalID: function () {
+    return this._intervalID;
+  },
+
+  setIntervalID: function (id) {
+    this._intervalID = id;
+  },
+
+  setCollection: function (collection) {
+    this._collection = collection;
+  },
+
+  getCollection: function () {
+    return this._collection;
+  },
+
+  setSearchTerm: function (searchTerm) {
+    this._searchTerm = searchTerm;
+  },
+
+  getSearchTerm: function () {
+    return this._searchTerm;
+  },
+
+  getSortByHeader: function () {
+    return this._sortByHeader;
+  },
+
+  setSortByHeader: function (header) {
+    this._sortByHeader = header;
+  },
+
+  getHeaderIsAscending: function () {
+    return this._headerIsAscending;
+  },
+
+  toggleHeaderIsAscending: function () {
+    if (this._prevSortbyHeader === this._sortByHeader) {
+      this._headerIsAscending = !this._headerIsAscending;
+    }
+  },
 
-    setSortByHeader: function (header) {
-      this._sortByHeader = header;
-    },
+  sortCollectionByColumnHeader: function (colName) {
+    var collectionTable = this._collection;
 
-    getHeaderIsAscending: function () {
-      return this._headerIsAscending;
-    },
+    var sorted = _.sortBy(collectionTable, function (item) {
+      var variable = colName;
 
-    toggleHeaderIsAscending: function () {
-      if (this._prevSortbyHeader === this._sortByHeader) {
-        this._headerIsAscending = !this._headerIsAscending;
+      if (_.isUndefined(item[variable])) {
+        variable = 'source';
       }
-    },
-
-    sortCollectionByColumnHeader: function (colName) {
-      var collectionTable = this._collection;
+      return item[variable];
+    });
 
-      var sorted = _.sortBy(collectionTable, function (item) {
-        var variable = colName;
+    this._prevSortbyHeader = colName;
+    this._collection = sorted;
+  },
 
-        if (_.isUndefined(item[variable])) {
-          variable = 'source';
-        }
-        return item[variable];
-      });
+  getFilteredTable: function (collection) {
+    var table = [];
 
-      this._prevSortbyHeader = colName;
-      this._collection = sorted;
-    },
+    //sort the table here
+    this.sortCollectionByColumnHeader(this._sortByHeader);
 
-    getFilteredTable: function (collection) {
-      var table = [];
+    //insert all matches into table
+    this._collection.map(function (item) {
+      var passesRadioFilter = this.passesRadioFilter(item);
+      var passesSearchFilter = this.passesSearchFilter(item);
 
-      //sort the table here
-      this.sortCollectionByColumnHeader(this._sortByHeader);
-
-      //insert all matches into table
-      this._collection.map(function (item) {
-        var passesRadioFilter = this.passesRadioFilter(item);
-        var passesSearchFilter = this.passesSearchFilter(item);
-
-        if (passesRadioFilter && passesSearchFilter) {
-          table.push(item);
-        }
-      }.bind(this));
-
-      // reverse if descending
-      if (!this._headerIsAscending) {
-        table.reverse();
+      if (passesRadioFilter && passesSearchFilter) {
+        table.push(item);
       }
+    }.bind(this));
 
-      return table;
-    },
+    // reverse if descending
+    if (!this._headerIsAscending) {
+      table.reverse();
+    }
 
-    passesSearchFilter: function (item) {
-      var searchTerm = this._searchTerm;
-      var regex = new RegExp(searchTerm, 'g');
+    return table;
+  },
 
-      var itemDatabasesTerm = '';
-      if (_.has(item, 'database')) {
-        itemDatabasesTerm += item.database;
-      }
-      if (_.has(item, 'source')) {
-        itemDatabasesTerm += item.source;
-      }
-      if (_.has(item, 'target')) {
-        itemDatabasesTerm += item.target;
-      }
+  passesSearchFilter: function (item) {
+    var searchTerm = this._searchTerm;
+    var regex = new RegExp(searchTerm, 'g');
 
-      return regex.test(itemDatabasesTerm);
-    },
+    var itemDatabasesTerm = '';
+    if (_.has(item, 'database')) {
+      itemDatabasesTerm += item.database;
+    }
+    if (_.has(item, 'source')) {
+      itemDatabasesTerm += item.source;
+    }
+    if (_.has(item, 'target')) {
+      itemDatabasesTerm += item.target;
+    }
 
-    passesRadioFilter: function (item) {
-      var selectedRadio = this._selectedRadio.toLowerCase().replace(' ', '_');
-      return item.type ===  selectedRadio ||  selectedRadio === 'all_tasks';
-    },
+    return regex.test(itemDatabasesTerm);
+  },
 
-    dispatch: function (action) {
-      switch (action.type) {
+  passesRadioFilter: function (item) {
+    var selectedRadio = this._selectedRadio.toLowerCase().replace(' ', '_');
+    return item.type ===  selectedRadio ||  selectedRadio === 'all_tasks';
+  },
 
-        case ActionTypes.ACTIVE_TASKS_FETCH_AND_SET:
-          this.initAfterFetching(action.options.collectionTable, action.options.backboneCollection);
-        break;
+  dispatch: function (action) {
+    switch (action.type) {
 
-        case ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL:
-          this.setPollingInterval(action.options);
-          this.setPolling();
-          this.triggerChange();
-        break;
+      case ActionTypes.ACTIVE_TASKS_FETCH_AND_SET:
+        this.initAfterFetching(action.options.collectionTable, action.options.backboneCollection);
+      break;
 
-        case ActionTypes.ACTIVE_TASKS_SWITCH_TAB:
-          this.setSelectedRadio(action.options);
-          this.triggerChange();
-        break;
+      case ActionTypes.ACTIVE_TASKS_CHANGE_POLLING_INTERVAL:
+        this.setPollingInterval(action.options);
+        this.setPolling();
+        this.triggerChange();
+      break;
 
-        case ActionTypes.ACTIVE_TASKS_SET_COLLECTION:
-          this.setCollection(action.options);
-          this.triggerChange();
-        break;
+      case ActionTypes.ACTIVE_TASKS_SWITCH_TAB:
+        this.setSelectedRadio(action.options);
+        this.triggerChange();
+      break;
 
-        case ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM:
-          this.setSearchTerm(action.options);
-          this.triggerChange();
-        break;
+      case ActionTypes.ACTIVE_TASKS_SET_COLLECTION:
+        this.setCollection(action.options);
+        this.triggerChange();
+      break;
 
-        case ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER:
-          this.toggleHeaderIsAscending();
-          this.setSortByHeader(action.options.columnName);
-          this.sortCollectionByColumnHeader(action.options.columnName);
-          this.triggerChange();
-        break;
+      case ActionTypes.ACTIVE_TASKS_SET_SEARCH_TERM:
+        this.setSearchTerm(action.options);
+        this.triggerChange();
+      break;
 
-        case ActionTypes.ACTIVE_TASKS_SET_IS_LOADING:
-          this.setIsLoading(action.options, new Date());
-          this.triggerChange();
-        break;
+      case ActionTypes.ACTIVE_TASKS_SORT_BY_COLUMN_HEADER:
+        this.toggleHeaderIsAscending();
+        this.setSortByHeader(action.options.columnName);
+        this.sortCollectionByColumnHeader(action.options.columnName);
+        this.triggerChange();
+      break;
 
-        default:
-        return;
-      }
+      case ActionTypes.ACTIVE_TASKS_SET_IS_LOADING:
+        this.setIsLoading(action.options, new Date());
+        this.triggerChange();
+      break;
+
+      default:
+      return;
     }
-  });
+  }
+});
 
-  var activeTasksStore = new ActiveTasksStore();
-  activeTasksStore.dispatchToken = FauxtonAPI.dispatcher.register(activeTasksStore.dispatch.bind(activeTasksStore));
-  return {
-    activeTasksStore: activeTasksStore
-  };
+var activeTasksStore = new ActiveTasksStore();
+activeTasksStore.dispatchToken = FauxtonAPI.dispatcher.register(activeTasksStore.dispatch.bind(activeTasksStore));
 
-});
+export default {
+  activeTasksStore: activeTasksStore
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx b/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
index 4029e48..8b60af6 100644
--- a/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
+++ b/app/addons/activetasks/tests/activetasks.componentsSpec.react.jsx
@@ -9,123 +9,120 @@
 // 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',
-  './fakeActiveTaskResponse',
-  'react',
-  'react-dom',
-  '../actions',
-  '../../../../test/mocha/testUtils',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ActiveTasks, Components, Stores, fakedResponse, React, ReactDOM, Actions, utils, TestUtils, sinon) {
-  var assert = utils.assert;
-  var restore = utils.restore;
-  var activeTasksStore = Stores.activeTasksStore;
-  var activeTasksCollection = new ActiveTasks.AllTasks({});
-  activeTasksCollection.parse(fakedResponse);
-
-  describe('Active Tasks -- Components', function () {
-
-    describe('Active Tasks Polling (Components)', function () {
-      var pollingWidgetDiv, pollingWidget;
-
-      beforeEach(function () {
-        pollingWidgetDiv = document.createElement('div');
-        pollingWidget = TestUtils.renderIntoDocument(
-          <Components.ActiveTasksPollingWidgetController />, pollingWidgetDiv
-        );
-      });
+import FauxtonAPI from "../../../core/api";
+import ActiveTasks from "../resources";
+import Components from "../components.react";
+import Stores from "../stores";
+import fakedResponse from "./fakeActiveTaskResponse";
+import React from "react";
+import ReactDOM from "react-dom";
+import Actions from "../actions";
+import utils from "../../../../test/mocha/testUtils";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+var assert = utils.assert;
+var restore = utils.restore;
+var activeTasksStore = Stores.activeTasksStore;
+var activeTasksCollection = new ActiveTasks.AllTasks({});
+activeTasksCollection.parse(fakedResponse);
+
+describe('Active Tasks -- Components', function () {
+
+  describe('Active Tasks Polling (Components)', function () {
+    var pollingWidgetDiv, pollingWidget;
+
+    beforeEach(function () {
+      pollingWidgetDiv = document.createElement('div');
+      pollingWidget = TestUtils.renderIntoDocument(
+        <Components.ActiveTasksPollingWidgetController />, pollingWidgetDiv
+      );
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(pollingWidgetDiv);
-        restore(Actions.changePollingInterval);
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(pollingWidgetDiv);
+      restore(Actions.changePollingInterval);
+    });
 
-      it('should trigger update polling interval', function () {
-        var spy = sinon.spy(Actions, 'changePollingInterval');
-        var rangeNode = TestUtils.findRenderedDOMComponentWithTag(pollingWidget, 'input');
-        var time = '9';
+    it('should trigger update polling interval', function () {
+      var spy = sinon.spy(Actions, 'changePollingInterval');
+      var rangeNode = TestUtils.findRenderedDOMComponentWithTag(pollingWidget, 'input');
+      var time = '9';
 
-        TestUtils.Simulate.change(rangeNode, {target: {value: time}});
-        assert.ok(spy.calledOnce);
-      });
+      TestUtils.Simulate.change(rangeNode, {target: {value: time}});
+      assert.ok(spy.calledOnce);
     });
+  });
 
-    describe('Active Tasks Table (Components)', function () {
-      var table, tableDiv, spy, filterTab;
+  describe('Active Tasks Table (Components)', function () {
+    var table, tableDiv, spy, filterTab;
 
-      beforeEach(function () {
-        tableDiv = document.createElement('div');
-        activeTasksStore.initAfterFetching(activeTasksCollection.table, activeTasksCollection);
-        table = TestUtils.renderIntoDocument(<Components.ActiveTasksController />, tableDiv);
-      });
+    beforeEach(function () {
+      tableDiv = document.createElement('div');
+      activeTasksStore.initAfterFetching(activeTasksCollection.table, activeTasksCollection);
+      table = TestUtils.renderIntoDocument(<Components.ActiveTasksController />, tableDiv);
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(tableDiv);
-        restore(window.confirm);
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(tableDiv);
+      restore(window.confirm);
+    });
 
-      describe('Active Tasks Filter tray', function () {
+    describe('Active Tasks Filter tray', function () {
 
-        afterEach(function () {
-          restore(Actions.switchTab);
-          restore(Actions.setSearchTerm);
-        });
+      afterEach(function () {
+        restore(Actions.switchTab);
+        restore(Actions.setSearchTerm);
+      });
 
-        const radioTexts = [
-          'Replication',
-          'Database Compaction',
-          'Indexer',
-          'View Compaction'
-        ];
+      const radioTexts = [
+        'Replication',
+        'Database Compaction',
+        'Indexer',
+        'View Compaction'
+      ];
 
-        it('should trigger change to radio buttons', () => {
+      it('should trigger change to radio buttons', () => {
 
-          radioTexts.forEach((text) => {
-            spy = sinon.spy(Actions, 'switchTab');
+        radioTexts.forEach((text) => {
+          spy = sinon.spy(Actions, 'switchTab');
 
-            const $table = $(ReactDOM.findDOMNode(table));
-            const element = $table.find(`input[value="${text}"]`)[0];
+          const $table = $(ReactDOM.findDOMNode(table));
+          const element = $table.find(`input[value="${text}"]`)[0];
 
-            TestUtils.Simulate.change(element);
-            assert.ok(spy.calledOnce);
+          TestUtils.Simulate.change(element);
+          assert.ok(spy.calledOnce);
 
-            spy.restore();
-          });
+          spy.restore();
         });
+      });
 
-        it('should trigger change to search term', function () {
-          spy = sinon.spy(Actions, 'setSearchTerm');
-          TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('.searchbox')[0], {target: {value: 'searching'}});
-          assert.ok(spy.calledOnce);
-        });
+      it('should trigger change to search term', function () {
+        spy = sinon.spy(Actions, 'setSearchTerm');
+        TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('.searchbox')[0], {target: {value: 'searching'}});
+        assert.ok(spy.calledOnce);
       });
+    });
 
-      describe('Active Tasks Table Headers', function () {
-        var headerNames = [
-          'type',
-          'database',
-          'started-on',
-          'updated-on',
-          'pid',
-          'progress'
-        ];
-
-        afterEach(function () {
-          restore(Actions.sortByColumnHeader);
-        });
+    describe('Active Tasks Table Headers', function () {
+      var headerNames = [
+        'type',
+        'database',
+        'started-on',
+        'updated-on',
+        'pid',
+        'progress'
+      ];
+
+      afterEach(function () {
+        restore(Actions.sortByColumnHeader);
+      });
 
-        it('should trigger change to which header to sort by', function () {
-          _.each(headerNames, function (header) {
-            spy = sinon.spy(Actions, 'sortByColumnHeader');
-            TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('#' + header)[0]);
-            assert.ok(spy.calledOnce);
-            spy.restore();
-          });
+      it('should trigger change to which header to sort by', function () {
+        _.each(headerNames, function (header) {
+          spy = sinon.spy(Actions, 'sortByColumnHeader');
+          TestUtils.Simulate.change($(ReactDOM.findDOMNode(table)).find('#' + header)[0]);
+          assert.ok(spy.calledOnce);
+          spy.restore();
         });
       });
     });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-results/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/stores.js b/app/addons/documents/index-results/stores.js
index eedbad9..282df98 100644
--- a/app/addons/documents/index-results/stores.js
+++ b/app/addons/documents/index-results/stores.js
@@ -10,841 +10,833 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes',
-  '../header/header.actiontypes',
-  '../pagination/actiontypes',
-
-  '../resources',
-  '../mango/mango.helper',
-  '../resources',
-  '../../databases/resources'
-],
-
-function (app, FauxtonAPI, ActionTypes, HeaderActionTypes, PaginationActionTypes,
-  Documents, MangoHelper, Resources, DatabaseResources) {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import HeaderActionTypes from "../header/header.actiontypes";
+import PaginationActionTypes from "../pagination/actiontypes";
+import Documents from "../resources";
+import MangoHelper from "../mango/mango.helper";
+import Resources from "../resources";
+import DatabaseResources from "../../databases/resources";
+
+var Stores = {};
+
+var maxDocLimit = 10000;
+
+Stores.IndexResultsStore = FauxtonAPI.Store.extend({
+
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._collection = new Backbone.Collection.extend({
+      url: ''
+    });
+
+    this._filteredCollection = [];
+    this._bulkDeleteDocCollection = new Resources.BulkDeleteDocCollection([], {});
+
+    this.clearSelectedItems();
+    this._isLoading = false;
+    this._textEmptyIndex = 'No Documents Found';
+    this._typeOfIndex = 'view';
+
+    this._tableViewSelectedFields = [];
+    this._isPrioritizedEnabled = false;
+
+    this._tableSchema = [];
+    this._tableView = false;
+
+    this.resetPagination();
+  },
+
+  resetPagination: function () {
+    this._pageStart = 1;
+    this._currentPage = 1;
+    this._enabled = true;
+    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;
+    }
 
-  var Stores = {};
+    this.initPerPage();
+  },
 
-  var maxDocLimit = 10000;
+  getCollection: function () {
+    return this._collection;
+  },
 
-  Stores.IndexResultsStore = FauxtonAPI.Store.extend({
+  canShowPrevious: function () {
+    if (!this._enabled) { return false; }
+    if (!this._collection || !this._collection.hasPrevious) { return false; }
 
-    initialize: function () {
-      this.reset();
-    },
+    return this._collection.hasPrevious();
+  },
 
-    reset: function () {
-      this._collection = new Backbone.Collection.extend({
-        url: ''
-      });
+  canShowNext: function () {
+    if (!this._enabled) { return this._enabled; }
 
-      this._filteredCollection = [];
-      this._bulkDeleteDocCollection = new Resources.BulkDeleteDocCollection([], {});
+    if ((this._pageStart + this._perPage) >= this._docLimit) {
+      return false;
+    }
 
-      this.clearSelectedItems();
-      this._isLoading = false;
-      this._textEmptyIndex = 'No Documents Found';
-      this._typeOfIndex = 'view';
+    if (!this._collection || !this._collection.hasNext) { return false; }
 
-      this._tableViewSelectedFields = [];
-      this._isPrioritizedEnabled = false;
+    return this._collection.hasNext();
+  },
 
-      this._tableSchema = [];
-      this._tableView = false;
+  paginateNext: function () {
+    this._currentPage += 1;
+    this._pageStart += this.getPerPage();
+    this._collection.paging.pageSize = this.documentsLeftToFetch();
+  },
 
-      this.resetPagination();
-    },
+  paginatePrevious: function () {
+    this._currentPage -= 1;
 
-    resetPagination: function () {
+    this._pageStart = this._pageStart - this.getPerPage();
+    if (this._pageStart < 1) {
       this._pageStart = 1;
-      this._currentPage = 1;
-      this._enabled = true;
-      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();
-    },
-
-    getCollection: function () {
-      return this._collection;
-    },
-
-    canShowPrevious: function () {
-      if (!this._enabled) { return false; }
-      if (!this._collection || !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 || !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;
-    },
+    this._collection.paging.pageSize = this.getPerPage();
+  },
 
-    totalDocsViewed: function () {
-      return this._perPage * this._currentPage;
-    },
+  getCurrentPage: function () {
+    return this._currentPage;
+  },
 
-    documentsLeftToFetch: function () {
-      var documentsLeftToFetch = this._docLimit - this.totalDocsViewed();
+  totalDocsViewed: function () {
+    return this._perPage * this._currentPage;
+  },
 
-      if (documentsLeftToFetch < this.getPerPage() ) {
-        return documentsLeftToFetch;
-      }
+  documentsLeftToFetch: function () {
+    var documentsLeftToFetch = this._docLimit - this.totalDocsViewed();
 
-      return this._perPage;
-    },
+    if (documentsLeftToFetch < this.getPerPage() ) {
+      return documentsLeftToFetch;
+    }
 
-    getPerPage: function () {
-      return this._perPage;
-    },
+    return this._perPage;
+  },
 
-    initPerPage: function () {
-      var perPage = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
+  getPerPage: function () {
+    return this._perPage;
+  },
 
-      if (window.localStorage) {
-        var storedPerPage = app.utils.localStorageGet('fauxton:perpage');
+  initPerPage: function () {
+    var perPage = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
 
-        if (storedPerPage) {
-          perPage = parseInt(storedPerPage, 10);
-        }
-      }
+    if (window.localStorage) {
+      var storedPerPage = app.utils.localStorageGet('fauxton:perpage');
 
-      if (this._docLimit < perPage) {
-        perPage = this._docLimit;
+      if (storedPerPage) {
+        perPage = parseInt(storedPerPage, 10);
       }
+    }
 
-      this.setPerPage(perPage);
-    },
+    if (this._docLimit < perPage) {
+      perPage = this._docLimit;
+    }
 
-    setPerPage: function (perPage) {
-      this._perPage = perPage;
-      app.utils.localStorageSet('fauxton:perpage', perPage);
+    this.setPerPage(perPage);
+  },
 
-      if (this._collection && this._collection.pageSizeReset) {
-        this._collection.pageSizeReset(perPage, {fetch: false});
-      }
-    },
+  setPerPage: function (perPage) {
+    this._perPage = perPage;
+    app.utils.localStorageSet('fauxton:perpage', perPage);
 
-    getTotalRows: function () {
-      if (!this._collection) { return false; }
+    if (this._collection && this._collection.pageSizeReset) {
+      this._collection.pageSizeReset(perPage, {fetch: false});
+    }
+  },
 
-      return this._collection.length;
-    },
+  getTotalRows: function () {
+    if (!this._collection) { return false; }
 
-    getPageStart: function () {
-      return this._pageStart;
-    },
+    return this._collection.length;
+  },
 
-    getPageEnd: function () {
-      if (!this._collection) { return false; }
-      return this._pageStart + this._collection.length - 1;
-    },
+  getPageStart: function () {
+    return this._pageStart;
+  },
 
-    getUpdateSeq: function () {
-      if (!this._collection) { return false; }
-      if (!this._collection.updateSeq) { return false; }
-      return this._collection.updateSeq();
-    },
+  getPageEnd: function () {
+    if (!this._collection) { return false; }
+    return this._pageStart + this._collection.length - 1;
+  },
 
-    clearSelectedItems: function () {
-      this._bulkDeleteDocCollection.reset([]);
-    },
+  getUpdateSeq: function () {
+    if (!this._collection) { return false; }
+    if (!this._collection.updateSeq) { return false; }
+    return this._collection.updateSeq();
+  },
 
-    newResults: function (options) {
-      this._collection = options.collection;
+  clearSelectedItems: function () {
+    this._bulkDeleteDocCollection.reset([]);
+  },
 
-      this._bulkDeleteDocCollection = options.bulkCollection;
+  newResults: function (options) {
+    this._collection = options.collection;
 
-      if (options.textEmptyIndex) {
-        this._textEmptyIndex = options.textEmptyIndex;
-      }
+    this._bulkDeleteDocCollection = options.bulkCollection;
 
-      if (options.typeOfIndex) {
-        this._typeOfIndex = options.typeOfIndex;
-      }
+    if (options.textEmptyIndex) {
+      this._textEmptyIndex = options.textEmptyIndex;
+    }
 
-      this._cachedSelected = [];
+    if (options.typeOfIndex) {
+      this._typeOfIndex = options.typeOfIndex;
+    }
 
-      this._filteredCollection = this._collection.filter(filterOutGeneratedMangoDocs);
+    this._cachedSelected = [];
 
-      function filterOutGeneratedMangoDocs (doc) {
-        if (doc.get && typeof doc.get === 'function') {
-          return doc.get('language') !== 'query';
-        }
+    this._filteredCollection = this._collection.filter(filterOutGeneratedMangoDocs);
 
-        return doc.language !== 'query';
+    function filterOutGeneratedMangoDocs (doc) {
+      if (doc.get && typeof doc.get === 'function') {
+        return doc.get('language') !== 'query';
       }
-    },
 
-    getTypeOfIndex: function () {
-      return this._typeOfIndex;
-    },
+      return doc.language !== 'query';
+    }
+  },
 
-    isEditable: function (doc) {
-      if (!this._collection) {
-        return false;
-      }
+  getTypeOfIndex: function () {
+    return this._typeOfIndex;
+  },
 
-      if (doc && this.isGhostDoc(doc)) {
-        return false;
-      }
+  isEditable: function (doc) {
+    if (!this._collection) {
+      return false;
+    }
 
-      if (doc && !doc.get('_id')) {
-        return false;
-      }
+    if (doc && this.isGhostDoc(doc)) {
+      return false;
+    }
 
-      if (!this._collection.isEditable) {
-        return false;
-      }
+    if (doc && !doc.get('_id')) {
+      return false;
+    }
 
-      return this._collection.isEditable();
-    },
+    if (!this._collection.isEditable) {
+      return false;
+    }
 
-    isGhostDoc: function (doc) {
-      // ghost docs are empty results where all properties were
-      // filtered away by mango
-      return !doc || !doc.attributes || !Object.keys(doc.attributes).length;
-    },
+    return this._collection.isEditable();
+  },
 
-    isDeletable: function (doc) {
-      if (this.isGhostDoc(doc)) {
-        return false;
-      }
+  isGhostDoc: function (doc) {
+    // ghost docs are empty results where all properties were
+    // filtered away by mango
+    return !doc || !doc.attributes || !Object.keys(doc.attributes).length;
+  },
 
-      return doc.isDeletable();
-    },
+  isDeletable: function (doc) {
+    if (this.isGhostDoc(doc)) {
+      return false;
+    }
 
-    getCollection: function () {
-      return this._collection;
-    },
+    return doc.isDeletable();
+  },
 
-    getBulkDocCollection: function () {
-      return this._bulkDeleteDocCollection;
-    },
+  getCollection: function () {
+    return this._collection;
+  },
 
-    getDocContent: function (originalDoc) {
-      var doc = originalDoc.toJSON();
+  getBulkDocCollection: function () {
+    return this._bulkDeleteDocCollection;
+  },
 
-      return JSON.stringify(doc, null, ' ');
-    },
+  getDocContent: function (originalDoc) {
+    var doc = originalDoc.toJSON();
 
-    getDocId: function (doc) {
+    return JSON.stringify(doc, null, ' ');
+  },
 
-      if (!_.isUndefined(doc.id)) {
-        return doc.id;
-      }
+  getDocId: function (doc) {
 
-      if (doc.get('key')) {
-        return doc.get('key').toString();
-      }
+    if (!_.isUndefined(doc.id)) {
+      return doc.id;
+    }
 
-      return '';
-    },
+    if (doc.get('key')) {
+      return doc.get('key').toString();
+    }
 
-    getMangoDocContent: function (originalDoc) {
-      var doc = originalDoc.toJSON();
+    return '';
+  },
 
-      delete doc.ddoc;
-      delete doc.name;
+  getMangoDocContent: function (originalDoc) {
+    var doc = originalDoc.toJSON();
 
-      return JSON.stringify(doc, null, ' ');
-    },
+    delete doc.ddoc;
+    delete doc.name;
 
-    getMangoDoc: function (doc, index) {
-      var selector,
-          header;
+    return JSON.stringify(doc, null, ' ');
+  },
 
-      if (doc.get('def') && doc.get('def').fields) {
+  getMangoDoc: function (doc, index) {
+    var selector,
+        header;
 
-        header = MangoHelper.getIndexName(doc);
+    if (doc.get('def') && doc.get('def').fields) {
 
-        return {
-          content: this.getMangoDocContent(doc),
-          header: header,
-          id: doc.getId(),
-          keylabel: '',
-          url: doc.isFromView() ? doc.url('app') : doc.url('web-index'),
-          isDeletable: this.isDeletable(doc),
-          isEditable: this.isEditable(doc)
-        };
-      }
+      header = MangoHelper.getIndexName(doc);
 
-      // we filtered away our content with the fields param
       return {
-        content: ' ',
+        content: this.getMangoDocContent(doc),
         header: header,
-        id: this.getDocId(doc) + index,
+        id: doc.getId(),
         keylabel: '',
-        url: this.isEditable(doc) ? doc.url('app') : null,
+        url: doc.isFromView() ? doc.url('app') : doc.url('web-index'),
         isDeletable: this.isDeletable(doc),
         isEditable: this.isEditable(doc)
       };
-    },
+    }
 
-    getResults: function () {
-      var hasBulkDeletableDoc;
-      var res;
+    // we filtered away our content with the fields param
+    return {
+      content: ' ',
+      header: header,
+      id: this.getDocId(doc) + index,
+      keylabel: '',
+      url: this.isEditable(doc) ? doc.url('app') : null,
+      isDeletable: this.isDeletable(doc),
+      isEditable: this.isEditable(doc)
+    };
+  },
+
+  getResults: function () {
+    var hasBulkDeletableDoc;
+    var res;
+
+    // Table sytle view
+    if (this.getIsTableView()) {
+      return this.getTableViewData();
+    }
 
-      // Table sytle view
-      if (this.getIsTableView()) {
-        return this.getTableViewData();
-      }
+    // JSON style views
+    res = this._filteredCollection
+      .map(function (doc, i) {
+        if (doc.get('def') || this.isGhostDoc(doc)) {
+          return this.getMangoDoc(doc, i);
+        }
+        return {
+          content: this.getDocContent(doc),
+          id: this.getDocId(doc),
+          _rev: doc.get('_rev'),
+          header: this.getDocId(doc),
+          keylabel: doc.isFromView() ? 'key' : 'id',
+          url: this.getDocId(doc) ? doc.url('app') : null,
+          isDeletable: this.isDeletable(doc),
+          isEditable: this.isEditable(doc)
+        };
+      }, this);
 
-      // JSON style views
-      res = this._filteredCollection
-        .map(function (doc, i) {
-          if (doc.get('def') || this.isGhostDoc(doc)) {
-            return this.getMangoDoc(doc, i);
-          }
-          return {
-            content: this.getDocContent(doc),
-            id: this.getDocId(doc),
-            _rev: doc.get('_rev'),
-            header: this.getDocId(doc),
-            keylabel: doc.isFromView() ? 'key' : 'id',
-            url: this.getDocId(doc) ? doc.url('app') : null,
-            isDeletable: this.isDeletable(doc),
-            isEditable: this.isEditable(doc)
-          };
-        }, this);
-
-      hasBulkDeletableDoc = this.hasBulkDeletableDoc(this._filteredCollection);
+    hasBulkDeletableDoc = this.hasBulkDeletableDoc(this._filteredCollection);
 
-      return {
-        displayedFields: this.getDisplayCountForTableView(),
-        hasBulkDeletableDoc: hasBulkDeletableDoc,
-        results: res
-      };
-    },
+    return {
+      displayedFields: this.getDisplayCountForTableView(),
+      hasBulkDeletableDoc: hasBulkDeletableDoc,
+      results: res
+    };
+  },
 
-    getPseudoSchema: function (data) {
-      var cache = [];
+  getPseudoSchema: function (data) {
+    var cache = [];
 
-      data.forEach(function (el) {
-        Object.keys(el).forEach(function (k) {
-          cache.push(k);
-        });
+    data.forEach(function (el) {
+      Object.keys(el).forEach(function (k) {
+        cache.push(k);
       });
+    });
 
-      cache = _.uniq(cache);
+    cache = _.uniq(cache);
 
-      // always begin with _id
-      var i = cache.indexOf('_id');
-      if (i !== -1) {
-        cache.splice(i, 1);
-        cache.unshift('_id');
-      }
+    // always begin with _id
+    var i = cache.indexOf('_id');
+    if (i !== -1) {
+      cache.splice(i, 1);
+      cache.unshift('_id');
+    }
 
-      return cache;
-    },
+    return cache;
+  },
 
-    normalizeTableData: function (data, isView) {
-      // filter out cruft
-      if (isView) {
-        return data;
-      }
+  normalizeTableData: function (data, isView) {
+    // filter out cruft
+    if (isView) {
+      return data;
+    }
 
-      return data.map(function (el) {
-        return el.doc || el;
-      });
-    },
+    return data.map(function (el) {
+      return el.doc || el;
+    });
+  },
 
-    isIncludeDocsEnabled: function () {
-      var params = app.getParams();
+  isIncludeDocsEnabled: function () {
+    var params = app.getParams();
 
-      return !!params.include_docs;
-    },
+    return !!params.include_docs;
+  },
 
-    getPrioritizedFields: function (data, max) {
-      var res = data.reduce(function (acc, el) {
-        acc = acc.concat(Object.keys(el));
-        return acc;
-      }, []);
+  getPrioritizedFields: function (data, max) {
+    var res = data.reduce(function (acc, el) {
+      acc = acc.concat(Object.keys(el));
+      return acc;
+    }, []);
 
-      res = _.countBy(res, function (el) {
-        return el;
-      });
+    res = _.countBy(res, function (el) {
+      return el;
+    });
 
-      delete res._id;
-      delete res.id;
-      delete res._rev;
-
-      res = Object.keys(res).reduce(function (acc, el) {
-        acc.push([res[el], el]);
-        return acc;
-      }, []);
-
-      res = this.sortByTwoFields(res);
-      res = res.slice(0, max);
-
-      return res.reduce(function (acc, el) {
-        acc.push(el[1]);
-        return acc;
-      }, []);
-    },
-
-     sortByTwoFields: function (elements) {
-      // given:
-      // var a = [[2, "b"], [3, "z"], [1, "a"], [3, "a"]]
-      // it sorts to:
-      // [[3, "a"], [3, "z"], [2, "b"], [1, "a"]]
-      // note that the arrays with 3 got the first two arrays
-      // _and_ that the second values in the array with 3 are also sorted
-
-      function _recursiveSort (a, b, index) {
-        if (a[index] === b[index]) {
-          return index < 2 ? _recursiveSort(a, b, index + 1) : 0;
-        }
+    delete res._id;
+    delete res.id;
+    delete res._rev;
 
-        // second elements asc
-        if (index === 1) {
-          return (a[index] < b[index]) ? -1 : 1;
-        }
+    res = Object.keys(res).reduce(function (acc, el) {
+      acc.push([res[el], el]);
+      return acc;
+    }, []);
 
-        // first elements desc
-        return (a[index] < b[index]) ? 1 : -1;
+    res = this.sortByTwoFields(res);
+    res = res.slice(0, max);
+
+    return res.reduce(function (acc, el) {
+      acc.push(el[1]);
+      return acc;
+    }, []);
+  },
+
+   sortByTwoFields: function (elements) {
+    // given:
+    // var a = [[2, "b"], [3, "z"], [1, "a"], [3, "a"]]
+    // it sorts to:
+    // [[3, "a"], [3, "z"], [2, "b"], [1, "a"]]
+    // note that the arrays with 3 got the first two arrays
+    // _and_ that the second values in the array with 3 are also sorted
+
+    function _recursiveSort (a, b, index) {
+      if (a[index] === b[index]) {
+        return index < 2 ? _recursiveSort(a, b, index + 1) : 0;
       }
 
-      return elements.sort(function (a, b) {
-        return _recursiveSort(a, b, 0);
-      });
-    },
+      // second elements asc
+      if (index === 1) {
+        return (a[index] < b[index]) ? -1 : 1;
+      }
 
-    hasIdOrRev: function (schema) {
+      // first elements desc
+      return (a[index] < b[index]) ? 1 : -1;
+    }
 
-      return schema.indexOf('_id') !== -1 ||
-        schema.indexOf('id') !== -1 ||
-        schema.indexOf('_rev') !== -1;
-    },
+    return elements.sort(function (a, b) {
+      return _recursiveSort(a, b, 0);
+    });
+  },
 
-    getNotSelectedFields: function (selectedFields, allFields) {
-      var without = _.without.bind(this, allFields);
-      return without.apply(this, selectedFields);
-    },
+  hasIdOrRev: function (schema) {
 
-    getDisplayCountForTableView: function () {
-      var allFieldCount;
-      var shownCount;
+    return schema.indexOf('_id') !== -1 ||
+      schema.indexOf('id') !== -1 ||
+      schema.indexOf('_rev') !== -1;
+  },
 
-      if (!this.getIsTableView()) {
-        return null;
-      }
+  getNotSelectedFields: function (selectedFields, allFields) {
+    var without = _.without.bind(this, allFields);
+    return without.apply(this, selectedFields);
+  },
 
-      if (!this.isIncludeDocsEnabled()) {
-        return null;
-      }
+  getDisplayCountForTableView: function () {
+    var allFieldCount;
+    var shownCount;
 
-      shownCount = _.uniq(this._tableViewSelectedFields).length;
+    if (!this.getIsTableView()) {
+      return null;
+    }
 
-      allFieldCount = this._tableSchema.length;
-      if (_.contains(this._tableSchema, '_id', '_rev')) {
-        allFieldCount = allFieldCount - 1;
-      }
+    if (!this.isIncludeDocsEnabled()) {
+      return null;
+    }
 
-      if (_.contains(this._tableSchema, '_id', '_rev')) {
-        shownCount = shownCount + 1;
-      }
+    shownCount = _.uniq(this._tableViewSelectedFields).length;
 
-      return {shown: shownCount, allFieldCount: allFieldCount};
-    },
-
-    getTableViewData: function () {
-      var res;
-      var schema;
-      var hasIdOrRev;
-      var hasIdOrRev;
-      var prioritizedFields;
-      var hasBulkDeletableDoc;
-      var database = this.getDatabase();
-      var isView = !!this._collection.view;
-
-      // softmigration remove backbone
-      var data;
-      var collectionType = this._collection.collectionType;
-      data = this._filteredCollection.map(function (el) {
-        return fixDocIdForMango(el.toJSON(), collectionType);
-      });
+    allFieldCount = this._tableSchema.length;
+    if (_.contains(this._tableSchema, '_id', '_rev')) {
+      allFieldCount = allFieldCount - 1;
+    }
 
-      function fixDocIdForMango (doc, docType) {
-        if (docType !== 'MangoIndex') {
-          return doc;
-        }
+    if (_.contains(this._tableSchema, '_id', '_rev')) {
+      shownCount = shownCount + 1;
+    }
 
-        doc.id = doc.ddoc;
+    return {shown: shownCount, allFieldCount: allFieldCount};
+  },
+
+  getTableViewData: function () {
+    var res;
+    var schema;
+    var hasIdOrRev;
+    var hasIdOrRev;
+    var prioritizedFields;
+    var hasBulkDeletableDoc;
+    var database = this.getDatabase();
+    var isView = !!this._collection.view;
+
+    // softmigration remove backbone
+    var data;
+    var collectionType = this._collection.collectionType;
+    data = this._filteredCollection.map(function (el) {
+      return fixDocIdForMango(el.toJSON(), collectionType);
+    });
+
+    function fixDocIdForMango (doc, docType) {
+      if (docType !== 'MangoIndex') {
         return doc;
       }
 
-      function isJSONDocEditable (doc, docType) {
+      doc.id = doc.ddoc;
+      return doc;
+    }
 
-        if (!doc) {
-          return;
-        }
+    function isJSONDocEditable (doc, docType) {
 
-        if (docType === 'MangoIndex') {
-          return false;
-        }
+      if (!doc) {
+        return;
+      }
 
-        if (!Object.keys(doc).length) {
-          return false;
-        }
+      if (docType === 'MangoIndex') {
+        return false;
+      }
 
-        if (!doc._id) {
-          return false;
-        }
+      if (!Object.keys(doc).length) {
+        return false;
+      }
 
-        return true;
+      if (!doc._id) {
+        return false;
       }
 
-      function isJSONDocBulkDeletable (doc, docType) {
-        if (docType === 'MangoIndex') {
-          return doc.type !== 'special';
-        }
+      return true;
+    }
 
-        return !!doc._id && !!doc._rev;
+    function isJSONDocBulkDeletable (doc, docType) {
+      if (docType === 'MangoIndex') {
+        return doc.type !== 'special';
       }
 
-      // softmigration end
+      return !!doc._id && !!doc._rev;
+    }
 
-      var isIncludeDocsEnabled = this.isIncludeDocsEnabled();
-      var notSelectedFields = null;
-      if (isIncludeDocsEnabled) {
+    // softmigration end
 
-        data = this.normalizeTableData(data, isView);
-        schema = this.getPseudoSchema(data);
-        hasIdOrRev = this.hasIdOrRev(schema);
+    var isIncludeDocsEnabled = this.isIncludeDocsEnabled();
+    var notSelectedFields = null;
+    if (isIncludeDocsEnabled) {
 
-        if (!this._isPrioritizedEnabled) {
-          this._tableViewSelectedFields = this._cachedSelected || [];
-        }
-
-        if (this._tableViewSelectedFields.length === 0) {
-          prioritizedFields = this.getPrioritizedFields(data, hasIdOrRev ? 4 : 5);
-          this._tableViewSelectedFields = prioritizedFields;
-          this._cachedSelected = this._tableViewSelectedFields;
-        }
+      data = this.normalizeTableData(data, isView);
+      schema = this.getPseudoSchema(data);
+      hasIdOrRev = this.hasIdOrRev(schema);
 
-        var schemaWithoutMetaDataFields = _.without(schema, '_id', '_rev', '_attachment');
-        notSelectedFields = this.getNotSelectedFields(this._tableViewSelectedFields, schemaWithoutMetaDataFields);
+      if (!this._isPrioritizedEnabled) {
+        this._tableViewSelectedFields = this._cachedSelected || [];
+      }
 
-        if (this._isPrioritizedEnabled) {
-          notSelectedFields = null;
-          this._tableViewSelectedFields = schemaWithoutMetaDataFields;
-        }
+      if (this._tableViewSelectedFields.length === 0) {
+        prioritizedFields = this.getPrioritizedFields(data, hasIdOrRev ? 4 : 5);
+        this._tableViewSelectedFields = prioritizedFields;
+        this._cachedSelected = this._tableViewSelectedFields;
+      }
 
+      var schemaWithoutMetaDataFields = _.without(schema, '_id', '_rev', '_attachment');
+      notSelectedFields = this.getNotSelectedFields(this._tableViewSelectedFields, schemaWithoutMetaDataFields);
 
-      } else {
-        schema = this.getPseudoSchema(data);
-        this._tableViewSelectedFields = _.without(schema, '_id', '_rev', '_attachment');
+      if (this._isPrioritizedEnabled) {
+        notSelectedFields = null;
+        this._tableViewSelectedFields = schemaWithoutMetaDataFields;
       }
 
-      this._notSelectedFields = notSelectedFields;
-      this._tableSchema = schema;
 
-      var dbId = database.safeID();
+    } else {
+      schema = this.getPseudoSchema(data);
+      this._tableViewSelectedFields = _.without(schema, '_id', '_rev', '_attachment');
+    }
 
-      res = data.map(function (doc) {
-        var safeId = app.utils.getSafeIdForDoc(doc._id || doc.id); // inconsistent apis for GET between mango and views
-        var url;
+    this._notSelectedFields = notSelectedFields;
+    this._tableSchema = schema;
 
-        if (safeId) {
-          url = FauxtonAPI.urls('document', 'app', dbId, safeId);
-        }
+    var dbId = database.safeID();
 
-        return {
-          content: doc,
-          id: doc._id || doc.id, // inconsistent apis for GET between mango and views
-          _rev: doc._rev,
-          header: '',
-          keylabel: '',
-          url: url,
-          isDeletable: isJSONDocBulkDeletable(doc, collectionType),
-          isEditable: isJSONDocEditable(doc, collectionType)
-        };
-      }.bind(this));
+    res = data.map(function (doc) {
+      var safeId = app.utils.getSafeIdForDoc(doc._id || doc.id); // inconsistent apis for GET between mango and views
+      var url;
 
-      hasBulkDeletableDoc = this.hasBulkDeletableDoc(this._filteredCollection);
+      if (safeId) {
+        url = FauxtonAPI.urls('document', 'app', dbId, safeId);
+      }
 
       return {
-        notSelectedFields: notSelectedFields,
-        hasMetadata: this.getHasMetadata(schema),
-        selectedFields: this._tableViewSelectedFields,
-        hasBulkDeletableDoc: hasBulkDeletableDoc,
-        schema: schema,
-        results: res,
-        displayedFields: this.getDisplayCountForTableView(),
+        content: doc,
+        id: doc._id || doc.id, // inconsistent apis for GET between mango and views
+        _rev: doc._rev,
+        header: '',
+        keylabel: '',
+        url: url,
+        isDeletable: isJSONDocBulkDeletable(doc, collectionType),
+        isEditable: isJSONDocEditable(doc, collectionType)
       };
-    },
-
-    changeTableViewFields: function (options) {
-      var newSelectedRow = options.newSelectedRow;
-      var i = options.index;
+    }.bind(this));
+
+    hasBulkDeletableDoc = this.hasBulkDeletableDoc(this._filteredCollection);
+
+    return {
+      notSelectedFields: notSelectedFields,
+      hasMetadata: this.getHasMetadata(schema),
+      selectedFields: this._tableViewSelectedFields,
+      hasBulkDeletableDoc: hasBulkDeletableDoc,
+      schema: schema,
+      results: res,
+      displayedFields: this.getDisplayCountForTableView(),
+    };
+  },
+
+  changeTableViewFields: function (options) {
+    var newSelectedRow = options.newSelectedRow;
+    var i = options.index;
+
+    this._tableViewSelectedFields[i] = newSelectedRow;
+  },
+
+  getHasMetadata: function (schema) {
+    return _.contains(schema, '_id', '_rev');
+  },
+
+  hasBulkDeletableDoc: function (docs) {
+    var found = false;
+    var length = docs.length;
+    var i;
+
+    // use a for loop here as we can end it once we found the first id
+    for (i = 0; i < length; i++) {
+      if (docs[i].isBulkDeletable()) {
+        found = true;
+        break;
+      }
+    }
 
-      this._tableViewSelectedFields[i] = newSelectedRow;
-    },
+    return found;
+  },
 
-    getHasMetadata: function (schema) {
-      return _.contains(schema, '_id', '_rev');
-    },
+  hasResults: function () {
+    if (this.isLoading()) { return this.isLoading(); }
+    return this._collection.length > 0;
+  },
 
-    hasBulkDeletableDoc: function (docs) {
-      var found = false;
-      var length = docs.length;
-      var i;
+  isLoading: function () {
+    return this._isLoading;
+  },
 
-      // use a for loop here as we can end it once we found the first id
-      for (i = 0; i < length; i++) {
-        if (docs[i].isBulkDeletable()) {
-          found = true;
-          break;
-        }
-      }
+  selectDoc: function (doc, noReset) {
 
-      return found;
-    },
+    if (!doc._id || doc._id === '_all_docs') {
+      return;
+    }
 
-    hasResults: function () {
-      if (this.isLoading()) { return this.isLoading(); }
-      return this._collection.length > 0;
-    },
+    if (!this._bulkDeleteDocCollection.get(doc._id)) {
+      this._bulkDeleteDocCollection.add(doc);
+      return;
+    }
 
-    isLoading: function () {
-      return this._isLoading;
-    },
+    this._bulkDeleteDocCollection.remove(doc._id);
+  },
 
-    selectDoc: function (doc, noReset) {
+  selectAllDocuments: function () {
+    this.deSelectCurrentCollection();
 
-      if (!doc._id || doc._id === '_all_docs') {
-        return;
-      }
+    this._collection.each(function (doc) {
 
-      if (!this._bulkDeleteDocCollection.get(doc._id)) {
-        this._bulkDeleteDocCollection.add(doc);
+      if (!doc.isBulkDeletable()) {
         return;
       }
 
-      this._bulkDeleteDocCollection.remove(doc._id);
-    },
-
-    selectAllDocuments: function () {
-      this.deSelectCurrentCollection();
-
-      this._collection.each(function (doc) {
-
-        if (!doc.isBulkDeletable()) {
-          return;
-        }
-
-        this.selectDoc({
-          _id: doc.id,
-          _rev: doc.get('_rev'),
-          _deleted: true
-        });
-      }, this);
-
-    },
-
-    deSelectCurrentCollection: function () {
-      this._collection.each(function (doc) {
-
-        if (!doc.isBulkDeletable()) {
-          return;
-        }
-
-        this._bulkDeleteDocCollection.remove(doc.id);
-      }, this);
-    },
-
-    toggleSelectAllDocuments: function () {
-      if (this.areAllDocumentsSelected()) {
-        return this.deSelectCurrentCollection();
-      }
+      this.selectDoc({
+        _id: doc.id,
+        _rev: doc.get('_rev'),
+        _deleted: true
+      });
+    }, this);
 
-      return this.selectAllDocuments();
-    },
+  },
 
-    togglePrioritizedTableView: function () {
-      this._isPrioritizedEnabled = !this._isPrioritizedEnabled;
-    },
+  deSelectCurrentCollection: function () {
+    this._collection.each(function (doc) {
 
-    areAllDocumentsSelected: function () {
-      if (this._collection.length === 0) {
-        return false;
+      if (!doc.isBulkDeletable()) {
+        return;
       }
 
-      var foundAllOnThisPage = true;
-
-      var selected = this._bulkDeleteDocCollection.pluck('_id');
+      this._bulkDeleteDocCollection.remove(doc.id);
+    }, this);
+  },
 
-      this._collection.forEach(function (doc) {
-        if (!doc.isBulkDeletable()) {
-          return;
-        }
-
-        if (!_.contains(selected, doc.id)) {
-          foundAllOnThisPage = false;
-        }
-      }.bind(this));
-
-      return foundAllOnThisPage;
-    },
+  toggleSelectAllDocuments: function () {
+    if (this.areAllDocumentsSelected()) {
+      return this.deSelectCurrentCollection();
+    }
 
-    getSelectedItemsLength: function () {
-      return this._bulkDeleteDocCollection.length;
-    },
+    return this.selectAllDocuments();
+  },
 
-    getDatabase: function () {
-      return this._collection.database;
-    },
+  togglePrioritizedTableView: function () {
+    this._isPrioritizedEnabled = !this._isPrioritizedEnabled;
+  },
 
-    getTextEmptyIndex: function () {
-      return this._textEmptyIndex;
-    },
+  areAllDocumentsSelected: function () {
+    if (this._collection.length === 0) {
+      return false;
+    }
 
-    hasSelectedItem: function () {
-      return this.getSelectedItemsLength() > 0;
-    },
+    var foundAllOnThisPage = true;
 
-    toggleTableView: function (options) {
-      var enableTableView = options.enable;
+    var selected = this._bulkDeleteDocCollection.pluck('_id');
 
-      if (enableTableView) {
-        this._tableView = true;
+    this._collection.forEach(function (doc) {
+      if (!doc.isBulkDeletable()) {
         return;
       }
 
-      this._tableView = false;
-    },
+      if (!_.contains(selected, doc.id)) {
+        foundAllOnThisPage = false;
+      }
+    }.bind(this));
 
-    getIsTableView: function () {
-      return this._tableView;
-    },
+    return foundAllOnThisPage;
+  },
 
-    getIsPrioritizedEnabled: function () {
-      return this._isPrioritizedEnabled;
-    },
+  getSelectedItemsLength: function () {
+    return this._bulkDeleteDocCollection.length;
+  },
 
-    getCurrentViewType: function () {
+  getDatabase: function () {
+    return this._collection.database;
+  },
 
-      if (this._tableView) {
-        return 'table';
-      }
+  getTextEmptyIndex: function () {
+    return this._textEmptyIndex;
+  },
 
-      return 'expanded';
-    },
+  hasSelectedItem: function () {
+    return this.getSelectedItemsLength() > 0;
+  },
 
-    getShowPrioritizedFieldToggler: function () {
-      return this.isIncludeDocsEnabled() && this.getIsTableView();
-    },
+  toggleTableView: function (options) {
+    var enableTableView = options.enable;
 
-    clearResultsBeforeFetch: function () {
-      if (this._collection && this._collection.reset) {
-        this._collection.reset();
-      }
-      this._isLoading = true;
-    },
+    if (enableTableView) {
+      this._tableView = true;
+      return;
+    }
 
-    resultsResetFromFetch: function () {
-      this._isLoading = false;
-    },
+    this._tableView = false;
+  },
 
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.INDEX_RESULTS_NEW_RESULTS:
-          this.newResults(action.options);
-        break;
-        case ActionTypes.INDEX_RESULTS_RESET:
-          this.resultsResetFromFetch();
-        break;
-        case ActionTypes.INDEX_RESULTS_SELECT_DOC:
-          this.selectDoc(action.options);
-        break;
-        case ActionTypes.INDEX_RESULTS_CLEAR_RESULTS:
-          this.clearResultsBeforeFetch();
-        break;
-        case ActionTypes.INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS:
-          this.toggleSelectAllDocuments();
-        break;
-        case ActionTypes.INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE:
-          this.changeTableViewFields(action.options);
-        break;
-        case ActionTypes.INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW:
-          this.togglePrioritizedTableView();
-        break;
-
-        case HeaderActionTypes.TOGGLE_TABLEVIEW:
-          this.toggleTableView(action.options);
-        break;
+  getIsTableView: function () {
+    return this._tableView;
+  },
 
-        case PaginationActionTypes.SET_PAGINATION_DOCUMENT_LIMIT:
-          this.setDocumentLimit(action.docLimit);
-        break;
-        case PaginationActionTypes.PAGINATE_NEXT:
-          this.paginateNext();
-        break;
-        case PaginationActionTypes.PAGINATE_PREVIOUS:
-          this.paginatePrevious();
-        break;
-        case PaginationActionTypes.PER_PAGE_CHANGE:
-          this.resetPagination();
-          this.setPerPage(action.perPage);
-        break;
+  getIsPrioritizedEnabled: function () {
+    return this._isPrioritizedEnabled;
+  },
 
-        default:
-        return;
-        // do nothing
-      }
+  getCurrentViewType: function () {
 
-      this.triggerChange();
+    if (this._tableView) {
+      return 'table';
     }
 
-  });
+    return 'expanded';
+  },
 
-  Stores.indexResultsStore = new Stores.IndexResultsStore();
+  getShowPrioritizedFieldToggler: function () {
+    return this.isIncludeDocsEnabled() && this.getIsTableView();
+  },
 
-  Stores.indexResultsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.indexResultsStore.dispatch);
+  clearResultsBeforeFetch: function () {
+    if (this._collection && this._collection.reset) {
+      this._collection.reset();
+    }
+    this._isLoading = true;
+  },
+
+  resultsResetFromFetch: function () {
+    this._isLoading = false;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.INDEX_RESULTS_NEW_RESULTS:
+        this.newResults(action.options);
+      break;
+      case ActionTypes.INDEX_RESULTS_RESET:
+        this.resultsResetFromFetch();
+      break;
+      case ActionTypes.INDEX_RESULTS_SELECT_DOC:
+        this.selectDoc(action.options);
+      break;
+      case ActionTypes.INDEX_RESULTS_CLEAR_RESULTS:
+        this.clearResultsBeforeFetch();
+      break;
+      case ActionTypes.INDEX_RESULTS_TOOGLE_SELECT_ALL_DOCUMENTS:
+        this.toggleSelectAllDocuments();
+      break;
+      case ActionTypes.INDEX_RESULTS_SELECT_NEW_FIELD_IN_TABLE:
+        this.changeTableViewFields(action.options);
+      break;
+      case ActionTypes.INDEX_RESULTS_TOGGLE_PRIORITIZED_TABLE_VIEW:
+        this.togglePrioritizedTableView();
+      break;
+
+      case HeaderActionTypes.TOGGLE_TABLEVIEW:
+        this.toggleTableView(action.options);
+      break;
+
+      case PaginationActionTypes.SET_PAGINATION_DOCUMENT_LIMIT:
+        this.setDocumentLimit(action.docLimit);
+      break;
+      case PaginationActionTypes.PAGINATE_NEXT:
+        this.paginateNext();
+      break;
+      case PaginationActionTypes.PAGINATE_PREVIOUS:
+        this.paginatePrevious();
+      break;
+      case PaginationActionTypes.PER_PAGE_CHANGE:
+        this.resetPagination();
+        this.setPerPage(action.perPage);
+      break;
+
+      default:
+      return;
+      // do nothing
+    }
 
-  return Stores;
+    this.triggerChange();
+  }
 
 });
+
+Stores.indexResultsStore = new Stores.IndexResultsStore();
+
+Stores.indexResultsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.indexResultsStore.dispatch);
+
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/index-results/tests/index-results.actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/tests/index-results.actionsSpec.js b/app/addons/documents/index-results/tests/index-results.actionsSpec.js
index f4ee3b1..dd64acf 100644
--- a/app/addons/documents/index-results/tests/index-results.actionsSpec.js
+++ b/app/addons/documents/index-results/tests/index-results.actionsSpec.js
@@ -10,93 +10,89 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../actions',
-  '../stores',
-  '../../resources',
-  '../../sidebar/actions',
-  '../../../../../test/mocha/testUtils',
-  '../../tests/document-test-helper',
-
-], function (FauxtonAPI, Actions, Stores, Documents, SidebarActions, testUtils, documentTestHelper) {
-  var assert = testUtils.assert;
-  var restore = testUtils.restore;
-  var store;
-
-  var createDocColumn = documentTestHelper.createDocColumn;
-
-  describe('#deleteSelected', function () {
-    var confirmStub;
-    var bulkDeleteCollection;
-
-    beforeEach(function () {
-      Stores.indexResultsStore = new Stores.IndexResultsStore();
-      Stores.indexResultsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.indexResultsStore.dispatch);
-      store = Stores.indexResultsStore;
-      store.reset();
-
-      bulkDeleteCollection = new Documents.BulkDeleteDocCollection([], {databaseId: '1'});
-      store._bulkDeleteDocCollection = bulkDeleteCollection;
-      store._collection = createDocColumn([{_id: 'testId1'}, {_id: 'testId2'}]);
-
-      store._selectedItems = {
-        'testId1': true,
-        'testId2': true
-      };
-
-      confirmStub = sinon.stub(window, 'confirm');
-      confirmStub.returns(true);
-
-    });
-
-    afterEach(function () {
-      restore(window.confirm);
-      restore(FauxtonAPI.addNotification);
-      restore(Actions.reloadResultsList);
-      restore(SidebarActions.refresh);
-      restore(Actions.newResultsList);
-    });
-
-    it('doesn\'t delete if user denies confirmation', function () {
-      window.confirm.restore();
-
-      var stub = sinon.stub(window, 'confirm');
-      stub.returns(false);
-
-      var spy = sinon.spy(bulkDeleteCollection, 'bulkDelete');
-
-      Actions.deleteSelected(bulkDeleteCollection, 1);
-
-      assert.notOk(spy.calledOnce);
-    });
-
-    it('on success notifies all deleted', function (done) {
-      var spy = sinon.spy(FauxtonAPI, 'addNotification');
-      var sidebarSpy = sinon.spy(SidebarActions, 'refresh');
-      var promise = FauxtonAPI.Deferred();
-      var ids = {
-        errorIds: []
-      };
-      var bulkDelete = {
-        bulkDelete: function () {
-          promise.resolve(ids);
-          return promise;
-        },
-        reset: function () {
-          done();
-        }
-      };
-
-      var reloadResultsListStub = sinon.stub(Actions, 'reloadResultsList');
-      var stubPromise = FauxtonAPI.Deferred();
-      stubPromise.resolve();
-      reloadResultsListStub.returns(stubPromise);
-
-      Actions.deleteSelected(bulkDelete, 1);
-
-      assert.ok(spy.calledOnce);
-      assert.ok(sidebarSpy.calledOnce);
-    });
+import FauxtonAPI from "../../../../core/api";
+import Actions from "../actions";
+import Stores from "../stores";
+import Documents from "../../resources";
+import SidebarActions from "../../sidebar/actions";
+import testUtils from "../../../../../test/mocha/testUtils";
+import documentTestHelper from "../../tests/document-test-helper";
+var assert = testUtils.assert;
+var restore = testUtils.restore;
+var store;
+
+var createDocColumn = documentTestHelper.createDocColumn;
+
+describe('#deleteSelected', function () {
+  var confirmStub;
+  var bulkDeleteCollection;
+
+  beforeEach(function () {
+    Stores.indexResultsStore = new Stores.IndexResultsStore();
+    Stores.indexResultsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.indexResultsStore.dispatch);
+    store = Stores.indexResultsStore;
+    store.reset();
+
+    bulkDeleteCollection = new Documents.BulkDeleteDocCollection([], {databaseId: '1'});
+    store._bulkDeleteDocCollection = bulkDeleteCollection;
+    store._collection = createDocColumn([{_id: 'testId1'}, {_id: 'testId2'}]);
+
+    store._selectedItems = {
+      'testId1': true,
+      'testId2': true
+    };
+
+    confirmStub = sinon.stub(window, 'confirm');
+    confirmStub.returns(true);
+
+  });
+
+  afterEach(function () {
+    restore(window.confirm);
+    restore(FauxtonAPI.addNotification);
+    restore(Actions.reloadResultsList);
+    restore(SidebarActions.refresh);
+    restore(Actions.newResultsList);
+  });
+
+  it('doesn\'t delete if user denies confirmation', function () {
+    window.confirm.restore();
+
+    var stub = sinon.stub(window, 'confirm');
+    stub.returns(false);
+
+    var spy = sinon.spy(bulkDeleteCollection, 'bulkDelete');
+
+    Actions.deleteSelected(bulkDeleteCollection, 1);
+
+    assert.notOk(spy.calledOnce);
+  });
+
+  it('on success notifies all deleted', function (done) {
+    var spy = sinon.spy(FauxtonAPI, 'addNotification');
+    var sidebarSpy = sinon.spy(SidebarActions, 'refresh');
+    var promise = FauxtonAPI.Deferred();
+    var ids = {
+      errorIds: []
+    };
+    var bulkDelete = {
+      bulkDelete: function () {
+        promise.resolve(ids);
+        return promise;
+      },
+      reset: function () {
+        done();
+      }
+    };
+
+    var reloadResultsListStub = sinon.stub(Actions, 'reloadResultsList');
+    var stubPromise = FauxtonAPI.Deferred();
+    stubPromise.resolve();
+    reloadResultsListStub.returns(stubPromise);
+
+    Actions.deleteSelected(bulkDelete, 1);
+
+    assert.ok(spy.calledOnce);
+    assert.ok(sidebarSpy.calledOnce);
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 3092d62..11bf3a3 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
@@ -9,325 +9,322 @@
 // 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',
-  '../index-results.components.react',
-  '../actions',
-  '../stores',
-  '../../resources',
-  '../../../databases/resources',
-  '../../tests/document-test-helper',
-  '../../../../../test/mocha/testUtils',
-  "react",
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, IndexResultsActions, Stores, Documents, Databases, documentTestHelper, utils, React, ReactDOM, TestUtils,
-  sinon) {
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
-
-  var assert = utils.assert;
-  var store = Stores.indexResultsStore;
-  var createDocColumn = documentTestHelper.createDocColumn;
-  var createMangoIndexDocColumn = documentTestHelper.createMangoIndexDocColumn;
-
-  describe('Index Results', function () {
-    var container, instance;
-
-    describe('no results text', function () {
-      beforeEach(function () {
-        container = document.createElement('div');
-        store.reset();
-      });
+import FauxtonAPI from "../../../../core/api";
+import Views from "../index-results.components.react";
+import IndexResultsActions from "../actions";
+import Stores from "../stores";
+import Documents from "../../resources";
+import Databases from "../../../databases/resources";
+import documentTestHelper from "../../tests/document-test-helper";
+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 store = Stores.indexResultsStore;
+var createDocColumn = documentTestHelper.createDocColumn;
+var createMangoIndexDocColumn = documentTestHelper.createMangoIndexDocColumn;
+
+describe('Index Results', function () {
+  var container, instance;
+
+  describe('no results text', function () {
+    beforeEach(function () {
+      container = document.createElement('div');
+      store.reset();
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
+      store.reset();
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
-        store.reset();
+    it('renders a default text', function () {
+      IndexResultsActions.newResultsList({
+        collection: [],
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
+      IndexResultsActions.resultsListReset();
 
-      it('renders a default text', function () {
-        IndexResultsActions.newResultsList({
-          collection: [],
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
-        IndexResultsActions.resultsListReset();
+      instance = TestUtils.renderIntoDocument(<Views.List />, container);
+      var $el = $(ReactDOM.findDOMNode(instance));
+      assert.equal($el.text(), 'No Documents Found');
+    });
 
-        instance = TestUtils.renderIntoDocument(<Views.List />, container);
-        var $el = $(ReactDOM.findDOMNode(instance));
-        assert.equal($el.text(), 'No Documents Found');
+    it('you can change the default text', function () {
+      IndexResultsActions.newResultsList({
+        collection: {
+          forEach: function () {},
+          filter: function () { return []; },
+          fetch: function () {
+            return {
+              then: function (cb) {
+                cb();
+              }
+            };
+          }
+        },
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
+        textEmptyIndex: 'I <3 Hamburg'
       });
 
-      it('you can change the default text', function () {
-        IndexResultsActions.newResultsList({
-          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 = $(ReactDOM.findDOMNode(instance));
-        assert.equal($el.text(), 'I <3 Hamburg');
-      });
+
+      instance = TestUtils.renderIntoDocument(<Views.List />, container);
+      var $el = $(ReactDOM.findDOMNode(instance));
+      assert.equal($el.text(), 'I <3 Hamburg');
     });
+  });
 
-    describe('checkbox rendering', function () {
-      var opts = {
-        params: {},
-        database: {
-          safeID: function () { return '1';}
-        }
-      };
-
-      beforeEach(function () {
-        container = document.createElement('div');
-        store.reset();
-      });
+  describe('checkbox rendering', function () {
+    var opts = {
+      params: {},
+      database: {
+        safeID: function () { return '1';}
+      }
+    };
+
+    beforeEach(function () {
+      container = document.createElement('div');
+      store.reset();
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
-        store.reset();
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
+      store.reset();
+    });
+
+    it('does not render checkboxes for elements with just the special index (Mango Index List)', function () {
+      IndexResultsActions.sendMessageNewResultList({
+        collection: createMangoIndexDocColumn([{foo: 'testId1', type: 'special'}]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
 
-      it('does not render checkboxes for elements with just the special index (Mango Index List)', function () {
-        IndexResultsActions.sendMessageNewResultList({
-          collection: createMangoIndexDocColumn([{foo: 'testId1', type: 'special'}]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
+      store.toggleTableView({enable: true});
 
-        store.toggleTableView({enable: true});
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.resultsListReset();
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
 
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
+      var $el = $(ReactDOM.findDOMNode(instance));
 
-        var $el = $(ReactDOM.findDOMNode(instance));
+      assert.ok($el.find('.tableview-checkbox-cell input').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 () {
+      IndexResultsActions.sendMessageNewResultList({
+        collection: createMangoIndexDocColumn([{
+          ddoc: null,
+          name: 'biene',
+          type: 'json',
+          def: {fields: [{_id: 'desc'}]}
+        },
+        {
+          ddoc: null,
+          name: 'biene',
+          type: 'special',
+          def: {fields: [{_id: 'desc'}]}
+        }]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
 
-      it('renders checkboxes for elements with more than just the the special index (Mango Index List)', function () {
-        IndexResultsActions.sendMessageNewResultList({
-          collection: createMangoIndexDocColumn([{
-            ddoc: null,
-            name: 'biene',
-            type: 'json',
-            def: {fields: [{_id: 'desc'}]}
-          },
-          {
-            ddoc: null,
-            name: 'biene',
-            type: 'special',
-            def: {fields: [{_id: 'desc'}]}
-          }]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
-
-        store.toggleTableView({enable: true});
-
-        IndexResultsActions.resultsListReset();
-
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
-
-        var $el = $(ReactDOM.findDOMNode(instance));
-
-        assert.ok($el.find('.tableview-checkbox-cell input').length > 0);
+      store.toggleTableView({enable: true});
+
+      IndexResultsActions.resultsListReset();
+
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
+
+      var $el = $(ReactDOM.findDOMNode(instance));
+
+      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 () {
+      IndexResultsActions.sendMessageNewResultList({
+        collection: createDocColumn([{
+          ddoc: null,
+          name: 'biene',
+          type: 'special',
+          def: {fields: [{_id: 'desc'}]}
+        }]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
 
-      it('does not render checkboxes for elements with no id in a table (usual docs)', function () {
-        IndexResultsActions.sendMessageNewResultList({
-          collection: createDocColumn([{
-            ddoc: null,
-            name: 'biene',
-            type: 'special',
-            def: {fields: [{_id: 'desc'}]}
-          }]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
+      store.toggleTableView({enable: true});
 
-        store.toggleTableView({enable: true});
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.resultsListReset();
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
 
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
+      var $el = $(ReactDOM.findDOMNode(instance));
 
-        var $el = $(ReactDOM.findDOMNode(instance));
+      assert.ok($el.find('.tableview-checkbox-cell input').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'}]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
 
-      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'}]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
+      store.toggleTableView({enable: true});
 
-        store.toggleTableView({enable: true});
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.resultsListReset();
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
 
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
+      var $el = $(ReactDOM.findDOMNode(instance));
 
-        var $el = $(ReactDOM.findDOMNode(instance));
+      assert.ok($el.find('.tableview-checkbox-cell input').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'}]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
 
-      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'}]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
+      store.toggleTableView({enable: true});
 
-        store.toggleTableView({enable: true});
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.resultsListReset();
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
 
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
+      var $el = $(ReactDOM.findDOMNode(instance));
 
-        var $el = $(ReactDOM.findDOMNode(instance));
+      assert.ok($el.find('.tableview-checkbox-cell input').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'}]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
 
-      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'}]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.resultsListReset();
+      store.toggleTableView({enable: false});
 
-        store.toggleTableView({enable: false});
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
 
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
+      var $el = $(ReactDOM.findDOMNode(instance));
+      assert.ok($el.find('.js-row-select').length > 0);
+    });
 
-        var $el = $(ReactDOM.findDOMNode(instance));
-        assert.ok($el.find('.js-row-select').length > 0);
+    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'}]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
       });
 
-      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'}]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.resultsListReset();
+      store.toggleTableView({enable: false});
 
-        store.toggleTableView({enable: false});
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
 
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
+      var $el = $(ReactDOM.findDOMNode(instance));
 
-        var $el = $(ReactDOM.findDOMNode(instance));
+      assert.notOk($el.hasClass('show-select'));
+    });
 
-        assert.notOk($el.hasClass('show-select'));
-      });
+  });
 
+  describe('cellcontent', function () {
+    beforeEach(function () {
+      container = document.createElement('div');
+      store.reset();
     });
 
-    describe('cellcontent', function () {
-      beforeEach(function () {
-        container = document.createElement('div');
-        store.reset();
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
+      store.reset();
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
-        store.reset();
-      });
+    it('formats title elements for better readability', function () {
+      var doc = {object: {a: 1, foo: [1, 2, 3]}};
 
-      it('formats title elements for better readability', function () {
-        var doc = {object: {a: 1, foo: [1, 2, 3]}};
+      IndexResultsActions.sendMessageNewResultList({
+        collection: createDocColumn([doc]),
+        bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
+      });
 
-        IndexResultsActions.sendMessageNewResultList({
-          collection: createDocColumn([doc]),
-          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
-        });
+      store.toggleTableView({enable: true});
 
-        store.toggleTableView({enable: true});
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.resultsListReset();
+      instance = TestUtils.renderIntoDocument(
+        <Views.List />,
+        container
+      );
 
-        instance = TestUtils.renderIntoDocument(
-          <Views.List />,
-          container
-        );
+      var $el = $(ReactDOM.findDOMNode(instance));
+      var $targetNode = $el.find('td.tableview-el-last').prev();
 
-        var $el = $(ReactDOM.findDOMNode(instance));
-        var $targetNode = $el.find('td.tableview-el-last').prev();
+      var formattedDoc = JSON.stringify(doc.object, null, '  ');
+      assert.equal($targetNode.attr('title'), formattedDoc);
+    });
 
-        var formattedDoc = JSON.stringify(doc.object, null, '  ');
-        assert.equal($targetNode.attr('title'), formattedDoc);
-      });
+  });
 
+  describe('loading', function () {
+    beforeEach(function () {
+      container = document.createElement('div');
+      store.reset();
     });
 
-    describe('loading', function () {
-      beforeEach(function () {
-        container = document.createElement('div');
-        store.reset();
-      });
-
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
-        store.reset();
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
+      store.reset();
+    });
 
-      it('should show loading component', function () {
-        var results = {results: []};
-        instance = TestUtils.renderIntoDocument(
-          <Views.ResultsScreen results={results} isLoading={true} />,
-          container
-        );
+    it('should show loading component', function () {
+      var results = {results: []};
+      instance = TestUtils.renderIntoDocument(
+        <Views.ResultsScreen results={results} isLoading={true} />,
+        container
+      );
 
-        var $el = $(ReactDOM.findDOMNode(instance));
+      var $el = $(ReactDOM.findDOMNode(instance));
 
-        assert.ok($el.find('.loading-lines').length === 1);
-      });
+      assert.ok($el.find('.loading-lines').length === 1);
+    });
 
-      it('should not show loading component', function () {
-        var results = {results: []};
-        instance = TestUtils.renderIntoDocument(
-          <Views.ResultsScreen results={results} isLoading={false} />,
-          container
-        );
+    it('should not show loading component', function () {
+      var results = {results: []};
+      instance = TestUtils.renderIntoDocument(
+        <Views.ResultsScreen results={results} isLoading={false} />,
+        container
+      );
 
-        var $el = $(ReactDOM.findDOMNode(instance));
+      var $el = $(ReactDOM.findDOMNode(instance));
 
-        assert.ok($el.find('.loading-lines').length === 0);
-      });
+      assert.ok($el.find('.loading-lines').length === 0);
     });
-
   });
+
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/components/stores.js b/app/addons/components/stores.js
index 916d6ea..af5a69c 100644
--- a/app/addons/components/stores.js
+++ b/app/addons/components/stores.js
@@ -10,126 +10,120 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-   '../../core/api',
-  '../../app',
-  './actiontypes'
-],
-
-function (FauxtonAPI, app, ActionTypes) {
-  var Stores = {};
-
-  Stores.ComponentStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._apiBarVisible = false;
-      this._apiBarButtonVisible = true;
-      this._endpoint = '';
-      this._docURL = FauxtonAPI.constants.DOC_URLS.GENERAL;
-    },
-
-    updateAPIBar: function (settings) {
-      this._apiBarVisible = settings.contentVisible;
-      this._apiBarButtonVisible = settings.buttonVisible;
-      this._endpoint = settings.endpoint;
-      this._docURL = settings.docURL;
-    },
-
-    setVisibleButton: function (state) {
-      this._apiBarButtonVisible = state;
-    },
-
-    setApiBarVisible: function (state) {
-      this._apiBarVisible = state;
-    },
-
-    getEndpoint: function () {
-      return this._endpoint;
-    },
-
-    getDocURL: function () {
-      return this._docURL;
-    },
-
-    getIsAPIBarButtonVisible: function () {
-      return this._apiBarButtonVisible;
-    },
-
-    getIsAPIBarVisible: function () {
-      return this._apiBarVisible;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.CMPNTS_SHOW_API_BAR_BUTTON:
-          this.setVisibleButton(true);
-        break;
-
-        case ActionTypes.CMPNTS_HIDE_API_BAR_BUTTON:
-          this.setVisibleButton(false);
-        break;
-
-        case ActionTypes.CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE:
-          this.setApiBarVisible(action.options);
-        break;
-
-        case ActionTypes.CMPNTS_UPDATE_API_BAR:
-          this.updateAPIBar(action.options);
-        break;
-
-        default:
-        return;
-          // do nothing
-      }
-
-      this.triggerChange();
+import FauxtonAPI from "../../core/api";
+import app from "../../app";
+import ActionTypes from "./actiontypes";
+var Stores = {};
+
+Stores.ComponentStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._apiBarVisible = false;
+    this._apiBarButtonVisible = true;
+    this._endpoint = '';
+    this._docURL = FauxtonAPI.constants.DOC_URLS.GENERAL;
+  },
+
+  updateAPIBar: function (settings) {
+    this._apiBarVisible = settings.contentVisible;
+    this._apiBarButtonVisible = settings.buttonVisible;
+    this._endpoint = settings.endpoint;
+    this._docURL = settings.docURL;
+  },
+
+  setVisibleButton: function (state) {
+    this._apiBarButtonVisible = state;
+  },
+
+  setApiBarVisible: function (state) {
+    this._apiBarVisible = state;
+  },
+
+  getEndpoint: function () {
+    return this._endpoint;
+  },
+
+  getDocURL: function () {
+    return this._docURL;
+  },
+
+  getIsAPIBarButtonVisible: function () {
+    return this._apiBarButtonVisible;
+  },
+
+  getIsAPIBarVisible: function () {
+    return this._apiBarVisible;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.CMPNTS_SHOW_API_BAR_BUTTON:
+        this.setVisibleButton(true);
+      break;
+
+      case ActionTypes.CMPNTS_HIDE_API_BAR_BUTTON:
+        this.setVisibleButton(false);
+      break;
+
+      case ActionTypes.CMPNTS_SET_API_BAR_CONTENT_VISIBLE_STATE:
+        this.setApiBarVisible(action.options);
+      break;
+
+      case ActionTypes.CMPNTS_UPDATE_API_BAR:
+        this.updateAPIBar(action.options);
+      break;
+
+      default:
+      return;
+        // do nothing
     }
-  });
 
-  Stores.DeleteDbModalStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
+    this.triggerChange();
+  }
+});
 
-    reset: function () {
-      this._deleteModal = {showDeleteModal: false, dbId: '', isSystemDatabase: false};
-    },
+Stores.DeleteDbModalStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
 
-    setDeleteModal: function (options) {
-      options.isSystemDatabase = app.utils.isSystemDatabase(options.dbId);
-      this._deleteModal = options;
-    },
+  reset: function () {
+    this._deleteModal = {showDeleteModal: false, dbId: '', isSystemDatabase: false};
+  },
 
-    getShowDeleteDatabaseModal: function () {
-      return this._deleteModal;
-    },
+  setDeleteModal: function (options) {
+    options.isSystemDatabase = app.utils.isSystemDatabase(options.dbId);
+    this._deleteModal = options;
+  },
 
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.CMPNTS_DATABASES_SHOWDELETE_MODAL:
-          this.setDeleteModal(action.options);
-        break;
+  getShowDeleteDatabaseModal: function () {
+    return this._deleteModal;
+  },
 
-        default:
-        return;
-      }
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.CMPNTS_DATABASES_SHOWDELETE_MODAL:
+        this.setDeleteModal(action.options);
+      break;
 
-      this.triggerChange();
+      default:
+      return;
     }
-  });
 
+    this.triggerChange();
+  }
+});
 
 
 
-  Stores.deleteDbModalStore = new Stores.DeleteDbModalStore();
-  Stores.deleteDbModalStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.deleteDbModalStore.dispatch);
 
-  Stores.componentStore = new Stores.ComponentStore();
-  Stores.componentStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.componentStore.dispatch);
+Stores.deleteDbModalStore = new Stores.DeleteDbModalStore();
+Stores.deleteDbModalStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.deleteDbModalStore.dispatch);
 
-  return Stores;
+Stores.componentStore = new Stores.ComponentStore();
+Stores.componentStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.componentStore.dispatch);
 
-});
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/apiBarControllerSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/apiBarControllerSpec.react.jsx b/app/addons/components/tests/apiBarControllerSpec.react.jsx
index 36a639b..edb016c 100644
--- a/app/addons/components/tests/apiBarControllerSpec.react.jsx
+++ b/app/addons/components/tests/apiBarControllerSpec.react.jsx
@@ -9,171 +9,168 @@
 // 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',
-  '../actions',
-  '../stores',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react-addons-test-utils',
-  'sinon',
-  'react',
-  'react-dom'
-], function (FauxtonAPI, Actions, Stores, ReactComponents, utils, TestUtils, sinon, React, ReactDOM) {
-
-  var assert = utils.assert;
-  var componentStore = Stores.componentStore;
-  var ApiBarController = ReactComponents.ApiBarController;
-
-
-  describe('ApiBarController', function () {
-    var container;
-
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
+import FauxtonAPI from "../../../core/api";
+import Actions from "../actions";
+import Stores from "../stores";
+import ReactComponents from "../react-components.react";
+import utils from "../../../../test/mocha/testUtils";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+import React from "react";
+import ReactDOM from "react-dom";
+
+var assert = utils.assert;
+var componentStore = Stores.componentStore;
+var ApiBarController = ReactComponents.ApiBarController;
+
+
+describe('ApiBarController', function () {
+  var container;
+
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-      componentStore.reset();
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+    componentStore.reset();
+  });
 
-    it('Doesn\'t show up when explicitly set to visible false', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      Actions.updateAPIBar({
-        buttonVisible: false,
-        endpoint: 'http://link.example.com',
-        docURL: 'http://link.example.com',
-        contentVisible: false
-      });
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 0);
+  it('Doesn\'t show up when explicitly set to visible false', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    Actions.updateAPIBar({
+      buttonVisible: false,
+      endpoint: 'http://link.example.com',
+      docURL: 'http://link.example.com',
+      contentVisible: false
     });
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 0);
+  });
 
-    it('Shows up when set to visible', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: 'http://link.example.com',
-        docURL: 'http://link.example.com',
-        contentVisible: false
-      });
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 1);
+  it('Shows up when set to visible', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: 'http://link.example.com',
+      docURL: 'http://link.example.com',
+      contentVisible: false
     });
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 1);
+  });
 
-    it('Doesn\'t show up when set to visible BUT there\'s no endpoint defined', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: '',
-        docURL: 'http://link.example.com',
-        contentVisible: false
-      });
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 0);
+  it('Doesn\'t show up when set to visible BUT there\'s no endpoint defined', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: '',
+      docURL: 'http://link.example.com',
+      contentVisible: false
     });
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 0);
+  });
 
-    it('Confirm hide/show actions update component', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+  it('Confirm hide/show actions update component', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
 
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: 'http://rocko.example.com',
-        docURL: 'http://link.example.com',
-        contentVisible: false
-      });
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: 'http://rocko.example.com',
+      docURL: 'http://link.example.com',
+      contentVisible: false
+    });
 
-      Actions.showAPIBarButton();
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 1, 'showAPIBarButton');
+    Actions.showAPIBarButton();
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 1, 'showAPIBarButton');
 
-      Actions.hideAPIBarButton();
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 0, 'hideAPIBarButton');
+    Actions.hideAPIBarButton();
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url').length, 0, 'hideAPIBarButton');
+  });
+
+  it('Confirm doc link icon appears when docURL set', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: 'http://rocko.example.com',
+      docURL: 'http://doc.example.com',
+      contentVisible: false
     });
 
-    it('Confirm doc link icon appears when docURL set', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: 'http://rocko.example.com',
-        docURL: 'http://doc.example.com',
-        contentVisible: false
-      });
-
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').length, 1);
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').length, 1);
+  });
+
+  it('Confirm doc link icon doesn\'t appear with no docURL', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: 'http://rocko.example.com',
+      docURL: null,
+      contentVisible: false
     });
 
-    it('Confirm doc link icon doesn\'t appear with no docURL', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: 'http://rocko.example.com',
-        docURL: null,
-        contentVisible: false
-      });
-
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').length, 0);
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').length, 0);
+  });
+
+  it('Confirm endpoint appears in markup', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    var link = 'http://booyah.example.com';
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: link,
+      docURL: null,
+      contentVisible: false
     });
 
-    it('Confirm endpoint appears in markup', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      var link = 'http://booyah.example.com';
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: link,
-        docURL: null,
-        contentVisible: false
-      });
-
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.text-field-to-copy').val(), link);
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.text-field-to-copy').val(), link);
+  });
+
+  it('Confirm endpoint is updated in markup', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    var link = 'http://booyah.example.com';
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: link,
+      docURL: null,
+      contentVisible: false
     });
 
-    it('Confirm endpoint is updated in markup', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      var link = 'http://booyah.example.com';
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: link,
-        docURL: null,
-        contentVisible: false
-      });
-
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.text-field-to-copy').val(), link);
-
-      var newLink = 'http://chickensarenoisy.example.com';
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: newLink,
-        docURL: null,
-        contentVisible: true
-      });
-
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.text-field-to-copy').val(), newLink);
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.text-field-to-copy').val(), link);
+
+    var newLink = 'http://chickensarenoisy.example.com';
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: newLink,
+      docURL: null,
+      contentVisible: true
     });
 
-    it('Confirm doc URL is updated in markup after a change', function () {
-      var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
-      var docLink = 'http://mydoc.example.com';
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: 'http://whatever.example.com',
-        docURL: docLink,
-        contentVisible: false
-      });
-
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').attr('href'), docLink);
-
-      var newDocLink = 'http://newawesomedoclink.example.com';
-      Actions.updateAPIBar({
-        buttonVisible: true,
-        endpoint: 'http://whatever.example.com',
-        docURL: newDocLink,
-        contentVisible: true
-      });
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').attr('href'), newDocLink);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.text-field-to-copy').val(), newLink);
+  });
+
+  it('Confirm doc URL is updated in markup after a change', function () {
+    var el = TestUtils.renderIntoDocument(<ApiBarController />, container);
+    var docLink = 'http://mydoc.example.com';
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: 'http://whatever.example.com',
+      docURL: docLink,
+      contentVisible: false
     });
 
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.control-toggle-api-url')[0]);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').attr('href'), docLink);
+
+    var newDocLink = 'http://newawesomedoclink.example.com';
+    Actions.updateAPIBar({
+      buttonVisible: true,
+      endpoint: 'http://whatever.example.com',
+      docURL: newDocLink,
+      contentVisible: true
+    });
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.help-link').attr('href'), newDocLink);
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/badgesSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/badgesSpec.react.jsx b/app/addons/components/tests/badgesSpec.react.jsx
index 5504cc1..23cf3ef 100644
--- a/app/addons/components/tests/badgesSpec.react.jsx
+++ b/app/addons/components/tests/badgesSpec.react.jsx
@@ -9,48 +9,45 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils) {
-
-  var assert = utils.assert;
-
-  describe('Badges', function () {
-    var container, instance;
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
-    });
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+import utils from "../../../../test/mocha/testUtils";
+import React from "react";
+import ReactDOM from "react-dom";
+import TestUtils from "react-addons-test-utils";
+
+var assert = utils.assert;
+
+describe('Badges', function () {
+  var container, instance;
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    it('renders a list of badges', function () {
-      instance = TestUtils.renderIntoDocument(
-        <ReactComponents.BadgeList elements={['foo', 'bar']} removeBadge={function () {}} />,
-        container
-      );
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(instance).parentNode);
+  });
 
-      var $el = $(ReactDOM.findDOMNode(instance));
+  it('renders a list of badges', function () {
+    instance = TestUtils.renderIntoDocument(
+      <ReactComponents.BadgeList elements={['foo', 'bar']} removeBadge={function () {}} />,
+      container
+    );
 
-      assert.equal($el.find('.component-badge').length, 2);
-    });
+    var $el = $(ReactDOM.findDOMNode(instance));
 
-    it('supports custom label formatters', function () {
-      instance = TestUtils.renderIntoDocument(
-        <ReactComponents.BadgeList elements={['foo', 'bar']} removeBadge={function () {}} getLabel={function (el) { return el + 'foo'; }} />,
-        container
-      );
+    assert.equal($el.find('.component-badge').length, 2);
+  });
 
-      var $el = $(ReactDOM.findDOMNode(instance));
+  it('supports custom label formatters', function () {
+    instance = TestUtils.renderIntoDocument(
+      <ReactComponents.BadgeList elements={['foo', 'bar']} removeBadge={function () {}} getLabel={function (el) { return el + 'foo'; }} />,
+      container
+    );
 
-      assert.equal($el.find('.component-badge').text(), 'foofoo�barfoo�');
-    });
+    var $el = $(ReactDOM.findDOMNode(instance));
 
+    assert.equal($el.find('.component-badge').text(), 'foofoo�barfoo�');
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/beautifySpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/beautifySpec.react.jsx b/app/addons/components/tests/beautifySpec.react.jsx
index ab48db6..7306b96 100644
--- a/app/addons/components/tests/beautifySpec.react.jsx
+++ b/app/addons/components/tests/beautifySpec.react.jsx
@@ -9,62 +9,59 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('Beautify', function () {
-    var container, beautifyEl;
+describe('Beautify', function () {
+  var container, beautifyEl;
 
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('should be empty for multi-lined code', function () {
-      var correctCode = 'function() {\n    console.log("hello");\n}';
-      beautifyEl = TestUtils.renderIntoDocument(
-        <ReactComponents.Beautify code={correctCode}/>,
-        container
-      );
-      assert.ok(_.isNull(ReactDOM.findDOMNode(beautifyEl)));
-    });
+  it('should be empty for multi-lined code', function () {
+    var correctCode = 'function() {\n    console.log("hello");\n}';
+    beautifyEl = TestUtils.renderIntoDocument(
+      <ReactComponents.Beautify code={correctCode}/>,
+      container
+    );
+    assert.ok(_.isNull(ReactDOM.findDOMNode(beautifyEl)));
+  });
 
-    it('should have button to beautify for single line code', function () {
-      var badCode = 'function () { console.log("hello"); }';
-      beautifyEl = TestUtils.renderIntoDocument(<ReactComponents.Beautify code={badCode}/>, container);
-      assert.ok($(ReactDOM.findDOMNode(beautifyEl)).hasClass('beautify'));
-    });
+  it('should have button to beautify for single line code', function () {
+    var badCode = 'function () { console.log("hello"); }';
+    beautifyEl = TestUtils.renderIntoDocument(<ReactComponents.Beautify code={badCode}/>, container);
+    assert.ok($(ReactDOM.findDOMNode(beautifyEl)).hasClass('beautify'));
+  });
 
-    it('on click beautifies code', function () {
-      var fixedCode;
-      var correctCode = 'function() {\n    console.log("hello");\n}';
+  it('on click beautifies code', function () {
+    var fixedCode;
+    var correctCode = 'function() {\n    console.log("hello");\n}';
 
-      var beautifiedCode = function (code) {
-        fixedCode = code;
-      };
+    var beautifiedCode = function (code) {
+      fixedCode = code;
+    };
 
-      beautifyEl = TestUtils.renderIntoDocument(
-        <ReactComponents.Beautify
-          beautifiedCode={beautifiedCode}
-          code={'function() { console.log("hello"); }'}
-          noOfLines={1}/>,
-        container
-      );
-      TestUtils.Simulate.click(ReactDOM.findDOMNode(beautifyEl));
-      assert.equal(fixedCode, correctCode);
+    beautifyEl = TestUtils.renderIntoDocument(
+      <ReactComponents.Beautify
+        beautifiedCode={beautifiedCode}
+        code={'function() { console.log("hello"); }'}
+        noOfLines={1}/>,
+      container
+    );
+    TestUtils.Simulate.click(ReactDOM.findDOMNode(beautifyEl));
+    assert.equal(fixedCode, correctCode);
 
-    });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/codeEditorPanelSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/codeEditorPanelSpec.react.jsx b/app/addons/components/tests/codeEditorPanelSpec.react.jsx
index 7d76162..1b62151 100644
--- a/app/addons/components/tests/codeEditorPanelSpec.react.jsx
+++ b/app/addons/components/tests/codeEditorPanelSpec.react.jsx
@@ -9,81 +9,77 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
 
-  var assert = utils.assert;
-  var codeNoNewlines = 'function (doc) {emit(doc._id, 1);}';
-  var code = 'function (doc) {\n  emit(doc._id, 1);\n}';
+var assert = utils.assert;
+var codeNoNewlines = 'function (doc) {emit(doc._id, 1);}';
+var code = 'function (doc) {\n  emit(doc._id, 1);\n}';
 
-  describe('CodeEditorPanel', function () {
+describe('CodeEditorPanel', function () {
 
-    describe('Doc icon', function () {
-      it('hidden by default', function () {
-        var container = document.createElement('div');
-        var codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditorPanel defaultCode={code} />,
-          container
-        );
-        assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.icon-question-sign').length, 0);
-      });
-      it('hidden by default', function () {
-        var container = document.createElement('div');
-        var codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditorPanel defaultCode={code} docLink="http://link.com" />,
-          container
-        );
-        assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.icon-question-sign').length, 1);
-      });
+  describe('Doc icon', function () {
+    it('hidden by default', function () {
+      var container = document.createElement('div');
+      var codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditorPanel defaultCode={code} />,
+        container
+      );
+      assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.icon-question-sign').length, 0);
     });
+    it('hidden by default', function () {
+      var container = document.createElement('div');
+      var codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditorPanel defaultCode={code} docLink="http://link.com" />,
+        container
+      );
+      assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.icon-question-sign').length, 1);
+    });
+  });
 
-    describe('Zen Mode', function () {
-      it('shows zen mode by default', function () {
-        var container = document.createElement('div');
-        var codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditorPanel defaultCode={code} />,
-          container
-        );
-        assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.zen-editor-icon').length, 1);
-      });
+  describe('Zen Mode', function () {
+    it('shows zen mode by default', function () {
+      var container = document.createElement('div');
+      var codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditorPanel defaultCode={code} />,
+        container
+      );
+      assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.zen-editor-icon').length, 1);
+    });
 
-      it('omits zen mode if explicitly turned off', function () {
-        var container = document.createElement('div');
-        var codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditor defaultCode={code} allowZenMode={false} />,
-          container
-        );
-        assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.zen-editor-icon').length, 0);
-      });
+    it('omits zen mode if explicitly turned off', function () {
+      var container = document.createElement('div');
+      var codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditor defaultCode={code} allowZenMode={false} />,
+        container
+      );
+      assert.equal($(ReactDOM.findDOMNode(codeEditorEl)).find('.zen-editor-icon').length, 0);
     });
+  });
 
-    describe('Beautify', function () {
-      it('confirm clicking beautify actually works within context of component', function () {
-        var container = document.createElement('div');
-        var codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditorPanel
-            defaultCode={codeNoNewlines}
-          />,
-          container
-        );
+  describe('Beautify', function () {
+    it('confirm clicking beautify actually works within context of component', function () {
+      var container = document.createElement('div');
+      var codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditorPanel
+          defaultCode={codeNoNewlines}
+        />,
+        container
+      );
 
-        // confirm there are no newlines in the code at this point
-        assert.equal(codeEditorEl.getValue().match(/\n/g), null);
+      // confirm there are no newlines in the code at this point
+      assert.equal(codeEditorEl.getValue().match(/\n/g), null);
 
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(codeEditorEl)).find('.beautify')[0]);
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(codeEditorEl)).find('.beautify')[0]);
 
-        // now confirm newlines are found
-        assert.equal(codeEditorEl.getValue().match(/\n/g).length, 2);
-      });
+      // now confirm newlines are found
+      assert.equal(codeEditorEl.getValue().match(/\n/g).length, 2);
     });
-
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/codeEditorSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/codeEditorSpec.react.jsx b/app/addons/components/tests/codeEditorSpec.react.jsx
index 99c5d17..7f45057 100644
--- a/app/addons/components/tests/codeEditorSpec.react.jsx
+++ b/app/addons/components/tests/codeEditorSpec.react.jsx
@@ -9,106 +9,103 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
 
-  var assert = utils.assert;
-  var code = 'function (doc) {\n  emit(doc._id, 1);\n}';
-  var code2 = 'function (doc) {\n if(doc._id) { \n emit(doc._id, 2); \n } \n}';
+var assert = utils.assert;
+var code = 'function (doc) {\n  emit(doc._id, 1);\n}';
+var code2 = 'function (doc) {\n if(doc._id) { \n emit(doc._id, 2); \n } \n}';
 
-  var ignorableErrors = [
-    'Missing name in function declaration.',
-    "['{a}'] is better written in dot notation."
-  ];
+var ignorableErrors = [
+  'Missing name in function declaration.',
+  "['{a}'] is better written in dot notation."
+];
 
-  describe('Code Editor', function () {
-    var container, codeEditorEl, spy;
+describe('Code Editor', function () {
+  var container, codeEditorEl, spy;
 
-    beforeEach(function () {
-      spy = sinon.spy();
-      container = document.createElement('div');
-      codeEditorEl = TestUtils.renderIntoDocument(
-        <ReactComponents.CodeEditor defaultCode={code} blur={spy} />,
-        container
-      );
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  beforeEach(function () {
+    spy = sinon.spy();
+    container = document.createElement('div');
+    codeEditorEl = TestUtils.renderIntoDocument(
+      <ReactComponents.CodeEditor defaultCode={code} blur={spy} />,
+      container
+    );
+  });
 
-    describe('Tracking edits', function () {
-      it('no change on mount', function () {
-        assert.notOk(codeEditorEl.hasChanged());
-      });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-      it('detects change on user input', function () {
-        codeEditorEl.editor.setValue(code2, -1);
-        assert.ok(codeEditorEl.hasChanged());
-      });
+  describe('Tracking edits', function () {
+    it('no change on mount', function () {
+      assert.notOk(codeEditorEl.hasChanged());
     });
 
-    describe('onBlur', function () {
-      it('calls blur function', function () {
-        codeEditorEl.editor._emit('blur');
-        assert.ok(spy.calledOnce);
-      });
+    it('detects change on user input', function () {
+      codeEditorEl.editor.setValue(code2, -1);
+      assert.ok(codeEditorEl.hasChanged());
     });
+  });
 
-    describe('setHeightToLineCount', function () {
-      it('check default num lines #1', function () {
-        codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditor code={code} setHeightToLineCount={true} />,
-          container
-        );
-        assert.ok(codeEditorEl.editor.getSession().getDocument().getLength(), 3);
-      });
-      it('check default num lines #2', function () {
-        codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditor code={code2} setHeightToLineCount={true} />,
-          container
-        );
-        assert.ok(codeEditorEl.editor.getSession().getDocument().getLength(), 5);
-      });
-      it('check maxLines', function () {
-        codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditor code={code2} setHeightToLineCount={true} maxLines={2} />,
-          container
-        );
-        assert.ok(codeEditorEl.editor.getSession().getDocument().getLength(), 2);
-      });
+  describe('onBlur', function () {
+    it('calls blur function', function () {
+      codeEditorEl.editor._emit('blur');
+      assert.ok(spy.calledOnce);
     });
+  });
 
-    describe('removeIncorrectAnnotations', function () {
-      beforeEach(function () {
-        codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditor defaultCode={code} ignorableErrors={ignorableErrors} />,
-          container
-        );
-      });
-      it('removes default errors that do not apply to CouchDB Views', function () {
-        assert.equal(codeEditorEl.getAnnotations(), 0);
-      });
+  describe('setHeightToLineCount', function () {
+    it('check default num lines #1', function () {
+      codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditor code={code} setHeightToLineCount={true} />,
+        container
+      );
+      assert.ok(codeEditorEl.editor.getSession().getDocument().getLength(), 3);
+    });
+    it('check default num lines #2', function () {
+      codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditor code={code2} setHeightToLineCount={true} />,
+        container
+      );
+      assert.ok(codeEditorEl.editor.getSession().getDocument().getLength(), 5);
     });
+    it('check maxLines', function () {
+      codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditor code={code2} setHeightToLineCount={true} maxLines={2} />,
+        container
+      );
+      assert.ok(codeEditorEl.editor.getSession().getDocument().getLength(), 2);
+    });
+  });
 
-    describe('getEditor', function () {
-      beforeEach(function () {
-        codeEditorEl = TestUtils.renderIntoDocument(
-          <ReactComponents.CodeEditor defaultCode={code} />,
-          container
-        );
-      });
-      it('returns a reference to get access to the editor', function () {
-        assert.ok(codeEditorEl.getEditor());
-      });
+  describe('removeIncorrectAnnotations', function () {
+    beforeEach(function () {
+      codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditor defaultCode={code} ignorableErrors={ignorableErrors} />,
+        container
+      );
     });
+    it('removes default errors that do not apply to CouchDB Views', function () {
+      assert.equal(codeEditorEl.getAnnotations(), 0);
+    });
+  });
 
+  describe('getEditor', function () {
+    beforeEach(function () {
+      codeEditorEl = TestUtils.renderIntoDocument(
+        <ReactComponents.CodeEditor defaultCode={code} />,
+        container
+      );
+    });
+    it('returns a reference to get access to the editor', function () {
+      assert.ok(codeEditorEl.getEditor());
+    });
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/confirmButtonSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/confirmButtonSpec.react.jsx b/app/addons/components/tests/confirmButtonSpec.react.jsx
index 2bc9bbf..cc44b7c 100644
--- a/app/addons/components/tests/confirmButtonSpec.react.jsx
+++ b/app/addons/components/tests/confirmButtonSpec.react.jsx
@@ -9,63 +9,60 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('ConfirmButton', function () {
-    var container, button;
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+describe('ConfirmButton', function () {
+  var container, button;
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    it('should render text properties', function () {
-      button = TestUtils.renderIntoDocument(
-        <ReactComponents.ConfirmButton text="Click here to render Rocko Artischocko" />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(button)).text(), 'Click here to render Rocko Artischocko');
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('should use onClick handler if provided', function () {
-      var spy = sinon.spy();
+  it('should render text properties', function () {
+    button = TestUtils.renderIntoDocument(
+      <ReactComponents.ConfirmButton text="Click here to render Rocko Artischocko" />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(button)).text(), 'Click here to render Rocko Artischocko');
+  });
 
-      button = TestUtils.renderIntoDocument(
-        <ReactComponents.ConfirmButton text="Click here" onClick={spy} />,
-        container
-      );
+  it('should use onClick handler if provided', function () {
+    var spy = sinon.spy();
 
-      TestUtils.Simulate.click(ReactDOM.findDOMNode(button));
-      assert.ok(spy.calledOnce);
-    });
+    button = TestUtils.renderIntoDocument(
+      <ReactComponents.ConfirmButton text="Click here" onClick={spy} />,
+      container
+    );
 
-    it('shows icon by default', function () {
-      button = TestUtils.renderIntoDocument(
-        <ReactComponents.ConfirmButton text="Click here" onClick={function () { }} />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(button)).find('.icon').length, 1);
-    });
+    TestUtils.Simulate.click(ReactDOM.findDOMNode(button));
+    assert.ok(spy.calledOnce);
+  });
 
-    it('optionally omits the icon', function () {
-      button = TestUtils.renderIntoDocument(
-        <ReactComponents.ConfirmButton text="Click here" onClick={function () { }} showIcon={false} />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(button)).find('.icon').length, 0);
-    });
+  it('shows icon by default', function () {
+    button = TestUtils.renderIntoDocument(
+      <ReactComponents.ConfirmButton text="Click here" onClick={function () { }} />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(button)).find('.icon').length, 1);
+  });
 
+  it('optionally omits the icon', function () {
+    button = TestUtils.renderIntoDocument(
+      <ReactComponents.ConfirmButton text="Click here" onClick={function () { }} showIcon={false} />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(button)).find('.icon').length, 0);
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/deleteDatabaseModalSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/deleteDatabaseModalSpec.react.jsx b/app/addons/components/tests/deleteDatabaseModalSpec.react.jsx
index 609bb43..32e6a52 100644
--- a/app/addons/components/tests/deleteDatabaseModalSpec.react.jsx
+++ b/app/addons/components/tests/deleteDatabaseModalSpec.react.jsx
@@ -9,70 +9,66 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react-bootstrap',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-], function (FauxtonAPI, ReactComponents, utils, ReactBootstrap, React, ReactDOM, TestUtils) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+import utils from "../../../../test/mocha/testUtils";
+import { Modal } from "react-bootstrap";
+import React from "react";
+import ReactDOM from "react-dom";
+import TestUtils from "react-addons-test-utils";
 
-  var assert = utils.assert;
-  var Modal = ReactBootstrap.Modal;
+var assert = utils.assert;
 
-  function noop () {}
+function noop () {}
 
-  describe('DeleteDatabaseModal', function () {
-    var container, instance;
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
+describe('DeleteDatabaseModal', function () {
+  var container, instance;
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('submitting is disabled when initially rendered', function () {
-      instance = TestUtils.renderIntoDocument(
-        <ReactComponents.DeleteDatabaseModal
-          showHide={noop}
-          modalProps={{isSystemDatabase: false, showDeleteModal: true, dbId: 'fooo'}} />,
-        container
-      );
+  it('submitting is disabled when initially rendered', function () {
+    instance = TestUtils.renderIntoDocument(
+      <ReactComponents.DeleteDatabaseModal
+        showHide={noop}
+        modalProps={{isSystemDatabase: false, showDeleteModal: true, dbId: 'fooo'}} />,
+      container
+    );
 
-      assert.ok($('body').find('.modal').find('button.delete').prop('disabled'));
-    });
+    assert.ok($('body').find('.modal').find('button.delete').prop('disabled'));
+  });
 
-    it('submitting is disabled when garbage entered', function () {
-      instance = TestUtils.renderIntoDocument(
-        <ReactComponents.DeleteDatabaseModal
-          showHide={noop}
-          modalProps={{isSystemDatabase: false, showDeleteModal: true, dbId: 'fooo'}} />,
-        container
-      );
+  it('submitting is disabled when garbage entered', function () {
+    instance = TestUtils.renderIntoDocument(
+      <ReactComponents.DeleteDatabaseModal
+        showHide={noop}
+        modalProps={{isSystemDatabase: false, showDeleteModal: true, dbId: 'fooo'}} />,
+      container
+    );
 
-      var input = $('body').find('.modal').find('input')[0];
+    var input = $('body').find('.modal').find('input')[0];
 
-      TestUtils.Simulate.change(input, {target: {value: 'Hello, world'}});
-      assert.ok($('body').find('.modal').find('button.delete').prop('disabled'));
-    });
+    TestUtils.Simulate.change(input, {target: {value: 'Hello, world'}});
+    assert.ok($('body').find('.modal').find('button.delete').prop('disabled'));
+  });
 
-    it('submitting is enabled when same db name entered', function () {
-      instance = TestUtils.renderIntoDocument(
-        <ReactComponents.DeleteDatabaseModal
-          showHide={noop}
-          modalProps={{isSystemDatabase: false, showDeleteModal: true, dbId: 'fooo'}} />,
-        container
-      );
+  it('submitting is enabled when same db name entered', function () {
+    instance = TestUtils.renderIntoDocument(
+      <ReactComponents.DeleteDatabaseModal
+        showHide={noop}
+        modalProps={{isSystemDatabase: false, showDeleteModal: true, dbId: 'fooo'}} />,
+      container
+    );
 
-      var input = $('body').find('.modal').find('input')[0];
+    var input = $('body').find('.modal').find('input')[0];
 
-      TestUtils.Simulate.change(input, {target: {value: 'fooo'}});
-      assert.notOk($('body').find('.modal').find('button.delete').prop('disabled'));
-    });
+    TestUtils.Simulate.change(input, {target: {value: 'fooo'}});
+    assert.notOk($('body').find('.modal').find('button.delete').prop('disabled'));
+  });
 
 
-  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/docSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/docSpec.react.jsx b/app/addons/components/tests/docSpec.react.jsx
index 1eb52bd..dd12277 100644
--- a/app/addons/components/tests/docSpec.react.jsx
+++ b/app/addons/components/tests/docSpec.react.jsx
@@ -9,167 +9,163 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
-
-  var assert = utils.assert;
-
-  describe('Document', function () {
-    var container, el;
-
-    var doc = {};
-    _.times(1000, function (n) {
-      doc['prop' + n] = n;
-    });
-    var docContent = JSON.stringify(doc, null, '  ');
-
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(el).parentNode);
-    });
-
-    it('hosts child elements', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document>
-          <div className="foo-children"></div>
-        </ReactComponents.Document>,
-        container
-      );
-      assert.ok($(ReactDOM.findDOMNode(el)).find('.foo-children').length);
-    });
-
-    it('does not require child elements', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document />,
-        container
-      );
-      assert.notOk($(ReactDOM.findDOMNode(el)).find('.doc-edit-symbol').length);
-    });
-
-    it('you can check it', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document isDeletable={true} checked={true} docIdentifier="foo" />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(el)).find('[data-checked="true"]').length, 1);
-    });
-
-    it('you can uncheck it', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document isDeletable={true} docIdentifier="foo" />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(el)).find('[data-checked="true"]').length, 0);
-    });
-
-    it('it calls an onchange callback', function () {
-      var spy = sinon.spy();
-
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document doc={{id: "foo"}} isDeletable={true} docChecked={spy} docIdentifier="foo" />,
-        container
-      );
-      var testEl = $(ReactDOM.findDOMNode(el)).find('input[type="checkbox"]')[0];
-      TestUtils.Simulate.change(testEl, {target: {value: 'Hello, world'}});
-      assert.ok(spy.calledOnce);
-    });
-
-    it('it calls an dblclick callback', function () {
-      var spy = sinon.spy();
-
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document isDeletable={true} onDoubleClick={spy} docIdentifier="foo" />,
-        container
-      );
-      TestUtils.Simulate.doubleClick(ReactDOM.findDOMNode(el));
-      assert.ok(spy.calledOnce);
-    });
-
-    it('can render without checkbox', function () {
-      var spy = sinon.spy();
-
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document isDeletable={false} onDoubleClick={spy} docIdentifier="foo" />,
-        container
-      );
-      assert.notOk($(ReactDOM.findDOMNode(el)).find('input[type="checkbox"]').length);
-      assert.ok($(ReactDOM.findDOMNode(el)).find('.checkbox-dummy').length);
-    });
-
-    it('contains a doc-data element when there\'s doc content', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document isDeletable={true} checked={true} docIdentifier="foo" docContent='{ "content": true }' />,
-        container
-      );
-      assert.equal(1, $(ReactDOM.findDOMNode(el)).find('.doc-data').length);
-    });
-
-    it('doesn\'t contain a doc-data element when there\'s no doc content', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document isDeletable={true} checked={true} docIdentifier="foo" docContent='' />,
-        container
-      );
-      assert.equal(0, $(ReactDOM.findDOMNode(el)).find('.doc-data').length);
-    });
-
-    it('allows empty headers', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document header={null} isDeletable={true} checked={true} docIdentifier="foo" docContent='' />,
-        container
-      );
-      assert.equal('', $(ReactDOM.findDOMNode(el)).find('.header-doc-id').text());
-    });
-
-    it('allows supports headers with "', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent='' />,
-        container
-      );
-      assert.equal('"foo"', $(ReactDOM.findDOMNode(el)).find('.header-doc-id').text());
-    });
-
-    it('small docs should not be truncated', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent='{ "content": true }' />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 0);
-    });
-
-    it('large docs should get truncated', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent={docContent} />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 1);
-    });
-
-    it('custom truncate value', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent={docContent} maxRows={2000} />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 0);
-    });
-
-    it('disabling truncation', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent={docContent} truncate={false} />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 0);
-    });
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
+
+var assert = utils.assert;
+
+describe('Document', function () {
+  var container, el;
+
+  var doc = {};
+  _.times(1000, function (n) {
+    doc['prop' + n] = n;
+  });
+  var docContent = JSON.stringify(doc, null, '  ');
+
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
+
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(el).parentNode);
+  });
+
+  it('hosts child elements', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document>
+        <div className="foo-children"></div>
+      </ReactComponents.Document>,
+      container
+    );
+    assert.ok($(ReactDOM.findDOMNode(el)).find('.foo-children').length);
+  });
+
+  it('does not require child elements', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document />,
+      container
+    );
+    assert.notOk($(ReactDOM.findDOMNode(el)).find('.doc-edit-symbol').length);
+  });
+
+  it('you can check it', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document isDeletable={true} checked={true} docIdentifier="foo" />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(el)).find('[data-checked="true"]').length, 1);
+  });
+
+  it('you can uncheck it', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document isDeletable={true} docIdentifier="foo" />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(el)).find('[data-checked="true"]').length, 0);
+  });
+
+  it('it calls an onchange callback', function () {
+    var spy = sinon.spy();
+
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document doc={{id: "foo"}} isDeletable={true} docChecked={spy} docIdentifier="foo" />,
+      container
+    );
+    var testEl = $(ReactDOM.findDOMNode(el)).find('input[type="checkbox"]')[0];
+    TestUtils.Simulate.change(testEl, {target: {value: 'Hello, world'}});
+    assert.ok(spy.calledOnce);
+  });
+
+  it('it calls an dblclick callback', function () {
+    var spy = sinon.spy();
+
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document isDeletable={true} onDoubleClick={spy} docIdentifier="foo" />,
+      container
+    );
+    TestUtils.Simulate.doubleClick(ReactDOM.findDOMNode(el));
+    assert.ok(spy.calledOnce);
+  });
+
+  it('can render without checkbox', function () {
+    var spy = sinon.spy();
+
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document isDeletable={false} onDoubleClick={spy} docIdentifier="foo" />,
+      container
+    );
+    assert.notOk($(ReactDOM.findDOMNode(el)).find('input[type="checkbox"]').length);
+    assert.ok($(ReactDOM.findDOMNode(el)).find('.checkbox-dummy').length);
+  });
+
+  it('contains a doc-data element when there\'s doc content', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document isDeletable={true} checked={true} docIdentifier="foo" docContent='{ "content": true }' />,
+      container
+    );
+    assert.equal(1, $(ReactDOM.findDOMNode(el)).find('.doc-data').length);
+  });
+
+  it('doesn\'t contain a doc-data element when there\'s no doc content', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document isDeletable={true} checked={true} docIdentifier="foo" docContent='' />,
+      container
+    );
+    assert.equal(0, $(ReactDOM.findDOMNode(el)).find('.doc-data').length);
+  });
+
+  it('allows empty headers', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document header={null} isDeletable={true} checked={true} docIdentifier="foo" docContent='' />,
+      container
+    );
+    assert.equal('', $(ReactDOM.findDOMNode(el)).find('.header-doc-id').text());
+  });
+
+  it('allows supports headers with "', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent='' />,
+      container
+    );
+    assert.equal('"foo"', $(ReactDOM.findDOMNode(el)).find('.header-doc-id').text());
+  });
+
+  it('small docs should not be truncated', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent='{ "content": true }' />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 0);
+  });
+
+  it('large docs should get truncated', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent={docContent} />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 1);
+  });
+
+  it('custom truncate value', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent={docContent} maxRows={2000} />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 0);
+  });
 
+  it('disabling truncation', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.Document header="foo" isDeletable={true} checked={true} docIdentifier="foo" docContent={docContent} truncate={false} />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.doc-content-truncated').length, 0);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/headerTogglebuttonSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/headerTogglebuttonSpec.react.jsx b/app/addons/components/tests/headerTogglebuttonSpec.react.jsx
index 40f0d51..f87a6e2 100644
--- a/app/addons/components/tests/headerTogglebuttonSpec.react.jsx
+++ b/app/addons/components/tests/headerTogglebuttonSpec.react.jsx
@@ -9,34 +9,31 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('Header Togglebutton', function () {
-    var container, toggleEl, toggleCallback;
-    beforeEach(function () {
-      container = document.createElement('div');
-      toggleCallback = sinon.spy();
-      toggleEl = TestUtils.renderIntoDocument(<ReactComponents.ToggleHeaderButton fonticon={'foo'}
-        classString={'bar'} toggleCallback={toggleCallback} />, container);
-    });
+describe('Header Togglebutton', function () {
+  var container, toggleEl, toggleCallback;
+  beforeEach(function () {
+    container = document.createElement('div');
+    toggleCallback = sinon.spy();
+    toggleEl = TestUtils.renderIntoDocument(<ReactComponents.ToggleHeaderButton fonticon={'foo'}
+      classString={'bar'} toggleCallback={toggleCallback} />, container);
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('should call the passed callback', function () {
-      TestUtils.Simulate.click(ReactDOM.findDOMNode(toggleEl));
-      assert.ok(toggleCallback.calledOnce);
-    });
+  it('should call the passed callback', function () {
+    TestUtils.Simulate.click(ReactDOM.findDOMNode(toggleEl));
+    assert.ok(toggleCallback.calledOnce);
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/paddedBorderedBoxSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/paddedBorderedBoxSpec.react.jsx b/app/addons/components/tests/paddedBorderedBoxSpec.react.jsx
index 9637968..3f1b317 100644
--- a/app/addons/components/tests/paddedBorderedBoxSpec.react.jsx
+++ b/app/addons/components/tests/paddedBorderedBoxSpec.react.jsx
@@ -9,37 +9,34 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('PaddedBorderedBox', function () {
-    var container, el;
+describe('PaddedBorderedBox', function () {
+  var container, el;
 
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('hosts child elements', function () {
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.PaddedBorderedBox>
-          <div className="foo-children"></div>
-        </ReactComponents.PaddedBorderedBox>,
-        container
-      );
-      assert.ok($(ReactDOM.findDOMNode(el)).find('.foo-children').length);
-    });
+  it('hosts child elements', function () {
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.PaddedBorderedBox>
+        <div className="foo-children"></div>
+      </ReactComponents.PaddedBorderedBox>,
+      container
+    );
+    assert.ok($(ReactDOM.findDOMNode(el)).find('.foo-children').length);
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/stringEditModalSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/stringEditModalSpec.react.jsx b/app/addons/components/tests/stringEditModalSpec.react.jsx
index f0b0e24..fbd25d8 100644
--- a/app/addons/components/tests/stringEditModalSpec.react.jsx
+++ b/app/addons/components/tests/stringEditModalSpec.react.jsx
@@ -9,45 +9,40 @@
 // 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',
-  '../react-components.react',
-  'react-bootstrap',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, ReactBootstrap, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+import { Modal } from "react-bootstrap";
+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";
 
-  var assert = utils.assert;
-  var Modal = ReactBootstrap.Modal;
+var assert = utils.assert;
 
-  describe('String Edit Modal', function () {
-    var container, el;
-    var stub = function () { };
+describe('String Edit Modal', function () {
+  var container, el;
+  var stub = function () { };
 
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    describe('onSave', function () {
-      it('ensures same content returns on saving', function () {
-        var string = "a string!";
-        var spy = sinon.spy();
-        el = TestUtils.renderIntoDocument(
-          <ReactComponents.StringEditModal visible={true} onClose={stub} onSave={spy} value={string} />,
-          container
-        );
-        TestUtils.Simulate.click($('body').find('#string-edit-save-btn')[0]);
-        assert.ok(spy.calledOnce);
-        assert.ok(spy.calledWith(string));
-      });
+  describe('onSave', function () {
+    it('ensures same content returns on saving', function () {
+      var string = "a string!";
+      var spy = sinon.spy();
+      el = TestUtils.renderIntoDocument(
+        <ReactComponents.StringEditModal visible={true} onClose={stub} onSave={spy} value={string} />,
+        container
+      );
+      TestUtils.Simulate.click($('body').find('#string-edit-save-btn')[0]);
+      assert.ok(spy.calledOnce);
+      assert.ok(spy.calledWith(string));
     });
   });
-
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/styledSelectSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/styledSelectSpec.react.jsx b/app/addons/components/tests/styledSelectSpec.react.jsx
index 36401b7..85f304b 100644
--- a/app/addons/components/tests/styledSelectSpec.react.jsx
+++ b/app/addons/components/tests/styledSelectSpec.react.jsx
@@ -9,53 +9,50 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
-
-  var assert = utils.assert;
-
-  describe('styled select', function () {
-    var container, selectorEl, spy = sinon.spy();
-
-    beforeEach(function () {
-      container = document.createElement('div');
-
-      var selectContent = (
-        <optgroup label="Select a document">
-          <option value="new">New Design Document</option>
-          <option value="foo">New Design Document</option>
-        </optgroup>
-      );
-
-      selectorEl = TestUtils.renderIntoDocument(
-        <ReactComponents.StyledSelect
-          selectId="new-ddoc"
-          selectClass=""
-          selectContent={selectContent}
-          selectChange={spy} />,
-        container
-      );
-    });
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
+
+var assert = utils.assert;
+
+describe('styled select', function () {
+  var container, selectorEl, spy = sinon.spy();
+
+  beforeEach(function () {
+    container = document.createElement('div');
+
+    var selectContent = (
+      <optgroup label="Select a document">
+        <option value="new">New Design Document</option>
+        <option value="foo">New Design Document</option>
+      </optgroup>
+    );
+
+    selectorEl = TestUtils.renderIntoDocument(
+      <ReactComponents.StyledSelect
+        selectId="new-ddoc"
+        selectClass=""
+        selectContent={selectContent}
+        selectChange={spy} />,
+      container
+    );
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('calls the callback on select', function () {
-      TestUtils.Simulate.change($(ReactDOM.findDOMNode(selectorEl)).find('#new-ddoc')[0], {
-        target: {
-          value: 'new'
-        }
-      });
-      assert.ok(spy.calledOnce);
+  it('calls the callback on select', function () {
+    TestUtils.Simulate.change($(ReactDOM.findDOMNode(selectorEl)).find('#new-ddoc')[0], {
+      target: {
+        value: 'new'
+      }
     });
-
+    assert.ok(spy.calledOnce);
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/components/tests/zenModeSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/zenModeSpec.react.jsx b/app/addons/components/tests/zenModeSpec.react.jsx
index e513c1c..861b24f 100644
--- a/app/addons/components/tests/zenModeSpec.react.jsx
+++ b/app/addons/components/tests/zenModeSpec.react.jsx
@@ -9,55 +9,52 @@
 // 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',
-  '../react-components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ReactComponents, utils, React, ReactDOM, TestUtils, sinon) {
-
-  var assert = utils.assert;
-  var code = 'function (doc) {\n  emit(doc._id, 1);\n}';
-
-  describe('Zen Mode', function () {
-    var container, el, spy;
-
-    beforeEach(function () {
-      spy = sinon.spy();
-      container = document.createElement('div');
-      el = TestUtils.renderIntoDocument(
-        <ReactComponents.ZenModeOverlay defaultCode={code} onExit={spy} />,
-        container
-      );
-    });
+import FauxtonAPI from "../../../core/api";
+import ReactComponents from "../react-components.react";
+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";
+
+var assert = utils.assert;
+var code = 'function (doc) {\n  emit(doc._id, 1);\n}';
+
+describe('Zen Mode', function () {
+  var container, el, spy;
+
+  beforeEach(function () {
+    spy = sinon.spy();
+    container = document.createElement('div');
+    el = TestUtils.renderIntoDocument(
+      <ReactComponents.ZenModeOverlay defaultCode={code} onExit={spy} />,
+      container
+    );
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-      window.localStorage.removeItem('zenTheme');
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+    window.localStorage.removeItem('zenTheme');
+  });
 
-    describe('Toggle theme', function () {
-      it('defaults to dark theme', function () {
-        assert.ok($(ReactDOM.findDOMNode(el)).hasClass('zen-theme-dark'));
-      });
-
-      it('switch to light theme on click', function () {
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.js-toggle-theme')[0]);
-        assert.ok($(ReactDOM.findDOMNode(el)).hasClass('zen-theme-light'));
-        // reset
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.js-toggle-theme')[0]);
-      });
+  describe('Toggle theme', function () {
+    it('defaults to dark theme', function () {
+      assert.ok($(ReactDOM.findDOMNode(el)).hasClass('zen-theme-dark'));
     });
 
-    describe('Closing zen mode', function () {
-      it('method called', function () {
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.js-exit-zen-mode')[0]);
-        assert.ok(spy.calledOnce);
-      });
+    it('switch to light theme on click', function () {
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.js-toggle-theme')[0]);
+      assert.ok($(ReactDOM.findDOMNode(el)).hasClass('zen-theme-light'));
+      // reset
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.js-toggle-theme')[0]);
     });
+  });
 
+  describe('Closing zen mode', function () {
+    it('method called', function () {
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el)).find('.js-exit-zen-mode')[0]);
+      assert.ok(spy.calledOnce);
+    });
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/config/base.js
----------------------------------------------------------------------
diff --git a/app/addons/config/base.js b/app/addons/config/base.js
index 4676d95..a10cab0 100644
--- a/app/addons/config/base.js
+++ b/app/addons/config/base.js
@@ -10,25 +10,17 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Config from "./routes";
+import "./assets/less/config.less";
+Config.initialize = function () {
+  FauxtonAPI.addHeaderLink({
+    title: 'Configuration',
+    href: '#_config',
+    icon: 'fonticon-cog',
+    className: 'config'
+  });
+};
 
-  '../../core/api',
-
-  // Modules
-  './routes',
-  './assets/less/config.less'
-],
-
-function (app, FauxtonAPI, Config) {
-  Config.initialize = function () {
-    FauxtonAPI.addHeaderLink({
-      title: 'Configuration',
-      href: '#_config',
-      icon: 'fonticon-cog',
-      className: 'config'
-    });
-  };
-
-  return Config;
-});
+export default Config;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/config/resources.js b/app/addons/config/resources.js
index 4402fc9..87eb8c3 100644
--- a/app/addons/config/resources.js
+++ b/app/addons/config/resources.js
@@ -10,106 +10,100 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api'
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
 
-],
+var Config = FauxtonAPI.addon();
 
-function (app, FauxtonAPI) {
 
-  var Config = FauxtonAPI.addon();
+Config.OptionModel = Backbone.Model.extend({
+  documentation: FauxtonAPI.constants.DOC_URLS.CONFIG,
 
+  initialize: function (_, options) {
+    this.node = options.node;
+  },
 
-  Config.OptionModel = Backbone.Model.extend({
-    documentation: FauxtonAPI.constants.DOC_URLS.CONFIG,
+  url: function () {
+    if (!this.node) {
+      throw new Error('no node set');
+    }
 
-    initialize: function (_, options) {
-      this.node = options.node;
-    },
+    return app.host + '/_node/' + this.node + '/_config/' +
+      this.get('section') + '/' + encodeURIComponent(this.get('name'));
+  },
 
-    url: function () {
-      if (!this.node) {
-        throw new Error('no node set');
-      }
+  isNew: function () { return false; },
 
-      return app.host + '/_node/' + this.node + '/_config/' +
-        this.get('section') + '/' + encodeURIComponent(this.get('name'));
-    },
+  sync: function (method, model, options) {
 
-    isNew: function () { return false; },
+    var params = {
+      url: model.url(),
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(model.get('value'))
+    };
 
-    sync: function (method, model, options) {
+    if (method === 'delete') {
+      params.type = 'DELETE';
+    } else {
+      params.type = 'PUT';
+    }
+    return $.ajax(params);
+  }
+});
 
-      var params = {
-        url: model.url(),
-        contentType: 'application/json',
-        dataType: 'json',
-        data: JSON.stringify(model.get('value'))
-      };
+Config.Model = Backbone.Model.extend({});
+Config.Collection = Backbone.Collection.extend({
+  model: Config.Model,
 
-      if (method === 'delete') {
-        params.type = 'DELETE';
-      } else {
-        params.type = 'PUT';
-      }
-      return $.ajax(params);
+  documentation: FauxtonAPI.constants.DOC_URLS.CONFIG,
+
+  initialize: function (_, options) {
+    this.node = options.node;
+  },
+
+  comparator: function (OptionModel) {
+    if (OptionModel.get('section')) {
+      return OptionModel.get('section');
     }
-  });
-
-  Config.Model = Backbone.Model.extend({});
-  Config.Collection = Backbone.Collection.extend({
-    model: Config.Model,
-
-    documentation: FauxtonAPI.constants.DOC_URLS.CONFIG,
-
-    initialize: function (_, options) {
-      this.node = options.node;
-    },
-
-    comparator: function (OptionModel) {
-      if (OptionModel.get('section')) {
-        return OptionModel.get('section');
-      }
-    },
-
-    url: function () {
-      if (!this.node) {
-        throw new Error('no node set');
-      }
-
-      return app.host + '/_node/' + this.node + '/_config';
-    },
-
-    findEntryInSection: function (sectionName, entry) {
-      var section = _.findWhere(this.toJSON(), {'section': sectionName}),
-          options;
-
-      if (!section) {
-        return false;
-      }
-
-      options = _.findWhere(section.options, {name: entry});
-
-      return options;
-    },
-
-    parse: function (resp) {
-      return _.map(resp, function (section, section_name) {
-        return {
-          section: section_name,
-          options: _.map(section, function (option, option_name) {
-            return {
-              name: option_name,
-              value: option
-            };
-          })
-        };
-      });
+  },
+
+  url: function () {
+    if (!this.node) {
+      throw new Error('no node set');
     }
-  });
 
+    return app.host + '/_node/' + this.node + '/_config';
+  },
 
+  findEntryInSection: function (sectionName, entry) {
+    var section = _.findWhere(this.toJSON(), {'section': sectionName}),
+        options;
 
-  return Config;
+    if (!section) {
+      return false;
+    }
+
+    options = _.findWhere(section.options, {name: entry});
+
+    return options;
+  },
+
+  parse: function (resp) {
+    return _.map(resp, function (section, section_name) {
+      return {
+        section: section_name,
+        options: _.map(section, function (option, option_name) {
+          return {
+            name: option_name,
+            value: option
+          };
+        })
+      };
+    });
+  }
 });
+
+
+
+export default Config;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/config/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/config/routes.js b/app/addons/config/routes.js
index 3f051ad..a94b702 100644
--- a/app/addons/config/routes.js
+++ b/app/addons/config/routes.js
@@ -10,91 +10,86 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './resources',
-  './views',
-  '../cors/components.react',
-  '../cors/actions',
-  '../cluster/cluster.actions'
-],
-
-function (app, FauxtonAPI, Config, Views, CORSComponents, CORSActions, ClusterActions) {
-
-
-  var ConfigDisabledRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'one_pane',
-
-    routes: {
-      '_config': 'checkNodes',
-    },
-
-    crumbs: [
-      { name: 'Config disabled', link: '_config' }
-    ],
-
-    checkNodes: function () {
-      ClusterActions.navigateToNodeBasedOnNodeCount('/_config/');
-    }
-  });
-
-
-  var ConfigPerNodeRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'with_tabs_sidebar',
-
-    roles: ['_admin'],
-    selectedHeader: 'Config',
-
-    crumbs: [
-      { name: 'Config', link: '_config' }
-    ],
-
-    apiUrl: function () {
-      return [this.configs.url(), this.configs.documentation];
-    },
-
-    routes: {
-      '_config/:node': 'configForNode',
-      '_config/:node/cors': 'configCorsForNode'
-    },
-
-    initialize: function (_a, _b, options) {
-      var node = options[0];
-
-      this.configs = new Config.Collection(null, {node: node});
-
-      this.sidebar = this.setView('#sidebar-content', new Views.Tabs({
-        sidebarItems: [
-          {
-            title: 'Main config',
-            typeSelect: 'main',
-            link: '_config/' + node
-          },
-          {
-            title: 'CORS',
-            typeSelect: 'cors',
-            link: '_config/' + node + '/cors'
-          }
-        ]
-      }));
-    },
-
-    configForNode: function () {
-      this.newSection = this.setView('#right-header', new Views.ConfigHeader({ collection: this.configs }));
-      this.setView('#dashboard-lower-content', new Views.Table({ collection: this.configs }));
-      this.sidebar.setSelectedTab('main');
-    },
-
-    configCorsForNode: function (node) {
-      this.removeView('#right-header');
-      this.newSection = this.setComponent('#dashboard-content', CORSComponents.CORSController);
-      CORSActions.fetchAndEditCors(node);
-      this.sidebar.setSelectedTab('cors');
-    }
-  });
-
-  Config.RouteObjects = [ConfigPerNodeRouteObject, ConfigDisabledRouteObject];
-
-  return Config;
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Config from "./resources";
+import Views from "./views";
+import CORSComponents from "../cors/components.react";
+import CORSActions from "../cors/actions";
+import ClusterActions from "../cluster/cluster.actions";
+
+
+var ConfigDisabledRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'one_pane',
+
+  routes: {
+    '_config': 'checkNodes',
+  },
+
+  crumbs: [
+    { name: 'Config disabled', link: '_config' }
+  ],
+
+  checkNodes: function () {
+    ClusterActions.navigateToNodeBasedOnNodeCount('/_config/');
+  }
 });
+
+
+var ConfigPerNodeRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'with_tabs_sidebar',
+
+  roles: ['_admin'],
+  selectedHeader: 'Config',
+
+  crumbs: [
+    { name: 'Config', link: '_config' }
+  ],
+
+  apiUrl: function () {
+    return [this.configs.url(), this.configs.documentation];
+  },
+
+  routes: {
+    '_config/:node': 'configForNode',
+    '_config/:node/cors': 'configCorsForNode'
+  },
+
+  initialize: function (_a, _b, options) {
+    var node = options[0];
+
+    this.configs = new Config.Collection(null, {node: node});
+
+    this.sidebar = this.setView('#sidebar-content', new Views.Tabs({
+      sidebarItems: [
+        {
+          title: 'Main config',
+          typeSelect: 'main',
+          link: '_config/' + node
+        },
+        {
+          title: 'CORS',
+          typeSelect: 'cors',
+          link: '_config/' + node + '/cors'
+        }
+      ]
+    }));
+  },
+
+  configForNode: function () {
+    this.newSection = this.setView('#right-header', new Views.ConfigHeader({ collection: this.configs }));
+    this.setView('#dashboard-lower-content', new Views.Table({ collection: this.configs }));
+    this.sidebar.setSelectedTab('main');
+  },
+
+  configCorsForNode: function (node) {
+    this.removeView('#right-header');
+    this.newSection = this.setComponent('#dashboard-content', CORSComponents.CORSController);
+    CORSActions.fetchAndEditCors(node);
+    this.sidebar.setSelectedTab('cors');
+  }
+});
+
+Config.RouteObjects = [ConfigPerNodeRouteObject, ConfigDisabledRouteObject];
+
+export default Config;


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

Posted by ga...@apache.org.
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
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/styletests/styletests.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/styletests/styletests.react.jsx b/app/addons/styletests/styletests.react.jsx
index 57c4c50..bbb3049 100644
--- a/app/addons/styletests/styletests.react.jsx
+++ b/app/addons/styletests/styletests.react.jsx
@@ -23,508 +23,503 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "app",
-  "api",
-  'react'
+import app from "app";
+import FauxtonAPI from "api";
+import React from "react";
 
-], function (app, FauxtonAPI, React) {
 
+var StyleTests = React.createClass({
 
-  var StyleTests = React.createClass({
+  render: function () {
+    return (
+      <div className="container theme-showcase">
 
-    render: function () {
-      return (
-        <div className="container theme-showcase">
+        <div className="jumbotron">
+          <h1>Fauxton Style Guide <small>mostly made of Bootstrap 2.x</small></h1>
+          <p>(Mostly) Standard Bootstrap styles customized for Fauxton.</p>
+        </div>
 
-          <div className="jumbotron">
-            <h1>Fauxton Style Guide <small>mostly made of Bootstrap 2.x</small></h1>
-            <p>(Mostly) Standard Bootstrap styles customized for Fauxton.</p>
-          </div>
+        <div className="page-header">
+          <h1>Typography</h1>
+        </div>
+        <h1>h1. Heading 1</h1>
+        <h2>h2. Heading 2</h2>
+        <h3>h3. Heading 3</h3>
+        <h4>h4. Heading 4</h4>
+        <h5>h5. Heading 5</h5>
+        <h6>h6. Heading 6</h6>
+
+        <div className="page-header">
+          <h1>Buttons</h1>
+        </div>
 
-          <div className="page-header">
-            <h1>Typography</h1>
-          </div>
-          <h1>h1. Heading 1</h1>
-          <h2>h2. Heading 2</h2>
-          <h3>h3. Heading 3</h3>
-          <h4>h4. Heading 4</h4>
-          <h5>h5. Heading 5</h5>
-          <h6>h6. Heading 6</h6>
-
-          <div className="page-header">
-            <h1>Buttons</h1>
-          </div>
+        <h4>Bootstrap Standard Button className names</h4>
+        <p>.btn.btn-large.btn-*<br />
+          <button type="button" className="btn btn-large btn-default">Default</button>
+          <button type="button" className="btn btn-large btn-primary">Primary</button>
+          <button type="button" className="btn btn-large btn-success">Success</button>
+          <button type="button" className="btn btn-large btn-info">Info</button>
+          <button type="button" className="btn btn-large btn-warning">Warning</button>
+          <button type="button" className="btn btn-large btn-danger">Danger</button>
+          <button type="button" className="btn btn-large btn-link">Link</button>
+        </p>
+        <p>.btn.btn-*<br />
+          <button type="button" className="btn btn-default">Default</button>
+          <button type="button" className="btn btn-primary">Primary</button>
+          <button type="button" className="btn btn-success">Success</button>
+          <button type="button" className="btn btn-info">Info</button>
+          <button type="button" className="btn btn-warning">Warning</button>
+          <button type="button" className="btn btn-danger">Danger</button>
+          <button type="button" className="btn btn-link">Link</button>
+        </p>
+        <p>.btn.btn-small.btn-*<br />
+          <button type="button" className="btn btn-small btn-default">Default</button>
+          <button type="button" className="btn btn-small btn-primary">Primary</button>
+          <button type="button" className="btn btn-small btn-success">Success</button>
+          <button type="button" className="btn btn-small btn-info">Info</button>
+          <button type="button" className="btn btn-small btn-warning">Warning</button>
+          <button type="button" className="btn btn-small btn-danger">Danger</button>
+          <button type="button" className="btn btn-small btn-link">Link</button>
+        </p>
+        <p>.btn.btn-mini.btn-*<br />
+          <button type="button" className="btn btn-mini btn-default">Default</button>
+          <button type="button" className="btn btn-mini btn-primary">Primary</button>
+          <button type="button" className="btn btn-mini btn-success">Success</button>
+          <button type="button" className="btn btn-mini btn-info">Info</button>
+          <button type="button" className="btn btn-mini btn-warning">Warning</button>
+          <button type="button" className="btn btn-mini btn-danger">Danger</button>
+          <button type="button" className="btn btn-mini btn-link">Link</button>
+        </p>
+
+        <h4>with Icons</h4>
+        <p>.btn.btn-large.btn-*<br />
+          <button type="button" className="btn btn-large btn-default"><i className="icon fonticon-new-database"></i> Default</button>
+          <button type="button" className="btn btn-large btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
+          <button type="button" className="btn btn-large btn-success"><i className="icon fonticon-new-database"></i> Success</button>
+          <button type="button" className="btn btn-large btn-info"><i className="icon fonticon-new-database"></i> Info</button>
+          <button type="button" className="btn btn-large btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
+          <button type="button" className="btn btn-large btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
+          <button type="button" className="btn btn-large btn-link"><i className="icon fonticon-new-database"></i> Link</button>
+        </p>
+
+        <p>.btn.btn-*<br />
+          <button type="button" className="btn btn-default"><i className="icon fonticon-new-database"></i> Default</button>
+          <button type="button" className="btn btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
+          <button type="button" className="btn btn-success"><i className="icon fonticon-new-database"></i> Success</button>
+          <button type="button" className="btn btn-info"><i className="icon fonticon-new-database"></i> Info</button>
+          <button type="button" className="btn btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
+          <button type="button" className="btn btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
+          <button type="button" className="btn btn-link"><i className="icon fonticon-new-database"></i> Link</button>
+        </p>
+        <p>.btn.btn-small.btn-*<br />
+          <button type="button" className="btn btn-small btn-default"><i className="icon fonticon-new-database"></i> Default</button>
+          <button type="button" className="btn btn-small btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
+          <button type="button" className="btn btn-small btn-success"><i className="icon fonticon-new-database"></i> Success</button>
+          <button type="button" className="btn btn-small btn-info"><i className="icon fonticon-new-database"></i> Info</button>
+          <button type="button" className="btn btn-small btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
+          <button type="button" className="btn btn-small btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
+          <button type="button" className="btn btn-small btn-link"><i className="icon fonticon-new-database"></i> Link</button>
+        </p>
+        <p>.btn.btn-mini.btn-*<br />
+          <button type="button" className="btn btn-mini btn-default"><i className="icon fonticon-new-database"></i> Default</button>
+          <button type="button" className="btn btn-mini btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
+          <button type="button" className="btn btn-mini btn-success"><i className="icon fonticon-new-database"></i> Success</button>
+          <button type="button" className="btn btn-mini btn-info"><i className="icon fonticon-new-database"></i> Info</button>
+          <button type="button" className="btn btn-mini btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
+          <button type="button" className="btn btn-mini btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
+          <button type="button" className="btn btn-mini btn-link"><i className="icon fonticon-new-database"></i> Link</button>
+        </p>
+
+        <h4>just Icons</h4>
+        <p>.btn.btn-large.btn-*<br />
+          <button type="button" className="btn btn-large btn-default"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-large btn-primary"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-large btn-success"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-large btn-info"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-large btn-warning"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-large btn-danger"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-large btn-link"><i className="icon fonticon-new-database"></i></button>
+        </p>
+
+        <p>.btn.btn-*<br />
+          <button type="button" className="btn btn-default"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-primary"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-success"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-info"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-warning"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-danger"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-link"><i className="icon fonticon-new-database"></i></button>
+        </p>
+        <p>.btn.btn-small.btn-*<br />
+          <button type="button" className="btn btn-small btn-default"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-small btn-primary"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-small btn-success"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-small btn-info"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-small btn-warning"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-small btn-danger"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-small btn-link"><i className="icon fonticon-new-database"></i></button>
+        </p>
+        <p>.btn.btn-mini.btn-*<br />
+          <button type="button" className="btn btn-mini btn-default"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-mini btn-primary"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-mini btn-success"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-mini btn-info"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-mini btn-warning"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-mini btn-danger"><i className="icon fonticon-new-database"></i></button>
+          <button type="button" className="btn btn-mini btn-link"><i className="icon fonticon-new-database"></i></button>
+        </p>
+        <p>.btn-group<br />
+          <div className="btn-group">
+            <a href="#" className="btn btn-small edits">Edit design doc</a>
+            <button href="#" className="btn btn-small btn-danger delete" title="Delete this document."><i className="icon icon-trash"></i></button>
+          </div>
+        </p>
+
+        <h4>disabled</h4>
+        <p>.btn.btn-*<br />
+          <button type="button" disabled="disabled" className="btn btn-default"><i className="icon fonticon-new-database"></i> Default</button>
+          <button type="button" disabled="disabled" className="btn btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
+          <button type="button" disabled="disabled" className="btn btn-success"><i className="icon fonticon-new-database"></i> Success</button>
+          <button type="button" disabled="disabled" className="btn btn-info"><i className="icon fonticon-new-database"></i> Info</button>
+          <button type="button" disabled="disabled" className="btn btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
+          <button type="button" disabled="disabled" className="btn btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
+          <button type="button" disabled="disabled" className="btn btn-link"><i className="icon fonticon-new-database"></i> Link</button>
+        </p>
+        <p>.btn.btn-*<br />
+          <button type="button" disabled="disabled" className="btn btn-default">Default</button>
+          <button type="button" disabled="disabled" className="btn btn-primary">Primary</button>
+          <button type="button" disabled="disabled" className="btn btn-success">Success</button>
+          <button type="button" disabled="disabled" className="btn btn-info">Info</button>
+          <button type="button" disabled="disabled" className="btn btn-warning">Warning</button>
+          <button type="button" disabled="disabled" className="btn btn-danger">Danger</button>
+          <button type="button" disabled="disabled" className="btn btn-link">Link</button>
+        </p>
+
+        <div className="page-header">
+          <h1>Forms</h1>
+        </div>
 
-          <h4>Bootstrap Standard Button className names</h4>
-          <p>.btn.btn-large.btn-*<br />
-            <button type="button" className="btn btn-large btn-default">Default</button>
-            <button type="button" className="btn btn-large btn-primary">Primary</button>
-            <button type="button" className="btn btn-large btn-success">Success</button>
-            <button type="button" className="btn btn-large btn-info">Info</button>
-            <button type="button" className="btn btn-large btn-warning">Warning</button>
-            <button type="button" className="btn btn-large btn-danger">Danger</button>
-            <button type="button" className="btn btn-large btn-link">Link</button>
-          </p>
-          <p>.btn.btn-*<br />
-            <button type="button" className="btn btn-default">Default</button>
-            <button type="button" className="btn btn-primary">Primary</button>
-            <button type="button" className="btn btn-success">Success</button>
-            <button type="button" className="btn btn-info">Info</button>
-            <button type="button" className="btn btn-warning">Warning</button>
-            <button type="button" className="btn btn-danger">Danger</button>
-            <button type="button" className="btn btn-link">Link</button>
-          </p>
-          <p>.btn.btn-small.btn-*<br />
-            <button type="button" className="btn btn-small btn-default">Default</button>
-            <button type="button" className="btn btn-small btn-primary">Primary</button>
-            <button type="button" className="btn btn-small btn-success">Success</button>
-            <button type="button" className="btn btn-small btn-info">Info</button>
-            <button type="button" className="btn btn-small btn-warning">Warning</button>
-            <button type="button" className="btn btn-small btn-danger">Danger</button>
-            <button type="button" className="btn btn-small btn-link">Link</button>
-          </p>
-          <p>.btn.btn-mini.btn-*<br />
-            <button type="button" className="btn btn-mini btn-default">Default</button>
-            <button type="button" className="btn btn-mini btn-primary">Primary</button>
-            <button type="button" className="btn btn-mini btn-success">Success</button>
-            <button type="button" className="btn btn-mini btn-info">Info</button>
-            <button type="button" className="btn btn-mini btn-warning">Warning</button>
-            <button type="button" className="btn btn-mini btn-danger">Danger</button>
-            <button type="button" className="btn btn-mini btn-link">Link</button>
-          </p>
-
-          <h4>with Icons</h4>
-          <p>.btn.btn-large.btn-*<br />
-            <button type="button" className="btn btn-large btn-default"><i className="icon fonticon-new-database"></i> Default</button>
-            <button type="button" className="btn btn-large btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
-            <button type="button" className="btn btn-large btn-success"><i className="icon fonticon-new-database"></i> Success</button>
-            <button type="button" className="btn btn-large btn-info"><i className="icon fonticon-new-database"></i> Info</button>
-            <button type="button" className="btn btn-large btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
-            <button type="button" className="btn btn-large btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
-            <button type="button" className="btn btn-large btn-link"><i className="icon fonticon-new-database"></i> Link</button>
-          </p>
-
-          <p>.btn.btn-*<br />
-            <button type="button" className="btn btn-default"><i className="icon fonticon-new-database"></i> Default</button>
-            <button type="button" className="btn btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
-            <button type="button" className="btn btn-success"><i className="icon fonticon-new-database"></i> Success</button>
-            <button type="button" className="btn btn-info"><i className="icon fonticon-new-database"></i> Info</button>
-            <button type="button" className="btn btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
-            <button type="button" className="btn btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
-            <button type="button" className="btn btn-link"><i className="icon fonticon-new-database"></i> Link</button>
-          </p>
-          <p>.btn.btn-small.btn-*<br />
-            <button type="button" className="btn btn-small btn-default"><i className="icon fonticon-new-database"></i> Default</button>
-            <button type="button" className="btn btn-small btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
-            <button type="button" className="btn btn-small btn-success"><i className="icon fonticon-new-database"></i> Success</button>
-            <button type="button" className="btn btn-small btn-info"><i className="icon fonticon-new-database"></i> Info</button>
-            <button type="button" className="btn btn-small btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
-            <button type="button" className="btn btn-small btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
-            <button type="button" className="btn btn-small btn-link"><i className="icon fonticon-new-database"></i> Link</button>
-          </p>
-          <p>.btn.btn-mini.btn-*<br />
-            <button type="button" className="btn btn-mini btn-default"><i className="icon fonticon-new-database"></i> Default</button>
-            <button type="button" className="btn btn-mini btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
-            <button type="button" className="btn btn-mini btn-success"><i className="icon fonticon-new-database"></i> Success</button>
-            <button type="button" className="btn btn-mini btn-info"><i className="icon fonticon-new-database"></i> Info</button>
-            <button type="button" className="btn btn-mini btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
-            <button type="button" className="btn btn-mini btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
-            <button type="button" className="btn btn-mini btn-link"><i className="icon fonticon-new-database"></i> Link</button>
-          </p>
-
-          <h4>just Icons</h4>
-          <p>.btn.btn-large.btn-*<br />
-            <button type="button" className="btn btn-large btn-default"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-large btn-primary"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-large btn-success"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-large btn-info"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-large btn-warning"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-large btn-danger"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-large btn-link"><i className="icon fonticon-new-database"></i></button>
-          </p>
-
-          <p>.btn.btn-*<br />
-            <button type="button" className="btn btn-default"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-primary"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-success"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-info"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-warning"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-danger"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-link"><i className="icon fonticon-new-database"></i></button>
-          </p>
-          <p>.btn.btn-small.btn-*<br />
-            <button type="button" className="btn btn-small btn-default"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-small btn-primary"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-small btn-success"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-small btn-info"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-small btn-warning"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-small btn-danger"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-small btn-link"><i className="icon fonticon-new-database"></i></button>
-          </p>
-          <p>.btn.btn-mini.btn-*<br />
-            <button type="button" className="btn btn-mini btn-default"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-mini btn-primary"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-mini btn-success"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-mini btn-info"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-mini btn-warning"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-mini btn-danger"><i className="icon fonticon-new-database"></i></button>
-            <button type="button" className="btn btn-mini btn-link"><i className="icon fonticon-new-database"></i></button>
-          </p>
-          <p>.btn-group<br />
-            <div className="btn-group">
-              <a href="#" className="btn btn-small edits">Edit design doc</a>
-              <button href="#" className="btn btn-small btn-danger delete" title="Delete this document."><i className="icon icon-trash"></i></button>
-            </div>
-          </p>
-
-          <h4>disabled</h4>
-          <p>.btn.btn-*<br />
-            <button type="button" disabled="disabled" className="btn btn-default"><i className="icon fonticon-new-database"></i> Default</button>
-            <button type="button" disabled="disabled" className="btn btn-primary"><i className="icon fonticon-new-database"></i> Primary</button>
-            <button type="button" disabled="disabled" className="btn btn-success"><i className="icon fonticon-new-database"></i> Success</button>
-            <button type="button" disabled="disabled" className="btn btn-info"><i className="icon fonticon-new-database"></i> Info</button>
-            <button type="button" disabled="disabled" className="btn btn-warning"><i className="icon fonticon-new-database"></i> Warning</button>
-            <button type="button" disabled="disabled" className="btn btn-danger"><i className="icon fonticon-new-database"></i> Danger</button>
-            <button type="button" disabled="disabled" className="btn btn-link"><i className="icon fonticon-new-database"></i> Link</button>
-          </p>
-          <p>.btn.btn-*<br />
-            <button type="button" disabled="disabled" className="btn btn-default">Default</button>
-            <button type="button" disabled="disabled" className="btn btn-primary">Primary</button>
-            <button type="button" disabled="disabled" className="btn btn-success">Success</button>
-            <button type="button" disabled="disabled" className="btn btn-info">Info</button>
-            <button type="button" disabled="disabled" className="btn btn-warning">Warning</button>
-            <button type="button" disabled="disabled" className="btn btn-danger">Danger</button>
-            <button type="button" disabled="disabled" className="btn btn-link">Link</button>
-          </p>
-
-          <div className="page-header">
-            <h1>Forms</h1>
+        <form className="navbar-form database-search">
+          <div className="input-append">
+            <input className="search-autocomplete" name="search-query" autoComplete="off" placeholder="Database name" type="text" />
+            <button className="btn btn-primary" type="submit"><i className="icon icon-search"></i></button>
           </div>
+        </form>
 
-          <form className="navbar-form database-search">
-            <div className="input-append">
-              <input className="search-autocomplete" name="search-query" autoComplete="off" placeholder="Database name" type="text" />
-              <button className="btn btn-primary" type="submit"><i className="icon icon-search"></i></button>
-            </div>
-          </form>
+        <form className="navbar-form database-search">
+          <div className="input-append">
+            <input className="search-autocomplete" name="search-query" autoComplete="off" placeholder="Database name" type="text" />
+            <button className="btn btn-primary" type="submit"><i className="icon icon-search"></i> Search</button>
+          </div>
+        </form>
 
-          <form className="navbar-form database-search">
-            <div className="input-append">
-              <input className="search-autocomplete" name="search-query" autoComplete="off" placeholder="Database name" type="text" />
-              <button className="btn btn-primary" type="submit"><i className="icon icon-search"></i> Search</button>
-            </div>
-          </form>
+        <form className="navbar-form">
+          <div className="input-append">
+            <input name="search-query" placeholder="Database name" type="text" />
+            <button className="btn btn-primary" type="submit">Search</button>
+          </div>
+        </form>
 
-          <form className="navbar-form">
-            <div className="input-append">
-              <input name="search-query" placeholder="Database name" type="text" />
-              <button className="btn btn-primary" type="submit">Search</button>
-            </div>
-          </form>
-
-          <form>
-            <fieldset>
-              <legend>Legend</legend>
-              <label>Label name</label>
-              <input type="text" placeholder="Type something\u2026" />
-              <span className="help-block">Example block-level help text here.</span>
-              <label className="checkbox">
-                <input type="checkbox" /> Check me out
-              </label>
-              <button type="submit" className="btn">Submit</button>
-            </fieldset>
-          </form>
-
-          <p>Search</p>
-          <form className="form-search">
-            <input type="text" className="input-medium search-query" />
-            <button type="submit" className="btn">Search</button>
-          </form>
-
-          <p>Sign in</p>
-          <form className="form-inline">
-            <input type="text" className="input-small" placeholder="Email" />
-            <input type="password" className="input-small" placeholder="Password" />
+        <form>
+          <fieldset>
+            <legend>Legend</legend>
+            <label>Label name</label>
+            <input type="text" placeholder="Type something\u2026" />
+            <span className="help-block">Example block-level help text here.</span>
             <label className="checkbox">
-              <input type="checkbox" /> Remember me
+              <input type="checkbox" /> Check me out
             </label>
-            <button type="submit" className="btn">Sign in</button>
-          </form>
-
-          <p>Whole form</p>
-          <form className="form-horizontal">
-          <div className="control-group">
-            <label className="control-label" htmlFor="inputEmail">Email</label>
-            <div className="controls">
-              <input type="text" id="inputEmail" placeholder="Email" />
-            </div>
-          </div>
-          <div className="control-group">
-            <label className="control-label" htmlFor="inputPassword">Password</label>
-            <div className="controls">
-              <input type="password" id="inputPassword" placeholder="Password" />
-            </div>
-          </div>
-          <div className="control-group">
-            <div className="controls">
-              <label className="checkbox">
-                <input type="checkbox" /> Remember me
-              </label>
-              <button type="submit" className="btn">Sign in</button>
-            </div>
+            <button type="submit" className="btn">Submit</button>
+          </fieldset>
+        </form>
+
+        <p>Search</p>
+        <form className="form-search">
+          <input type="text" className="input-medium search-query" />
+          <button type="submit" className="btn">Search</button>
+        </form>
+
+        <p>Sign in</p>
+        <form className="form-inline">
+          <input type="text" className="input-small" placeholder="Email" />
+          <input type="password" className="input-small" placeholder="Password" />
+          <label className="checkbox">
+            <input type="checkbox" /> Remember me
+          </label>
+          <button type="submit" className="btn">Sign in</button>
+        </form>
+
+        <p>Whole form</p>
+        <form className="form-horizontal">
+        <div className="control-group">
+          <label className="control-label" htmlFor="inputEmail">Email</label>
+          <div className="controls">
+            <input type="text" id="inputEmail" placeholder="Email" />
           </div>
-          </form>
-
-          <p>Selects</p>
-          <select>
-            <option>1</option>
-            <option>2</option>
-            <option>3</option>
-            <option>4</option>
-            <option>5</option>
-          </select>
-
-          <select multiple="multiple">
-            <option>1</option>
-            <option>2</option>
-            <option>3</option>
-            <option>4</option>
-            <option>5</option>
-          </select>
-
-          <p>Inputs with pre</p>
-          <div className="input-prepend">
-            <span className="add-on">@</span>
-            <input className="span2" id="prependedInput" type="text" placeholder="Username" />
-          </div>
-          <p>Inputs with post</p>
-          <div className="input-append">
-            <input className="span2" id="appendedInput" type="text" />
-            <span className="add-on">.00</span>
+        </div>
+        <div className="control-group">
+          <label className="control-label" htmlFor="inputPassword">Password</label>
+          <div className="controls">
+            <input type="password" id="inputPassword" placeholder="Password" />
           </div>
-          <p>Inputs with pre and post</p>
-          <div className="input-prepend input-append">
-            <span className="add-on">$</span>
-            <input className="span2" id="appendedPrependedInput" type="text" />
-            <span className="add-on">.00</span>
+        </div>
+        <div className="control-group">
+          <div className="controls">
+            <label className="checkbox">
+              <input type="checkbox" /> Remember me
+            </label>
+            <button type="submit" className="btn">Sign in</button>
           </div>
-          <p>Inputs with button</p>
-        <div className="input-append">
-          <input className="span2" id="appendedInputButton" type="text" />
-          <button className="btn" type="button">Go!</button>
         </div>
-          <p>Inputs with two buttons</p>
-        <div className="input-append">
-          <input className="span2" id="appendedInputButtons" type="text" />
-          <button className="btn" type="button">Search</button>
-          <button className="btn" type="button">Options</button>
+        </form>
+
+        <p>Selects</p>
+        <select>
+          <option>1</option>
+          <option>2</option>
+          <option>3</option>
+          <option>4</option>
+          <option>5</option>
+        </select>
+
+        <select multiple="multiple">
+          <option>1</option>
+          <option>2</option>
+          <option>3</option>
+          <option>4</option>
+          <option>5</option>
+        </select>
+
+        <p>Inputs with pre</p>
+        <div className="input-prepend">
+          <span className="add-on">@</span>
+          <input className="span2" id="prependedInput" type="text" placeholder="Username" />
         </div>
-        <p>Inputs with dropdown button</p>
+        <p>Inputs with post</p>
         <div className="input-append">
-          <input className="span2" id="appendedDropdownButton" type="text" />
-          <div className="btn-group">
-            <button className="btn dropdown-toggle" data-toggle="dropdown">
-              Action
-              <span className="caret"></span>
-            </button>
-            <ul className="dropdown-menu">
-              ...
-            </ul>
-          </div>
+          <input className="span2" id="appendedInput" type="text" />
+          <span className="add-on">.00</span>
         </div>
-        <p>Inputs sizes</p>
-        <input className="input-mini" type="text" placeholder=".input-mini" />
-        <input className="input-small" type="text" placeholder=".input-small" />
-        <input className="input-medium" type="text" placeholder=".input-medium" />
-        <input className="input-large" type="text" placeholder=".input-large" />
-        <input className="input-xlarge" type="text" placeholder=".input-xlarge" />
-        <input className="input-xxlarge" type="text" placeholder=".input-xxlarge" />
-
-
-          <div className="page-header">
-            <h1>Thumbnails</h1>
-          </div>
-        <img src="dashboard.assets/img/ripley.jpeg" className="img-rounded" />
-        <img src="dashboard.assets/img/ripley.jpeg" className="img-circle" />
-        <img src="dashboard.assets/img/ripley.jpeg" className="img-polaroid" />
+        <p>Inputs with pre and post</p>
+        <div className="input-prepend input-append">
+          <span className="add-on">$</span>
+          <input className="span2" id="appendedPrependedInput" type="text" />
+          <span className="add-on">.00</span>
+        </div>
+        <p>Inputs with button</p>
+      <div className="input-append">
+        <input className="span2" id="appendedInputButton" type="text" />
+        <button className="btn" type="button">Go!</button>
+      </div>
+        <p>Inputs with two buttons</p>
+      <div className="input-append">
+        <input className="span2" id="appendedInputButtons" type="text" />
+        <button className="btn" type="button">Search</button>
+        <button className="btn" type="button">Options</button>
+      </div>
+      <p>Inputs with dropdown button</p>
+      <div className="input-append">
+        <input className="span2" id="appendedDropdownButton" type="text" />
+        <div className="btn-group">
+          <button className="btn dropdown-toggle" data-toggle="dropdown">
+            Action
+            <span className="caret"></span>
+          </button>
+          <ul className="dropdown-menu">
+            ...
+          </ul>
+        </div>
+      </div>
+      <p>Inputs sizes</p>
+      <input className="input-mini" type="text" placeholder=".input-mini" />
+      <input className="input-small" type="text" placeholder=".input-small" />
+      <input className="input-medium" type="text" placeholder=".input-medium" />
+      <input className="input-large" type="text" placeholder=".input-large" />
+      <input className="input-xlarge" type="text" placeholder=".input-xlarge" />
+      <input className="input-xxlarge" type="text" placeholder=".input-xxlarge" />
+
+
+        <div className="page-header">
+          <h1>Thumbnails</h1>
+        </div>
+      <img src="dashboard.assets/img/ripley.jpeg" className="img-rounded" />
+      <img src="dashboard.assets/img/ripley.jpeg" className="img-circle" />
+      <img src="dashboard.assets/img/ripley.jpeg" className="img-polaroid" />
 
 
-          <div className="page-header">
-            <h1>Dropdown menus</h1>
-          </div>
-          <div className="dropdown theme-dropdown clearfix">
-            <a id="dropdownMenu1" href="#" role="button" className="sr-only dropdown-toggle" data-toggle="dropdown">Dropdown <b className="caret"></b></a>
-            <ul className="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
-              <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Action</a></li>
-              <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Another action</a></li>
-              <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Something else here</a></li>
-              <li role="presentation" className="divider"></li>
-              <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Separated link</a></li>
-            </ul>
-          </div>
+        <div className="page-header">
+          <h1>Dropdown menus</h1>
+        </div>
+        <div className="dropdown theme-dropdown clearfix">
+          <a id="dropdownMenu1" href="#" role="button" className="sr-only dropdown-toggle" data-toggle="dropdown">Dropdown <b className="caret"></b></a>
+          <ul className="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
+            <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Action</a></li>
+            <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Another action</a></li>
+            <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Something else here</a></li>
+            <li role="presentation" className="divider"></li>
+            <li role="presentation"><a role="menuitem" tabIndex="-1" href="#">Separated link</a></li>
+          </ul>
+        </div>
 
 
 
 
-          <div className="page-header">
-            <h1>Navbars</h1>
-          </div>
+        <div className="page-header">
+          <h1>Navbars</h1>
+        </div>
 
-          <div className="navbar navbar-default">
-            <div className="container">
-              <div className="navbar-header">
-                <button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
-                  <span className="icon-bar"></span>
-                  <span className="icon-bar"></span>
-                  <span className="icon-bar"></span>
-                </button>
-                <a className="navbar-brand" href="#">Project name</a>
-              </div>
-              <div className="navbar-collapse collapse">
-                <ul className="nav navbar-nav">
-                  <li className="active"><a href="#">Home</a></li>
-                  <li><a href="#about">About</a></li>
-                  <li><a href="#contact">Contact</a></li>
-                </ul>
-                <ul className="nav navbar-nav navbar-right">
-                  <li><a href="../navbar/">Default</a></li>
-                  <li><a href="../navbar-static-top/">Static top</a></li>
-                  <li className="active"><a href="./">Fixed top</a></li>
-                </ul>
-              </div>
+        <div className="navbar navbar-default">
+          <div className="container">
+            <div className="navbar-header">
+              <button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+                <span className="icon-bar"></span>
+                <span className="icon-bar"></span>
+                <span className="icon-bar"></span>
+              </button>
+              <a className="navbar-brand" href="#">Project name</a>
+            </div>
+            <div className="navbar-collapse collapse">
+              <ul className="nav navbar-nav">
+                <li className="active"><a href="#">Home</a></li>
+                <li><a href="#about">About</a></li>
+                <li><a href="#contact">Contact</a></li>
+              </ul>
+              <ul className="nav navbar-nav navbar-right">
+                <li><a href="../navbar/">Default</a></li>
+                <li><a href="../navbar-static-top/">Static top</a></li>
+                <li className="active"><a href="./">Fixed top</a></li>
+              </ul>
             </div>
           </div>
+        </div>
 
-          <div className="navbar navbar-inverse">
-            <div className="container">
-              <div className="navbar-header">
-                <button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
-                  <span className="icon-bar"></span>
-                  <span className="icon-bar"></span>
-                  <span className="icon-bar"></span>
-                </button>
-                <a className="navbar-brand" href="#">Project name</a>
-              </div>
-              <div className="navbar-collapse collapse">
-                <ul className="nav navbar-nav">
-                  <li className="active"><a href="#">Home</a></li>
-                  <li><a href="#about">About</a></li>
-                  <li><a href="#contact">Contact</a></li>
-                </ul>
-                <ul className="nav navbar-nav navbar-right">
-                  <li><a href="../navbar/">Default</a></li>
-                  <li><a href="../navbar-static-top/">Static top</a></li>
-                  <li className="active"><a href="./">Fixed top</a></li>
-                </ul>
-              </div>
+        <div className="navbar navbar-inverse">
+          <div className="container">
+            <div className="navbar-header">
+              <button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+                <span className="icon-bar"></span>
+                <span className="icon-bar"></span>
+                <span className="icon-bar"></span>
+              </button>
+              <a className="navbar-brand" href="#">Project name</a>
+            </div>
+            <div className="navbar-collapse collapse">
+              <ul className="nav navbar-nav">
+                <li className="active"><a href="#">Home</a></li>
+                <li><a href="#about">About</a></li>
+                <li><a href="#contact">Contact</a></li>
+              </ul>
+              <ul className="nav navbar-nav navbar-right">
+                <li><a href="../navbar/">Default</a></li>
+                <li><a href="../navbar-static-top/">Static top</a></li>
+                <li className="active"><a href="./">Fixed top</a></li>
+              </ul>
             </div>
           </div>
+        </div>
 
 
 
-          <div className="page-header">
-            <h1>Alerts</h1>
-          </div>
-          <div className="alert alert-success">
-            <strong>Well done!</strong> You successfully read this important alert message.
-          </div>
-          <div className="alert alert-info">
-            <strong>Heads up!</strong> This alert needs your attention, but it's not super important.
-          </div>
-          <div className="alert alert-warning">
-            <strong>Warning!</strong> Best check yo self, you're not looking too good.
-          </div>
-          <div className="alert alert-danger">
-            <strong>Oh snap!</strong> Change a few things up and try submitting again.
-          </div>
+        <div className="page-header">
+          <h1>Alerts</h1>
+        </div>
+        <div className="alert alert-success">
+          <strong>Well done!</strong> You successfully read this important alert message.
+        </div>
+        <div className="alert alert-info">
+          <strong>Heads up!</strong> This alert needs your attention, but it's not super important.
+        </div>
+        <div className="alert alert-warning">
+          <strong>Warning!</strong> Best check yo self, you're not looking too good.
+        </div>
+        <div className="alert alert-danger">
+          <strong>Oh snap!</strong> Change a few things up and try submitting again.
+        </div>
 
 
 
-          <div className="page-header">
-            <h1>Progresss</h1>
-          </div>
-          <div className="progress">
-            <div className="bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{width: '60%'}}><span className="sr-only">60% Complete</span></div>
-          </div>
-          <div className="progress">
-            <div className="bar bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style={{width: '40%'}}><span className="sr-only">40% Complete (success)</span></div>
-          </div>
-          <div className="progress">
-            <div className="bar bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style={{width: '20%'}}><span className="sr-only">20% Complete</span></div>
-          </div>
-          <div className="progress">
-            <div className="bar bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{width: '60%'}}><span className="sr-only">60% Complete (warning)</span></div>
-          </div>
-          <div className="progress">
-            <div className="bar bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style={{width: '80%'}}><span className="sr-only">80% Complete (danger)</span></div>
-          </div>
-          <div className="progress">
-            <div className="bar bar-success" style={{width: '35%'}}><span className="sr-only">35% Complete (success)</span></div>
-            <div className="bar bar-warning" style={{width: '20%'}}><span className="sr-only">20% Complete (warning)</span></div>
-            <div className="bar bar-danger" style={{width: '10%'}}><span className='sr-only'>10% Complete (danger)</span></div>
-          </div>
+        <div className="page-header">
+          <h1>Progresss</h1>
+        </div>
+        <div className="progress">
+          <div className="bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{width: '60%'}}><span className="sr-only">60% Complete</span></div>
+        </div>
+        <div className="progress">
+          <div className="bar bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style={{width: '40%'}}><span className="sr-only">40% Complete (success)</span></div>
+        </div>
+        <div className="progress">
+          <div className="bar bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style={{width: '20%'}}><span className="sr-only">20% Complete</span></div>
+        </div>
+        <div className="progress">
+          <div className="bar bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{width: '60%'}}><span className="sr-only">60% Complete (warning)</span></div>
+        </div>
+        <div className="progress">
+          <div className="bar bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style={{width: '80%'}}><span className="sr-only">80% Complete (danger)</span></div>
+        </div>
+        <div className="progress">
+          <div className="bar bar-success" style={{width: '35%'}}><span className="sr-only">35% Complete (success)</span></div>
+          <div className="bar bar-warning" style={{width: '20%'}}><span className="sr-only">20% Complete (warning)</span></div>
+          <div className="bar bar-danger" style={{width: '10%'}}><span className='sr-only'>10% Complete (danger)</span></div>
+        </div>
 
 
 
-          <div className="page-header">
-            <h1>List groups</h1>
+        <div className="page-header">
+          <h1>List groups</h1>
+        </div>
+        <div className="row">
+          <div className="col-sm-4">
+            <ul className="nav nav-tabs nav-stacked">
+              <li className="list-group-item">Cras justo odio</li>
+              <li className="list-group-item">Dapibus ac facilisis in</li>
+              <li className="list-group-item">Morbi leo risus</li>
+              <li className="list-group-item">Porta ac consectetur ac</li>
+              <li className="list-group-item">Vestibulum at eros</li>
+            </ul>
           </div>
-          <div className="row">
-            <div className="col-sm-4">
-              <ul className="nav nav-tabs nav-stacked">
-                <li className="list-group-item">Cras justo odio</li>
-                <li className="list-group-item">Dapibus ac facilisis in</li>
-                <li className="list-group-item">Morbi leo risus</li>
-                <li className="list-group-item">Porta ac consectetur ac</li>
-                <li className="list-group-item">Vestibulum at eros</li>
-              </ul>
-            </div>
-            <div className="col-sm-4">
-              <div className="nav nav-tabs nav-stacked">
-                <a href="#" className="list-group-item active">
-                  Cras justo odio
-                </a>
-                <a href="#" className="list-group-item">Dapibus ac facilisis in</a>
-                <a href="#" className="list-group-item">Morbi leo risus</a>
-                <a href="#" className="list-group-item">Porta ac consectetur ac</a>
-                <a href="#" className="list-group-item">Vestibulum at eros</a>
-              </div>
+          <div className="col-sm-4">
+            <div className="nav nav-tabs nav-stacked">
+              <a href="#" className="list-group-item active">
+                Cras justo odio
+              </a>
+              <a href="#" className="list-group-item">Dapibus ac facilisis in</a>
+              <a href="#" className="list-group-item">Morbi leo risus</a>
+              <a href="#" className="list-group-item">Porta ac consectetur ac</a>
+              <a href="#" className="list-group-item">Vestibulum at eros</a>
             </div>
-            <div className="col-sm-4">
-              <div className="nav nav-tabs nav-stacked">
-                <a href="#" className="list-group-item active">
-                  <h4 className="list-group-item-heading">List group item heading</h4>
-                  <p className="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
-                </a>
-                <a href="#" className="list-group-item">
-                  <h4 className="list-group-item-heading">List group item heading</h4>
-                  <p className="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
-                </a>
-                <a href="#" className="list-group-item">
-                  <h4 className="list-group-item-heading">List group item heading</h4>
-                  <p className="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
-                </a>
-              </div>
-            </div>
-          </div>
-
-          <div className="page-header">
-            <h1>Wells</h1>
           </div>
-          <div className="well">
-            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed diam eget risus varius blandit sit amet non magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cras mattis consectetur purus sit amet fermentum. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur.</p>
+          <div className="col-sm-4">
+            <div className="nav nav-tabs nav-stacked">
+              <a href="#" className="list-group-item active">
+                <h4 className="list-group-item-heading">List group item heading</h4>
+                <p className="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
+              </a>
+              <a href="#" className="list-group-item">
+                <h4 className="list-group-item-heading">List group item heading</h4>
+                <p className="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
+              </a>
+              <a href="#" className="list-group-item">
+                <h4 className="list-group-item-heading">List group item heading</h4>
+                <p className="list-group-item-text">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
+              </a>
+            </div>
           </div>
+        </div>
 
-
+        <div className="page-header">
+          <h1>Wells</h1>
+        </div>
+        <div className="well">
+          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed diam eget risus varius blandit sit amet non magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cras mattis consectetur purus sit amet fermentum. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur.</p>
         </div>
-      );
-    }
 
-  });
 
-  return {
-    StyleTests: StyleTests
-  };
+      </div>
+    );
+  }
 
 });
+
+export default {
+  StyleTests: StyleTests
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/actions.js b/app/addons/verifyinstall/actions.js
index b19f2de..7cf5228 100644
--- a/app/addons/verifyinstall/actions.js
+++ b/app/addons/verifyinstall/actions.js
@@ -10,100 +10,94 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './constants',
-  './resources',
-  './actiontypes'
-],
-function (app, FauxtonAPI, Constants, VerifyInstall, ActionTypes) {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Constants from "./constants";
+import VerifyInstall from "./resources";
+import ActionTypes from "./actiontypes";
+
+
+// helper function to publish success/fail result of a single test having been ran
+var testPassed = function (test) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.VERIFY_INSTALL_SINGLE_TEST_COMPLETE,
+    test: test,
+    success: true
+  });
+};
+
+var testFailed = function (test) {
+  return function (xhr, error) {
+    if (!xhr) { return; }
 
-
-  // helper function to publish success/fail result of a single test having been ran
-  var testPassed = function (test) {
     FauxtonAPI.dispatch({
       type: ActionTypes.VERIFY_INSTALL_SINGLE_TEST_COMPLETE,
       test: test,
-      success: true
+      success: false
     });
-  };
-
-  var testFailed = function (test) {
-    return function (xhr, error) {
-      if (!xhr) { return; }
-
-      FauxtonAPI.dispatch({
-        type: ActionTypes.VERIFY_INSTALL_SINGLE_TEST_COMPLETE,
-        test: test,
-        success: false
-      });
-
-      FauxtonAPI.addNotification({
-        msg: 'Error: ' + JSON.parse(xhr.responseText).reason,
-        type: 'error'
-      });
-    };
-  };
-
-
-  return {
-    resetStore: function () {
-      FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_RESET });
-    },
-
-    startVerification: function () {
 
-      // announce that we're starting the verification tests
-      FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_START });
-
-      var testProcess = VerifyInstall.testProcess;
-
-      testProcess.setup()
-        .then(function () {
-          return testProcess.saveDB();
-        }, testFailed(Constants.TESTS.CREATE_DATABASE))
-        .then(function () {
-          testPassed(Constants.TESTS.CREATE_DATABASE);
-          return testProcess.saveDoc();
-        }, testFailed(Constants.TESTS.CREATE_DOCUMENT))
-        .then(function () {
-          testPassed(Constants.TESTS.CREATE_DOCUMENT);
-          return testProcess.updateDoc();
-        }, testFailed(Constants.TESTS.UPDATE_DOCUMENT))
-        .then(function () {
-          testPassed(Constants.TESTS.UPDATE_DOCUMENT);
-          return testProcess.destroyDoc();
-        }, testFailed(Constants.TESTS.DELETE_DOCUMENT))
-        .then(function () {
-          testPassed(Constants.TESTS.DELETE_DOCUMENT);
-          return testProcess.setupView();
-        }, testFailed(Constants.TESTS.CREATE_VIEW))
-        .then(function () {
-          return testProcess.testView();
-        }, testFailed(Constants.TESTS.CREATE_VIEW))
-        .then(function () {
-          testPassed(Constants.TESTS.CREATE_VIEW);
-          return testProcess.setupReplicate();
-        }, testFailed(Constants.TESTS.CREATE_VIEW))
-        .then(function () {
-          return testProcess.testReplicate();
-        }, testFailed(Constants.TESTS.REPLICATION))
-        .then(function () {
-          testPassed(Constants.TESTS.REPLICATION);
-
-          // now announce the tests have been ran
-          FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_ALL_TESTS_COMPLETE });
-
-          FauxtonAPI.addNotification({
-            msg: 'Success! Your CouchDB installation is working. Time to Relax.',
-            type: 'success'
-          });
-
-          testProcess.removeDBs();
-        }, testFailed(Constants.TESTS.REPLICATION));
-    }
+    FauxtonAPI.addNotification({
+      msg: 'Error: ' + JSON.parse(xhr.responseText).reason,
+      type: 'error'
+    });
   };
-
-
-});
+};
+
+
+export default {
+  resetStore: function () {
+    FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_RESET });
+  },
+
+  startVerification: function () {
+
+    // announce that we're starting the verification tests
+    FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_START });
+
+    var testProcess = VerifyInstall.testProcess;
+
+    testProcess.setup()
+      .then(function () {
+        return testProcess.saveDB();
+      }, testFailed(Constants.TESTS.CREATE_DATABASE))
+      .then(function () {
+        testPassed(Constants.TESTS.CREATE_DATABASE);
+        return testProcess.saveDoc();
+      }, testFailed(Constants.TESTS.CREATE_DOCUMENT))
+      .then(function () {
+        testPassed(Constants.TESTS.CREATE_DOCUMENT);
+        return testProcess.updateDoc();
+      }, testFailed(Constants.TESTS.UPDATE_DOCUMENT))
+      .then(function () {
+        testPassed(Constants.TESTS.UPDATE_DOCUMENT);
+        return testProcess.destroyDoc();
+      }, testFailed(Constants.TESTS.DELETE_DOCUMENT))
+      .then(function () {
+        testPassed(Constants.TESTS.DELETE_DOCUMENT);
+        return testProcess.setupView();
+      }, testFailed(Constants.TESTS.CREATE_VIEW))
+      .then(function () {
+        return testProcess.testView();
+      }, testFailed(Constants.TESTS.CREATE_VIEW))
+      .then(function () {
+        testPassed(Constants.TESTS.CREATE_VIEW);
+        return testProcess.setupReplicate();
+      }, testFailed(Constants.TESTS.CREATE_VIEW))
+      .then(function () {
+        return testProcess.testReplicate();
+      }, testFailed(Constants.TESTS.REPLICATION))
+      .then(function () {
+        testPassed(Constants.TESTS.REPLICATION);
+
+        // now announce the tests have been ran
+        FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_ALL_TESTS_COMPLETE });
+
+        FauxtonAPI.addNotification({
+          msg: 'Success! Your CouchDB installation is working. Time to Relax.',
+          type: 'success'
+        });
+
+        testProcess.removeDBs();
+      }, testFailed(Constants.TESTS.REPLICATION));
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/actiontypes.js b/app/addons/verifyinstall/actiontypes.js
index 72cf1ec..89db7e1 100644
--- a/app/addons/verifyinstall/actiontypes.js
+++ b/app/addons/verifyinstall/actiontypes.js
@@ -10,11 +10,9 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    VERIFY_INSTALL_START: 'VERIFY_INSTALL_START',
-    VERIFY_INSTALL_RESET: 'VERIFY_INSTALL_RESET',
-    VERIFY_INSTALL_SINGLE_TEST_COMPLETE: 'VERIFY_INSTALL_SINGLE_TEST_COMPLETE',
-    VERIFY_INSTALL_ALL_TESTS_COMPLETE: 'VERIFY_INSTALL_ALL_TESTS_COMPLETE'
-  };
-});
+export default {
+  VERIFY_INSTALL_START: 'VERIFY_INSTALL_START',
+  VERIFY_INSTALL_RESET: 'VERIFY_INSTALL_RESET',
+  VERIFY_INSTALL_SINGLE_TEST_COMPLETE: 'VERIFY_INSTALL_SINGLE_TEST_COMPLETE',
+  VERIFY_INSTALL_ALL_TESTS_COMPLETE: 'VERIFY_INSTALL_ALL_TESTS_COMPLETE'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/base.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/base.js b/app/addons/verifyinstall/base.js
index 95e8be8..23a6ce7 100644
--- a/app/addons/verifyinstall/base.js
+++ b/app/addons/verifyinstall/base.js
@@ -10,22 +10,17 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './routes',
-  "./assets/less/verifyinstall.less"
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import VerifyInstall from "./routes";
+import "./assets/less/verifyinstall.less";
+VerifyInstall.initialize = function () {
+  FauxtonAPI.addHeaderLink({
+    title: 'Verify',
+    href: '#verifyinstall',
+    icon: 'fonticon-ok-circled',
+    bottomNav: true
+  });
+};
 
-function (app, FauxtonAPI, VerifyInstall) {
-  VerifyInstall.initialize = function () {
-    FauxtonAPI.addHeaderLink({
-      title: 'Verify',
-      href: '#verifyinstall',
-      icon: 'fonticon-ok-circled',
-      bottomNav: true
-    });
-  };
-
-  return VerifyInstall;
-});
+export default VerifyInstall;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/components.react.jsx b/app/addons/verifyinstall/components.react.jsx
index d56b735..2b6bd54 100644
--- a/app/addons/verifyinstall/components.react.jsx
+++ b/app/addons/verifyinstall/components.react.jsx
@@ -10,134 +10,129 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  './constants',
-  './resources',
-  './actions',
-  './stores'
-],
-function (app, FauxtonAPI, React, Constants, VerifyInstall, Actions, Stores) {
-
-  var store = Stores.verifyInstallStore;
-
-
-  var VerifyInstallController = React.createClass({
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        isVerifying: store.checkIsVerifying(),
-        testResults: store.getTestResults()
-      };
-    },
-
-    startVerification: function () {
-      Actions.startVerification();
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    componentDidMount: function () {
-      store.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      store.off('change', this.onChange);
-    },
-
-    render: function () {
-      return (
-        <div>
-          <VerifyInstallButton verify={this.startVerification} isVerifying={this.state.isVerifying} />
-          <VerifyInstallResults testResults={this.state.testResults} />
-        </div>
-      );
-    }
-  });
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import Constants from "./constants";
+import VerifyInstall from "./resources";
+import Actions from "./actions";
+import Stores from "./stores";
+
+var store = Stores.verifyInstallStore;
+
+
+var VerifyInstallController = React.createClass({
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      isVerifying: store.checkIsVerifying(),
+      testResults: store.getTestResults()
+    };
+  },
+
+  startVerification: function () {
+    Actions.startVerification();
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+  },
+
+  render: function () {
+    return (
+      <div>
+        <VerifyInstallButton verify={this.startVerification} isVerifying={this.state.isVerifying} />
+        <VerifyInstallResults testResults={this.state.testResults} />
+      </div>
+    );
+  }
+});
 
 
-  var VerifyInstallButton = React.createClass({
-    propTypes: {
-      verify: React.PropTypes.func.isRequired,
-      isVerifying: React.PropTypes.bool.isRequired
-    },
+var VerifyInstallButton = React.createClass({
+  propTypes: {
+    verify: React.PropTypes.func.isRequired,
+    isVerifying: React.PropTypes.bool.isRequired
+  },
 
-    render: function () {
-      return (
-        <button id="start" className="btn btn-success" onClick={this.props.verify} disabled={this.props.isVerifying}>
-          {this.props.isVerifying ? 'Verifying' : 'Verify Installation'}
-        </button>
-      );
-    }
-  });
-
-
-  var VerifyInstallResults = React.createClass({
-    propTypes: {
-      testResults: React.PropTypes.object.isRequired
-    },
-
-    showTestResult: function (test) {
-      if (!this.props.testResults[test].complete) {
-        return '';
-      }
-      if (this.props.testResults[test].success) {
-        return <span>&#10003;</span>;
-      }
-      return <span>&#x2717;</span>;
-    },
-
-    render: function () {
-      return (
-        <table className="table table-striped table-bordered">
-          <thead>
-            <tr>
-              <th>Test</th>
-              <th>Status</th>
-            </tr>
-          </thead>
-          <tbody>
-            <tr>
-              <td>Create Database</td>
-              <td id="js-test-create-db">{this.showTestResult(Constants.TESTS.CREATE_DATABASE)}</td>
-            </tr>
-            <tr>
-              <td>Create Document</td>
-              <td id="js-test-create-doc">{this.showTestResult(Constants.TESTS.CREATE_DOCUMENT)}</td>
-            </tr>
-            <tr>
-              <td>Update Document</td>
-              <td id="js-test-update-doc">{this.showTestResult(Constants.TESTS.UPDATE_DOCUMENT)}</td>
-            </tr>
-            <tr>
-              <td>Delete Document</td>
-              <td id="js-test-delete-doc">{this.showTestResult(Constants.TESTS.DELETE_DOCUMENT)}</td>
-            </tr>
-            <tr>
-              <td>Create View</td>
-              <td id="js-test-create-view">{this.showTestResult(Constants.TESTS.CREATE_VIEW)}</td>
-            </tr>
-            <tr>
-              <td>Replication</td>
-              <td id="js-test-replication">{this.showTestResult(Constants.TESTS.REPLICATION)}</td>
-            </tr>
-          </tbody>
-        </table>
-      );
-    }
-  });
+  render: function () {
+    return (
+      <button id="start" className="btn btn-success" onClick={this.props.verify} disabled={this.props.isVerifying}>
+        {this.props.isVerifying ? 'Verifying' : 'Verify Installation'}
+      </button>
+    );
+  }
+});
 
-  return {
-    VerifyInstallController: VerifyInstallController,
-    VerifyInstallButton: VerifyInstallButton,
-    VerifyInstallResults: VerifyInstallResults
-  };
 
+var VerifyInstallResults = React.createClass({
+  propTypes: {
+    testResults: React.PropTypes.object.isRequired
+  },
+
+  showTestResult: function (test) {
+    if (!this.props.testResults[test].complete) {
+      return '';
+    }
+    if (this.props.testResults[test].success) {
+      return <span>&#10003;</span>;
+    }
+    return <span>&#x2717;</span>;
+  },
+
+  render: function () {
+    return (
+      <table className="table table-striped table-bordered">
+        <thead>
+          <tr>
+            <th>Test</th>
+            <th>Status</th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>Create Database</td>
+            <td id="js-test-create-db">{this.showTestResult(Constants.TESTS.CREATE_DATABASE)}</td>
+          </tr>
+          <tr>
+            <td>Create Document</td>
+            <td id="js-test-create-doc">{this.showTestResult(Constants.TESTS.CREATE_DOCUMENT)}</td>
+          </tr>
+          <tr>
+            <td>Update Document</td>
+            <td id="js-test-update-doc">{this.showTestResult(Constants.TESTS.UPDATE_DOCUMENT)}</td>
+          </tr>
+          <tr>
+            <td>Delete Document</td>
+            <td id="js-test-delete-doc">{this.showTestResult(Constants.TESTS.DELETE_DOCUMENT)}</td>
+          </tr>
+          <tr>
+            <td>Create View</td>
+            <td id="js-test-create-view">{this.showTestResult(Constants.TESTS.CREATE_VIEW)}</td>
+          </tr>
+          <tr>
+            <td>Replication</td>
+            <td id="js-test-replication">{this.showTestResult(Constants.TESTS.REPLICATION)}</td>
+          </tr>
+        </tbody>
+      </table>
+    );
+  }
 });
+
+export default {
+  VerifyInstallController: VerifyInstallController,
+  VerifyInstallButton: VerifyInstallButton,
+  VerifyInstallResults: VerifyInstallResults
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/constants.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/constants.js b/app/addons/verifyinstall/constants.js
index 56de9c9..fd286c0 100644
--- a/app/addons/verifyinstall/constants.js
+++ b/app/addons/verifyinstall/constants.js
@@ -10,18 +10,15 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
+var CONSTANTS = {
+  TESTS: {
+    CREATE_DATABASE: 'TEST_CREATE_DATABASE',
+    CREATE_DOCUMENT: 'TEST_CREATE_DOCUMENT',
+    UPDATE_DOCUMENT: 'TEST_UPDATE_DOCUMENT',
+    DELETE_DOCUMENT: 'TEST_DELETE_DOCUMENT',
+    CREATE_VIEW: 'TEST_CREATE_VIEW',
+    REPLICATION: 'TEST_REPLICATION'
+  }
+};
 
-  var CONSTANTS = {
-    TESTS: {
-      CREATE_DATABASE: 'TEST_CREATE_DATABASE',
-      CREATE_DOCUMENT: 'TEST_CREATE_DOCUMENT',
-      UPDATE_DOCUMENT: 'TEST_UPDATE_DOCUMENT',
-      DELETE_DOCUMENT: 'TEST_DELETE_DOCUMENT',
-      CREATE_VIEW: 'TEST_CREATE_VIEW',
-      REPLICATION: 'TEST_REPLICATION'
-    }
-  };
-
-  return CONSTANTS;
-});
+export default CONSTANTS;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/resources.js b/app/addons/verifyinstall/resources.js
index 3897850..a49d2b1 100644
--- a/app/addons/verifyinstall/resources.js
+++ b/app/addons/verifyinstall/resources.js
@@ -10,158 +10,153 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  '../databases/resources',
-  '../documents/resources'
-],
-
-function (app, FauxtonAPI, Databases, Documents) {
-  var Verifyinstall = FauxtonAPI.addon();
-
-  var db = new Databases.Model({
-    id: 'verifytestdb',
-    name: 'verifytestdb'
-  });
-
-  var dbReplicate = new Databases.Model({
-    id: 'verifytestdb_replicate',
-    name: 'verifytestdb_replicate'
-  });
-
-  var doc, viewDoc;
-
-  Verifyinstall.testProcess = {
-    saveDoc: function () {
-      doc = new Documents.Doc({_id: 'test_doc_1', a: 1}, {
-        database: db
-      });
-
-      return doc.save();
-    },
-
-    destroyDoc: function () {
-      return doc.destroy();
-    },
-
-    updateDoc: function () {
-      doc.set({b: 'hello'});
-      return doc.save();
-    },
-
-    saveDB: function () {
-      return db.save();
-    },
-
-    setupDB: function (db) {
-      var deferred = FauxtonAPI.Deferred();
-      db.fetch()
-      .then(function () {
-        return db.destroy();
-      }, function (xhr) {
-        deferred.resolve();
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Databases from "../databases/resources";
+import Documents from "../documents/resources";
+var Verifyinstall = FauxtonAPI.addon();
+
+var db = new Databases.Model({
+  id: 'verifytestdb',
+  name: 'verifytestdb'
+});
+
+var dbReplicate = new Databases.Model({
+  id: 'verifytestdb_replicate',
+  name: 'verifytestdb_replicate'
+});
+
+var doc, viewDoc;
+
+Verifyinstall.testProcess = {
+  saveDoc: function () {
+    doc = new Documents.Doc({_id: 'test_doc_1', a: 1}, {
+      database: db
+    });
+
+    return doc.save();
+  },
+
+  destroyDoc: function () {
+    return doc.destroy();
+  },
+
+  updateDoc: function () {
+    doc.set({b: 'hello'});
+    return doc.save();
+  },
+
+  saveDB: function () {
+    return db.save();
+  },
+
+  setupDB: function (db) {
+    var deferred = FauxtonAPI.Deferred();
+    db.fetch()
+    .then(function () {
+      return db.destroy();
+    }, function (xhr) {
+      deferred.resolve();
+    })
+    .then(function () {
+      deferred.resolve();
+    }, function (xhr, error, reason) {
+      if (reason === 'Unauthorized') {
+        deferred.reject(xhr, error, reason);
+      }
+    });
+
+    return deferred;
+  },
+
+  setup: function () {
+    return FauxtonAPI.when([
+      this.setupDB(db),
+      this.setupDB(dbReplicate)
+    ]);
+  },
+
+  testView: function () {
+    var deferred = FauxtonAPI.Deferred();
+    var promise = $.get(viewDoc.url() + '/_view/testview');
+
+    promise.then(function (resp) {
+      resp = _.isString(resp) ? JSON.parse(resp) : resp;
+      var row = resp.rows[0];
+      if (row.value === 6) {
+        return deferred.resolve();
+      }
+      var reason = {
+        reason: 'Values expect 6, got ' + row.value
+      };
+
+      deferred.reject({responseText: JSON.stringify(reason)});
+    }, deferred.reject);
+
+    return deferred;
+  },
+
+  setupView: function () {
+    var doc1 = new Documents.Doc({_id: 'test_doc_10', a: 1}, { database: db });
+    var doc2 = new Documents.Doc({_id: 'test_doc_20', a: 2}, { database: db });
+    var doc3 = new Documents.Doc({_id: 'test_doc_30', a: 3}, { database: db });
+
+    viewDoc = new Documents.Doc({
+      _id: '_design/view_check',
+      views: {
+        'testview': {
+          map: 'function (doc) { emit(doc._id, doc.a); }',
+          reduce: '_sum'
+        }
+      }
+    }, {
+      database: db
+    });
+
+    return FauxtonAPI.when([doc1.save(), doc2.save(), doc3.save(), viewDoc.save()]);
+  },
+
+  setupReplicate: function () {
+    return $.ajax({
+      url: app.host + '/_replicate',
+      contentType: 'application/json',
+      type: 'POST',
+      dataType: 'json',
+      processData: false,
+      data: JSON.stringify({
+        create_target: true,
+        source: 'verifytestdb',
+        target: 'verifytestdb_replicate'
       })
-      .then(function () {
+    });
+  },
+
+  testReplicate: function () {
+    var deferred = FauxtonAPI.Deferred();
+    var promise = dbReplicate.fetch();
+
+    promise.then(function () {
+      var docCount = dbReplicate.get('doc_count');
+      if ( docCount === 4) {
         deferred.resolve();
-      }, function (xhr, error, reason) {
-        if (reason === 'Unauthorized') {
-          deferred.reject(xhr, error, reason);
-        }
-      });
-
-      return deferred;
-    },
-
-    setup: function () {
-      return FauxtonAPI.when([
-        this.setupDB(db),
-        this.setupDB(dbReplicate)
-      ]);
-    },
-
-    testView: function () {
-      var deferred = FauxtonAPI.Deferred();
-      var promise = $.get(viewDoc.url() + '/_view/testview');
-
-      promise.then(function (resp) {
-        resp = _.isString(resp) ? JSON.parse(resp) : resp;
-        var row = resp.rows[0];
-        if (row.value === 6) {
-          return deferred.resolve();
-        }
-        var reason = {
-          reason: 'Values expect 6, got ' + row.value
-        };
-
-        deferred.reject({responseText: JSON.stringify(reason)});
-      }, deferred.reject);
-
-      return deferred;
-    },
-
-    setupView: function () {
-      var doc1 = new Documents.Doc({_id: 'test_doc_10', a: 1}, { database: db });
-      var doc2 = new Documents.Doc({_id: 'test_doc_20', a: 2}, { database: db });
-      var doc3 = new Documents.Doc({_id: 'test_doc_30', a: 3}, { database: db });
-
-      viewDoc = new Documents.Doc({
-        _id: '_design/view_check',
-        views: {
-          'testview': {
-            map: 'function (doc) { emit(doc._id, doc.a); }',
-            reduce: '_sum'
-          }
-        }
-      }, {
-        database: db
-      });
-
-      return FauxtonAPI.when([doc1.save(), doc2.save(), doc3.save(), viewDoc.save()]);
-    },
-
-    setupReplicate: function () {
-      return $.ajax({
-        url: app.host + '/_replicate',
-        contentType: 'application/json',
-        type: 'POST',
-        dataType: 'json',
-        processData: false,
-        data: JSON.stringify({
-          create_target: true,
-          source: 'verifytestdb',
-          target: 'verifytestdb_replicate'
-        })
-      });
-    },
-
-    testReplicate: function () {
-      var deferred = FauxtonAPI.Deferred();
-      var promise = dbReplicate.fetch();
-
-      promise.then(function () {
-        var docCount = dbReplicate.get('doc_count');
-        if ( docCount === 4) {
-          deferred.resolve();
-          return;
-        }
+        return;
+      }
 
-        var reason = {
-          reason: 'Replication Failed, expected 4 docs got ' + docCount
-        };
+      var reason = {
+        reason: 'Replication Failed, expected 4 docs got ' + docCount
+      };
 
-        deferred.reject({responseText: JSON.stringify(reason)});
-      }, deferred.reject);
+      deferred.reject({responseText: JSON.stringify(reason)});
+    }, deferred.reject);
 
-      return deferred;
-    },
+    return deferred;
+  },
 
-    removeDBs: function () {
-      dbReplicate.destroy();
-      db.destroy();
-    }
-  };
+  removeDBs: function () {
+    dbReplicate.destroy();
+    db.destroy();
+  }
+};
 
 
-  return Verifyinstall;
-});
+export default Verifyinstall;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/routes.js b/app/addons/verifyinstall/routes.js
index 542b715..94fb346 100644
--- a/app/addons/verifyinstall/routes.js
+++ b/app/addons/verifyinstall/routes.js
@@ -10,32 +10,28 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './resources',
-  './actions',
-  './components.react'
-],
-function (app, FauxtonAPI, VerifyInstall, Actions, Components) {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import VerifyInstall from "./resources";
+import Actions from "./actions";
+import Components from "./components.react";
 
-  var VerifyRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'one_pane',
+var VerifyRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'one_pane',
 
-    routes: {
-      'verifyinstall': 'verifyInstall'
-    },
-    selectedHeader: 'Verify',
+  routes: {
+    'verifyinstall': 'verifyInstall'
+  },
+  selectedHeader: 'Verify',
 
-    verifyInstall: function () {
-      Actions.resetStore();
-      this.setComponent('#dashboard-content', Components.VerifyInstallController);
-    },
+  verifyInstall: function () {
+    Actions.resetStore();
+    this.setComponent('#dashboard-content', Components.VerifyInstallController);
+  },
 
-    crumbs: [{name: 'Verify CouchDB Installation', link: '#'}]
-  });
+  crumbs: [{name: 'Verify CouchDB Installation', link: '#'}]
+});
 
-  VerifyInstall.RouteObjects = [VerifyRouteObject];
+VerifyInstall.RouteObjects = [VerifyRouteObject];
 
-  return VerifyInstall;
-});
+export default VerifyInstall;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/stores.js b/app/addons/verifyinstall/stores.js
index d3fd9b5..b9de784 100644
--- a/app/addons/verifyinstall/stores.js
+++ b/app/addons/verifyinstall/stores.js
@@ -10,90 +10,84 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../core/api',
-  './constants',
-  './actiontypes'
-],
-
-function (FauxtonAPI, Constants, ActionTypes) {
-
-  var VerifyInstallStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._isVerifying = false;
-
-      // reset all the tests
-      this._tests = {};
-      _.each(Object.keys(Constants.TESTS), function (key) {
-        this._tests[Constants.TESTS[key]] = { complete: false };
-      }, this);
-    },
-
-    startVerification: function () {
-      this._isVerifying = true;
-    },
-
-    stopVerification: function () {
-      this._isVerifying = false;
-    },
-
-    checkIsVerifying: function () {
-      return this._isVerifying;
-    },
-
-    updateTestStatus: function (test, success) {
-
-      // shouldn't ever occur since we're using constants for the test names
-      if (!_.has(this._tests, test)) {
-        throw new Error('Invalid test name passed to updateTestStatus()');
-      }
-
-      // mark this test as complete, and track whether it was a success or failure
-      this._tests[test] = { complete: true, success: success };
-    },
-
-    getTestResults: function () {
-      return this._tests;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.VERIFY_INSTALL_START:
-          this.startVerification();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.VERIFY_INSTALL_RESET:
-          this.reset();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.VERIFY_INSTALL_SINGLE_TEST_COMPLETE:
-          this.updateTestStatus(action.test, action.success);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.VERIFY_INSTALL_ALL_TESTS_COMPLETE:
-          this.stopVerification();
-          this.triggerChange();
-        break;
-
-        default:
-        return;
-      }
+import FauxtonAPI from "../../core/api";
+import Constants from "./constants";
+import ActionTypes from "./actiontypes";
+
+var VerifyInstallStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._isVerifying = false;
+
+    // reset all the tests
+    this._tests = {};
+    _.each(Object.keys(Constants.TESTS), function (key) {
+      this._tests[Constants.TESTS[key]] = { complete: false };
+    }, this);
+  },
+
+  startVerification: function () {
+    this._isVerifying = true;
+  },
+
+  stopVerification: function () {
+    this._isVerifying = false;
+  },
+
+  checkIsVerifying: function () {
+    return this._isVerifying;
+  },
+
+  updateTestStatus: function (test, success) {
+
+    // shouldn't ever occur since we're using constants for the test names
+    if (!_.has(this._tests, test)) {
+      throw new Error('Invalid test name passed to updateTestStatus()');
     }
-  });
 
+    // mark this test as complete, and track whether it was a success or failure
+    this._tests[test] = { complete: true, success: success };
+  },
+
+  getTestResults: function () {
+    return this._tests;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.VERIFY_INSTALL_START:
+        this.startVerification();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.VERIFY_INSTALL_RESET:
+        this.reset();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.VERIFY_INSTALL_SINGLE_TEST_COMPLETE:
+        this.updateTestStatus(action.test, action.success);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.VERIFY_INSTALL_ALL_TESTS_COMPLETE:
+        this.stopVerification();
+        this.triggerChange();
+      break;
+
+      default:
+      return;
+    }
+  }
+});
 
-  var Stores = {};
-  Stores.verifyInstallStore = new VerifyInstallStore();
-  Stores.verifyInstallStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.verifyInstallStore.dispatch);
 
+var Stores = {};
+Stores.verifyInstallStore = new VerifyInstallStore();
+Stores.verifyInstallStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.verifyInstallStore.dispatch);
 
-  return Stores;
 
-});
+export default Stores;


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/mango/tests/mango.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/tests/mango.componentsSpec.react.jsx b/app/addons/documents/mango/tests/mango.componentsSpec.react.jsx
index 566ea9c..bf2baad 100644
--- a/app/addons/documents/mango/tests/mango.componentsSpec.react.jsx
+++ b/app/addons/documents/mango/tests/mango.componentsSpec.react.jsx
@@ -10,201 +10,198 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../mango.components.react',
-  '../mango.stores',
-  '../mango.actions',
-  '../mango.actiontypes',
-  '../../resources',
-  '../../../databases/resources',
-  '../../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, Stores, MangoActions, ActionTypes, Resources, Databases, utils, React, ReactDOM, TestUtils, sinon) {
-
-  var assert = utils.assert;
-
-  describe('Mango IndexEditor', function () {
-    var database = new Databases.Model({id: 'testdb'}),
-        container,
-        editor;
-
-    beforeEach(function () {
-      container = document.createElement('div');
-      MangoActions.setDatabase({
-        database: database
-      });
+import FauxtonAPI from "../../../../core/api";
+import Views from "../mango.components.react";
+import Stores from "../mango.stores";
+import MangoActions from "../mango.actions";
+import ActionTypes from "../mango.actiontypes";
+import Resources from "../../resources";
+import Databases from "../../../databases/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";
+
+var assert = utils.assert;
+
+describe('Mango IndexEditor', function () {
+  var database = new Databases.Model({id: 'testdb'}),
+      container,
+      editor;
+
+  beforeEach(function () {
+    container = document.createElement('div');
+    MangoActions.setDatabase({
+      database: database
     });
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('renders a default index definition', function () {
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoIndexEditorController description="foo" />,
-        container
-      );
+  it('renders a default index definition', function () {
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoIndexEditorController description="foo" />,
+      container
+    );
 
-      var payload = JSON.parse(editor.getMangoEditor().getEditorValue());
-      assert.equal(payload.index.fields[0], '_id');
-    });
+    var payload = JSON.parse(editor.getMangoEditor().getEditorValue());
+    assert.equal(payload.index.fields[0], '_id');
+  });
 
-    it('renders the current database', function () {
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoIndexEditorController description="foo" />,
-        container
-      );
-      var $el = $(ReactDOM.findDOMNode(editor));
+  it('renders the current database', function () {
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoIndexEditorController description="foo" />,
+      container
+    );
+    var $el = $(ReactDOM.findDOMNode(editor));
 
-      assert.equal($el.find('.db-title').text(), 'testdb');
-    });
+    assert.equal($el.find('.db-title').text(), 'testdb');
+  });
 
-    it('renders a description', function () {
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoIndexEditorController description="CouchDB Query is great!" />,
-        container
-      );
-      var $el = $(ReactDOM.findDOMNode(editor));
+  it('renders a description', function () {
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoIndexEditorController description="CouchDB Query is great!" />,
+      container
+    );
+    var $el = $(ReactDOM.findDOMNode(editor));
 
-      assert.equal($el.find('.editor-description').text(), 'CouchDB Query is great!');
-    });
+    assert.equal($el.find('.editor-description').text(), 'CouchDB Query is great!');
   });
+});
 
-  describe('Mango QueryEditor', function () {
-    var database = new Databases.Model({id: 'testdb'}),
-        container,
-        editor,
-        mangoCollection;
-
-    beforeEach(function () {
-      container = document.createElement('div');
-      MangoActions.setDatabase({
-        database: database
-      });
-
-      MangoActions.mangoResetIndexList({isLoading: false});
-
-      mangoCollection = new Resources.MangoIndexCollection([{
-        ddoc: '_design/e4d338e5d6f047749f5399ab998b4fa04ba0c816',
-        def: {
-          fields: [
-            {'_id': 'asc'},
-            {'foo': 'bar'},
-            {'ente': 'gans'}
-          ]
-        },
-        name: 'e4d338e5d6f047749f5399ab998b4fa04ba0c816',
-        type: 'json'
-      }, {
-        ddoc: null,
-        def: {
-          fields: [{
-            '_id': 'asc'
-          }]
-        },
-        name: '_all_docs',
-        type: 'special'
-      }], {
-        params: {},
-        database: {
-          safeID: function () { return '1'; }
-        }
-      });
-
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_NEW_AVAILABLE_INDEXES,
-        options: {indexList: mangoCollection}
-      });
+describe('Mango QueryEditor', function () {
+  var database = new Databases.Model({id: 'testdb'}),
+      container,
+      editor,
+      mangoCollection;
 
+  beforeEach(function () {
+    container = document.createElement('div');
+    MangoActions.setDatabase({
+      database: database
     });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
+    MangoActions.mangoResetIndexList({isLoading: false});
+
+    mangoCollection = new Resources.MangoIndexCollection([{
+      ddoc: '_design/e4d338e5d6f047749f5399ab998b4fa04ba0c816',
+      def: {
+        fields: [
+          {'_id': 'asc'},
+          {'foo': 'bar'},
+          {'ente': 'gans'}
+        ]
+      },
+      name: 'e4d338e5d6f047749f5399ab998b4fa04ba0c816',
+      type: 'json'
+    }, {
+      ddoc: null,
+      def: {
+        fields: [{
+          '_id': 'asc'
+        }]
+      },
+      name: '_all_docs',
+      type: 'special'
+    }], {
+      params: {},
+      database: {
+        safeID: function () { return '1'; }
+      }
     });
 
-    it('lists our available indexes', function () {
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoQueryEditorController description="foo" />,
-        container
-      );
-      var $el = $(ReactDOM.findDOMNode(editor));
-      assert.equal($el.find('.mango-available-indexes').length, 1);
-
-      assert.include(
-        $el.find('.mango-available-indexes').text(),
-        'json: _id, foo, ente'
-      );
-      assert.include(
-        $el.find('.mango-available-indexes').text(),
-        'json: _id'
-      );
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_NEW_AVAILABLE_INDEXES,
+      options: {indexList: mangoCollection}
     });
 
-    it('has a default query', function () {
-      editor = ReactDOM.render(
-        <Views.MangoQueryEditorController description="foo" />,
-        container
-      );
-      var json = JSON.parse(editor.getMangoEditor().getEditorValue());
-      assert.equal(Object.keys(json.selector)[0], '_id');
-    });
+  });
 
-    it('can render a query based on the last defined index', function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
-        options: {
-          fields: ['zetti', 'mussmaennchen']
-        }
-      });
-
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoQueryEditorController description="foo" />,
-        container
-      );
-
-      var json = JSON.parse(editor.getMangoEditor().getEditorValue());
-      assert.equal(Object.keys(json.selector)[0], 'zetti');
-      assert.equal(Object.keys(json.selector)[1], 'mussmaennchen');
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('informs the user that it uses a query based on the last defined index', function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
-        options: {
-          fields: ['zetti', 'mussmaennchen']
-        }
-      });
-
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoQueryEditorController description="foo" />,
-        container
-      );
-      var $el = $(ReactDOM.findDOMNode(editor));
-      assert.equal($el.find('.info-changed-query').length, 1);
-    });
+  it('lists our available indexes', function () {
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoQueryEditorController description="foo" />,
+      container
+    );
+    var $el = $(ReactDOM.findDOMNode(editor));
+    assert.equal($el.find('.mango-available-indexes').length, 1);
+
+    assert.include(
+      $el.find('.mango-available-indexes').text(),
+      'json: _id, foo, ente'
+    );
+    assert.include(
+      $el.find('.mango-available-indexes').text(),
+      'json: _id'
+    );
+  });
 
-    it('renders the current database', function () {
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoQueryEditorController description="foo" />,
-        container
-      );
-      var $el = $(ReactDOM.findDOMNode(editor));
+  it('has a default query', function () {
+    editor = ReactDOM.render(
+      <Views.MangoQueryEditorController description="foo" />,
+      container
+    );
+    var json = JSON.parse(editor.getMangoEditor().getEditorValue());
+    assert.equal(Object.keys(json.selector)[0], '_id');
+  });
 
-      assert.equal($el.find('.db-title').text(), 'testdb');
+  it('can render a query based on the last defined index', function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
+      options: {
+        fields: ['zetti', 'mussmaennchen']
+      }
     });
 
-    it('renders a description', function () {
-      editor = TestUtils.renderIntoDocument(
-        <Views.MangoQueryEditorController description="CouchDB Query is great!" />,
-        container
-      );
-      var $el = $(ReactDOM.findDOMNode(editor));
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoQueryEditorController description="foo" />,
+      container
+    );
 
-      assert.equal($el.find('.editor-description').text(), 'CouchDB Query is great!');
+    var json = JSON.parse(editor.getMangoEditor().getEditorValue());
+    assert.equal(Object.keys(json.selector)[0], 'zetti');
+    assert.equal(Object.keys(json.selector)[1], 'mussmaennchen');
+  });
+
+  it('informs the user that it uses a query based on the last defined index', function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
+      options: {
+        fields: ['zetti', 'mussmaennchen']
+      }
     });
+
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoQueryEditorController description="foo" />,
+      container
+    );
+    var $el = $(ReactDOM.findDOMNode(editor));
+    assert.equal($el.find('.info-changed-query').length, 1);
+  });
+
+  it('renders the current database', function () {
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoQueryEditorController description="foo" />,
+      container
+    );
+    var $el = $(ReactDOM.findDOMNode(editor));
+
+    assert.equal($el.find('.db-title').text(), 'testdb');
+  });
+
+  it('renders a description', function () {
+    editor = TestUtils.renderIntoDocument(
+      <Views.MangoQueryEditorController description="CouchDB Query is great!" />,
+      container
+    );
+    var $el = $(ReactDOM.findDOMNode(editor));
+
+    assert.equal($el.find('.editor-description').text(), 'CouchDB Query is great!');
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/mango/tests/mango.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/tests/mango.storesSpec.js b/app/addons/documents/mango/tests/mango.storesSpec.js
index 5a2e599..34a843c 100644
--- a/app/addons/documents/mango/tests/mango.storesSpec.js
+++ b/app/addons/documents/mango/tests/mango.storesSpec.js
@@ -10,92 +10,88 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../mango.stores',
-  '../mango.actiontypes',
-  '../../resources',
-  '../../../../../test/mocha/testUtils',
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../mango.stores";
+import ActionTypes from "../mango.actiontypes";
+import Resources from "../../resources";
+import testUtils from "../../../../../test/mocha/testUtils";
+var assert = testUtils.assert;
+var dispatchToken;
+var store;
 
-], function (FauxtonAPI, Stores, ActionTypes, Resources, testUtils) {
-  var assert = testUtils.assert;
-  var dispatchToken;
-  var store;
+describe('Mango Store', function () {
 
-  describe('Mango Store', function () {
+  describe('getQueryCode', function () {
 
-    describe('getQueryCode', function () {
-
-      beforeEach(function () {
-        store = new Stores.MangoStore();
-        dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
-      });
+    beforeEach(function () {
+      store = new Stores.MangoStore();
+      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+    });
 
-      afterEach(function () {
-        FauxtonAPI.dispatcher.unregister(dispatchToken);
-      });
+    afterEach(function () {
+      FauxtonAPI.dispatcher.unregister(dispatchToken);
+    });
 
-      it('returns a default query', function () {
-        assert.ok(store.getQueryFindCode());
-      });
+    it('returns a default query', function () {
+      assert.ok(store.getQueryFindCode());
+    });
 
-      it('can set new selectors', function () {
-        store.newQueryFindCodeFromFields({fields: ['foo', 'bar']});
-        var res = store.getQueryFindCode();
-        assert.equal(res, JSON.stringify({
-          "selector": {
-            "foo": {"$gt": null},
-            "bar": {"$gt": null}
-          }
-        }, null, '  '));
-      });
+    it('can set new selectors', function () {
+      store.newQueryFindCodeFromFields({fields: ['foo', 'bar']});
+      var res = store.getQueryFindCode();
+      assert.equal(res, JSON.stringify({
+        "selector": {
+          "foo": {"$gt": null},
+          "bar": {"$gt": null}
+        }
+      }, null, '  '));
+    });
 
-      it('indicates that we set another query for the user', function () {
-        assert.notOk(store.getQueryFindCodeChanged());
-        store.newQueryFindCodeFromFields({fields: ['mussman', 'zetti']});
-        assert.ok(store.getQueryFindCodeChanged());
-      });
+    it('indicates that we set another query for the user', function () {
+      assert.notOk(store.getQueryFindCodeChanged());
+      store.newQueryFindCodeFromFields({fields: ['mussman', 'zetti']});
+      assert.ok(store.getQueryFindCodeChanged());
+    });
 
-      it('alters the default query', function () {
-        assert.notOk(store.getQueryFindCodeChanged());
-        store.newQueryFindCodeFromFields({fields: ['mussman', 'zetti']});
-        assert.deepEqual(store.getQueryFindCode(), JSON.stringify({
-          "selector": {
-            "mussman": {"$gt": null},
-            "zetti": {"$gt": null}
-          }
-        }, null, '  '));
-      });
+    it('alters the default query', function () {
+      assert.notOk(store.getQueryFindCodeChanged());
+      store.newQueryFindCodeFromFields({fields: ['mussman', 'zetti']});
+      assert.deepEqual(store.getQueryFindCode(), JSON.stringify({
+        "selector": {
+          "mussman": {"$gt": null},
+          "zetti": {"$gt": null}
+        }
+      }, null, '  '));
+    });
 
-      it('filters querytypes that are not needed', function () {
+    it('filters querytypes that are not needed', function () {
 
-        var collection = new Resources.MangoIndexCollection([
-          new Resources.MangoIndex({
-            ddoc: null,
-            name: 'emma',
-            type: 'special',
-            def: {fields: [{_id: 'asc'}]}
-          }, {}),
-          new Resources.MangoIndex({
-            ddoc: null,
-            name: 'biene',
-            type: 'json',
-            def: {fields: [{_id: 'desc'}]}
-          }, {}),
-          new Resources.MangoIndex({
-            ddoc: null,
-            name: 'alf',
-            type: 'nickname',
-            def: {fields: [{_id: 'asc'}]}
-          }, {})
-        ], {
-          database: {id: 'databaseId', safeID: function () { return this.id; }},
-          params: {limit: 20}
-        });
-        store._availableIndexes = collection;
-        assert.equal(store.getAvailableQueryIndexes().length, 2);
+      var collection = new Resources.MangoIndexCollection([
+        new Resources.MangoIndex({
+          ddoc: null,
+          name: 'emma',
+          type: 'special',
+          def: {fields: [{_id: 'asc'}]}
+        }, {}),
+        new Resources.MangoIndex({
+          ddoc: null,
+          name: 'biene',
+          type: 'json',
+          def: {fields: [{_id: 'desc'}]}
+        }, {}),
+        new Resources.MangoIndex({
+          ddoc: null,
+          name: 'alf',
+          type: 'nickname',
+          def: {fields: [{_id: 'asc'}]}
+        }, {})
+      ], {
+        database: {id: 'databaseId', safeID: function () { return this.id; }},
+        params: {limit: 20}
       });
-
+      store._availableIndexes = collection;
+      assert.equal(store.getAvailableQueryIndexes().length, 2);
     });
+
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/pagination/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/actions.js b/app/addons/documents/pagination/actions.js
index 03c3fa6..02735de 100644
--- a/app/addons/documents/pagination/actions.js
+++ b/app/addons/documents/pagination/actions.js
@@ -10,77 +10,71 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  "../../../core/api",
-  './actiontypes',
-  '../index-results/actions',
-
-
-],
-function (app, FauxtonAPI, ActionTypes, IndexResultsActions) {
-
-  return {
-
-    updatePerPage: function (perPage, collection, bulkCollection) {
-
-      FauxtonAPI.dispatch({
-        type: ActionTypes.PER_PAGE_CHANGE,
-        perPage: perPage
-      });
-
-      IndexResultsActions.clearResults();
-      collection.fetch().then(function () {
-        IndexResultsActions.resultsListReset();
-        IndexResultsActions.sendMessageNewResultList({
-          collection: collection,
-          bulkCollection: bulkCollection
-        });
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import IndexResultsActions from "../index-results/actions";
+
+export default {
+
+  updatePerPage: function (perPage, collection, bulkCollection) {
+
+    FauxtonAPI.dispatch({
+      type: ActionTypes.PER_PAGE_CHANGE,
+      perPage: perPage
+    });
+
+    IndexResultsActions.clearResults();
+    collection.fetch().then(function () {
+      IndexResultsActions.resultsListReset();
+      IndexResultsActions.sendMessageNewResultList({
+        collection: collection,
+        bulkCollection: bulkCollection
       });
-    },
-
-    setDocumentLimit: function (docLimit) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.SET_PAGINATION_DOCUMENT_LIMIT,
-        docLimit: docLimit
-      });
-    },
-
-    paginateNext: function (collection, bulkCollection) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.PAGINATE_NEXT,
+    });
+  },
+
+  setDocumentLimit: function (docLimit) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.SET_PAGINATION_DOCUMENT_LIMIT,
+      docLimit: docLimit
+    });
+  },
+
+  paginateNext: function (collection, bulkCollection) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.PAGINATE_NEXT,
+    });
+
+    IndexResultsActions.clearResults();
+    collection.next().then(function () {
+      IndexResultsActions.resultsListReset();
+
+      IndexResultsActions.sendMessageNewResultList({
+        collection: collection,
+        bulkCollection: bulkCollection
       });
+    });
+  },
 
-      IndexResultsActions.clearResults();
-      collection.next().then(function () {
-        IndexResultsActions.resultsListReset();
-
-        IndexResultsActions.sendMessageNewResultList({
-          collection: collection,
-          bulkCollection: bulkCollection
-        });
-      });
-    },
-
-    paginatePrevious: function (collection, bulkCollection) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.PAGINATE_PREVIOUS,
-      });
+  paginatePrevious: function (collection, bulkCollection) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.PAGINATE_PREVIOUS,
+    });
 
-      IndexResultsActions.clearResults();
-      collection.previous().then(function () {
-        IndexResultsActions.resultsListReset();
+    IndexResultsActions.clearResults();
+    collection.previous().then(function () {
+      IndexResultsActions.resultsListReset();
 
-        IndexResultsActions.sendMessageNewResultList({
-          collection: collection,
-          bulkCollection: bulkCollection
-        });
+      IndexResultsActions.sendMessageNewResultList({
+        collection: collection,
+        bulkCollection: bulkCollection
       });
-    },
+    });
+  },
 
-    toggleTableViewType: function () {
-      IndexResultsActions.togglePrioritizedTableView();
-    }
+  toggleTableViewType: function () {
+    IndexResultsActions.togglePrioritizedTableView();
+  }
 
-  };
-});
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/pagination/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/actiontypes.js b/app/addons/documents/pagination/actiontypes.js
index 199131e..7e47937 100644
--- a/app/addons/documents/pagination/actiontypes.js
+++ b/app/addons/documents/pagination/actiontypes.js
@@ -10,12 +10,10 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    COLLECTION_CHANGED: 'COLLECTION_CHANGED',
-    PER_PAGE_CHANGE: 'PER_PAGE_CHANGE',
-    PAGINATE_NEXT: 'PAGINATE_NEXT',
-    PAGINATE_PREVIOUS: 'PAGINATE_PREVIOUS',
-    SET_PAGINATION_DOCUMENT_LIMIT: 'SET_PAGINATION_DOCUMENT_LIMIT'
-  };
-});
+export default {
+  COLLECTION_CHANGED: 'COLLECTION_CHANGED',
+  PER_PAGE_CHANGE: 'PER_PAGE_CHANGE',
+  PAGINATE_NEXT: 'PAGINATE_NEXT',
+  PAGINATE_PREVIOUS: 'PAGINATE_PREVIOUS',
+  SET_PAGINATION_DOCUMENT_LIMIT: 'SET_PAGINATION_DOCUMENT_LIMIT'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 04ace67..2b8e5de 100644
--- a/app/addons/documents/pagination/pagination.react.jsx
+++ b/app/addons/documents/pagination/pagination.react.jsx
@@ -10,263 +10,259 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../../core/api",
-  "react",
-  './actions',
-  '../index-results/stores',
-  ], function (FauxtonAPI, React, Actions, IndexResultsStore) {
-    var indexResultsStore = IndexResultsStore.indexResultsStore;
-
-    var IndexPaginationController = React.createClass({
-
-      getStoreState: function () {
-        return {
-          canShowPrevious: indexResultsStore.canShowPrevious(),
-          canShowNext: indexResultsStore.canShowNext(),
-          collection: indexResultsStore.getCollection(),
-          bulkCollection: indexResultsStore.getBulkDocCollection(),
-        };
-      },
-
-      getInitialState: function () {
-        return this.getStoreState();
-      },
-
-      componentDidMount: function () {
-        indexResultsStore.on('change', this.onChange, this);
-      },
-
-      componentWillUnmount: function () {
-        indexResultsStore.off('change', this.onChange);
-      },
-
-      onChange: function () {
-        this.setState(this.getStoreState());
-      },
-
-      nextClicked: function (event) {
-        event.preventDefault();
-        if (!this.state.canShowNext) { return; }
-
-        var collection = this.state.collection;
-        var bulkCollection = this.state.bulkCollection;
-        Actions.paginateNext(collection, bulkCollection);
-      },
-
-      previousClicked: function (event) {
-        event.preventDefault();
-        if (!this.state.canShowPrevious) { return; }
-
-        var collection = this.state.collection;
-        var bulkCollection = this.state.bulkCollection;
-        Actions.paginatePrevious(collection, bulkCollection);
-      },
-
-      render: function () {
-        var canShowPreviousClassName = '';
-        var canShowNextClassName = '';
-
-        if (!this.state.canShowPrevious) {
-          canShowPreviousClassName = 'disabled';
-        }
-
-        if (!this.state.canShowNext) {
-          canShowNextClassName = 'disabled';
-        }
-
-        return (
-          <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>
-        );
-      }
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import Actions from "./actions";
+import IndexResultsStore from "../index-results/stores";
+var indexResultsStore = IndexResultsStore.indexResultsStore;
 
-    });
-
-    var PerPageSelector = React.createClass({
-
-      propTypes: {
-        perPage: React.PropTypes.number.isRequired,
-        perPageChange: React.PropTypes.func.isRequired,
-        label: React.PropTypes.string,
-        options: React.PropTypes.array
-      },
-
-      getDefaultProps: function () {
-        return {
-          label: 'Documents per page: ',
-          options: [5, 10, 20, 30, 50, 100]
-        };
-      },
-
-      perPageChange: function (e) {
-        var perPage = parseInt(e.target.value, 10);
-        this.props.perPageChange(perPage);
-      },
-
-      getOptions: function () {
-        return _.map(this.props.options, function (i) {
-          return (<option value={i} key={i}>{i}</option>);
-        });
-      },
-
-      render: function () {
-        return (
-          <div id="per-page">
-            <label htmlFor="select-per-page" className="drop-down inline">
-              {this.props.label} &nbsp;
-              <select id="select-per-page" onChange={this.perPageChange} value={this.props.perPage.toString()} className="input-small">
-                {this.getOptions()}
-              </select>
-            </label>
-          </div>
-        );
-      }
-
-    });
+var IndexPaginationController = React.createClass({
 
-    var AllDocsNumberController = React.createClass({
-
-      getStoreState: function () {
-        return {
-          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(),
-        };
-      },
-
-      getInitialState: function () {
-        return this.getStoreState();
-      },
-
-      componentDidMount: function () {
-        indexResultsStore.on('change', this.onChange, this);
-      },
-
-      componentWillUnmount: function () {
-        indexResultsStore.off('change', this.onChange);
-      },
-
-      onChange: function () {
-        this.setState(this.getStoreState());
-      },
-
-      getPageNumberText: function () {
-        if (this.state.totalRows === 0) {
-          return <span>Showing 0 documents.</span>;
-        }
-
-        return <span>Showing document {this.state.pageStart} - {this.state.pageEnd}.</span>;
-      },
-
-      perPageChange: function (perPage) {
-        var collection = this.state.collection;
-        var bulkCollection = this.state.bulkCollection;
-        Actions.updatePerPage(perPage, collection, bulkCollection);
-      },
-
-      render: function () {
-        var showTableControls = this.state.showPrioritizedFieldToggler;
-
-        return (
-          <div className="footer-controls">
-
-            <div className="page-controls">
-              {showTableControls ?
-                <TableControls
-                  prioritizedEnabled={this.state.prioritizedEnabled}
-                  displayedFields={this.state.displayedFields} /> : null}
-            </div>
-
-            <PerPageSelector perPageChange={this.perPageChange} perPage={this.state.perPage} />
-            <div className="current-docs">
-              {this.getPageNumberText()}
-            </div>
-          </div>
-        );
-      }
-
-    });
+  getStoreState: function () {
+    return {
+      canShowPrevious: indexResultsStore.canShowPrevious(),
+      canShowNext: indexResultsStore.canShowNext(),
+      collection: indexResultsStore.getCollection(),
+      bulkCollection: indexResultsStore.getBulkDocCollection(),
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    indexResultsStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    indexResultsStore.off('change', this.onChange);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  nextClicked: function (event) {
+    event.preventDefault();
+    if (!this.state.canShowNext) { return; }
+
+    var collection = this.state.collection;
+    var bulkCollection = this.state.bulkCollection;
+    Actions.paginateNext(collection, bulkCollection);
+  },
+
+  previousClicked: function (event) {
+    event.preventDefault();
+    if (!this.state.canShowPrevious) { return; }
+
+    var collection = this.state.collection;
+    var bulkCollection = this.state.bulkCollection;
+    Actions.paginatePrevious(collection, bulkCollection);
+  },
+
+  render: function () {
+    var canShowPreviousClassName = '';
+    var canShowNextClassName = '';
+
+    if (!this.state.canShowPrevious) {
+      canShowPreviousClassName = 'disabled';
+    }
+
+    if (!this.state.canShowNext) {
+      canShowNextClassName = 'disabled';
+    }
+
+    return (
+      <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>
+    );
+  }
+
+});
+
+var PerPageSelector = React.createClass({
+
+  propTypes: {
+    perPage: React.PropTypes.number.isRequired,
+    perPageChange: React.PropTypes.func.isRequired,
+    label: React.PropTypes.string,
+    options: React.PropTypes.array
+  },
+
+  getDefaultProps: function () {
+    return {
+      label: 'Documents per page: ',
+      options: [5, 10, 20, 30, 50, 100]
+    };
+  },
 
-    var TableControls = React.createClass({
-
-      propTypes: {
-        prioritizedEnabled: React.PropTypes.bool.isRequired,
-        displayedFields: React.PropTypes.object.isRequired,
-      },
-
-      getAmountShownFields: function () {
-        var fields = this.props.displayedFields;
-
-        if (fields.shown === fields.allFieldCount) {
-          return (
-            <div className="pull-left shown-fields">
-              Showing {fields.shown} columns.
-            </div>
-          );
-        }
-
-        return (
-          <div className="pull-left shown-fields">
-            Showing {fields.shown} of {fields.allFieldCount} columns.
-          </div>
-        );
-      },
-
-      toggleTableViewType: function () {
-        Actions.toggleTableViewType();
-      },
-
-      render: function () {
-        return (
-          <div className="footer-table-control">
-            {this.getAmountShownFields()}
-            <div className="footer-doc-control-prioritized-wrapper pull-left">
-              <label htmlFor="footer-doc-control-prioritized">
-                <input
-                  id="footer-doc-control-prioritized"
-                  checked={this.props.prioritizedEnabled}
-                  onChange={this.toggleTableViewType}
-                  type="checkbox">
-                </input>
-                Show all columns.
-              </label>
-            </div>
-          </div>
-        );
-      }
-    });
+  perPageChange: function (e) {
+    var perPage = parseInt(e.target.value, 10);
+    this.props.perPageChange(perPage);
+  },
 
-    var Footer = React.createClass({
-      render: function () {
-        return (
-          <footer className="index-pagination pagination-footer">
-            <IndexPaginationController />
-            <AllDocsNumberController />
-          </footer>
-        );
-      }
+  getOptions: function () {
+    return _.map(this.props.options, function (i) {
+      return (<option value={i} key={i}>{i}</option>);
     });
-
+  },
+
+  render: function () {
+    return (
+      <div id="per-page">
+        <label htmlFor="select-per-page" className="drop-down inline">
+          {this.props.label} &nbsp;
+          <select id="select-per-page" onChange={this.perPageChange} value={this.props.perPage.toString()} className="input-small">
+            {this.getOptions()}
+          </select>
+        </label>
+      </div>
+    );
+  }
+
+});
+
+var AllDocsNumberController = React.createClass({
+
+  getStoreState: function () {
     return {
-      AllDocsNumber: AllDocsNumberController,
-      PerPageSelector: PerPageSelector,
-      Footer: Footer,
-      TableControls: TableControls,
+      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(),
     };
-
-  });
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    indexResultsStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    indexResultsStore.off('change', this.onChange);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  getPageNumberText: function () {
+    if (this.state.totalRows === 0) {
+      return <span>Showing 0 documents.</span>;
+    }
+
+    return <span>Showing document {this.state.pageStart} - {this.state.pageEnd}.</span>;
+  },
+
+  perPageChange: function (perPage) {
+    var collection = this.state.collection;
+    var bulkCollection = this.state.bulkCollection;
+    Actions.updatePerPage(perPage, collection, bulkCollection);
+  },
+
+  render: function () {
+    var showTableControls = this.state.showPrioritizedFieldToggler;
+
+    return (
+      <div className="footer-controls">
+
+        <div className="page-controls">
+          {showTableControls ?
+            <TableControls
+              prioritizedEnabled={this.state.prioritizedEnabled}
+              displayedFields={this.state.displayedFields} /> : null}
+        </div>
+
+        <PerPageSelector perPageChange={this.perPageChange} perPage={this.state.perPage} />
+        <div className="current-docs">
+          {this.getPageNumberText()}
+        </div>
+      </div>
+    );
+  }
+
+});
+
+var TableControls = React.createClass({
+
+  propTypes: {
+    prioritizedEnabled: React.PropTypes.bool.isRequired,
+    displayedFields: React.PropTypes.object.isRequired,
+  },
+
+  getAmountShownFields: function () {
+    var fields = this.props.displayedFields;
+
+    if (fields.shown === fields.allFieldCount) {
+      return (
+        <div className="pull-left shown-fields">
+          Showing {fields.shown} columns.
+        </div>
+      );
+    }
+
+    return (
+      <div className="pull-left shown-fields">
+        Showing {fields.shown} of {fields.allFieldCount} columns.
+      </div>
+    );
+  },
+
+  toggleTableViewType: function () {
+    Actions.toggleTableViewType();
+  },
+
+  render: function () {
+    return (
+      <div className="footer-table-control">
+        {this.getAmountShownFields()}
+        <div className="footer-doc-control-prioritized-wrapper pull-left">
+          <label htmlFor="footer-doc-control-prioritized">
+            <input
+              id="footer-doc-control-prioritized"
+              checked={this.props.prioritizedEnabled}
+              onChange={this.toggleTableViewType}
+              type="checkbox">
+            </input>
+            Show all columns.
+          </label>
+        </div>
+      </div>
+    );
+  }
+});
+
+var Footer = React.createClass({
+  render: function () {
+    return (
+      <footer className="index-pagination pagination-footer">
+        <IndexPaginationController />
+        <AllDocsNumberController />
+      </footer>
+    );
+  }
+});
+
+export default {
+  AllDocsNumber: AllDocsNumberController,
+  PerPageSelector: PerPageSelector,
+  Footer: Footer,
+  TableControls: TableControls,
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/pagination/tests/pagination.componentSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/pagination/tests/pagination.componentSpec.react.jsx b/app/addons/documents/pagination/tests/pagination.componentSpec.react.jsx
index 4b2358b..6ae6511 100644
--- a/app/addons/documents/pagination/tests/pagination.componentSpec.react.jsx
+++ b/app/addons/documents/pagination/tests/pagination.componentSpec.react.jsx
@@ -9,116 +9,113 @@
 // 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',
-  '../pagination.react',
-  '../../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, utils, React, ReactDOM, TestUtils, sinon) {
+import FauxtonAPI from "../../../../core/api";
+import Views from "../pagination.react";
+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([]);
+FauxtonAPI.router = new FauxtonAPI.Router([]);
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('All Docs Number', function () {
+describe('All Docs Number', function () {
 
-    describe('PerPageSelector', function () {
-      var container, selectorEl, perPageChange;
+  describe('PerPageSelector', function () {
+    var container, selectorEl, perPageChange;
 
-      beforeEach(function () {
-        perPageChange = sinon.spy();
-        container = document.createElement('div');
-      });
+    beforeEach(function () {
+      perPageChange = sinon.spy();
+      container = document.createElement('div');
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(selectorEl).parentNode);
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(selectorEl).parentNode);
+    });
 
-      it('on new select calls callback with new page size', function () {
-        selectorEl = TestUtils.renderIntoDocument(
-          <Views.PerPageSelector
-            perPageChange={perPageChange}
-            perPage={10} />,
-          container
-        );
-        var selectEl = $(ReactDOM.findDOMNode(selectorEl)).find('#select-per-page')[0];
-        var perPage = 5;
-        TestUtils.Simulate.change(selectEl, {
-          target: {
-            value: perPage
-          }
-        });
-
-        assert.ok(perPageChange.calledWith(perPage));
+    it('on new select calls callback with new page size', function () {
+      selectorEl = TestUtils.renderIntoDocument(
+        <Views.PerPageSelector
+          perPageChange={perPageChange}
+          perPage={10} />,
+        container
+      );
+      var selectEl = $(ReactDOM.findDOMNode(selectorEl)).find('#select-per-page')[0];
+      var perPage = 5;
+      TestUtils.Simulate.change(selectEl, {
+        target: {
+          value: perPage
+        }
       });
 
-      it('applies custom label', function () {
-        var customLabel = 'alphabet soup';
-        selectorEl = TestUtils.renderIntoDocument(
-          <Views.PerPageSelector
-            label={customLabel}
-            perPageChange={perPageChange}
-            perPage={10} />,
-          container
-        );
-        var regexp = new RegExp(customLabel);
-        assert.ok(regexp.test(ReactDOM.findDOMNode(selectorEl).outerHTML));
-      });
+      assert.ok(perPageChange.calledWith(perPage));
+    });
 
-      it('applies custom options', function () {
-        selectorEl = TestUtils.renderIntoDocument(
-          <Views.PerPageSelector
-            options={[1, 2, 3]}
-            perPageChange={perPageChange}
-            perPage={10} />,
-          container
-        );
-        var options = $(ReactDOM.findDOMNode(selectorEl)).find('option');
-        assert.equal(options.length, 3);
-        assert.equal(options[0].innerHTML, "1");
-        assert.equal(options[1].innerHTML, "2");
-        assert.equal(options[2].innerHTML, "3");
-      });
+    it('applies custom label', function () {
+      var customLabel = 'alphabet soup';
+      selectorEl = TestUtils.renderIntoDocument(
+        <Views.PerPageSelector
+          label={customLabel}
+          perPageChange={perPageChange}
+          perPage={10} />,
+        container
+      );
+      var regexp = new RegExp(customLabel);
+      assert.ok(regexp.test(ReactDOM.findDOMNode(selectorEl).outerHTML));
+    });
 
+    it('applies custom options', function () {
+      selectorEl = TestUtils.renderIntoDocument(
+        <Views.PerPageSelector
+          options={[1, 2, 3]}
+          perPageChange={perPageChange}
+          perPage={10} />,
+        container
+      );
+      var options = $(ReactDOM.findDOMNode(selectorEl)).find('option');
+      assert.equal(options.length, 3);
+      assert.equal(options[0].innerHTML, "1");
+      assert.equal(options[1].innerHTML, "2");
+      assert.equal(options[2].innerHTML, "3");
     });
 
-    describe('TableControls', function () {
-      var container, selectorEl;
+  });
 
-      beforeEach(function () {
-        container = document.createElement('div');
-      });
+  describe('TableControls', function () {
+    var container, selectorEl;
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(selectorEl).parentNode);
-      });
+    beforeEach(function () {
+      container = document.createElement('div');
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(selectorEl).parentNode);
+    });
 
-      it('shows the amount of fields, none hidden', function () {
+    it('shows the amount of fields, none hidden', function () {
 
-        selectorEl = TestUtils.renderIntoDocument(
-          <Views.TableControls prioritizedEnabled={true} displayedFields={{shown: 7, allFieldCount: 7}} />,
-          container
-        );
+      selectorEl = TestUtils.renderIntoDocument(
+        <Views.TableControls prioritizedEnabled={true} displayedFields={{shown: 7, allFieldCount: 7}} />,
+        container
+      );
 
-        var text = $(ReactDOM.findDOMNode(selectorEl)).find('.shown-fields').text();
+      var text = $(ReactDOM.findDOMNode(selectorEl)).find('.shown-fields').text();
 
-        assert.equal('Showing 7 columns.', text);
-      });
+      assert.equal('Showing 7 columns.', text);
+    });
 
-      it('shows the amount of fields, some hidden', function () {
+    it('shows the amount of fields, some hidden', function () {
 
-        selectorEl = TestUtils.renderIntoDocument(
-          <Views.TableControls prioritizedEnabled={true} displayedFields={{shown: 5, allFieldCount: 7}} />,
-          container
-        );
+      selectorEl = TestUtils.renderIntoDocument(
+        <Views.TableControls prioritizedEnabled={true} displayedFields={{shown: 5, allFieldCount: 7}} />,
+        container
+      );
 
-        var text = $(ReactDOM.findDOMNode(selectorEl)).find('.shown-fields').text();
+      var text = $(ReactDOM.findDOMNode(selectorEl)).find('.shown-fields').text();
 
-        assert.equal('Showing 5 of 7 columns.', text);
-      });
+      assert.equal('Showing 5 of 7 columns.', text);
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/queryoptions/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/actions.js b/app/addons/documents/queryoptions/actions.js
index 0eef485..89e84cc 100644
--- a/app/addons/documents/queryoptions/actions.js
+++ b/app/addons/documents/queryoptions/actions.js
@@ -10,105 +10,102 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes',
-  './stores'
-],
-function (app, FauxtonAPI, ActionTypes, Stores) {
-  var store = Stores.queryOptionsStore;
-  return {
-
-    toggleIncludeDocs: function () {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import Stores from "./stores";
+var store = Stores.queryOptionsStore;
+
+export default {
+
+  toggleIncludeDocs: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_TOGGLE_INCLUDE_DOCS
+    });
+  },
+
+  toggleByKeys: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_TOGGLE_BY_KEYS
+    });
+  },
+
+  toggleBetweenKeys: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_TOGGLE_BETWEEN_KEYS
+    });
+  },
+
+  toggleDescending: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_TOGGLE_DESCENDING
+    });
+  },
+
+  toggleReduce: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_TOGGLE_REDUCE
+    });
+  },
+
+  updateBetweenKeys: function (betweenKeys) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_UPDATE_BETWEEN_KEYS,
+      betweenKeys: betweenKeys
+    });
+  },
+
+  updateByKeys: function (byKeys) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_UPDATE_BY_KEYS,
+      byKeys: byKeys
+    });
+  },
+
+  updateSkip: function (skip) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_UPDATE_SKIP,
+      skip: skip
+    });
+  },
+
+  updateLimit: function (limit) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_UPDATE_LIMIT,
+      limit: limit
+    });
+  },
+
+  runQuery: function (params) {
+    var url = app.utils.replaceQueryParams(params);
+    FauxtonAPI.navigate(url);
+  },
+
+  toggleQueryBarVisibility: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_UPDATE_VISIBILITY,
+      options: options
+    });
+  },
+
+  updateGroupLevel: function (groupLevel) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_UPDATE_GROUP_LEVEL,
+      groupLevel: groupLevel
+    });
+  },
+
+  reset: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.QUERY_RESET,
+      params: options.queryParams
+    });
+
+    if (options.showReduce) {
       FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_TOGGLE_INCLUDE_DOCS
+        type: ActionTypes.QUERY_SHOW_REDUCE
       });
-    },
-
-    toggleByKeys: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_TOGGLE_BY_KEYS
-      });
-    },
-
-    toggleBetweenKeys: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_TOGGLE_BETWEEN_KEYS
-      });
-    },
-
-    toggleDescending: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_TOGGLE_DESCENDING
-      });
-    },
-
-    toggleReduce: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_TOGGLE_REDUCE
-      });
-    },
-
-    updateBetweenKeys: function (betweenKeys) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_UPDATE_BETWEEN_KEYS,
-        betweenKeys: betweenKeys
-      });
-    },
-
-    updateByKeys: function (byKeys) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_UPDATE_BY_KEYS,
-        byKeys: byKeys
-      });
-    },
-
-    updateSkip: function (skip) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_UPDATE_SKIP,
-        skip: skip
-      });
-    },
-
-    updateLimit: function (limit) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_UPDATE_LIMIT,
-        limit: limit
-      });
-    },
-
-    runQuery: function (params) {
-      var url = app.utils.replaceQueryParams(params);
-      FauxtonAPI.navigate(url);
-    },
-
-    toggleQueryBarVisibility: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_UPDATE_VISIBILITY,
-        options: options
-      });
-    },
-
-    updateGroupLevel: function (groupLevel) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_UPDATE_GROUP_LEVEL,
-        groupLevel: groupLevel
-      });
-    },
-
-    reset: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.QUERY_RESET,
-        params: options.queryParams
-      });
-
-      if (options.showReduce) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.QUERY_SHOW_REDUCE
-        });
-      }
     }
+  }
 
-  };
-});
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/queryoptions/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/actiontypes.js b/app/addons/documents/queryoptions/actiontypes.js
index b91e92a..225f38b 100644
--- a/app/addons/documents/queryoptions/actiontypes.js
+++ b/app/addons/documents/queryoptions/actiontypes.js
@@ -10,20 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    QUERY_TOGGLE_INCLUDE_DOCS: 'QUERY_TOGGLE_INCLUDE_DOCS',
-    QUERY_TOGGLE_BY_KEYS: 'QUERY_TOGGLE_BY_KEYS',
-    QUERY_TOGGLE_BETWEEN_KEYS: 'QUERY_TOGGLE_BETWEEN_KEYS',
-    QUERY_UPDATE_BETWEEN_KEYS: 'QUERY_UPDATE_BETWEEN_KEYS',
-    QUERY_UPDATE_BY_KEYS: 'QUERY_UPDATE_BY_KEYS',
-    QUERY_TOGGLE_DESCENDING: 'QUERY_TOGGLE_DESCENDING',
-    QUERY_TOGGLE_REDUCE: 'QUERY_TOGGLE_REDUCE',
-    QUERY_UPDATE_SKIP: 'QUERY_UPDATE_SKIP',
-    QUERY_UPDATE_LIMIT: 'QUERY_UPDATE_LIMIT',
-    QUERY_RESET: 'QUERY_RESET',
-    QUERY_SHOW_REDUCE: 'QUERY_SHOW_REDUCE',
-    QUERY_UPDATE_GROUP_LEVEL: 'QUERY_UPDATE_GROUP_LEVEL',
-    QUERY_UPDATE_VISIBILITY: 'QUERY_UPDATE_VISIBILITY'
-  };
-});
+export default {
+  QUERY_TOGGLE_INCLUDE_DOCS: 'QUERY_TOGGLE_INCLUDE_DOCS',
+  QUERY_TOGGLE_BY_KEYS: 'QUERY_TOGGLE_BY_KEYS',
+  QUERY_TOGGLE_BETWEEN_KEYS: 'QUERY_TOGGLE_BETWEEN_KEYS',
+  QUERY_UPDATE_BETWEEN_KEYS: 'QUERY_UPDATE_BETWEEN_KEYS',
+  QUERY_UPDATE_BY_KEYS: 'QUERY_UPDATE_BY_KEYS',
+  QUERY_TOGGLE_DESCENDING: 'QUERY_TOGGLE_DESCENDING',
+  QUERY_TOGGLE_REDUCE: 'QUERY_TOGGLE_REDUCE',
+  QUERY_UPDATE_SKIP: 'QUERY_UPDATE_SKIP',
+  QUERY_UPDATE_LIMIT: 'QUERY_UPDATE_LIMIT',
+  QUERY_RESET: 'QUERY_RESET',
+  QUERY_SHOW_REDUCE: 'QUERY_SHOW_REDUCE',
+  QUERY_UPDATE_GROUP_LEVEL: 'QUERY_UPDATE_GROUP_LEVEL',
+  QUERY_UPDATE_VISIBILITY: 'QUERY_UPDATE_VISIBILITY'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 97876bd..a24b8cf 100644
--- a/app/addons/documents/queryoptions/queryoptions.react.jsx
+++ b/app/addons/documents/queryoptions/queryoptions.react.jsx
@@ -10,431 +10,426 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  'react-dom',
-  './stores',
-  './actions',
-  '../../components/react-components.react'
-],
-
-function (app, FauxtonAPI, React, ReactDOM, Stores, Actions, Components) {
-  var store = Stores.queryOptionsStore;
-  var TrayContents = Components.TrayContents;
-  var ToggleHeaderButton = Components.ToggleHeaderButton;
-
-  var TrayWrapper = Components.TrayWrapper;
-  var connectToStores = Components.connectToStores;
-
-  var MainFieldsView = React.createClass({
-    propTypes: {
-      toggleIncludeDocs: React.PropTypes.func.isRequired,
-      includeDocs: React.PropTypes.bool.isRequired,
-      reduce: React.PropTypes.bool.isRequired,
-      toggleReduce: React.PropTypes.func,
-      updateGroupLevel: React.PropTypes.func,
-      docURL: React.PropTypes.string
-    },
-
-    getDefaultProps: function () {
-      return {
-        docURL: FauxtonAPI.constants.DOC_URLS.GENERAL
-      };
-    },
-
-    toggleIncludeDocs: function (e) {
-      this.props.toggleIncludeDocs(e);
-    },
-
-    groupLevelChange: function (e) {
-      this.props.updateGroupLevel(e.target.value);
-    },
-
-    groupLevel: function () {
-      if (!this.props.reduce) {
-        return null;
-      }
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Stores from "./stores";
+import Actions from "./actions";
+import Components from "../../components/react-components.react";
+var store = Stores.queryOptionsStore;
+var TrayContents = Components.TrayContents;
+var ToggleHeaderButton = Components.ToggleHeaderButton;
+
+var TrayWrapper = Components.TrayWrapper;
+var connectToStores = Components.connectToStores;
+
+var MainFieldsView = React.createClass({
+  propTypes: {
+    toggleIncludeDocs: React.PropTypes.func.isRequired,
+    includeDocs: React.PropTypes.bool.isRequired,
+    reduce: React.PropTypes.bool.isRequired,
+    toggleReduce: React.PropTypes.func,
+    updateGroupLevel: React.PropTypes.func,
+    docURL: React.PropTypes.string
+  },
+
+  getDefaultProps: function () {
+    return {
+      docURL: FauxtonAPI.constants.DOC_URLS.GENERAL
+    };
+  },
+
+  toggleIncludeDocs: function (e) {
+    this.props.toggleIncludeDocs(e);
+  },
+
+  groupLevelChange: function (e) {
+    this.props.updateGroupLevel(e.target.value);
+  },
+
+  groupLevel: function () {
+    if (!this.props.reduce) {
+      return null;
+    }
 
-      return (
-        <label className="drop-down inline" id="qoGroupLevelGroup">
-          Group Level
-          <select onChange={this.groupLevelChange} id="qoGroupLevel" value={this.props.groupLevel} name="group_level" className="input-small">
-            <option value="0">None</option>
-            <option value="1">1</option>
-            <option value="2">2</option>
-            <option value="3">3</option>
-            <option value="4">4</option>
-            <option value="5">5</option>
-            <option value="6">6</option>
-            <option value="7">7</option>
-            <option value="8">8</option>
-            <option value="9">9</option>
-            <option value="exact">Exact</option>
-          </select>
-        </label>
-      );
-    },
-
-    reduce: function () {
-      if (!this.props.showReduce) {
-        return null;
-      }
+    return (
+      <label className="drop-down inline" id="qoGroupLevelGroup">
+        Group Level
+        <select onChange={this.groupLevelChange} id="qoGroupLevel" value={this.props.groupLevel} name="group_level" className="input-small">
+          <option value="0">None</option>
+          <option value="1">1</option>
+          <option value="2">2</option>
+          <option value="3">3</option>
+          <option value="4">4</option>
+          <option value="5">5</option>
+          <option value="6">6</option>
+          <option value="7">7</option>
+          <option value="8">8</option>
+          <option value="9">9</option>
+          <option value="exact">Exact</option>
+        </select>
+      </label>
+    );
+  },
+
+  reduce: function () {
+    if (!this.props.showReduce) {
+      return null;
+    }
 
-      return (
-        <span>
-          <div className="checkbox inline">
-            <input id="qoReduce" name="reduce" onChange={this.props.toggleReduce} type="checkbox" checked={this.props.reduce} />
-            <label htmlFor="qoReduce">Reduce</label>
-          </div>
-          {this.groupLevel()}
+    return (
+      <span>
+        <div className="checkbox inline">
+          <input id="qoReduce" name="reduce" onChange={this.props.toggleReduce} type="checkbox" checked={this.props.reduce} />
+          <label htmlFor="qoReduce">Reduce</label>
+        </div>
+        {this.groupLevel()}
+      </span>
+    );
+  },
+
+  render: function () {
+    var includeDocs = this.props.includeDocs;
+    return (
+      <div className="query-group" id="query-options-main-fields">
+        <span className="add-on">
+          Query Options
+          <a className="help-link" href={this.props.docURL} target="_blank" data-bypass="true">
+            <i className="icon-question-sign" />
+          </a>
         </span>
-      );
-    },
-
-    render: function () {
-      var includeDocs = this.props.includeDocs;
-      return (
-        <div className="query-group" id="query-options-main-fields">
-          <span className="add-on">
-            Query Options
-            <a className="help-link" href={this.props.docURL} target="_blank" data-bypass="true">
-              <i className="icon-question-sign" />
-            </a>
-          </span>
-          <div className="controls-group qo-main-fields-row">
-            <div className="row-fluid fieldsets">
-              <div className="checkbox inline">
-                <input disabled={this.props.reduce} onChange={this.toggleIncludeDocs} id="qoIncludeDocs"
-                   name="include_docs" type="checkbox" checked={includeDocs} />
-                <label className={this.props.reduce ? 'disabled' : ''} htmlFor="qoIncludeDocs" id="qoIncludeDocsLabel">Include Docs</label>
-              </div>
-              {this.reduce()}
+        <div className="controls-group qo-main-fields-row">
+          <div className="row-fluid fieldsets">
+            <div className="checkbox inline">
+              <input disabled={this.props.reduce} onChange={this.toggleIncludeDocs} id="qoIncludeDocs"
+                 name="include_docs" type="checkbox" checked={includeDocs} />
+              <label className={this.props.reduce ? 'disabled' : ''} htmlFor="qoIncludeDocs" id="qoIncludeDocsLabel">Include Docs</label>
             </div>
+            {this.reduce()}
           </div>
         </div>
-      );
-    }
-
-  });
-
-  var KeySearchFields = React.createClass({
-    toggleByKeys: function () {
-      this.props.toggleByKeys();
-    },
-
-    toggleBetweenKeys: function () {
-      this.props.toggleBetweenKeys();
-    },
+      </div>
+    );
+  }
 
-    updateBetweenKeys: function () {
-      this.props.updateBetweenKeys({
-        startkey: ReactDOM.findDOMNode(this.refs.startkey).value,
-        endkey: ReactDOM.findDOMNode(this.refs.endkey).value,
-        include: this.props.betweenKeys.include
-      });
-    },
-
-    updateInclusiveEnd: function () {
-      this.props.updateBetweenKeys({
-        include: !this.props.betweenKeys.include,
-        startkey: this.props.betweenKeys.startkey,
-        endkey: this.props.betweenKeys.endkey
-      });
-    },
-
-    updateByKeys: function (e) {
-      this.props.updateByKeys(e.target.value);
-    },
-
-    render: function () {
-      var keysGroupClass = 'controls-group well js-query-keys-wrapper ';
-      var byKeysClass = 'row-fluid js-keys-section ';
-      var betweenKeysClass = byKeysClass;
-      var byKeysButtonClass = 'drop-down btn ';
-      var betweenKeysButtonClass = byKeysButtonClass;
+});
 
-      if (!this.props.showByKeys && !this.props.showBetweenKeys) {
-        keysGroupClass += 'hide';
-      }
+var KeySearchFields = React.createClass({
+  toggleByKeys: function () {
+    this.props.toggleByKeys();
+  },
+
+  toggleBetweenKeys: function () {
+    this.props.toggleBetweenKeys();
+  },
+
+  updateBetweenKeys: function () {
+    this.props.updateBetweenKeys({
+      startkey: ReactDOM.findDOMNode(this.refs.startkey).value,
+      endkey: ReactDOM.findDOMNode(this.refs.endkey).value,
+      include: this.props.betweenKeys.include
+    });
+  },
+
+  updateInclusiveEnd: function () {
+    this.props.updateBetweenKeys({
+      include: !this.props.betweenKeys.include,
+      startkey: this.props.betweenKeys.startkey,
+      endkey: this.props.betweenKeys.endkey
+    });
+  },
+
+  updateByKeys: function (e) {
+    this.props.updateByKeys(e.target.value);
+  },
+
+  render: function () {
+    var keysGroupClass = 'controls-group well js-query-keys-wrapper ';
+    var byKeysClass = 'row-fluid js-keys-section ';
+    var betweenKeysClass = byKeysClass;
+    var byKeysButtonClass = 'drop-down btn ';
+    var betweenKeysButtonClass = byKeysButtonClass;
+
+    if (!this.props.showByKeys && !this.props.showBetweenKeys) {
+      keysGroupClass += 'hide';
+    }
 
-      if (!this.props.showByKeys) {
-        byKeysClass += 'hide';
-      } else {
-        byKeysButtonClass += 'active';
-      }
+    if (!this.props.showByKeys) {
+      byKeysClass += 'hide';
+    } else {
+      byKeysButtonClass += 'active';
+    }
 
-      if (!this.props.showBetweenKeys) {
-        betweenKeysClass += 'hide';
-      } else {
-        betweenKeysButtonClass += 'active';
-      }
+    if (!this.props.showBetweenKeys) {
+      betweenKeysClass += 'hide';
+    } else {
+      betweenKeysButtonClass += 'active';
+    }
 
-      return (
-        <div className="query-group" id="query-options-key-search">
-          <div className="add-on">Keys</div>
-          <div className="btn-group toggle-btns row-fluid">
-            <label style={{width: '101px'}} id="byKeys" onClick={this.toggleByKeys} className={byKeysButtonClass}>By Key(s)</label>
-            <label style={{width: '101px'}} id="betweenKeys" onClick={this.toggleBetweenKeys} className={betweenKeysButtonClass}>Between Keys</label>
-          </div>
+    return (
+      <div className="query-group" id="query-options-key-search">
+        <div className="add-on">Keys</div>
+        <div className="btn-group toggle-btns row-fluid">
+          <label style={{width: '101px'}} id="byKeys" onClick={this.toggleByKeys} className={byKeysButtonClass}>By Key(s)</label>
+          <label style={{width: '101px'}} id="betweenKeys" onClick={this.toggleBetweenKeys} className={betweenKeysButtonClass}>Between Keys</label>
+        </div>
 
-          <div className={keysGroupClass}>
-            <div className={byKeysClass} id="js-showKeys">
-              <div className="controls controls-row">
-                <label htmlFor="keys-input" className="drop-down">A key, or an array of keys.</label>
-                <textarea value={this.props.byKeys} onChange={this.updateByKeys} id="keys-input" className="input-xxlarge" rows="5" type="text"
-                  placeholder='Enter either a single key ["123"] or an array of keys ["123", "456"].
+        <div className={keysGroupClass}>
+          <div className={byKeysClass} id="js-showKeys">
+            <div className="controls controls-row">
+              <label htmlFor="keys-input" className="drop-down">A key, or an array of keys.</label>
+              <textarea value={this.props.byKeys} onChange={this.updateByKeys} id="keys-input" className="input-xxlarge" rows="5" type="text"
+                placeholder='Enter either a single key ["123"] or an array of keys ["123", "456"].
 A key value is the first parameter emitted in a map function. For example emit("123", 1) the key is "123".'></textarea>
-                <div id="keys-error" className="inline-block js-keys-error"></div>
-              </div>
+              <div id="keys-error" className="inline-block js-keys-error"></div>
             </div>
+          </div>
 
-            <div className={betweenKeysClass} id="js-showStartEnd">
-              <div className="controls controls-row">
-                <div>
-                  <label htmlFor="startkey" className="drop-down">Start key</label>
-                  <input id="startkey" ref="startkey" type="text" onChange={this.updateBetweenKeys} value={this.props.betweenKeys.startkey} placeholder='e.g., "1234"' />
-                </div>
-                <div>
-                  <label htmlFor="endkey" className="drop-down">End key</label>
-                  <input id="endkey" ref="endkey" onChange={this.updateBetweenKeys} value={this.props.betweenKeys.endkey} type="text" placeholder='e.g., "1234"'/>
-                  <div className="controls include-end-key-row checkbox controls-row inline">
-                    <input id="qoIncludeEndKeyInResults" ref="inclusive_end" type="checkbox" onChange={this.updateInclusiveEnd} checked={this.props.betweenKeys.include}/>
-                    <label htmlFor="qoIncludeEndKeyInResults">Include End Key in results</label>
-                  </div>
+          <div className={betweenKeysClass} id="js-showStartEnd">
+            <div className="controls controls-row">
+              <div>
+                <label htmlFor="startkey" className="drop-down">Start key</label>
+                <input id="startkey" ref="startkey" type="text" onChange={this.updateBetweenKeys} value={this.props.betweenKeys.startkey} placeholder='e.g., "1234"' />
+              </div>
+              <div>
+                <label htmlFor="endkey" className="drop-down">End key</label>
+                <input id="endkey" ref="endkey" onChange={this.updateBetweenKeys} value={this.props.betweenKeys.endkey} type="text" placeholder='e.g., "1234"'/>
+                <div className="controls include-end-key-row checkbox controls-row inline">
+                  <input id="qoIncludeEndKeyInResults" ref="inclusive_end" type="checkbox" onChange={this.updateInclusiveEnd} checked={this.props.betweenKeys.include}/>
+                  <label htmlFor="qoIncludeEndKeyInResults">Include End Key in results</label>
                 </div>
               </div>
             </div>
           </div>
-
         </div>
-      );
-    }
-  });
-
-  var AdditionalParams = React.createClass({
-    updateSkip: function (e) {
-      e.preventDefault();
-      var val = e.target.value;
-
-      //check skip is only numbers
-      if (!/^\d*$/.test(val)) {
-        FauxtonAPI.addNotification({
-          msg: 'Skip can only be a number',
-          type: 'error'
-        });
-        val = this.props.skip;
-      }
 
-      this.props.updateSkip(val);
-    },
+      </div>
+    );
+  }
+});
 
-    updateLimit: function (e) {
-      e.preventDefault();
-      this.props.updateLimit(e.target.value);
-    },
+var AdditionalParams = React.createClass({
+  updateSkip: function (e) {
+    e.preventDefault();
+    var val = e.target.value;
 
-    render: function () {
-      return (
-        <div className="query-group" id="query-options-additional-params">
-          <div className="add-on additionalParams">Additional Parameters</div>
-          <div className="row-fluid fieldsets">
-            <div className="dropdown inline">
-              <label className="drop-down">
-                Limit
-                <select id="qoLimit" onChange={this.updateLimit} name="limit" value={this.props.limit} className="input-small">
-                  <option value="none">None</option>
-                  <option value={5}>5</option>
-                  <option value={10}>10</option>
-                  <option value={20}>20</option>
-                  <option value={30}>30</option>
-                  <option value={50}>50</option>
-                  <option value={100}>100</option>
-                  <option value={500}>500</option>
-                </select>
-              </label>
-            </div>
-          </div>
-          <div className="row-fluid fieldsets">
-            <div className="checkbox inline">
-              <input id="qoDescending" type="checkbox" onChange={this.props.toggleDescending} checked={this.props.descending} />
-              <label htmlFor="qoDescending">Descending</label>
-            </div>
-            <div className="dropdown inline">
-              <label htmlFor="qoSkip" className="drop-down">
-                Skip
-                <input value={this.props.skip} onChange={this.updateSkip} className="input-small" type="text" id="qoSkip" placeholder="# of rows" />
-              </label>
-            </div>
+    //check skip is only numbers
+    if (!/^\d*$/.test(val)) {
+      FauxtonAPI.addNotification({
+        msg: 'Skip can only be a number',
+        type: 'error'
+      });
+      val = this.props.skip;
+    }
+
+    this.props.updateSkip(val);
+  },
+
+  updateLimit: function (e) {
+    e.preventDefault();
+    this.props.updateLimit(e.target.value);
+  },
+
+  render: function () {
+    return (
+      <div className="query-group" id="query-options-additional-params">
+        <div className="add-on additionalParams">Additional Parameters</div>
+        <div className="row-fluid fieldsets">
+          <div className="dropdown inline">
+            <label className="drop-down">
+              Limit
+              <select id="qoLimit" onChange={this.updateLimit} name="limit" value={this.props.limit} className="input-small">
+                <option value="none">None</option>
+                <option value={5}>5</option>
+                <option value={10}>10</option>
+                <option value={20}>20</option>
+                <option value={30}>30</option>
+                <option value={50}>50</option>
+                <option value={100}>100</option>
+                <option value={500}>500</option>
+              </select>
+            </label>
           </div>
         </div>
-      );
-    }
-  });
-
-  var QueryButtons = React.createClass({
-    propTypes: {
-      onCancel: React.PropTypes.func.isRequired
-    },
-
-    hideTray: function (e) {
-      this.props.onCancel();
-    },
-
-    render: function () {
-      return (
-        <div className="controls-group query-group">
-          <div id="button-options" className="controls controls-row">
-            <button type="submit" className="btn btn-success">
-              <i className="fonticon-play icon" />
-              Run Query
-            </button>
-            <a onClick={this.hideTray} className="btn btn-cancel">Cancel</a>
+        <div className="row-fluid fieldsets">
+          <div className="checkbox inline">
+            <input id="qoDescending" type="checkbox" onChange={this.props.toggleDescending} checked={this.props.descending} />
+            <label htmlFor="qoDescending">Descending</label>
+          </div>
+          <div className="dropdown inline">
+            <label htmlFor="qoSkip" className="drop-down">
+              Skip
+              <input value={this.props.skip} onChange={this.updateSkip} className="input-small" type="text" id="qoSkip" placeholder="# of rows" />
+            </label>
           </div>
         </div>
-      );
-    }
-  });
-
-  var QueryOptionsController = React.createClass({
-
-    getWrap: function () {
-      return connectToStores(TrayWrapper, [store], function () {
-
-        return {
-          includeDocs: store.includeDocs(),
-          showBetweenKeys: store.showBetweenKeys(),
-          showByKeys: store.showByKeys(),
-          betweenKeys: store.betweenKeys(),
-          byKeys: store.byKeys(),
-          descending: store.descending(),
-          skip: store.skip(),
-          limit: store.limit(),
-          showReduce: store.showReduce(),
-          reduce: store.reduce(),
-          groupLevel: store.groupLevel(),
-          contentVisible: store.getTrayVisible(),
-          queryParams: store.getQueryParams()
-        };
-      });
-    },
-
-    render: function () {
-      var TrayWrapper = this.getWrap();
-      return (
-        <TrayWrapper>
-          <QueryTray contentVisible={false} />
-        </TrayWrapper>
-      );
-    }
-  });
+      </div>
+    );
+  }
+});
 
-  var QueryTray = React.createClass({
+var QueryButtons = React.createClass({
+  propTypes: {
+    onCancel: React.PropTypes.func.isRequired
+  },
+
+  hideTray: function (e) {
+    this.props.onCancel();
+  },
+
+  render: function () {
+    return (
+      <div className="controls-group query-group">
+        <div id="button-options" className="controls controls-row">
+          <button type="submit" className="btn btn-success">
+            <i className="fonticon-play icon" />
+            Run Query
+          </button>
+          <a onClick={this.hideTray} className="btn btn-cancel">Cancel</a>
+        </div>
+      </div>
+    );
+  }
+});
 
-    propTypes: {
-      contentVisible: React.PropTypes.bool.isRequired
-    },
+var QueryOptionsController = React.createClass({
 
-    runQuery: function (e) {
-      e.preventDefault();
+  getWrap: function () {
+    return connectToStores(TrayWrapper, [store], function () {
 
-      Actions.runQuery(this.props.queryParams);
-      this.toggleTrayVisibility();
-    },
+      return {
+        includeDocs: store.includeDocs(),
+        showBetweenKeys: store.showBetweenKeys(),
+        showByKeys: store.showByKeys(),
+        betweenKeys: store.betweenKeys(),
+        byKeys: store.byKeys(),
+        descending: store.descending(),
+        skip: store.skip(),
+        limit: store.limit(),
+        showReduce: store.showReduce(),
+        reduce: store.reduce(),
+        groupLevel: store.groupLevel(),
+        contentVisible: store.getTrayVisible(),
+        queryParams: store.getQueryParams()
+      };
+    });
+  },
+
+  render: function () {
+    var TrayWrapper = this.getWrap();
+    return (
+      <TrayWrapper>
+        <QueryTray contentVisible={false} />
+      </TrayWrapper>
+    );
+  }
+});
 
-    toggleTrayVisibility: function () {
-      Actions.toggleQueryBarVisibility(!this.props.contentVisible);
-    },
+var QueryTray = React.createClass({
 
-    closeTray: function () {
-      Actions.toggleQueryBarVisibility(false);
-    },
-
-    componentDidMount: function () {
-      $('body').on('click.QueryTray', function (e) {
-        if ($(e.target).closest('#query-options').length) {
-          return;
-        }
-        Actions.toggleQueryBarVisibility(false);
-      }.bind(this));
-    },
-
-    componentWillUnmount: function () {
-      $('body').off('click.QueryTray');
-    },
-
-    toggleIncludeDocs: function (e) {
-      Actions.toggleIncludeDocs();
-    },
-
-    getTray: function () {
-      if (!this.props.contentVisible) {
-        return null;
+  propTypes: {
+    contentVisible: React.PropTypes.bool.isRequired
+  },
+
+  runQuery: function (e) {
+    e.preventDefault();
+
+    Actions.runQuery(this.props.queryParams);
+    this.toggleTrayVisibility();
+  },
+
+  toggleTrayVisibility: function () {
+    Actions.toggleQueryBarVisibility(!this.props.contentVisible);
+  },
+
+  closeTray: function () {
+    Actions.toggleQueryBarVisibility(false);
+  },
+
+  componentDidMount: function () {
+    $('body').on('click.QueryTray', function (e) {
+      if ($(e.target).closest('#query-options').length) {
+        return;
       }
+      Actions.toggleQueryBarVisibility(false);
+    }.bind(this));
+  },
 
-      return (
-        <TrayContents
-          className="query-options"
-          id="query-options-tray">
-
-          <form onSubmit={this.runQuery} className="js-view-query-update custom-inputs">
-            <MainFieldsView
-              includeDocs={this.props.includeDocs}
-              toggleIncludeDocs={this.toggleIncludeDocs}
-              showReduce={this.props.showReduce}
-              reduce={this.props.reduce}
-              toggleReduce={Actions.toggleReduce}
-              groupLevel={this.props.groupLevel}
-              updateGroupLevel={Actions.updateGroupLevel} />
-            <KeySearchFields
-              key={1}
-              showByKeys={this.props.showByKeys}
-              showBetweenKeys={this.props.showBetweenKeys}
-              toggleByKeys={Actions.toggleByKeys}
-              toggleBetweenKeys={Actions.toggleBetweenKeys}
-              betweenKeys={this.props.betweenKeys}
-              updateBetweenKeys={Actions.updateBetweenKeys}
-              byKeys={this.props.byKeys}
-              updateByKeys={Actions.updateByKeys} />
-            <AdditionalParams
-              descending={this.props.descending}
-              toggleDescending={Actions.toggleDescending}
-              skip={this.props.skip}
-              updateSkip={Actions.updateSkip}
-              updateLimit={Actions.updateLimit}
-              limit={this.props.limit} />
-            <QueryButtons onCancel={this.closeTray} />
-          </form>
-        </TrayContents>
-      );
-
-    },
-
-    render: function () {
-      return (
-        <div>
-          <ToggleHeaderButton
-            toggleCallback={this.toggleTrayVisibility}
-            containerClasses="header-control-box control-toggle-queryoptions"
-            title="Query Options"
-            fonticon="fonticon-gears"
-            text="Options" />
-          {this.getTray()}
-        </div>
-      );
-    }
+  componentWillUnmount: function () {
+    $('body').off('click.QueryTray');
+  },
 
-  });
+  toggleIncludeDocs: function (e) {
+    Actions.toggleIncludeDocs();
+  },
 
-  return {
-    QueryOptionsController: QueryOptionsController,
-    QueryButtons: QueryButtons,
-    MainFieldsView: MainFieldsView,
-    KeySearchFields: KeySearchFields,
-    AdditionalParams: AdditionalParams,
-    render: function (el) {
-      ReactDOM.render(<QueryOptionsController />, $(el)[0]);
+  getTray: function () {
+    if (!this.props.contentVisible) {
+      return null;
     }
-  };
+
+    return (
+      <TrayContents
+        className="query-options"
+        id="query-options-tray">
+
+        <form onSubmit={this.runQuery} className="js-view-query-update custom-inputs">
+          <MainFieldsView
+            includeDocs={this.props.includeDocs}
+            toggleIncludeDocs={this.toggleIncludeDocs}
+            showReduce={this.props.showReduce}
+            reduce={this.props.reduce}
+            toggleReduce={Actions.toggleReduce}
+            groupLevel={this.props.groupLevel}
+            updateGroupLevel={Actions.updateGroupLevel} />
+          <KeySearchFields
+            key={1}
+            showByKeys={this.props.showByKeys}
+            showBetweenKeys={this.props.showBetweenKeys}
+            toggleByKeys={Actions.toggleByKeys}
+            toggleBetweenKeys={Actions.toggleBetweenKeys}
+            betweenKeys={this.props.betweenKeys}
+            updateBetweenKeys={Actions.updateBetweenKeys}
+            byKeys={this.props.byKeys}
+            updateByKeys={Actions.updateByKeys} />
+          <AdditionalParams
+            descending={this.props.descending}
+            toggleDescending={Actions.toggleDescending}
+            skip={this.props.skip}
+            updateSkip={Actions.updateSkip}
+            updateLimit={Actions.updateLimit}
+            limit={this.props.limit} />
+          <QueryButtons onCancel={this.closeTray} />
+        </form>
+      </TrayContents>
+    );
+
+  },
+
+  render: function () {
+    return (
+      <div>
+        <ToggleHeaderButton
+          toggleCallback={this.toggleTrayVisibility}
+          containerClasses="header-control-box control-toggle-queryoptions"
+          title="Query Options"
+          fonticon="fonticon-gears"
+          text="Options" />
+        {this.getTray()}
+      </div>
+    );
+  }
+
 });
+
+export default {
+  QueryOptionsController: QueryOptionsController,
+  QueryButtons: QueryButtons,
+  MainFieldsView: MainFieldsView,
+  KeySearchFields: KeySearchFields,
+  AdditionalParams: AdditionalParams,
+  render: function (el) {
+    ReactDOM.render(<QueryOptionsController />, $(el)[0]);
+  }
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/sidebar/stores.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/stores.react.jsx b/app/addons/documents/sidebar/stores.react.jsx
index 6ac9c66..787a338 100644
--- a/app/addons/documents/sidebar/stores.react.jsx
+++ b/app/addons/documents/sidebar/stores.react.jsx
@@ -10,336 +10,330 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  './actiontypes'
-],
-
-function (app, FauxtonAPI, React, ActionTypes) {
-  var Stores = {};
-
-  Stores.SidebarStore = FauxtonAPI.Store.extend({
-
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._designDocs = new Backbone.Collection();
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ActionTypes from "./actiontypes";
+var Stores = {};
+
+Stores.SidebarStore = FauxtonAPI.Store.extend({
+
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._designDocs = new Backbone.Collection();
+    this._selected = {
+      navItem: 'all-docs',
+      designDocName: '',
+      designDocSection: '', // 'metadata' / name of index group ("Views", etc.)
+      indexName: ''
+    };
+    this._loading = true;
+    this._toggledSections = {};
+
+    this._deleteIndexModalVisible = false;
+    this._deleteIndexModalDesignDocName = '';
+    this._deleteIndexModalText = '';
+    this._deleteIndexModalIndexName = '';
+    this._deleteIndexModalOnSubmit = function () { };
+
+    this._cloneIndexModalVisible = false;
+    this._cloneIndexDesignDocProp = '';
+    this._cloneIndexModalTitle = '';
+    this._cloneIndexModalSelectedDesignDoc = '';
+    this._cloneIndexModalNewDesignDocName = '';
+    this._cloneIndexModalNewIndexName = '';
+    this._cloneIndexModalIndexLabel = '';
+    this._cloneIndexModalOnSubmit = function () { };
+  },
+
+  newOptions: function (options) {
+    this._database = options.database;
+    this._designDocs = options.designDocs;
+    this._loading = false;
+
+    // this can be expanded in future as we need. Right now it can only set a top-level nav item ('all docs',
+    // 'permissions' etc.) and not a nested page
+    if (options.selectedNavItem) {
       this._selected = {
-        navItem: 'all-docs',
+        navItem: options.selectedNavItem,
         designDocName: '',
-        designDocSection: '', // 'metadata' / name of index group ("Views", etc.)
+        designDocSection: '',
         indexName: ''
       };
-      this._loading = true;
-      this._toggledSections = {};
-
-      this._deleteIndexModalVisible = false;
-      this._deleteIndexModalDesignDocName = '';
-      this._deleteIndexModalText = '';
-      this._deleteIndexModalIndexName = '';
-      this._deleteIndexModalOnSubmit = function () { };
-
-      this._cloneIndexModalVisible = false;
-      this._cloneIndexDesignDocProp = '';
-      this._cloneIndexModalTitle = '';
-      this._cloneIndexModalSelectedDesignDoc = '';
-      this._cloneIndexModalNewDesignDocName = '';
-      this._cloneIndexModalNewIndexName = '';
-      this._cloneIndexModalIndexLabel = '';
-      this._cloneIndexModalOnSubmit = function () { };
-    },
-
-    newOptions: function (options) {
-      this._database = options.database;
-      this._designDocs = options.designDocs;
-      this._loading = false;
-
-      // this can be expanded in future as we need. Right now it can only set a top-level nav item ('all docs',
-      // 'permissions' etc.) and not a nested page
-      if (options.selectedNavItem) {
-        this._selected = {
-          navItem: options.selectedNavItem,
-          designDocName: '',
-          designDocSection: '',
-          indexName: ''
-        };
-      }
-    },
+    }
+  },
 
-    updatedDesignDocs: function (designDocs) {
-      this._designDocs = designDocs;
-    },
+  updatedDesignDocs: function (designDocs) {
+    this._designDocs = designDocs;
+  },
 
-    isDeleteIndexModalVisible: function () {
-      return this._deleteIndexModalVisible;
-    },
+  isDeleteIndexModalVisible: function () {
+    return this._deleteIndexModalVisible;
+  },
 
-    getDeleteIndexModalText: function () {
-      return this._deleteIndexModalText;
-    },
+  getDeleteIndexModalText: function () {
+    return this._deleteIndexModalText;
+  },
 
-    getDeleteIndexModalOnSubmit: function () {
-      return this._deleteIndexModalOnSubmit;
-    },
+  getDeleteIndexModalOnSubmit: function () {
+    return this._deleteIndexModalOnSubmit;
+  },
 
-    isLoading: function () {
-      return this._loading;
-    },
+  isLoading: function () {
+    return this._loading;
+  },
 
-    getDatabase: function () {
-      if (this.isLoading()) {
-        return {};
-      }
-      return this._database;
-    },
-
-    // used to toggle both design docs, and any index groups within them
-    toggleContent: function (designDoc, indexGroup) {
-      if (!this._toggledSections[designDoc]) {
-        this._toggledSections[designDoc] = {
-          visible: true,
-          indexGroups: {}
-        };
-        return;
-      }
+  getDatabase: function () {
+    if (this.isLoading()) {
+      return {};
+    }
+    return this._database;
+  },
+
+  // used to toggle both design docs, and any index groups within them
+  toggleContent: function (designDoc, indexGroup) {
+    if (!this._toggledSections[designDoc]) {
+      this._toggledSections[designDoc] = {
+        visible: true,
+        indexGroups: {}
+      };
+      return;
+    }
 
-      if (indexGroup) {
-        return this.toggleIndexGroup(designDoc, indexGroup);
-      }
+    if (indexGroup) {
+      return this.toggleIndexGroup(designDoc, indexGroup);
+    }
 
-      this._toggledSections[designDoc].visible = !this._toggledSections[designDoc].visible;
-    },
+    this._toggledSections[designDoc].visible = !this._toggledSections[designDoc].visible;
+  },
 
-    toggleIndexGroup: function (designDoc, indexGroup) {
-      var expanded = this._toggledSections[designDoc].indexGroups[indexGroup];
+  toggleIndexGroup: function (designDoc, indexGroup) {
+    var expanded = this._toggledSections[designDoc].indexGroups[indexGroup];
 
-      if (_.isUndefined(expanded)) {
-        this._toggledSections[designDoc].indexGroups[indexGroup] = true;
-        return;
-      }
+    if (_.isUndefined(expanded)) {
+      this._toggledSections[designDoc].indexGroups[indexGroup] = true;
+      return;
+    }
 
-      this._toggledSections[designDoc].indexGroups[indexGroup] = !expanded;
-    },
+    this._toggledSections[designDoc].indexGroups[indexGroup] = !expanded;
+  },
 
-    isVisible: function (designDoc, indexGroup) {
-      if (!this._toggledSections[designDoc]) {
-        return false;
-      }
-      if (indexGroup) {
-        return this._toggledSections[designDoc].indexGroups[indexGroup];
+  isVisible: function (designDoc, indexGroup) {
+    if (!this._toggledSections[designDoc]) {
+      return false;
+    }
+    if (indexGroup) {
+      return this._toggledSections[designDoc].indexGroups[indexGroup];
+    }
+    return this._toggledSections[designDoc].visible;
+  },
+
+  getSelected: function () {
+    return this._selected;
+  },
+
+  setSelected: function (params) {
+    this._selected = {
+      navItem: params.navItem,
+      designDocName: params.designDocName,
+      designDocSection: params.designDocSection,
+      indexName: params.indexName
+    };
+
+    if (params.designDocName) {
+      if (!_.has(this._toggledSections, params.designDocName)) {
+        this._toggledSections[params.designDocName] = { visible: true, indexGroups: {} };
       }
-      return this._toggledSections[designDoc].visible;
-    },
-
-    getSelected: function () {
-      return this._selected;
-    },
-
-    setSelected: function (params) {
-      this._selected = {
-        navItem: params.navItem,
-        designDocName: params.designDocName,
-        designDocSection: params.designDocSection,
-        indexName: params.indexName
-      };
+      this._toggledSections[params.designDocName].visible = true;
 
-      if (params.designDocName) {
-        if (!_.has(this._toggledSections, params.designDocName)) {
-          this._toggledSections[params.designDocName] = { visible: true, indexGroups: {} };
-        }
-        this._toggledSections[params.designDocName].visible = true;
-
-        if (params.designDocSection) {
-          this._toggledSections[params.designDocName].indexGroups[params.designDocSection] = true;
-        }
+      if (params.designDocSection) {
+        this._toggledSections[params.designDocName].indexGroups[params.designDocSection] = true;
       }
-    },
+    }
+  },
 
-    getToggledSections: function () {
-      return this._toggledSections;
-    },
+  getToggledSections: function () {
+    return this._toggledSections;
+  },
 
-    getDatabaseName: function () {
-      if (this.isLoading()) {
-        return '';
-      }
-      return this._database.safeID();
-    },
-
-    getDesignDocs: function () {
-      return this._designDocs;
-    },
-
-    // returns a simple array of design doc IDs
-    getAvailableDesignDocs: function () {
-      var availableDocs = this.getDesignDocs().filter(function (doc) {
-        return !doc.isMangoDoc();
-      });
-      return _.map(availableDocs, function (doc) {
-        return doc.id;
-      });
-    },
-
-    getDesignDocList: function () {
-      if (this.isLoading()) {
-        return {};
-      }
-      var docs = this._designDocs.toJSON();
-
-      docs = _.filter(docs, function (doc) {
-        if (_.has(doc.doc, 'language')) {
-          return doc.doc.language !== 'query';
-        }
-        return true;
-      });
-
-      return docs.map(function (doc) {
-        doc.safeId = app.utils.safeURLName(doc._id.replace(/^_design\//, ""));
-        return _.extend(doc, doc.doc);
-      });
-    },
-
-    showDeleteIndexModal: function (params) {
-      this._deleteIndexModalIndexName = params.indexName;
-      this._deleteIndexModalDesignDocName = params.designDocName;
-      this._deleteIndexModalVisible = true;
-      this._deleteIndexModalText = (<div>Are you sure you want to delete the <code>{this._deleteIndexModalIndexName}</code> {params.indexLabel}?</div>);
-      this._deleteIndexModalOnSubmit = params.onDelete;
-    },
-
-    getDeleteIndexModalIndexName: function () {
-      return this._deleteIndexModalIndexName;
-    },
-
-    getDeleteIndexDesignDoc: function () {
-      var designDoc = this._designDocs.find(function (ddoc) {
-        return '_design/' + this._deleteIndexModalDesignDocName === ddoc.id;
-      }, this);
-
-      return (designDoc) ? designDoc.dDocModel() : null;
-    },
-
-    isCloneIndexModalVisible: function () {
-      return this._cloneIndexModalVisible;
-    },
-
-    getCloneIndexModalTitle: function () {
-      return this._cloneIndexModalTitle;
-    },
-
-    showCloneIndexModal: function (params) {
-      this._cloneIndexModalIndexLabel = params.indexLabel;
-      this._cloneIndexModalTitle = params.cloneIndexModalTitle;
-      this._cloneIndexModalSourceIndexName = params.sourceIndexName;
-      this._cloneIndexModalSourceDesignDocName = params.sourceDesignDocName;
-      this._cloneIndexModalSelectedDesignDoc = '_design/' + params.sourceDesignDocName;
-      this._cloneIndexDesignDocProp = '';
-      this._cloneIndexModalVisible = true;
-      this._cloneIndexModalOnSubmit = params.onSubmit;
-    },
-
-    getCloneIndexModalIndexLabel: function () {
-      return this._cloneIndexModalIndexLabel;
-    },
-
-    getCloneIndexModalOnSubmit: function () {
-      return this._cloneIndexModalOnSubmit;
-    },
-
-    getCloneIndexModalSourceIndexName: function () {
-      return this._cloneIndexModalSourceIndexName;
-    },
-
-    getCloneIndexModalSourceDesignDocName: function () {
-      return this._cloneIndexModalSourceDesignDocName;
-    },
-
-    getCloneIndexDesignDocProp: function () {
-      return this._cloneIndexDesignDocProp;
-    },
-
-    getCloneIndexModalSelectedDesignDoc: function () {
-      return this._cloneIndexModalSelectedDesignDoc;
-    },
-
-    getCloneIndexModalNewDesignDocName: function () {
-      return this._cloneIndexModalNewDesignDocName;
-    },
-
-    getCloneIndexModalNewIndexName: function () {
-      return this._cloneIndexModalNewIndexName;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.SIDEBAR_SET_SELECTED_NAV_ITEM:
-          this.setSelected(action.options);
-        break;
-
-        case ActionTypes.SIDEBAR_NEW_OPTIONS:
-          this.newOptions(action.options);
-        break;
-
-        case ActionTypes.SIDEBAR_TOGGLE_CONTENT:
-          this.toggleContent(action.designDoc, action.indexGroup);
-        break;
-
-        case ActionTypes.SIDEBAR_FETCHING:
-          this._loading = true;
-        break;
-
-        case ActionTypes.SIDEBAR_REFRESH:
-        break;
-
-        case ActionTypes.SIDEBAR_SHOW_DELETE_INDEX_MODAL:
-          this.showDeleteIndexModal(action.options);
-        break;
-
-        case ActionTypes.SIDEBAR_HIDE_DELETE_INDEX_MODAL:
-          this._deleteIndexModalVisible = false;
-        break;
-
-        case ActionTypes.SIDEBAR_SHOW_CLONE_INDEX_MODAL:
-          this.showCloneIndexModal(action.options);
-        break;
-
-        case ActionTypes.SIDEBAR_HIDE_CLONE_INDEX_MODAL:
-          this._cloneIndexModalVisible = false;
-        break;
-
-        case ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE:
-          this._cloneIndexModalSelectedDesignDoc = action.options.value;
-        break;
-
-        case ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED:
-          this._cloneIndexModalNewDesignDocName = action.options.value;
-        break;
-
-        case ActionTypes.SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME:
-          this._cloneIndexModalNewIndexName = action.options.value;
-        break;
-
-        case ActionTypes.SIDEBAR_UPDATED_DESIGN_DOCS:
-          this.updatedDesignDocs(action.options.designDocs);
-        break;
-
-        default:
-        return;
-        // do nothing
-      }
+  getDatabaseName: function () {
+    if (this.isLoading()) {
+      return '';
+    }
+    return this._database.safeID();
+  },
+
+  getDesignDocs: function () {
+    return this._designDocs;
+  },
+
+  // returns a simple array of design doc IDs
+  getAvailableDesignDocs: function () {
+    var availableDocs = this.getDesignDocs().filter(function (doc) {
+      return !doc.isMangoDoc();
+    });
+    return _.map(availableDocs, function (doc) {
+      return doc.id;
+    });
+  },
+
+  getDesignDocList: function () {
+    if (this.isLoading()) {
+      return {};
+    }
+    var docs = this._designDocs.toJSON();
 
-      this.triggerChange();
+    docs = _.filter(docs, function (doc) {
+      if (_.has(doc.doc, 'language')) {
+        return doc.doc.language !== 'query';
+      }
+      return true;
+    });
+
+    return docs.map(function (doc) {
+      doc.safeId = app.utils.safeURLName(doc._id.replace(/^_design\//, ""));
+      return _.extend(doc, doc.doc);
+    });
+  },
+
+  showDeleteIndexModal: function (params) {
+    this._deleteIndexModalIndexName = params.indexName;
+    this._deleteIndexModalDesignDocName = params.designDocName;
+    this._deleteIndexModalVisible = true;
+    this._deleteIndexModalText = (<div>Are you sure you want to delete the <code>{this._deleteIndexModalIndexName}</code> {params.indexLabel}?</div>);
+    this._deleteIndexModalOnSubmit = params.onDelete;
+  },
+
+  getDeleteIndexModalIndexName: function () {
+    return this._deleteIndexModalIndexName;
+  },
+
+  getDeleteIndexDesignDoc: function () {
+    var designDoc = this._designDocs.find(function (ddoc) {
+      return '_design/' + this._deleteIndexModalDesignDocName === ddoc.id;
+    }, this);
+
+    return (designDoc) ? designDoc.dDocModel() : null;
+  },
+
+  isCloneIndexModalVisible: function () {
+    return this._cloneIndexModalVisible;
+  },
+
+  getCloneIndexModalTitle: function () {
+    return this._cloneIndexModalTitle;
+  },
+
+  showCloneIndexModal: function (params) {
+    this._cloneIndexModalIndexLabel = params.indexLabel;
+    this._cloneIndexModalTitle = params.cloneIndexModalTitle;
+    this._cloneIndexModalSourceIndexName = params.sourceIndexName;
+    this._cloneIndexModalSourceDesignDocName = params.sourceDesignDocName;
+    this._cloneIndexModalSelectedDesignDoc = '_design/' + params.sourceDesignDocName;
+    this._cloneIndexDesignDocProp = '';
+    this._cloneIndexModalVisible = true;
+    this._cloneIndexModalOnSubmit = params.onSubmit;
+  },
+
+  getCloneIndexModalIndexLabel: function () {
+    return this._cloneIndexModalIndexLabel;
+  },
+
+  getCloneIndexModalOnSubmit: function () {
+    return this._cloneIndexModalOnSubmit;
+  },
+
+  getCloneIndexModalSourceIndexName: function () {
+    return this._cloneIndexModalSourceIndexName;
+  },
+
+  getCloneIndexModalSourceDesignDocName: function () {
+    return this._cloneIndexModalSourceDesignDocName;
+  },
+
+  getCloneIndexDesignDocProp: function () {
+    return this._cloneIndexDesignDocProp;
+  },
+
+  getCloneIndexModalSelectedDesignDoc: function () {
+    return this._cloneIndexModalSelectedDesignDoc;
+  },
+
+  getCloneIndexModalNewDesignDocName: function () {
+    return this._cloneIndexModalNewDesignDocName;
+  },
+
+  getCloneIndexModalNewIndexName: function () {
+    return this._cloneIndexModalNewIndexName;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.SIDEBAR_SET_SELECTED_NAV_ITEM:
+        this.setSelected(action.options);
+      break;
+
+      case ActionTypes.SIDEBAR_NEW_OPTIONS:
+        this.newOptions(action.options);
+      break;
+
+      case ActionTypes.SIDEBAR_TOGGLE_CONTENT:
+        this.toggleContent(action.designDoc, action.indexGroup);
+      break;
+
+      case ActionTypes.SIDEBAR_FETCHING:
+        this._loading = true;
+      break;
+
+      case ActionTypes.SIDEBAR_REFRESH:
+      break;
+
+      case ActionTypes.SIDEBAR_SHOW_DELETE_INDEX_MODAL:
+        this.showDeleteIndexModal(action.options);
+      break;
+
+      case ActionTypes.SIDEBAR_HIDE_DELETE_INDEX_MODAL:
+        this._deleteIndexModalVisible = false;
+      break;
+
+      case ActionTypes.SIDEBAR_SHOW_CLONE_INDEX_MODAL:
+        this.showCloneIndexModal(action.options);
+      break;
+
+      case ActionTypes.SIDEBAR_HIDE_CLONE_INDEX_MODAL:
+        this._cloneIndexModalVisible = false;
+      break;
+
+      case ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE:
+        this._cloneIndexModalSelectedDesignDoc = action.options.value;
+      break;
+
+      case ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED:
+        this._cloneIndexModalNewDesignDocName = action.options.value;
+      break;
+
+      case ActionTypes.SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME:
+        this._cloneIndexModalNewIndexName = action.options.value;
+      break;
+
+      case ActionTypes.SIDEBAR_UPDATED_DESIGN_DOCS:
+        this.updatedDesignDocs(action.options.designDocs);
+      break;
+
+      default:
+      return;
+      // do nothing
     }
 
-  });
+    this.triggerChange();
+  }
 
-  Stores.sidebarStore = new Stores.SidebarStore();
-  Stores.sidebarStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.sidebarStore.dispatch);
+});
 
-  return Stores;
+Stores.sidebarStore = new Stores.SidebarStore();
+Stores.sidebarStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.sidebarStore.dispatch);
 
-});
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/sidebar/tests/sidebar.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/tests/sidebar.componentsSpec.react.jsx b/app/addons/documents/sidebar/tests/sidebar.componentsSpec.react.jsx
index 3bb99d4..5d1617b 100644
--- a/app/addons/documents/sidebar/tests/sidebar.componentsSpec.react.jsx
+++ b/app/addons/documents/sidebar/tests/sidebar.componentsSpec.react.jsx
@@ -9,109 +9,105 @@
 // 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',
-  'react',
-  'react-dom',
-  '../../../../../test/mocha/testUtils',
-  '../sidebar.react',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, React, ReactDOM, utils, Components, TestUtils, sinon) {
-  var assert = utils.assert;
-  var DesignDoc = Components.DesignDoc;
+import FauxtonAPI from "../../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import utils from "../../../../../test/mocha/testUtils";
+import Components from "../sidebar.react";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+var assert = utils.assert;
+var DesignDoc = Components.DesignDoc;
 
 
-  describe('DesignDoc', function () {
-    var container;
-    var database = { id: 'db' };
+describe('DesignDoc', function () {
+  var container;
+  var database = { id: 'db' };
 
-    var selectedNavInfo = {
-      navItem: 'all-docs',
-      designDocName: '',
-      designDocSection: '',
-      indexName: ''
-    };
+  var selectedNavInfo = {
+    navItem: 'all-docs',
+    designDocName: '',
+    designDocSection: '',
+    indexName: ''
+  };
 
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    it('confirm only single sub-option is shown by default (metadata link)', function () {
-      var el = TestUtils.renderIntoDocument(<DesignDoc
-        database={database}
-        toggle={function () {}}
-        sidebarListTypes={[]}
-        isExpanded={true}
-        selectedNavInfo={selectedNavInfo}
-        toggledSections={{}}
-        designDoc={{ customProp: { one: 'something' } }}
-      />, container);
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-      var subOptions = $(ReactDOM.findDOMNode(el)).find('.accordion-body li');
-      assert.equal(subOptions.length, 1);
-   });
+  it('confirm only single sub-option is shown by default (metadata link)', function () {
+    var el = TestUtils.renderIntoDocument(<DesignDoc
+      database={database}
+      toggle={function () {}}
+      sidebarListTypes={[]}
+      isExpanded={true}
+      selectedNavInfo={selectedNavInfo}
+      toggledSections={{}}
+      designDoc={{ customProp: { one: 'something' } }}
+    />, container);
 
-    it('confirm design doc sidebar extensions appear', function () {
-      var el = TestUtils.renderIntoDocument(<DesignDoc
-        database={database}
-        toggle={function () {}}
-        sidebarListTypes={[{
-          selector: 'customProp',
-          name: 'Search Indexes',
-          icon: 'icon-here',
-          urlNamespace: 'whatever'
-        }]}
-        isExpanded={true}
-        selectedNavInfo={selectedNavInfo}
-        toggledSections={{}}
-        designDoc={{ customProp: { one: 'something' } }}
-      />, container);
+    var subOptions = $(ReactDOM.findDOMNode(el)).find('.accordion-body li');
+    assert.equal(subOptions.length, 1);
+ });
 
-      var subOptions = $(ReactDOM.findDOMNode(el)).find('.accordion-body li');
-      assert.equal(subOptions.length, 3); // 1 for "Metadata" row, 1 for Type List row ("search indexes") and one for the index itself
-    });
+  it('confirm design doc sidebar extensions appear', function () {
+    var el = TestUtils.renderIntoDocument(<DesignDoc
+      database={database}
+      toggle={function () {}}
+      sidebarListTypes={[{
+        selector: 'customProp',
+        name: 'Search Indexes',
+        icon: 'icon-here',
+        urlNamespace: 'whatever'
+      }]}
+      isExpanded={true}
+      selectedNavInfo={selectedNavInfo}
+      toggledSections={{}}
+      designDoc={{ customProp: { one: 'something' } }}
+    />, container);
 
-    it('confirm design doc sidebar extensions do not appear when they have no content', function () {
-      var el = TestUtils.renderIntoDocument(<DesignDoc
-        database={database}
-        toggle={function () {}}
-        sidebarListTypes={[{
-          selector: 'customProp',
-          name: 'Search Indexes',
-          icon: 'icon-here',
-          urlNamespace: 'whatever'
-        }]}
-        isExpanded={true}
-        selectedNavInfo={selectedNavInfo}
-        designDoc={{}} // note that this is empty
-      />, container);
+    var subOptions = $(ReactDOM.findDOMNode(el)).find('.accordion-body li');
+    assert.equal(subOptions.length, 3); // 1 for "Metadata" row, 1 for Type List row ("search indexes") and one for the index itself
+  });
 
-      var subOptions = $(ReactDOM.findDOMNode(el)).find('.accordion-body li');
-      assert.equal(subOptions.length, 1);
-    });
+  it('confirm design doc sidebar extensions do not appear when they have no content', function () {
+    var el = TestUtils.renderIntoDocument(<DesignDoc
+      database={database}
+      toggle={function () {}}
+      sidebarListTypes={[{
+        selector: 'customProp',
+        name: 'Search Indexes',
+        icon: 'icon-here',
+        urlNamespace: 'whatever'
+      }]}
+      isExpanded={true}
+      selectedNavInfo={selectedNavInfo}
+      designDoc={{}} // note that this is empty
+    />, container);
 
-    it('confirm doc metadata page is highlighted if selected', function () {
-      var el = TestUtils.renderIntoDocument(<DesignDoc
-        database={database}
-        toggle={function () {}}
-        sidebarListTypes={[]}
-        isExpanded={true}
-        selectedNavInfo={{
-          navItem: 'designDoc',
-          designDocName: 'id',
-          designDocSection: 'metadata',
-          indexName: ''
-        }}
-        designDoc={{}} />, container);
+    var subOptions = $(ReactDOM.findDOMNode(el)).find('.accordion-body li');
+    assert.equal(subOptions.length, 1);
+  });
 
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.accordion-body li.active a').html(), 'Metadata');
-    });
+  it('confirm doc metadata page is highlighted if selected', function () {
+    var el = TestUtils.renderIntoDocument(<DesignDoc
+      database={database}
+      toggle={function () {}}
+      sidebarListTypes={[]}
+      isExpanded={true}
+      selectedNavInfo={{
+        navItem: 'designDoc',
+        designDocName: 'id',
+        designDocSection: 'metadata',
+        indexName: ''
+      }}
+      designDoc={{}} />, container);
 
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.accordion-body li.active a').html(), 'Metadata');
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/sidebar/tests/sidebar.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/tests/sidebar.storesSpec.js b/app/addons/documents/sidebar/tests/sidebar.storesSpec.js
index 69b75f8..8edb848 100644
--- a/app/addons/documents/sidebar/tests/sidebar.storesSpec.js
+++ b/app/addons/documents/sidebar/tests/sidebar.storesSpec.js
@@ -10,70 +10,67 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../stores.react',
-  '../actiontypes',
-  '../../../../../test/mocha/testUtils',
-], function (FauxtonAPI, Stores, ActionTypes, testUtils) {
-  var assert = testUtils.assert;
-  var dispatchToken;
-  var store;
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../stores.react";
+import ActionTypes from "../actiontypes";
+import testUtils from "../../../../../test/mocha/testUtils";
+var assert = testUtils.assert;
+var dispatchToken;
+var store;
 
 
-  describe('Sidebar Store', function () {
-    beforeEach(function () {
-      store = new Stores.SidebarStore();
-      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
-    });
-
-    afterEach(function () {
-      FauxtonAPI.dispatcher.unregister(dispatchToken);
-    });
+describe('Sidebar Store', function () {
+  beforeEach(function () {
+    store = new Stores.SidebarStore();
+    dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+  });
 
-    describe('toggle state', function () {
+  afterEach(function () {
+    FauxtonAPI.dispatcher.unregister(dispatchToken);
+  });
 
-      it('should not be visible if never toggled', function () {
-        assert.notOk(store.isVisible('designDoc'));
-      });
+  describe('toggle state', function () {
 
-      it('should be visible after being toggled', function () {
-        var designDoc = 'designDoc';
-        store.toggleContent(designDoc);
-        assert.ok(store.isVisible(designDoc));
-      });
+    it('should not be visible if never toggled', function () {
+      assert.notOk(store.isVisible('designDoc'));
+    });
 
-      it('should not be visible after being toggled twice', function () {
-        var designDoc = 'designDoc';
-        store.toggleContent(designDoc);
-        store.toggleContent(designDoc);
-        assert.notOk(store.isVisible(designDoc));
-      });
+    it('should be visible after being toggled', function () {
+      var designDoc = 'designDoc';
+      store.toggleContent(designDoc);
+      assert.ok(store.isVisible(designDoc));
+    });
 
+    it('should not be visible after being toggled twice', function () {
+      var designDoc = 'designDoc';
+      store.toggleContent(designDoc);
+      store.toggleContent(designDoc);
+      assert.notOk(store.isVisible(designDoc));
     });
 
-    describe('toggle state for index', function () {
-      var designDoc = 'design-doc';
+  });
 
-      beforeEach(function () {
-        store.toggleContent(designDoc);
-      });
+  describe('toggle state for index', function () {
+    var designDoc = 'design-doc';
 
-      it('should be hidden if never toggled', function () {
-        assert.notOk(store.isVisible(designDoc, 'index'));
-      });
+    beforeEach(function () {
+      store.toggleContent(designDoc);
+    });
 
-      it('should be if toggled', function () {
-        store.toggleContent(designDoc, 'index');
-        assert.ok(store.isVisible(designDoc, 'index'));
-      });
+    it('should be hidden if never toggled', function () {
+      assert.notOk(store.isVisible(designDoc, 'index'));
+    });
 
-      it('should be hidden after being toggled twice', function () {
-        store.toggleContent(designDoc, 'index');
-        store.toggleContent(designDoc, 'index');
-        assert.notOk(store.isVisible(designDoc, 'index'));
-      });
+    it('should be if toggled', function () {
+      store.toggleContent(designDoc, 'index');
+      assert.ok(store.isVisible(designDoc, 'index'));
+    });
 
+    it('should be hidden after being toggled twice', function () {
+      store.toggleContent(designDoc, 'index');
+      store.toggleContent(designDoc, 'index');
+      assert.notOk(store.isVisible(designDoc, 'index'));
     });
+
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/document-test-helper.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/document-test-helper.js b/app/addons/documents/tests/document-test-helper.js
index ea2e27d..6822639 100644
--- a/app/addons/documents/tests/document-test-helper.js
+++ b/app/addons/documents/tests/document-test-helper.js
@@ -9,37 +9,33 @@
 // 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'
-], function (FauxtonAPI, Documents) {
+import FauxtonAPI from "../../../core/api";
+import Documents from "../resources";
 
-  var opts = {
-    params: {},
-    database: {
-      safeID: function () { return '1';}
-    }
-  };
-
-  function createDocColumn (docs) {
-    docs = docs.map(function (doc) {
-      return Documents.Doc.prototype.parse(doc);
-    });
-
-    return new Documents.AllDocs(docs, opts);
+var opts = {
+  params: {},
+  database: {
+    safeID: function () { return '1';}
   }
+};
 
-  function createMangoIndexDocColumn (docs) {
-    docs = docs.map(function (doc) {
-      return Documents.MangoIndex.prototype.parse(doc);
-    });
+function createDocColumn (docs) {
+  docs = docs.map(function (doc) {
+    return Documents.Doc.prototype.parse(doc);
+  });
 
-    return new Documents.MangoIndexCollection(docs, opts);
-  }
+  return new Documents.AllDocs(docs, opts);
+}
+
+function createMangoIndexDocColumn (docs) {
+  docs = docs.map(function (doc) {
+    return Documents.MangoIndex.prototype.parse(doc);
+  });
 
-  return {
-    createDocColumn: createDocColumn,
-    createMangoIndexDocColumn: createMangoIndexDocColumn
-  };
+  return new Documents.MangoIndexCollection(docs, opts);
+}
 
-});
+export default {
+  createDocColumn: createDocColumn,
+  createMangoIndexDocColumn: createMangoIndexDocColumn
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/helpersSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/helpersSpec.js b/app/addons/documents/tests/helpersSpec.js
index 228b861..bbb6952 100644
--- a/app/addons/documents/tests/helpersSpec.js
+++ b/app/addons/documents/tests/helpersSpec.js
@@ -9,42 +9,38 @@
 // 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',
-  '../helpers',
-  '../../../../test/mocha/testUtils',
-], function (FauxtonAPI, Helpers, testUtils) {
-  var assert = testUtils.assert;
-
-  describe('Helpers', function () {
-
-    describe('parseJSON', function () {
-      it('replaces "\\n" with actual newlines', function () {
-        var string = 'I am a string\\nwith\\nfour\\nlinebreaks\\nin';
-        var result = Helpers.parseJSON(string);
-        assert.equal(result.match(/\n/g).length, 4);
-      });
+import FauxtonAPI from "../../../core/api";
+import Helpers from "../helpers";
+import testUtils from "../../../../test/mocha/testUtils";
+var assert = testUtils.assert;
+
+describe('Helpers', function () {
+
+  describe('parseJSON', function () {
+    it('replaces "\\n" with actual newlines', function () {
+      var string = 'I am a string\\nwith\\nfour\\nlinebreaks\\nin';
+      var result = Helpers.parseJSON(string);
+      assert.equal(result.match(/\n/g).length, 4);
     });
+  });
 
-    describe('truncateDoc', function () {
-      var sevenLineDoc = '{\n"line2": 2,\n"line3": 3,\n"line4": 4,\n"line5": 5,\n"line6": 6\n}';
-
-      it('does no truncation if maxRows set higher than doc', function () {
-        var result = Helpers.truncateDoc(sevenLineDoc, 10);
-        assert.equal(result.isTruncated, false);
-        assert.equal(result.content, result.content);
-      });
+  describe('truncateDoc', function () {
+    var sevenLineDoc = '{\n"line2": 2,\n"line3": 3,\n"line4": 4,\n"line5": 5,\n"line6": 6\n}';
 
-      it('truncates by specified line count', function () {
-        var result = Helpers.truncateDoc(sevenLineDoc, 5);
-        assert.equal(result.isTruncated, true);
-        assert.equal(result.content, '{\n"line2": 2,\n"line3": 3,\n"line4": 4,\n"line5": 5,');
+    it('does no truncation if maxRows set higher than doc', function () {
+      var result = Helpers.truncateDoc(sevenLineDoc, 10);
+      assert.equal(result.isTruncated, false);
+      assert.equal(result.content, result.content);
+    });
 
-        var result2 = Helpers.truncateDoc(sevenLineDoc, 2);
-        assert.equal(result2.isTruncated, true);
-        assert.equal(result2.content, '{\n"line2": 2,');
-      });
+    it('truncates by specified line count', function () {
+      var result = Helpers.truncateDoc(sevenLineDoc, 5);
+      assert.equal(result.isTruncated, true);
+      assert.equal(result.content, '{\n"line2": 2,\n"line3": 3,\n"line4": 4,\n"line5": 5,');
 
+      var result2 = Helpers.truncateDoc(sevenLineDoc, 2);
+      assert.equal(result2.isTruncated, true);
+      assert.equal(result2.content, '{\n"line2": 2,');
     });
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/bulkDelete.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/bulkDelete.js b/app/addons/documents/tests/nightwatch/bulkDelete.js
index 0721884..5b8a5a9 100644
--- a/app/addons/documents/tests/nightwatch/bulkDelete.js
+++ b/app/addons/documents/tests/nightwatch/bulkDelete.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Bulk deletes': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 81c91e5..0620175 100644
--- a/app/addons/documents/tests/nightwatch/changes.js
+++ b/app/addons/documents/tests/nightwatch/changes.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Does not display the View-Selector-Button': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/changesFilter.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/changesFilter.js b/app/addons/documents/tests/nightwatch/changesFilter.js
index 050df1c..b5191de 100644
--- a/app/addons/documents/tests/nightwatch/changesFilter.js
+++ b/app/addons/documents/tests/nightwatch/changesFilter.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   // some basic test for the changes page. All of this and more is covered in the

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js b/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js
index c259b00..7db7eaa 100644
--- a/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js
+++ b/app/addons/documents/tests/nightwatch/checkSidebarBehavior.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Checks if design docs that have a dot symbol in the id show up in the UI': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/createsDocument.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/createsDocument.js b/app/addons/documents/tests/nightwatch/createsDocument.js
index eddb58a..7dc3f7d 100644
--- a/app/addons/documents/tests/nightwatch/createsDocument.js
+++ b/app/addons/documents/tests/nightwatch/createsDocument.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Creates a document' : function (client) {
     /*jshint multistr: true */

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js b/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js
index 288cb91..fe70b8a 100644
--- a/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js
+++ b/app/addons/documents/tests/nightwatch/createsDocumentWithoutId.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Creates a document without id' : function (client) {
     /*jshint multistr: true */

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js b/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js
index 26f659a..d109934 100644
--- a/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js
+++ b/app/addons/documents/tests/nightwatch/deleteDatabaseModal.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 var helpers = require('../../../../../test/nightwatch_tests/helpers/helpers.js');
 module.exports = {
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/deletesDocuments.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/deletesDocuments.js b/app/addons/documents/tests/nightwatch/deletesDocuments.js
index 622c357..e483571 100644
--- a/app/addons/documents/tests/nightwatch/deletesDocuments.js
+++ b/app/addons/documents/tests/nightwatch/deletesDocuments.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Deletes a document': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/designDocInfoPresent.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/designDocInfoPresent.js b/app/addons/documents/tests/nightwatch/designDocInfoPresent.js
index 2cc7930..628bee8 100644
--- a/app/addons/documents/tests/nightwatch/designDocInfoPresent.js
+++ b/app/addons/documents/tests/nightwatch/designDocInfoPresent.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Design Doc Metadata present' : function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/doubleEmitResults.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/doubleEmitResults.js b/app/addons/documents/tests/nightwatch/doubleEmitResults.js
index d83ecb2..c8c7777 100644
--- a/app/addons/documents/tests/nightwatch/doubleEmitResults.js
+++ b/app/addons/documents/tests/nightwatch/doubleEmitResults.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'View results with same id are all shown': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/editDocumentsFromView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/editDocumentsFromView.js b/app/addons/documents/tests/nightwatch/editDocumentsFromView.js
index 64be89d..3b1fba0 100644
--- a/app/addons/documents/tests/nightwatch/editDocumentsFromView.js
+++ b/app/addons/documents/tests/nightwatch/editDocumentsFromView.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Edit is allowed from default Map Views' : function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/fixRegressionTableView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/fixRegressionTableView.js b/app/addons/documents/tests/nightwatch/fixRegressionTableView.js
index 869b98a..4890a6d 100644
--- a/app/addons/documents/tests/nightwatch/fixRegressionTableView.js
+++ b/app/addons/documents/tests/nightwatch/fixRegressionTableView.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Does not crash the table view': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/jsonView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/jsonView.js b/app/addons/documents/tests/nightwatch/jsonView.js
index 444bd7e..6372fb6 100644
--- a/app/addons/documents/tests/nightwatch/jsonView.js
+++ b/app/addons/documents/tests/nightwatch/jsonView.js
@@ -34,3 +34,4 @@ module.exports = {
       .end();
   }
 };
+

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/lookaheadTray.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/lookaheadTray.js b/app/addons/documents/tests/nightwatch/lookaheadTray.js
index 88a5737..0c89c75 100644
--- a/app/addons/documents/tests/nightwatch/lookaheadTray.js
+++ b/app/addons/documents/tests/nightwatch/lookaheadTray.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'The tray opens': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/mangoIndex.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/mangoIndex.js b/app/addons/documents/tests/nightwatch/mangoIndex.js
index 8c54d09..2cabd90 100644
--- a/app/addons/documents/tests/nightwatch/mangoIndex.js
+++ b/app/addons/documents/tests/nightwatch/mangoIndex.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Creating new indexes with mango (mangoIndex.js)': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/mangoQuery.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/mangoQuery.js b/app/addons/documents/tests/nightwatch/mangoQuery.js
index 6801436..886fcab 100644
--- a/app/addons/documents/tests/nightwatch/mangoQuery.js
+++ b/app/addons/documents/tests/nightwatch/mangoQuery.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Finding things with with mango': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js b/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
index 95e1282..f537525 100644
--- a/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
+++ b/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Navigate to New Doc Page, editing and then clicking on the sidebar should show a confirmation dialog': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
index 6807a3d..88c1ef5 100644
--- a/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
+++ b/app/addons/documents/tests/nightwatch/navigateFromNewDoc.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   // this tests that the user is able to just navigate to and from the New View page without errors [it confirms

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/navigateToNewView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/navigateToNewView.js b/app/addons/documents/tests/nightwatch/navigateToNewView.js
index 232ef7c..7aa47fe 100644
--- a/app/addons/documents/tests/nightwatch/navigateToNewView.js
+++ b/app/addons/documents/tests/nightwatch/navigateToNewView.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   // this tests that the user is able to just navigate to and from the New View page without errors [it confirms

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/paginateAllDocs.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/paginateAllDocs.js b/app/addons/documents/tests/nightwatch/paginateAllDocs.js
index 44bf229..b529181 100644
--- a/app/addons/documents/tests/nightwatch/paginateAllDocs.js
+++ b/app/addons/documents/tests/nightwatch/paginateAllDocs.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'change number of items per page': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 2ec10e0..3b6256d 100644
--- a/app/addons/documents/tests/nightwatch/paginateView.js
+++ b/app/addons/documents/tests/nightwatch/paginateView.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
 	'change number of items per page': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/previousButton.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/previousButton.js b/app/addons/documents/tests/nightwatch/previousButton.js
index 39ef44c..e1b3efa 100644
--- a/app/addons/documents/tests/nightwatch/previousButton.js
+++ b/app/addons/documents/tests/nightwatch/previousButton.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Mango: Navigate back to _all_docs': function (client) {
     var newDatabaseName = client.globals.testDatabaseName,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/queryOptions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/queryOptions.js b/app/addons/documents/tests/nightwatch/queryOptions.js
index 4b105a4..7a0416e 100644
--- a/app/addons/documents/tests/nightwatch/queryOptions.js
+++ b/app/addons/documents/tests/nightwatch/queryOptions.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Query Options: check startkey filters properly': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js b/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js
index 561e1ea..c7430be 100644
--- a/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js
+++ b/app/addons/documents/tests/nightwatch/queryOptionsCloseBug.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Query Options: close if opened / closed multiple times': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/revBrowser.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/revBrowser.js b/app/addons/documents/tests/nightwatch/revBrowser.js
index 1a26785..6bac281 100644
--- a/app/addons/documents/tests/nightwatch/revBrowser.js
+++ b/app/addons/documents/tests/nightwatch/revBrowser.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'is able to show two docs next to each other, and diff them' : function (client) {
     /*jshint multistr: true */

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 217c9b0..12ae6eb 100644
--- a/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
+++ b/app/addons/documents/tests/nightwatch/selectDocViaTypeahead.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Select doc via typeahead field redirects user': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/switchDatabaseViaLookaheadTray.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/switchDatabaseViaLookaheadTray.js b/app/addons/documents/tests/nightwatch/switchDatabaseViaLookaheadTray.js
index 5aa49fe..dda04c3 100644
--- a/app/addons/documents/tests/nightwatch/switchDatabaseViaLookaheadTray.js
+++ b/app/addons/documents/tests/nightwatch/switchDatabaseViaLookaheadTray.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Confirm switching databases via lookahead tray': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 21644cd..27ea089 100644
--- a/app/addons/documents/tests/nightwatch/tableView.js
+++ b/app/addons/documents/tests/nightwatch/tableView.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Shows data in the table for all docs (include docs enabled)': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/tableViewConflicts.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/tableViewConflicts.js b/app/addons/documents/tests/nightwatch/tableViewConflicts.js
index aaeb964..76cea81 100644
--- a/app/addons/documents/tests/nightwatch/tableViewConflicts.js
+++ b/app/addons/documents/tests/nightwatch/tableViewConflicts.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Shows how many conflicts have appeared': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/uploadAttachment.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/uploadAttachment.js b/app/addons/documents/tests/nightwatch/uploadAttachment.js
index b534823..4b1192e 100644
--- a/app/addons/documents/tests/nightwatch/uploadAttachment.js
+++ b/app/addons/documents/tests/nightwatch/uploadAttachment.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Uploading an attachment works': function (client) {
     /*jshint multistr: true */

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/viewClone.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewClone.js b/app/addons/documents/tests/nightwatch/viewClone.js
index 9127c25..41af1ac 100644
--- a/app/addons/documents/tests/nightwatch/viewClone.js
+++ b/app/addons/documents/tests/nightwatch/viewClone.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Clones a view': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 4eacb91..ecefc71 100644
--- a/app/addons/documents/tests/nightwatch/viewCreate.js
+++ b/app/addons/documents/tests/nightwatch/viewCreate.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Creates a Design Doc using the dropdown at "all documents"': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/viewCreateBadView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewCreateBadView.js b/app/addons/documents/tests/nightwatch/viewCreateBadView.js
index 0555cf4..2145adc 100644
--- a/app/addons/documents/tests/nightwatch/viewCreateBadView.js
+++ b/app/addons/documents/tests/nightwatch/viewCreateBadView.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Displays an error if reduce is not possible': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/viewDelete.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewDelete.js b/app/addons/documents/tests/nightwatch/viewDelete.js
index 0e5dee1..6671a33 100644
--- a/app/addons/documents/tests/nightwatch/viewDelete.js
+++ b/app/addons/documents/tests/nightwatch/viewDelete.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Deletes a view': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/viewEdit.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewEdit.js b/app/addons/documents/tests/nightwatch/viewEdit.js
index 20c0f5f..7349592 100644
--- a/app/addons/documents/tests/nightwatch/viewEdit.js
+++ b/app/addons/documents/tests/nightwatch/viewEdit.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
 
   'Edits a design doc - renames index': function (client) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/nightwatch/viewQueryOptions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewQueryOptions.js b/app/addons/documents/tests/nightwatch/viewQueryOptions.js
index 2ec943c..ac4c161 100644
--- a/app/addons/documents/tests/nightwatch/viewQueryOptions.js
+++ b/app/addons/documents/tests/nightwatch/viewQueryOptions.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Edit view: Queryoptions work': function (client) {
     /*jshint multistr: true */


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/notifications/notifications.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/notifications/notifications.react.jsx b/app/addons/fauxton/notifications/notifications.react.jsx
index a307bf7..a8f7814 100644
--- a/app/addons/fauxton/notifications/notifications.react.jsx
+++ b/app/addons/fauxton/notifications/notifications.react.jsx
@@ -10,449 +10,442 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  'react-dom',
-  './actions',
-  './stores',
-  '../components.react',
-
-  'velocity-react',
-  "velocity-animate/velocity",
-  "velocity-animate/velocity.ui"
-],
-
-function (app, FauxtonAPI, React, ReactDOM, Actions, Stores, Components, VelocityReact) {
-
-  var store = Stores.notificationStore;
-  var Clipboard = Components.Clipboard;
-  var VelocityComponent = VelocityReact.VelocityComponent;
-
-
-  // The one-stop-shop for Fauxton notifications. This controller handler the header notifications and the rightmost
-  // notification center panel
-  var NotificationController = React.createClass({
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        notificationCenterVisible: store.isNotificationCenterVisible(),
-        notificationCenterFilter: store.getNotificationFilter(),
-        notifications: store.getNotifications()
-      };
-    },
-
-    componentDidMount: function () {
-      store.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      store.off('change', this.onChange);
-    },
-
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
-
-    render: function () {
-      return (
-        <div>
-          <GlobalNotifications
-            notifications={this.state.notifications} />
-          <NotificationCenterPanel
-            visible={this.state.notificationCenterVisible}
-            filter={this.state.notificationCenterFilter}
-            notifications={this.state.notifications} />
-        </div>
-      );
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Actions from "./actions";
+import Stores from "./stores";
+import Components from "../components.react";
+import VelocityReact from "velocity-react";
+import "velocity-animate/velocity";
+import "velocity-animate/velocity.ui";
+
+var store = Stores.notificationStore;
+var Clipboard = Components.Clipboard;
+var VelocityComponent = VelocityReact.VelocityComponent;
+
+
+// The one-stop-shop for Fauxton notifications. This controller handler the header notifications and the rightmost
+// notification center panel
+var NotificationController = React.createClass({
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      notificationCenterVisible: store.isNotificationCenterVisible(),
+      notificationCenterFilter: store.getNotificationFilter(),
+      notifications: store.getNotifications()
+    };
+  },
+
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+  },
+
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
     }
-  });
+  },
+
+  render: function () {
+    return (
+      <div>
+        <GlobalNotifications
+          notifications={this.state.notifications} />
+        <NotificationCenterPanel
+          visible={this.state.notificationCenterVisible}
+          filter={this.state.notificationCenterFilter}
+          notifications={this.state.notifications} />
+      </div>
+    );
+  }
+});
 
 
-  var GlobalNotifications = React.createClass({
-    propTypes: {
-      notifications: React.PropTypes.array.isRequired
-    },
+var GlobalNotifications = React.createClass({
+  propTypes: {
+    notifications: React.PropTypes.array.isRequired
+  },
 
-    componentDidMount: function () {
-      $(document).on('keydown.notificationClose', this.onKeyDown);
-    },
+  componentDidMount: function () {
+    $(document).on('keydown.notificationClose', this.onKeyDown);
+  },
 
-    componentWillUnmount: function () {
-      $(document).off('keydown.notificationClose', this.onKeyDown);
-    },
+  componentWillUnmount: function () {
+    $(document).off('keydown.notificationClose', this.onKeyDown);
+  },
 
-    onKeyDown: function (e) {
-      var code = e.keyCode || e.which;
-      if (code === 27) {
-        Actions.hideAllVisibleNotifications();
-      }
-    },
+  onKeyDown: function (e) {
+    var code = e.keyCode || e.which;
+    if (code === 27) {
+      Actions.hideAllVisibleNotifications();
+    }
+  },
 
-    getNotifications: function () {
-      if (!this.props.notifications.length) {
-        return null;
-      }
+  getNotifications: function () {
+    if (!this.props.notifications.length) {
+      return null;
+    }
 
-      return _.map(this.props.notifications, function (notification, index) {
+    return _.map(this.props.notifications, function (notification, index) {
 
-        // notifications are completely removed from the DOM once they're
-        if (!notification.visible) {
-          return;
-        }
+      // notifications are completely removed from the DOM once they're
+      if (!notification.visible) {
+        return;
+      }
 
-        return (
-          <Notification
-            notificationId={notification.notificationId}
-            isHiding={notification.isHiding}
-            key={index}
-            msg={notification.msg}
-            type={notification.type}
-            escape={notification.escape}
-            onStartHide={Actions.startHidingNotification}
-            onHideComplete={Actions.hideNotification} />
-        );
-      }, this);
-    },
-
-    render: function () {
       return (
-        <div id="global-notifications">
-          {this.getNotifications()}
-        </div>
+        <Notification
+          notificationId={notification.notificationId}
+          isHiding={notification.isHiding}
+          key={index}
+          msg={notification.msg}
+          type={notification.type}
+          escape={notification.escape}
+          onStartHide={Actions.startHidingNotification}
+          onHideComplete={Actions.hideNotification} />
       );
+    }, this);
+  },
+
+  render: function () {
+    return (
+      <div id="global-notifications">
+        {this.getNotifications()}
+      </div>
+    );
+  }
+});
+
+
+var Notification = React.createClass({
+  propTypes: {
+    msg: React.PropTypes.string.isRequired,
+    onStartHide: React.PropTypes.func.isRequired,
+    onHideComplete: React.PropTypes.func.isRequired,
+    type: React.PropTypes.oneOf(['error', 'info', 'success']),
+    escape: React.PropTypes.bool,
+    isHiding: React.PropTypes.bool.isRequired,
+    visibleTime: React.PropTypes.number
+  },
+
+  getDefaultProps: function () {
+    return {
+      type: 'info',
+      visibleTime: 8000,
+      escape: true,
+      slideInTime: 200,
+      slideOutTime: 200
+    };
+  },
+
+  componentWillUnmount: function () {
+    if (this.timeout) {
+      window.clearTimeout(this.timeout);
     }
-  });
-
-
-  var Notification = React.createClass({
-    propTypes: {
-      msg: React.PropTypes.string.isRequired,
-      onStartHide: React.PropTypes.func.isRequired,
-      onHideComplete: React.PropTypes.func.isRequired,
-      type: React.PropTypes.oneOf(['error', 'info', 'success']),
-      escape: React.PropTypes.bool,
-      isHiding: React.PropTypes.bool.isRequired,
-      visibleTime: React.PropTypes.number
-    },
-
-    getDefaultProps: function () {
-      return {
-        type: 'info',
-        visibleTime: 8000,
-        escape: true,
-        slideInTime: 200,
-        slideOutTime: 200
-      };
-    },
-
-    componentWillUnmount: function () {
-      if (this.timeout) {
-        window.clearTimeout(this.timeout);
+  },
+
+  getInitialState: function () {
+    return {
+      animation: { opacity: 0, minHeight: 0 }
+    };
+  },
+
+  componentDidMount: function () {
+    this.setState({
+      animation: {
+        opacity: (this.props.isHiding) ? 0 : 1,
+        minHeight: (this.props.isHiding) ? 0 : ReactDOM.findDOMNode(this.refs.notification).offsetHeight
       }
-    },
+    });
 
-    getInitialState: function () {
-      return {
-        animation: { opacity: 0, minHeight: 0 }
-      };
-    },
+    this.timeout = setTimeout(function () {
+      this.hide();
+    }.bind(this), this.props.visibleTime);
+  },
 
-    componentDidMount: function () {
+  componentDidUpdate: function (prevProps) {
+    if (!prevProps.isHiding && this.props.isHiding) {
       this.setState({
         animation: {
-          opacity: (this.props.isHiding) ? 0 : 1,
-          minHeight: (this.props.isHiding) ? 0 : ReactDOM.findDOMNode(this.refs.notification).offsetHeight
+          opacity: 0,
+          minHeight: 0
         }
       });
+    }
+  },
 
-      this.timeout = setTimeout(function () {
-        this.hide();
-      }.bind(this), this.props.visibleTime);
-    },
-
-    componentDidUpdate: function (prevProps) {
-      if (!prevProps.isHiding && this.props.isHiding) {
-        this.setState({
-          animation: {
-            opacity: 0,
-            minHeight: 0
-          }
-        });
-      }
-    },
+  getHeight: function () {
+    return $(ReactDOM.findDOMNode(this)).outerHeight(true);
+  },
 
-    getHeight: function () {
-      return $(ReactDOM.findDOMNode(this)).outerHeight(true);
-    },
+  hide: function (e) {
+    if (e) {
+      e.preventDefault();
+    }
+    this.props.onStartHide(this.props.notificationId);
+  },
+
+  // many messages contain HTML, hence the need for dangerouslySetInnerHTML
+  getMsg: function () {
+    var msg = (this.props.escape) ? _.escape(this.props.msg) : this.props.msg;
+    return {
+      __html: msg
+    };
+  },
+
+  onAnimationComplete: function () {
+    if (this.props.isHiding) {
+      this.props.onHideComplete(this.props.notificationId);
+    }
+  },
+
+  render: function () {
+    var iconMap = {
+      error: 'fonticon-attention-circled',
+      info: 'fonticon-info-circled',
+      success: 'fonticon-ok-circled'
+    };
+
+    return (
+      <VelocityComponent animation={this.state.animation}
+        runOnMount={true} duration={this.props.slideInTime} complete={this.onAnimationComplete}>
+          <div className="notification-wrapper">
+            <div className={'global-notification alert alert-' + this.props.type} ref="notification">
+              <a data-bypass href="#" onClick={this.hide}><i className="pull-right fonticon-cancel" /></a>
+              <i className={'notification-icon ' + iconMap[this.props.type]} />
+              <span dangerouslySetInnerHTML={this.getMsg()}></span>
+            </div>
+          </div>
+      </VelocityComponent>
+    );
+  }
+});
 
-    hide: function (e) {
-      if (e) {
-        e.preventDefault();
-      }
-      this.props.onStartHide(this.props.notificationId);
-    },
-
-    // many messages contain HTML, hence the need for dangerouslySetInnerHTML
-    getMsg: function () {
-      var msg = (this.props.escape) ? _.escape(this.props.msg) : this.props.msg;
-      return {
-        __html: msg
-      };
-    },
-
-    onAnimationComplete: function () {
-      if (this.props.isHiding) {
-        this.props.onHideComplete(this.props.notificationId);
-      }
-    },
 
-    render: function () {
-      var iconMap = {
-        error: 'fonticon-attention-circled',
-        info: 'fonticon-info-circled',
-        success: 'fonticon-ok-circled'
-      };
+var NotificationCenterButton = React.createClass({
+  getInitialState: function () {
+    return {
+      visible: true
+    };
+  },
 
-      return (
-        <VelocityComponent animation={this.state.animation}
-          runOnMount={true} duration={this.props.slideInTime} complete={this.onAnimationComplete}>
-            <div className="notification-wrapper">
-              <div className={'global-notification alert alert-' + this.props.type} ref="notification">
-                <a data-bypass href="#" onClick={this.hide}><i className="pull-right fonticon-cancel" /></a>
-                <i className={'notification-icon ' + iconMap[this.props.type]} />
-                <span dangerouslySetInnerHTML={this.getMsg()}></span>
-              </div>
-            </div>
-        </VelocityComponent>
-      );
-    }
-  });
+  hide: function () {
+    this.setState({ visible: false });
+  },
 
+  show: function () {
+    this.setState({ visible: true });
+  },
 
-  var NotificationCenterButton = React.createClass({
-    getInitialState: function () {
-      return {
-        visible: true
-      };
-    },
+  render: function () {
+    var classes = 'fonticon fonticon-bell' + ((!this.state.visible) ? ' hide' : '');
+    return (
+      <div className={classes} onClick={Actions.showNotificationCenter}></div>
+    );
+  }
+});
 
-    hide: function () {
-      this.setState({ visible: false });
-    },
 
-    show: function () {
-      this.setState({ visible: true });
-    },
+var NotificationCenterPanel = React.createClass({
+  propTypes: {
+    visible: React.PropTypes.bool.isRequired,
+    filter: React.PropTypes.string.isRequired,
+    notifications: React.PropTypes.array.isRequired
+  },
 
-    render: function () {
-      var classes = 'fonticon fonticon-bell' + ((!this.state.visible) ? ' hide' : '');
+  getNotifications: function () {
+    if (!this.props.notifications.length) {
       return (
-        <div className={classes} onClick={Actions.showNotificationCenter}></div>
+        <li className="no-notifications">No notifications.</li>
       );
     }
-  });
-
 
-  var NotificationCenterPanel = React.createClass({
-    propTypes: {
-      visible: React.PropTypes.bool.isRequired,
-      filter: React.PropTypes.string.isRequired,
-      notifications: React.PropTypes.array.isRequired
-    },
-
-    getNotifications: function () {
-      if (!this.props.notifications.length) {
-        return (
-          <li className="no-notifications">No notifications.</li>
-        );
-      }
-
-      return _.map(this.props.notifications, function (notification) {
-        return (
-          <NotificationPanelRow
-            isVisible={this.props.visible}
-            item={notification}
-            filter={this.props.filter}
-            key={notification.notificationId}
-          />
-        );
-      }, this);
-    },
-
-    render: function () {
-      var panelClasses = 'notification-center-panel flex-layout flex-col';
-      if (this.props.visible) {
-        panelClasses += ' visible';
-      }
-
-      var filterClasses = {
-        all: 'flex-body',
-        success: 'flex-body',
-        error: 'flex-body',
-        info: 'flex-body'
-      };
-      filterClasses[this.props.filter] += ' selected';
-
-      var maskClasses = 'notification-page-mask' + ((this.props.visible) ? ' visible' : '');
+    return _.map(this.props.notifications, function (notification) {
       return (
-        <div id="notification-center">
-          <div className={panelClasses}>
-
-            <header className="flex-layout flex-row">
-              <span className="fonticon fonticon-bell" />
-              <h1 className="flex-body">Notifications</h1>
-              <button type="button" onClick={Actions.hideNotificationCenter}>�</button>
-            </header>
-
-            <ul className="notification-filter flex-layout flex-row">
-              <li className={filterClasses.all} title="All notifications" data-filter="all"
-                  onClick={Actions.selectNotificationFilter.bind(this, 'all')}>All</li>
-              <li className={filterClasses.success} title="Success notifications" data-filter="success"
-                  onClick={Actions.selectNotificationFilter.bind(this, 'success')}>
-                <span className="fonticon fonticon-ok-circled" />
-              </li>
-              <li className={filterClasses.error} title="Error notifications" data-filter="error"
-                  onClick={Actions.selectNotificationFilter.bind(this, 'error')}>
-                <span className="fonticon fonticon-attention-circled" />
-              </li>
-              <li className={filterClasses.info} title="Info notifications" data-filter="info"
-                  onClick={Actions.selectNotificationFilter.bind(this, 'info')}>
-                <span className="fonticon fonticon-info-circled" />
-              </li>
-            </ul>
+        <NotificationPanelRow
+          isVisible={this.props.visible}
+          item={notification}
+          filter={this.props.filter}
+          key={notification.notificationId}
+        />
+      );
+    }, this);
+  },
 
-            <div className="flex-body">
-              <ul className="notification-list">
-                {this.getNotifications()}
-              </ul>
-            </div>
+  render: function () {
+    var panelClasses = 'notification-center-panel flex-layout flex-col';
+    if (this.props.visible) {
+      panelClasses += ' visible';
+    }
 
-            <footer>
-              <input
-                type="button"
-                value="Clear All"
-                className="btn btn-small btn-info"
-                onClick={Actions.clearAllNotifications} />
-            </footer>
+    var filterClasses = {
+      all: 'flex-body',
+      success: 'flex-body',
+      error: 'flex-body',
+      info: 'flex-body'
+    };
+    filterClasses[this.props.filter] += ' selected';
+
+    var maskClasses = 'notification-page-mask' + ((this.props.visible) ? ' visible' : '');
+    return (
+      <div id="notification-center">
+        <div className={panelClasses}>
+
+          <header className="flex-layout flex-row">
+            <span className="fonticon fonticon-bell" />
+            <h1 className="flex-body">Notifications</h1>
+            <button type="button" onClick={Actions.hideNotificationCenter}>�</button>
+          </header>
+
+          <ul className="notification-filter flex-layout flex-row">
+            <li className={filterClasses.all} title="All notifications" data-filter="all"
+                onClick={Actions.selectNotificationFilter.bind(this, 'all')}>All</li>
+            <li className={filterClasses.success} title="Success notifications" data-filter="success"
+                onClick={Actions.selectNotificationFilter.bind(this, 'success')}>
+              <span className="fonticon fonticon-ok-circled" />
+            </li>
+            <li className={filterClasses.error} title="Error notifications" data-filter="error"
+                onClick={Actions.selectNotificationFilter.bind(this, 'error')}>
+              <span className="fonticon fonticon-attention-circled" />
+            </li>
+            <li className={filterClasses.info} title="Info notifications" data-filter="info"
+                onClick={Actions.selectNotificationFilter.bind(this, 'info')}>
+              <span className="fonticon fonticon-info-circled" />
+            </li>
+          </ul>
+
+          <div className="flex-body">
+            <ul className="notification-list">
+              {this.getNotifications()}
+            </ul>
           </div>
 
-          <div className={maskClasses} onClick={Actions.hideNotificationCenter}></div>
+          <footer>
+            <input
+              type="button"
+              value="Clear All"
+              className="btn btn-small btn-info"
+              onClick={Actions.clearAllNotifications} />
+          </footer>
         </div>
-      );
-    }
-  });
-
-
-  var NotificationPanelRow = React.createClass({
-    propTypes: {
-      item: React.PropTypes.object.isRequired,
-      filter: React.PropTypes.string.isRequired,
-      transitionSpeed: React.PropTypes.number
-    },
-
-    getDefaultProps: function () {
-      return {
-        transitionSpeed: 300
-      };
-    },
-
-    clearNotification: function () {
-      var notificationId = this.props.item.notificationId;
-      this.hide(function () {
-        Actions.clearSingleNotification(notificationId);
-      });
-    },
 
-    componentDidMount: function () {
-      this.setState({
-        elementHeight: this.getHeight()
-      });
-    },
-
-    componentDidUpdate: function (prevProps) {
-      // in order for the nice slide effects to work we need a concrete element height to slide to and from.
-      // $.outerHeight() only works reliably on visible elements, hence this additional setState here
-      if (!prevProps.isVisible && this.props.isVisible) {
-        this.setState({
-          elementHeight: this.getHeight()
-        });
-      }
-
-      var show = true;
-      if (this.props.filter !== 'all') {
-        show = this.props.item.type === this.props.filter;
-      }
-      if (show) {
-        $(ReactDOM.findDOMNode(this)).velocity({ opacity: 1, height: this.state.elementHeight }, this.props.transitionSpeed);
-        return;
-      }
-      this.hide();
-    },
+        <div className={maskClasses} onClick={Actions.hideNotificationCenter}></div>
+      </div>
+    );
+  }
+});
 
-    getHeight: function () {
-      return $(ReactDOM.findDOMNode(this)).outerHeight(true);
-    },
 
-    hide: function (onHidden) {
-      $(ReactDOM.findDOMNode(this)).velocity({ opacity: 0, height: 0 }, this.props.transitionSpeed, function () {
-        if (onHidden) {
-          onHidden();
-        }
+var NotificationPanelRow = React.createClass({
+  propTypes: {
+    item: React.PropTypes.object.isRequired,
+    filter: React.PropTypes.string.isRequired,
+    transitionSpeed: React.PropTypes.number
+  },
+
+  getDefaultProps: function () {
+    return {
+      transitionSpeed: 300
+    };
+  },
+
+  clearNotification: function () {
+    var notificationId = this.props.item.notificationId;
+    this.hide(function () {
+      Actions.clearSingleNotification(notificationId);
+    });
+  },
+
+  componentDidMount: function () {
+    this.setState({
+      elementHeight: this.getHeight()
+    });
+  },
+
+  componentDidUpdate: function (prevProps) {
+    // in order for the nice slide effects to work we need a concrete element height to slide to and from.
+    // $.outerHeight() only works reliably on visible elements, hence this additional setState here
+    if (!prevProps.isVisible && this.props.isVisible) {
+      this.setState({
+        elementHeight: this.getHeight()
       });
-    },
-
-    render: function () {
-      var iconMap = {
-        success: 'fonticon-ok-circled',
-        error: 'fonticon-attention-circled',
-        info: 'fonticon-info-circled'
-      };
+    }
 
-      var timeElapsed = this.props.item.time.fromNow();
+    var show = true;
+    if (this.props.filter !== 'all') {
+      show = this.props.item.type === this.props.filter;
+    }
+    if (show) {
+      $(ReactDOM.findDOMNode(this)).velocity({ opacity: 1, height: this.state.elementHeight }, this.props.transitionSpeed);
+      return;
+    }
+    this.hide();
+  },
 
-      // we can safely do this because the store ensures all notifications are of known types
-      var rowIconClasses = 'fonticon ' + iconMap[this.props.item.type];
-      var hidden = (this.props.filter === 'all' || this.props.filter === this.props.item.type) ? false : true;
+  getHeight: function () {
+    return $(ReactDOM.findDOMNode(this)).outerHeight(true);
+  },
 
-      // N.B. wrapper <div> needed to ensure smooth hide/show transitions
-      return (
-        <li aria-hidden={hidden}>
-          <div className="flex-layout flex-row">
-            <span className={rowIconClasses}></span>
-            <div className="flex-body">
-              <p>{this.props.item.cleanMsg}</p>
-              <div className="notification-actions">
-                <span className="time-elapsed">{timeElapsed}</span>
-                <span className="divider">|</span>
-                <Clipboard text={this.props.item.cleanMsg} displayType="text" />
-              </div>
+  hide: function (onHidden) {
+    $(ReactDOM.findDOMNode(this)).velocity({ opacity: 0, height: 0 }, this.props.transitionSpeed, function () {
+      if (onHidden) {
+        onHidden();
+      }
+    });
+  },
+
+  render: function () {
+    var iconMap = {
+      success: 'fonticon-ok-circled',
+      error: 'fonticon-attention-circled',
+      info: 'fonticon-info-circled'
+    };
+
+    var timeElapsed = this.props.item.time.fromNow();
+
+    // we can safely do this because the store ensures all notifications are of known types
+    var rowIconClasses = 'fonticon ' + iconMap[this.props.item.type];
+    var hidden = (this.props.filter === 'all' || this.props.filter === this.props.item.type) ? false : true;
+
+    // N.B. wrapper <div> needed to ensure smooth hide/show transitions
+    return (
+      <li aria-hidden={hidden}>
+        <div className="flex-layout flex-row">
+          <span className={rowIconClasses}></span>
+          <div className="flex-body">
+            <p>{this.props.item.cleanMsg}</p>
+            <div className="notification-actions">
+              <span className="time-elapsed">{timeElapsed}</span>
+              <span className="divider">|</span>
+              <Clipboard text={this.props.item.cleanMsg} displayType="text" />
             </div>
-            <button type="button" onClick={this.clearNotification}>�</button>
           </div>
-        </li>
-      );
-    }
-  });
-
+          <button type="button" onClick={this.clearNotification}>�</button>
+        </div>
+      </li>
+    );
+  }
+});
 
-  return {
-    NotificationController: NotificationController,
-    NotificationCenterButton: NotificationCenterButton,
-    NotificationCenterPanel: NotificationCenterPanel,
-    NotificationPanelRow: NotificationPanelRow,
-    Notification: Notification,
 
-    renderNotificationController: function (el) {
-      return ReactDOM.render(<NotificationController />, el);
-    }
-  };
+export default {
+  NotificationController: NotificationController,
+  NotificationCenterButton: NotificationCenterButton,
+  NotificationCenterPanel: NotificationCenterPanel,
+  NotificationPanelRow: NotificationPanelRow,
+  Notification: Notification,
 
-});
+  renderNotificationController: function (el) {
+    return ReactDOM.render(<NotificationController />, el);
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/notifications/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/notifications/stores.js b/app/addons/fauxton/notifications/stores.js
index 08becfb..f99fd27 100644
--- a/app/addons/fauxton/notifications/stores.js
+++ b/app/addons/fauxton/notifications/stores.js
@@ -10,171 +10,165 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  '../../../app',
-  './actiontypes',
-  'moment'
-],
-
-function (FauxtonAPI, app, ActionTypes, moment) {
-  var Stores = {};
-
-  // static var used to assign a unique ID to each notification
-  var counter = 0;
-  var validNotificationTypes = ['success', 'error', 'info'];
-
-
-  /**
-   * Notifications are of the form:
-   * {
-   *   notificationId: N,
-   *   message: "string",
-   *   type: "success"|etc. see above list
-   *   clear: true|false,
-   *   escape: true|false
-   * }
-   */
-
-  Stores.NotificationStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._notifications = [];
-      this._notificationCenterVisible = false;
-      this._selectedNotificationFilter = 'all';
-    },
-
-    isNotificationCenterVisible: function () {
-      return this._notificationCenterVisible;
-    },
-
-    addNotification: function (info) {
-      if (_.isEmpty(info.type) || !_.contains(validNotificationTypes, info.type)) {
-        console.warn('Invalid message type: ', info);
-        return;
-      }
-
-      info.notificationId = ++counter;
-      info.cleanMsg = app.utils.stripHTML(info.msg);
-      info.time = moment();
-
-      // all new notifications are visible by default. They get hidden after their time expires, by the component
-      info.visible = true;
-      info.isHiding = false;
-
-      // clear: true causes all visible messages to be hidden
-      if (info.clear) {
-        this._notifications.forEach(function (notification) {
-          if (notification.visible) {
-            notification.isHiding = true;
-          }
-        });
-      }
-      this._notifications.unshift(info);
-    },
-
-    getNotifications: function () {
-      return this._notifications;
-    },
-
-    clearNotification: function (notificationId) {
-      this._notifications = _.without(this._notifications, _.findWhere(this._notifications, { notificationId: notificationId }));
-    },
+import FauxtonAPI from "../../../core/api";
+import app from "../../../app";
+import ActionTypes from "./actiontypes";
+import moment from "moment";
+var Stores = {};
+
+// static var used to assign a unique ID to each notification
+var counter = 0;
+var validNotificationTypes = ['success', 'error', 'info'];
+
+
+/**
+ * Notifications are of the form:
+ * {
+ *   notificationId: N,
+ *   message: "string",
+ *   type: "success"|etc. see above list
+ *   clear: true|false,
+ *   escape: true|false
+ * }
+ */
+
+Stores.NotificationStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._notifications = [];
+    this._notificationCenterVisible = false;
+    this._selectedNotificationFilter = 'all';
+  },
+
+  isNotificationCenterVisible: function () {
+    return this._notificationCenterVisible;
+  },
+
+  addNotification: function (info) {
+    if (_.isEmpty(info.type) || !_.contains(validNotificationTypes, info.type)) {
+      console.warn('Invalid message type: ', info);
+      return;
+    }
 
-    clearNotifications: function () {
-      this._notifications = [];
-    },
+    info.notificationId = ++counter;
+    info.cleanMsg = app.utils.stripHTML(info.msg);
+    info.time = moment();
 
-    hideNotification: function (notificationId) {
-      var notification = _.findWhere(this._notifications, { notificationId: notificationId });
-      notification.visible = false;
-      notification.isHiding = false;
-    },
+    // all new notifications are visible by default. They get hidden after their time expires, by the component
+    info.visible = true;
+    info.isHiding = false;
 
-    hideAllNotifications: function () {
+    // clear: true causes all visible messages to be hidden
+    if (info.clear) {
       this._notifications.forEach(function (notification) {
         if (notification.visible) {
           notification.isHiding = true;
         }
       });
-    },
-
-      startHidingNotification: function (notificationId) {
-      var notification = _.findWhere(this._notifications, { notificationId: notificationId });
-      notification.isHiding = true;
-    },
-
-    getNotificationFilter: function () {
-      return this._selectedNotificationFilter;
-    },
-
-    setNotificationFilter: function (filter) {
-      if ((_.isEmpty(filter) || !_.contains(validNotificationTypes, filter)) && filter !== 'all') {
-        console.warn('Invalid notification filter: ', filter);
-        return;
-      }
-      this._selectedNotificationFilter = filter;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.ADD_NOTIFICATION:
-          this.addNotification(action.options.info);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.CLEAR_ALL_NOTIFICATIONS:
-          this.clearNotifications();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.CLEAR_SINGLE_NOTIFICATION:
-          this.clearNotification(action.options.notificationId);
-        break;
-
-        case ActionTypes.START_HIDING_NOTIFICATION:
-          this.startHidingNotification(action.options.notificationId);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.HIDE_NOTIFICATION:
-          this.hideNotification(action.options.notificationId);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.HIDE_ALL_NOTIFICATIONS:
-          this.hideAllNotifications();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.SHOW_NOTIFICATION_CENTER:
-          this._notificationCenterVisible = true;
-          this.triggerChange();
-        break;
-
-        case ActionTypes.HIDE_NOTIFICATION_CENTER:
-          this._notificationCenterVisible = false;
-          this.triggerChange();
-        break;
-
-        case ActionTypes.SELECT_NOTIFICATION_FILTER:
-          this.setNotificationFilter(action.options.filter);
-          this.triggerChange();
-        break;
-
-        default:
-        return;
-          // do nothing
+    }
+    this._notifications.unshift(info);
+  },
+
+  getNotifications: function () {
+    return this._notifications;
+  },
+
+  clearNotification: function (notificationId) {
+    this._notifications = _.without(this._notifications, _.findWhere(this._notifications, { notificationId: notificationId }));
+  },
+
+  clearNotifications: function () {
+    this._notifications = [];
+  },
+
+  hideNotification: function (notificationId) {
+    var notification = _.findWhere(this._notifications, { notificationId: notificationId });
+    notification.visible = false;
+    notification.isHiding = false;
+  },
+
+  hideAllNotifications: function () {
+    this._notifications.forEach(function (notification) {
+      if (notification.visible) {
+        notification.isHiding = true;
       }
+    });
+  },
+
+    startHidingNotification: function (notificationId) {
+    var notification = _.findWhere(this._notifications, { notificationId: notificationId });
+    notification.isHiding = true;
+  },
+
+  getNotificationFilter: function () {
+    return this._selectedNotificationFilter;
+  },
+
+  setNotificationFilter: function (filter) {
+    if ((_.isEmpty(filter) || !_.contains(validNotificationTypes, filter)) && filter !== 'all') {
+      console.warn('Invalid notification filter: ', filter);
+      return;
     }
-  });
-
-  Stores.notificationStore = new Stores.NotificationStore();
-  Stores.notificationStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.notificationStore.dispatch);
+    this._selectedNotificationFilter = filter;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.ADD_NOTIFICATION:
+        this.addNotification(action.options.info);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.CLEAR_ALL_NOTIFICATIONS:
+        this.clearNotifications();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.CLEAR_SINGLE_NOTIFICATION:
+        this.clearNotification(action.options.notificationId);
+      break;
+
+      case ActionTypes.START_HIDING_NOTIFICATION:
+        this.startHidingNotification(action.options.notificationId);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.HIDE_NOTIFICATION:
+        this.hideNotification(action.options.notificationId);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.HIDE_ALL_NOTIFICATIONS:
+        this.hideAllNotifications();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.SHOW_NOTIFICATION_CENTER:
+        this._notificationCenterVisible = true;
+        this.triggerChange();
+      break;
+
+      case ActionTypes.HIDE_NOTIFICATION_CENTER:
+        this._notificationCenterVisible = false;
+        this.triggerChange();
+      break;
+
+      case ActionTypes.SELECT_NOTIFICATION_FILTER:
+        this.setNotificationFilter(action.options.filter);
+        this.triggerChange();
+      break;
+
+      default:
+      return;
+        // do nothing
+    }
+  }
+});
 
-  return Stores;
+Stores.notificationStore = new Stores.NotificationStore();
+Stores.notificationStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.notificationStore.dispatch);
 
-});
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/notifications/tests/actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/notifications/tests/actionsSpec.js b/app/addons/fauxton/notifications/tests/actionsSpec.js
index 1afd7de..8d61628 100644
--- a/app/addons/fauxton/notifications/tests/actionsSpec.js
+++ b/app/addons/fauxton/notifications/tests/actionsSpec.js
@@ -9,41 +9,41 @@
 // 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',
-  '../notifications.react',
-  '../stores',
-  '../actions',
-  '../../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'moment',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, {notificationStore: store}, Actions, {assert, restore}, React, ReactDOM, moment, TestUtils) {
+import FauxtonAPI from "../../../../core/api";
+import Views from "../notifications.react";
+import Stores from "../stores";
+import Actions from "../actions";
+import utils from "../../../../../test/mocha/testUtils";
+import React from "react";
+import ReactDOM from "react-dom";
+import moment from "moment";
+import TestUtils from "react-addons-test-utils";
+import "sinon";
 
-  describe('NotificationPanel', function () {
-    var container;
+const store = Stores.notificationStore;
+const {restore, assert} = utils;
 
-    beforeEach(function () {
-      container = document.createElement('div');
-      store.reset();
-    });
+describe('NotificationPanel', function () {
+  var container;
 
-    afterEach(function () {
-      restore(Actions.clearAllNotifications);
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+    store.reset();
+  });
+
+  afterEach(function () {
+    restore(Actions.clearAllNotifications);
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('clear all action fires', function () {
-      var stub = sinon.stub(Actions, 'clearAllNotifications');
+  it('clear all action fires', function () {
+    var stub = sinon.stub(Actions, 'clearAllNotifications');
 
-      var panelEl = TestUtils.renderIntoDocument(<Views.NotificationCenterPanel
-        notifications={[]} filter={'all'}
-        visible={true} />, container);
+    var panelEl = TestUtils.renderIntoDocument(<Views.NotificationCenterPanel
+      notifications={[]} filter={'all'}
+      visible={true} />, container);
 
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(panelEl)).find('footer input')[0]);
-      assert.ok(stub.calledOnce);
-    });
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(panelEl)).find('footer input')[0]);
+    assert.ok(stub.calledOnce);
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/notifications/tests/componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/notifications/tests/componentsSpec.react.jsx b/app/addons/fauxton/notifications/tests/componentsSpec.react.jsx
index 0f4d72a..13d5c40 100644
--- a/app/addons/fauxton/notifications/tests/componentsSpec.react.jsx
+++ b/app/addons/fauxton/notifications/tests/componentsSpec.react.jsx
@@ -9,185 +9,181 @@
 // 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',
-  '../notifications.react',
-  '../stores',
-  '../actions',
-  '../../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'moment',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, Stores, Actions, utils, React, ReactDOM, moment, TestUtils) {
-  var assert = utils.assert;
-  var store = Stores.notificationStore;
-
-
-  describe('NotificationController', function () {
-    var container;
-
-    beforeEach(function () {
-      container = document.createElement('div');
-      store.reset();
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
-
-    it('notifications should be escaped by default', function () {
-      var component = TestUtils.renderIntoDocument(<Views.NotificationController />, container);
-      FauxtonAPI.addNotification({ msg: '<script>window.whatever=1;</script>' });
-      assert.ok(/&lt;script&gt;window.whatever=1;&lt;\/script&gt;/.test(ReactDOM.findDOMNode(component).innerHTML));
-    });
-
-    it('notifications should be able to render unescaped', function () {
-      var component = TestUtils.renderIntoDocument(<Views.NotificationController />, container);
-      FauxtonAPI.addNotification({ msg: '<script>window.whatever=1;</script>', escape: false });
-      assert.ok(/<script>window.whatever=1;<\/script>/.test(ReactDOM.findDOMNode(component).innerHTML));
-    });
+import FauxtonAPI from "../../../../core/api";
+import Views from "../notifications.react";
+import Stores from "../stores";
+import Actions from "../actions";
+import utils from "../../../../../test/mocha/testUtils";
+import React from "react";
+import ReactDOM from "react-dom";
+import moment from "moment";
+import TestUtils from "react-addons-test-utils";
+import "sinon";
+var assert = utils.assert;
+var store = Stores.notificationStore;
+
+
+describe('NotificationController', function () {
+  var container;
+
+  beforeEach(function () {
+    container = document.createElement('div');
+    store.reset();
   });
 
-  describe('NotificationPanelRow', function () {
-    var container;
-
-    var notifications = {
-      success: {
-        notificationId: 1,
-        type: 'success',
-        msg: 'Success!',
-        time: moment()
-      },
-      info: {
-        notificationId: 2,
-        type: 'info',
-        msg: 'Error!',
-        time: moment()
-      },
-      error: {
-        notificationId: 3,
-        type: 'error',
-        msg: 'Error!',
-        time: moment()
-      }
-    };
-
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
-
-    it('shows all notification types when "all" filter applied', function () {
-      var row1 = TestUtils.renderIntoDocument(
-        <Views.NotificationPanelRow filter="all" item={notifications.success}/>,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(row1)).attr('aria-hidden'), 'false');
-      ReactDOM.unmountComponentAtNode(container);
-
-      var row2 = TestUtils.renderIntoDocument(
-        <Views.NotificationPanelRow filter="all" item={notifications.error}/>,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(row2)).attr('aria-hidden'), 'false');
-      ReactDOM.unmountComponentAtNode(container);
-
-      var row3 = TestUtils.renderIntoDocument(
-        <Views.NotificationPanelRow filter="all" item={notifications.info}/>,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(row3)).attr('aria-hidden'), 'false');
-      ReactDOM.unmountComponentAtNode(container);
-    });
-
-    it('hides notification when filter doesn\'t match', function () {
-      var rowEl = TestUtils.renderIntoDocument(
-        <Views.NotificationPanelRow filter="success" item={notifications.info}/>,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(rowEl)).attr('aria-hidden'), 'true');
-    });
-
-    it('shows notification when filter exact match', function () {
-      var rowEl = TestUtils.renderIntoDocument(
-        <Views.NotificationPanelRow filter="info" item={notifications.info}/>,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(rowEl)).attr('aria-hidden'), 'false');
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
   });
 
+  it('notifications should be escaped by default', function () {
+    var component = TestUtils.renderIntoDocument(<Views.NotificationController />, container);
+    FauxtonAPI.addNotification({ msg: '<script>window.whatever=1;</script>' });
+    assert.ok(/&lt;script&gt;window.whatever=1;&lt;\/script&gt;/.test(ReactDOM.findDOMNode(component).innerHTML));
+  });
+
+  it('notifications should be able to render unescaped', function () {
+    var component = TestUtils.renderIntoDocument(<Views.NotificationController />, container);
+    FauxtonAPI.addNotification({ msg: '<script>window.whatever=1;</script>', escape: false });
+    assert.ok(/<script>window.whatever=1;<\/script>/.test(ReactDOM.findDOMNode(component).innerHTML));
+  });
+});
+
+describe('NotificationPanelRow', function () {
+  var container;
+
+  var notifications = {
+    success: {
+      notificationId: 1,
+      type: 'success',
+      msg: 'Success!',
+      time: moment()
+    },
+    info: {
+      notificationId: 2,
+      type: 'info',
+      msg: 'Error!',
+      time: moment()
+    },
+    error: {
+      notificationId: 3,
+      type: 'error',
+      msg: 'Error!',
+      time: moment()
+    }
+  };
+
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
+
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
+
+  it('shows all notification types when "all" filter applied', function () {
+    var row1 = TestUtils.renderIntoDocument(
+      <Views.NotificationPanelRow filter="all" item={notifications.success}/>,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(row1)).attr('aria-hidden'), 'false');
+    ReactDOM.unmountComponentAtNode(container);
+
+    var row2 = TestUtils.renderIntoDocument(
+      <Views.NotificationPanelRow filter="all" item={notifications.error}/>,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(row2)).attr('aria-hidden'), 'false');
+    ReactDOM.unmountComponentAtNode(container);
+
+    var row3 = TestUtils.renderIntoDocument(
+      <Views.NotificationPanelRow filter="all" item={notifications.info}/>,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(row3)).attr('aria-hidden'), 'false');
+    ReactDOM.unmountComponentAtNode(container);
+  });
+
+  it('hides notification when filter doesn\'t match', function () {
+    var rowEl = TestUtils.renderIntoDocument(
+      <Views.NotificationPanelRow filter="success" item={notifications.info}/>,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(rowEl)).attr('aria-hidden'), 'true');
+  });
 
-  describe('NotificationCenterPanel', function () {
-    var container;
-
-    beforeEach(function () {
-      container = document.createElement('div');
-      store.reset();
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
-
-    it('shows all notifications by default', function () {
-      store.addNotification({type: 'success', msg: 'Success are okay'});
-      store.addNotification({type: 'success', msg: 'another success.'});
-      store.addNotification({type: 'info', msg: 'A single info message'});
-      store.addNotification({type: 'error', msg: 'Error #1'});
-      store.addNotification({type: 'error', msg: 'Error #2'});
-      store.addNotification({type: 'error', msg: 'Error #3'});
-
-      var panelEl = TestUtils.renderIntoDocument(
-        <Views.NotificationCenterPanel
-          filter="all"
-          notifications={store.getNotifications()}
-        />, container);
-
-      assert.equal($(ReactDOM.findDOMNode(panelEl)).find('.notification-list li[aria-hidden=false]').length, 6);
-    });
-
-    it('appropriate filters are applied - 1', function () {
-      store.addNotification({type: 'success', msg: 'Success are okay'});
-      store.addNotification({type: 'success', msg: 'another success.'});
-      store.addNotification({type: 'info', msg: 'A single info message'});
-      store.addNotification({type: 'error', msg: 'Error #1'});
-      store.addNotification({type: 'error', msg: 'Error #2'});
-      store.addNotification({type: 'error', msg: 'Error #3'});
-
-      var panelEl = TestUtils.renderIntoDocument(
-        <Views.NotificationCenterPanel
-          filter="success"
-          notifications={store.getNotifications()}
-        />, container);
-
-      // there are 2 success messages
-      assert.equal($(ReactDOM.findDOMNode(panelEl)).find('.notification-list li[aria-hidden=false]').length, 2);
-    });
-
-    it('appropriate filters are applied - 2', function () {
-      store.addNotification({type: 'success', msg: 'Success are okay'});
-      store.addNotification({type: 'success', msg: 'another success.'});
-      store.addNotification({type: 'info', msg: 'A single info message'});
-      store.addNotification({type: 'error', msg: 'Error #1'});
-      store.addNotification({type: 'error', msg: 'Error #2'});
-      store.addNotification({type: 'error', msg: 'Error #3'});
-
-      var panelEl = TestUtils.renderIntoDocument(
-        <Views.NotificationCenterPanel
-          filter="error"
-          notifications={store.getNotifications()}
-        />, container);
-
-      // 3 errors
-      assert.equal($(ReactDOM.findDOMNode(panelEl)).find('.notification-list li[aria-hidden=false]').length, 3);
-    });
+  it('shows notification when filter exact match', function () {
+    var rowEl = TestUtils.renderIntoDocument(
+      <Views.NotificationPanelRow filter="info" item={notifications.info}/>,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(rowEl)).attr('aria-hidden'), 'false');
+  });
+});
+
+
+describe('NotificationCenterPanel', function () {
+  var container;
+
+  beforeEach(function () {
+    container = document.createElement('div');
+    store.reset();
+  });
+
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
+
+  it('shows all notifications by default', function () {
+    store.addNotification({type: 'success', msg: 'Success are okay'});
+    store.addNotification({type: 'success', msg: 'another success.'});
+    store.addNotification({type: 'info', msg: 'A single info message'});
+    store.addNotification({type: 'error', msg: 'Error #1'});
+    store.addNotification({type: 'error', msg: 'Error #2'});
+    store.addNotification({type: 'error', msg: 'Error #3'});
+
+    var panelEl = TestUtils.renderIntoDocument(
+      <Views.NotificationCenterPanel
+        filter="all"
+        notifications={store.getNotifications()}
+      />, container);
+
+    assert.equal($(ReactDOM.findDOMNode(panelEl)).find('.notification-list li[aria-hidden=false]').length, 6);
+  });
+
+  it('appropriate filters are applied - 1', function () {
+    store.addNotification({type: 'success', msg: 'Success are okay'});
+    store.addNotification({type: 'success', msg: 'another success.'});
+    store.addNotification({type: 'info', msg: 'A single info message'});
+    store.addNotification({type: 'error', msg: 'Error #1'});
+    store.addNotification({type: 'error', msg: 'Error #2'});
+    store.addNotification({type: 'error', msg: 'Error #3'});
+
+    var panelEl = TestUtils.renderIntoDocument(
+      <Views.NotificationCenterPanel
+        filter="success"
+        notifications={store.getNotifications()}
+      />, container);
+
+    // there are 2 success messages
+    assert.equal($(ReactDOM.findDOMNode(panelEl)).find('.notification-list li[aria-hidden=false]').length, 2);
+  });
 
+  it('appropriate filters are applied - 2', function () {
+    store.addNotification({type: 'success', msg: 'Success are okay'});
+    store.addNotification({type: 'success', msg: 'another success.'});
+    store.addNotification({type: 'info', msg: 'A single info message'});
+    store.addNotification({type: 'error', msg: 'Error #1'});
+    store.addNotification({type: 'error', msg: 'Error #2'});
+    store.addNotification({type: 'error', msg: 'Error #3'});
+
+    var panelEl = TestUtils.renderIntoDocument(
+      <Views.NotificationCenterPanel
+        filter="error"
+        notifications={store.getNotifications()}
+      />, container);
+
+    // 3 errors
+    assert.equal($(ReactDOM.findDOMNode(panelEl)).find('.notification-list li[aria-hidden=false]').length, 3);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/notifications/tests/storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/notifications/tests/storesSpec.js b/app/addons/fauxton/notifications/tests/storesSpec.js
index d72dd8d..57d4afc 100644
--- a/app/addons/fauxton/notifications/tests/storesSpec.js
+++ b/app/addons/fauxton/notifications/tests/storesSpec.js
@@ -10,92 +10,88 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../app',
-  '../../../../core/api',
-  '../../../../../test/mocha/testUtils',
-  '../stores'
-], function (app, FauxtonAPI, utils, Stores) {
+import app from "../../../../app";
+import FauxtonAPI from "../../../../core/api";
+import utils from "../../../../../test/mocha/testUtils";
+import Stores from "../stores";
 
-  var assert = utils.assert;
-  var store = Stores.notificationStore;
+var assert = utils.assert;
+var store = Stores.notificationStore;
 
-  describe('Notification Store', function () {
+describe('Notification Store', function () {
 
-    beforeEach(function () {
-      store.reset();
-    });
-
-    it("sets reasonable defaults", function () {
-      assert.equal(store.getNotifications().length, 0);
-      assert.equal(store.isNotificationCenterVisible(), false);
-      assert.equal(store.getNotificationFilter(), 'all');
-    });
+  beforeEach(function () {
+    store.reset();
+  });
 
-    it("confirm only known notification types get added", function () {
-      assert.equal(store.getNotifications().length, 0);
-      store.addNotification({ type: 'success', msg: 'Success are okay' });
+  it("sets reasonable defaults", function () {
+    assert.equal(store.getNotifications().length, 0);
+    assert.equal(store.isNotificationCenterVisible(), false);
+    assert.equal(store.getNotificationFilter(), 'all');
+  });
 
-      assert.equal(store.getNotifications().length, 1);
-      store.addNotification({ type: 'info', msg: 'Infos are also okay' });
+  it("confirm only known notification types get added", function () {
+    assert.equal(store.getNotifications().length, 0);
+    store.addNotification({ type: 'success', msg: 'Success are okay' });
 
-      assert.equal(store.getNotifications().length, 2);
-      store.addNotification({ type: 'error', msg: 'Errors? Bring em on' });
+    assert.equal(store.getNotifications().length, 1);
+    store.addNotification({ type: 'info', msg: 'Infos are also okay' });
 
-      assert.equal(store.getNotifications().length, 3);
-      store.addNotification({ type: 'rhubarb', msg: 'But rhubarb is NOT a valid notification type' });
+    assert.equal(store.getNotifications().length, 2);
+    store.addNotification({ type: 'error', msg: 'Errors? Bring em on' });
 
-      // confirm it wasn't added
-      assert.equal(store.getNotifications().length, 3);
-    });
+    assert.equal(store.getNotifications().length, 3);
+    store.addNotification({ type: 'rhubarb', msg: 'But rhubarb is NOT a valid notification type' });
 
-    it("clearNotification clears a specific notification", function () {
-      store.addNotification({ type: 'success', msg: 'one' });
-      store.addNotification({ type: 'success', msg: 'two' });
-      store.addNotification({ type: 'success', msg: 'three' });
-      store.addNotification({ type: 'success', msg: 'four' });
+    // confirm it wasn't added
+    assert.equal(store.getNotifications().length, 3);
+  });
 
-      var notifications = store.getNotifications();
-      assert.equal(notifications.length, 4);
+  it("clearNotification clears a specific notification", function () {
+    store.addNotification({ type: 'success', msg: 'one' });
+    store.addNotification({ type: 'success', msg: 'two' });
+    store.addNotification({ type: 'success', msg: 'three' });
+    store.addNotification({ type: 'success', msg: 'four' });
 
-      // find the notification ID of the "three" message
-      var notification = _.findWhere(notifications, { msg: 'three' });
-      store.clearNotification(notification.notificationId);
+    var notifications = store.getNotifications();
+    assert.equal(notifications.length, 4);
 
-      // confirm it was removed
-      var updatedNotifications = store.getNotifications();
-      assert.equal(updatedNotifications.length, 3);
-      assert.equal(_.findWhere(updatedNotifications, { msg: 'three' }), undefined);
-    });
+    // find the notification ID of the "three" message
+    var notification = _.findWhere(notifications, { msg: 'three' });
+    store.clearNotification(notification.notificationId);
 
-    it("setNotificationFilter only sets for known notification types", function () {
-      store.setNotificationFilter('all');
-      assert.equal(store.getNotificationFilter(), 'all');
+    // confirm it was removed
+    var updatedNotifications = store.getNotifications();
+    assert.equal(updatedNotifications.length, 3);
+    assert.equal(_.findWhere(updatedNotifications, { msg: 'three' }), undefined);
+  });
 
-      store.setNotificationFilter('success');
-      assert.equal(store.getNotificationFilter(), 'success');
+  it("setNotificationFilter only sets for known notification types", function () {
+    store.setNotificationFilter('all');
+    assert.equal(store.getNotificationFilter(), 'all');
 
-      store.setNotificationFilter('error');
-      assert.equal(store.getNotificationFilter(), 'error');
+    store.setNotificationFilter('success');
+    assert.equal(store.getNotificationFilter(), 'success');
 
-      store.setNotificationFilter('info');
-      assert.equal(store.getNotificationFilter(), 'info');
+    store.setNotificationFilter('error');
+    assert.equal(store.getNotificationFilter(), 'error');
 
-      store.setNotificationFilter('broccoli');
-      assert.equal(store.getNotificationFilter(), 'info'); // this check it's still set to the previously set value
-    });
+    store.setNotificationFilter('info');
+    assert.equal(store.getNotificationFilter(), 'info');
 
-    it("clear all notifications", function () {
-      store.addNotification({ type: 'success', msg: 'one' });
-      store.addNotification({ type: 'success', msg: 'two' });
-      store.addNotification({ type: 'success', msg: 'three' });
-      store.addNotification({ type: 'success', msg: 'four' });
-      assert.equal(store.getNotifications().length, 4);
+    store.setNotificationFilter('broccoli');
+    assert.equal(store.getNotificationFilter(), 'info'); // this check it's still set to the previously set value
+  });
 
-      store.clearNotifications();
-      assert.equal(store.getNotifications().length, 0);
-    });
+  it("clear all notifications", function () {
+    store.addNotification({ type: 'success', msg: 'one' });
+    store.addNotification({ type: 'success', msg: 'two' });
+    store.addNotification({ type: 'success', msg: 'three' });
+    store.addNotification({ type: 'success', msg: 'four' });
+    assert.equal(store.getNotifications().length, 4);
 
+    store.clearNotifications();
+    assert.equal(store.getNotifications().length, 0);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/baseSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/baseSpec.js b/app/addons/fauxton/tests/baseSpec.js
index 3e4638f..da124b2 100644
--- a/app/addons/fauxton/tests/baseSpec.js
+++ b/app/addons/fauxton/tests/baseSpec.js
@@ -9,80 +9,76 @@
 // 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([
-  '../../../../test/mocha/testUtils',
-  '../../../core/api',
-  '../base',
-  'backbone',
-  'sinon'
-], function (testUtils, FauxtonAPI, Base, Backbone, sinon) {
-  var assert = testUtils.assert;
+import testUtils from "../../../../test/mocha/testUtils";
+import FauxtonAPI from "../../../core/api";
+import Base from "../base";
+import Backbone from "backbone";
+import sinon from "sinon";
+var assert = testUtils.assert;
 
 
-  describe('Fauxton RouteObject:beforeEstablish', function () {
-    var TestRouteObject, testRouteObject, mockLayout, _layout, setViewCalled;
+describe('Fauxton RouteObject:beforeEstablish', function () {
+  var TestRouteObject, testRouteObject, mockLayout, _layout, setViewCalled;
 
-    before(function () {
-      Base.initialize();
-      _layout = FauxtonAPI.masterLayout;
-      setViewCalled = false;
-    });
-
-    beforeEach(function () {
-      TestRouteObject = FauxtonAPI.RouteObject.extend({
-        crumbs: ['mycrumbs'],
-        hideNotificationCenter: true
-      });
-
-      testRouteObject = new TestRouteObject();
-      var apiBar = {};
-      apiBar.hide = sinon.spy();
+  before(function () {
+    Base.initialize();
+    _layout = FauxtonAPI.masterLayout;
+    setViewCalled = false;
+  });
 
-      // Need to find a better way of doing this
-      mockLayout = {
-        setTemplate: function () {
-          var promise = $.Deferred();
-          promise.resolve();
-          return promise;
-        },
-        clearBreadcrumbs: sinon.spy(),
-        setView: function () {
-          return {
-            render: function () {
-              setViewCalled = true;
-            }
-          };
-        },
-        renderView: function () {
-          var d = $.Deferred();
-          d.resolve();
-          return d.promise();
-        },
-        removeView: sinon.spy(),
-        hooks: [],
-        setBreadcrumbs: sinon.spy(),
-        apiBar: apiBar,
-        layout: {
-          setView: function () {}
-        }
-      };
+  beforeEach(function () {
+    TestRouteObject = FauxtonAPI.RouteObject.extend({
+      crumbs: ['mycrumbs'],
+      hideNotificationCenter: true
     });
 
-    after(function () {
-      FauxtonAPI.masterLayout = _layout;
-    });
+    testRouteObject = new TestRouteObject();
+    var apiBar = {};
+    apiBar.hide = sinon.spy();
 
-    it('Should clear breadcrumbs', function () {
-      FauxtonAPI.masterLayout = mockLayout;
-      testRouteObject.renderWith('the-route', mockLayout, 'args');
-      assert.ok(mockLayout.removeView.calledWith('#breadcrumbs'), 'Clear Breadcrumbs called');
-    });
+    // Need to find a better way of doing this
+    mockLayout = {
+      setTemplate: function () {
+        var promise = $.Deferred();
+        promise.resolve();
+        return promise;
+      },
+      clearBreadcrumbs: sinon.spy(),
+      setView: function () {
+        return {
+          render: function () {
+            setViewCalled = true;
+          }
+        };
+      },
+      renderView: function () {
+        var d = $.Deferred();
+        d.resolve();
+        return d.promise();
+      },
+      removeView: sinon.spy(),
+      hooks: [],
+      setBreadcrumbs: sinon.spy(),
+      apiBar: apiBar,
+      layout: {
+        setView: function () {}
+      }
+    };
+  });
 
-    it('Should set breadcrumbs when breadcrumbs exist', function () {
-      FauxtonAPI.masterLayout = mockLayout;
-      testRouteObject.renderWith('the-route', mockLayout, 'args');
-      assert.ok(setViewCalled, 'Set Breadcrumbs was called');
-    });
+  after(function () {
+    FauxtonAPI.masterLayout = _layout;
   });
 
+  it('Should clear breadcrumbs', function () {
+    FauxtonAPI.masterLayout = mockLayout;
+    testRouteObject.renderWith('the-route', mockLayout, 'args');
+    assert.ok(mockLayout.removeView.calledWith('#breadcrumbs'), 'Clear Breadcrumbs called');
+  });
+
+  it('Should set breadcrumbs when breadcrumbs exist', function () {
+    FauxtonAPI.masterLayout = mockLayout;
+    testRouteObject.renderWith('the-route', mockLayout, 'args');
+    assert.ok(setViewCalled, 'Set Breadcrumbs was called');
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/breadcrumbsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/breadcrumbsSpec.js b/app/addons/fauxton/tests/breadcrumbsSpec.js
index 5cbe96a..3becca9 100644
--- a/app/addons/fauxton/tests/breadcrumbsSpec.js
+++ b/app/addons/fauxton/tests/breadcrumbsSpec.js
@@ -9,83 +9,78 @@
 // 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',
-  '../base',
-  '../../../../test/mocha/testUtils',
-  'sinon'
-], function (FauxtonAPI, Fauxton, testUtils, sinon) {
-  var assert = testUtils.assert;
-
-  describe('Breadcrumbs', function () {
-
-    describe('can be overriden in routeObject', function () {
-      var routeObj;
-
-      beforeEach(function () {
-        var RouteObj = FauxtonAPI.RouteObject.extend({
-          overrideBreadcrumbs: true,
-          crumbs: ["crumb"]
-        });
-        routeObj = new RouteObj({});
-      });
+import FauxtonAPI from "../../../core/api";
+import Fauxton from "../base";
+import testUtils from "../../../../test/mocha/testUtils";
+import sinon from "sinon";
+var assert = testUtils.assert;
 
-      it('should not remove old breadcrumbs', function () {
-        var removeViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'removeView');
+describe('Breadcrumbs', function () {
 
-        routeObj.triggerBroadcast('beforeEstablish');
-        assert.notOk(removeViewSpy.called);
-        FauxtonAPI.masterLayout.removeView.restore();
-      });
-    });
+  describe('can be overriden in routeObject', function () {
+    var routeObj;
 
-    //Breadcrumbs are create and managed in Fauxton/base.js
-    //If the route object has a crumbs function a breadcrumbs view is created
-    //and rendered on the page in #breadcrumbs
-    describe('Auto creation of breadcrumbs', function () {
-      var routeObj;
-
-      beforeEach(function () {
-        var RouteObj = FauxtonAPI.RouteObject.extend({
-          crumbs: ["crumb1", "crumb2"]
-        });
-        routeObj = new RouteObj({});
+    beforeEach(function () {
+      var RouteObj = FauxtonAPI.RouteObject.extend({
+        overrideBreadcrumbs: true,
+        crumbs: ["crumb"]
       });
+      routeObj = new RouteObj({});
+    });
 
-      afterEach(function () {
-        if (FauxtonAPI.masterLayout.removeView.restore) {
-          FauxtonAPI.masterLayout.removeView.restore();
-        }
+    it('should not remove old breadcrumbs', function () {
+      var removeViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'removeView');
 
-        if (FauxtonAPI.masterLayout.setView.restore) {
-          FauxtonAPI.masterLayout.setView.restore();
-        }
-      });
+      routeObj.triggerBroadcast('beforeEstablish');
+      assert.notOk(removeViewSpy.called);
+      FauxtonAPI.masterLayout.removeView.restore();
+    });
+  });
 
-      it('should remove old breadcrumbs', function () {
-        var removeViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'removeView');
+  //Breadcrumbs are create and managed in Fauxton/base.js
+  //If the route object has a crumbs function a breadcrumbs view is created
+  //and rendered on the page in #breadcrumbs
+  describe('Auto creation of breadcrumbs', function () {
+    var routeObj;
 
-        routeObj.triggerBroadcast('beforeEstablish');
-        assert.ok(removeViewSpy.called);
+    beforeEach(function () {
+      var RouteObj = FauxtonAPI.RouteObject.extend({
+        crumbs: ["crumb1", "crumb2"]
       });
+      routeObj = new RouteObj({});
+    });
 
-      it('should create new breadcrumbs', function () {
-        var setViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'setView');
+    afterEach(function () {
+      if (FauxtonAPI.masterLayout.removeView.restore) {
+        FauxtonAPI.masterLayout.removeView.restore();
+      }
 
-        routeObj.triggerBroadcast('beforeEstablish');
-        assert.equal(setViewSpy.getCall(0).args[0], '#breadcrumbs');
-      });
+      if (FauxtonAPI.masterLayout.setView.restore) {
+        FauxtonAPI.masterLayout.setView.restore();
+      }
+    });
 
-      it('should not create new breadcrumbs when no crumbs are on routeObject', function () {
-        var removeViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'setView');
-        routeObj.crumbs = [];
-        routeObj.triggerBroadcast('beforeEstablish');
+    it('should remove old breadcrumbs', function () {
+      var removeViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'removeView');
 
-        assert.notOk(removeViewSpy.called);
-      });
+      routeObj.triggerBroadcast('beforeEstablish');
+      assert.ok(removeViewSpy.called);
+    });
+
+    it('should create new breadcrumbs', function () {
+      var setViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'setView');
 
+      routeObj.triggerBroadcast('beforeEstablish');
+      assert.equal(setViewSpy.getCall(0).args[0], '#breadcrumbs');
     });
-  });
 
+    it('should not create new breadcrumbs when no crumbs are on routeObject', function () {
+      var removeViewSpy = sinon.spy(FauxtonAPI.masterLayout, 'setView');
+      routeObj.crumbs = [];
+      routeObj.triggerBroadcast('beforeEstablish');
+
+      assert.notOk(removeViewSpy.called);
+    });
 
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/breadcrumbsViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/breadcrumbsViewSpec.js b/app/addons/fauxton/tests/breadcrumbsViewSpec.js
index ef3157f..43089c1 100644
--- a/app/addons/fauxton/tests/breadcrumbsViewSpec.js
+++ b/app/addons/fauxton/tests/breadcrumbsViewSpec.js
@@ -10,94 +10,91 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../components',
-  '../../../../test/mocha/testUtils',
-], function (app, Components, testUtils) {
-  var assert = testUtils.assert,
-    ViewSandbox = testUtils.ViewSandbox;
-
-  describe('Breadcrumbs', function () {
-
-    describe('3 Breadcrumbs', function () {
-      var breadcrumbs, viewSandbox;
-
-      // async setup with done-callback
-      beforeEach(function (done) {
-
-        // initialize a Breadcrumb-View with fake data
-        breadcrumbs = new Components.Breadcrumbs({
-          crumbs: [
-            { link: "/root", name: "root" },
-            { link: "/first", name: "first" },
-            { link: "/second", name: "second" }
-          ]
-        });
-
-        // render in a view-sandbox, which attaches it to the DOM
-        // for us, so we can test it
-        viewSandbox = new ViewSandbox();
-        viewSandbox.renderView(breadcrumbs, done);
+import app from "../../../app";
+import Components from "../components";
+import testUtils from "../../../../test/mocha/testUtils";
+var assert = testUtils.assert,
+  ViewSandbox = testUtils.ViewSandbox;
+
+describe('Breadcrumbs', function () {
+
+  describe('3 Breadcrumbs', function () {
+    var breadcrumbs, viewSandbox;
+
+    // async setup with done-callback
+    beforeEach(function (done) {
+
+      // initialize a Breadcrumb-View with fake data
+      breadcrumbs = new Components.Breadcrumbs({
+        crumbs: [
+          { link: "/root", name: "root" },
+          { link: "/first", name: "first" },
+          { link: "/second", name: "second" }
+        ]
       });
 
-      afterEach(function () {
-        // sync cleanup (done callback not provided)!
-        viewSandbox.remove();
-      });
+      // render in a view-sandbox, which attaches it to the DOM
+      // for us, so we can test it
+      viewSandbox = new ViewSandbox();
+      viewSandbox.renderView(breadcrumbs, done);
+    });
 
-      // sync test
-      it('should have 2 dividers between 3 breadcrumbs', function () {
-        assert.equal(2, breadcrumbs.$('.divider').length);
-      });
+    afterEach(function () {
+      // sync cleanup (done callback not provided)!
+      viewSandbox.remove();
     });
 
+    // sync test
+    it('should have 2 dividers between 3 breadcrumbs', function () {
+      assert.equal(2, breadcrumbs.$('.divider').length);
+    });
+  });
 
-    describe('2 Breadcrumbs, one empty', function () {
-      var breadcrumbs, viewSandbox;
 
-      beforeEach(function (done) {
-        breadcrumbs = new Components.Breadcrumbs({
-          crumbs: [
-            {link: "/root", name: "" },
-            {link: "/root", name: "crumb 2" }
-          ]
-        });
-        viewSandbox = new ViewSandbox();
-        viewSandbox.renderView(breadcrumbs, done);
-      });
+  describe('2 Breadcrumbs, one empty', function () {
+    var breadcrumbs, viewSandbox;
 
-      afterEach(function () {
-        viewSandbox.remove();
+    beforeEach(function (done) {
+      breadcrumbs = new Components.Breadcrumbs({
+        crumbs: [
+          {link: "/root", name: "" },
+          {link: "/root", name: "crumb 2" }
+        ]
       });
+      viewSandbox = new ViewSandbox();
+      viewSandbox.renderView(breadcrumbs, done);
+    });
 
-      it('should have 0 dividers for 2 breadcrumb when one is empty', function () {
-        assert.equal(0, breadcrumbs.$('.divider').length);
-      });
+    afterEach(function () {
+      viewSandbox.remove();
     });
 
+    it('should have 0 dividers for 2 breadcrumb when one is empty', function () {
+      assert.equal(0, breadcrumbs.$('.divider').length);
+    });
+  });
 
-    describe('1 Breadcrumb', function () {
-      var breadcrumbs, viewSandbox;
 
-      beforeEach(function (done) {
-        breadcrumbs = new Components.Breadcrumbs({
-          crumbs: [
-            {link: "/root", name: "root"}
-          ]
-        });
-        viewSandbox = new ViewSandbox();
-        viewSandbox.renderView(breadcrumbs, done);
-      });
+  describe('1 Breadcrumb', function () {
+    var breadcrumbs, viewSandbox;
 
-      afterEach(function () {
-        viewSandbox.remove();
+    beforeEach(function (done) {
+      breadcrumbs = new Components.Breadcrumbs({
+        crumbs: [
+          {link: "/root", name: "root"}
+        ]
       });
+      viewSandbox = new ViewSandbox();
+      viewSandbox.renderView(breadcrumbs, done);
+    });
 
-      it('should have 0 dividers for 1 breadcrumb', function () {
-        assert.equal(0, breadcrumbs.$('.divider').length);
-      });
+    afterEach(function () {
+      viewSandbox.remove();
     });
 
+    it('should have 0 dividers for 1 breadcrumb', function () {
+      assert.equal(0, breadcrumbs.$('.divider').length);
+    });
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/componentsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/componentsSpec.js b/app/addons/fauxton/tests/componentsSpec.js
index 329d862..572af56 100644
--- a/app/addons/fauxton/tests/componentsSpec.js
+++ b/app/addons/fauxton/tests/componentsSpec.js
@@ -9,31 +9,27 @@
 // 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([
-  '../../../../test/mocha/testUtils',
-  '../../../core/api',
-  '../components'
-], function (testUtils, FauxtonAPI, Components) {
-  var assert = testUtils.assert;
+import testUtils from "../../../../test/mocha/testUtils";
+import FauxtonAPI from "../../../core/api";
+import Components from "../components";
+var assert = testUtils.assert;
 
-  describe('DbSearchTypeahead', function () {
+describe('DbSearchTypeahead', function () {
 
-    // simple test to confirm that the query part of the URL and the \u9999 search end char
-    // are URL encoded
-    it('should URI encode parts of URL', function () {
-      var dbLimit = 30;
-      var typeahead = new Components.DbSearchTypeahead({
-        dbLimit: dbLimit
-      });
-      var url = typeahead.getURL('querywith[]chars', dbLimit);
+  // simple test to confirm that the query part of the URL and the \u9999 search end char
+  // are URL encoded
+  it('should URI encode parts of URL', function () {
+    var dbLimit = 30;
+    var typeahead = new Components.DbSearchTypeahead({
+      dbLimit: dbLimit
+    });
+    var url = typeahead.getURL('querywith[]chars', dbLimit);
 
-      // confirm the [] chars have been encoded
-      assert.isTrue(/%5B%5D/.test(url));
+    // confirm the [] chars have been encoded
+    assert.isTrue(/%5B%5D/.test(url));
 
-      // confirm the \u9999 char has been encoded
-      assert.isFalse(/\u9999/.test(url));
-      assert.isTrue(/%E9%A6%99/.test(url));
-    });
+    // confirm the \u9999 char has been encoded
+    assert.isFalse(/\u9999/.test(url));
+    assert.isTrue(/%E9%A6%99/.test(url));
   });
-
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/tests/actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/tests/actionsSpec.js b/app/addons/verifyinstall/tests/actionsSpec.js
index c1c4751..5560d78 100644
--- a/app/addons/verifyinstall/tests/actionsSpec.js
+++ b/app/addons/verifyinstall/tests/actionsSpec.js
@@ -10,25 +10,21 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  '../../../../test/mocha/testUtils',
-  '../stores',
-  '../actiontypes',
-  'sinon'
-], function (app, FauxtonAPI, testUtils, Stores, ActionTypes, sinon) {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import testUtils from "../../../../test/mocha/testUtils";
+import Stores from "../stores";
+import ActionTypes from "../actiontypes";
+import sinon from "sinon";
 
-  var assert = testUtils.assert;
+var assert = testUtils.assert;
 
-  describe('Verify Install Actions', function () {
-
-    it('resets the store when action called', function () {
-      var spy = sinon.spy(Stores.verifyInstallStore, 'reset');
-      FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_RESET });
-      assert.ok(spy.calledOnce);
-    });
+describe('Verify Install Actions', function () {
 
+  it('resets the store when action called', function () {
+    var spy = sinon.spy(Stores.verifyInstallStore, 'reset');
+    FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_RESET });
+    assert.ok(spy.calledOnce);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/tests/componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/tests/componentsSpec.react.jsx b/app/addons/verifyinstall/tests/componentsSpec.react.jsx
index 9ba5b4c..2d33160 100644
--- a/app/addons/verifyinstall/tests/componentsSpec.react.jsx
+++ b/app/addons/verifyinstall/tests/componentsSpec.react.jsx
@@ -10,128 +10,122 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  'react-dom',
-  '../../../../test/mocha/testUtils',
-  '../constants',
-  '../components.react',
-  'react-addons-test-utils',
-  'sinon'
-
-], function (app, FauxtonAPI, React, ReactDOM, testUtils, Constants, Components, TestUtils, sinon) {
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
-
-  var assert = testUtils.assert;
-
-  describe('VerifyInstallResults', function () {
-    var container, el;
-
-    var tests = [
-      { key: 'CREATE_DATABASE', id: 'js-test-create-db' },
-      { key: 'CREATE_DOCUMENT', id: 'js-test-create-doc' },
-      { key: 'UPDATE_DOCUMENT', id: 'js-test-update-doc' },
-      { key: 'DELETE_DOCUMENT', id: 'js-test-delete-doc' },
-      { key: 'CREATE_VIEW', id: 'js-test-create-view' },
-      { key: 'REPLICATION', id: 'js-test-replication' }
-    ];
-
-    var testResults = {};
-    tests.forEach(function (test) {
-      testResults[Constants.TESTS[test.key]] = { complete: false };
-    });
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import testUtils from "../../../../test/mocha/testUtils";
+import Constants from "../constants";
+import Components from "../components.react";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+FauxtonAPI.router = new FauxtonAPI.Router([]);
+
+var assert = testUtils.assert;
+
+describe('VerifyInstallResults', function () {
+  var container, el;
+
+  var tests = [
+    { key: 'CREATE_DATABASE', id: 'js-test-create-db' },
+    { key: 'CREATE_DOCUMENT', id: 'js-test-create-doc' },
+    { key: 'UPDATE_DOCUMENT', id: 'js-test-update-doc' },
+    { key: 'DELETE_DOCUMENT', id: 'js-test-delete-doc' },
+    { key: 'CREATE_VIEW', id: 'js-test-create-view' },
+    { key: 'REPLICATION', id: 'js-test-replication' }
+  ];
+
+  var testResults = {};
+  tests.forEach(function (test) {
+    testResults[Constants.TESTS[test.key]] = { complete: false };
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('confirm all result fields blank before tests ran', function () {
-      container = document.createElement('div');
-      el = TestUtils.renderIntoDocument(<Components.VerifyInstallResults testResults={testResults} />, container);
+  it('confirm all result fields blank before tests ran', function () {
+    container = document.createElement('div');
+    el = TestUtils.renderIntoDocument(<Components.VerifyInstallResults testResults={testResults} />, container);
 
-      tests.forEach(function (test) {
-        assert.equal($(ReactDOM.findDOMNode(el)).find('#' + test.id).html(), '');
-      });
+    tests.forEach(function (test) {
+      assert.equal($(ReactDOM.findDOMNode(el)).find('#' + test.id).html(), '');
     });
+  });
 
-    it('confirm each result field shows success after successful test', function () {
-      tests.forEach(function (test) {
-        var copy = _.clone(testResults);
+  it('confirm each result field shows success after successful test', function () {
+    tests.forEach(function (test) {
+      var copy = _.clone(testResults);
 
-        // mark this single test as complete
-        copy[Constants.TESTS[test.key]] = {
-          complete: true,
-          success: true
-        };
+      // mark this single test as complete
+      copy[Constants.TESTS[test.key]] = {
+        complete: true,
+        success: true
+      };
 
-        el = TestUtils.renderIntoDocument(<Components.VerifyInstallResults testResults={copy} />, container);
+      el = TestUtils.renderIntoDocument(<Components.VerifyInstallResults testResults={copy} />, container);
 
-        // now look at the DOM for that element. It should contain a tick char
-        assert.equal($(ReactDOM.findDOMNode(el)).find('#' + test.id + ' span').html(), '\u2713');
-      });
+      // now look at the DOM for that element. It should contain a tick char
+      assert.equal($(ReactDOM.findDOMNode(el)).find('#' + test.id + ' span').html(), '\u2713');
     });
+  });
 
-    it('confirm each result field shows error marker after failed test', function () {
-      tests.forEach(function (test) {
-        var copy = _.clone(testResults);
+  it('confirm each result field shows error marker after failed test', function () {
+    tests.forEach(function (test) {
+      var copy = _.clone(testResults);
 
-        // mark this single test as complete
-        copy[Constants.TESTS[test.key]] = {
-          complete: true,
-          success: false
-        };
+      // mark this single test as complete
+      copy[Constants.TESTS[test.key]] = {
+        complete: true,
+        success: false
+      };
 
-        el = TestUtils.renderIntoDocument(<Components.VerifyInstallResults testResults={copy} />, container);
+      el = TestUtils.renderIntoDocument(<Components.VerifyInstallResults testResults={copy} />, container);
 
-        // now look at the DOM for that element. It should contain an error char
-        assert.equal($(ReactDOM.findDOMNode(el)).find('#' + test.id + ' span').html(), '\u2717');
-      });
+      // now look at the DOM for that element. It should contain an error char
+      assert.equal($(ReactDOM.findDOMNode(el)).find('#' + test.id + ' span').html(), '\u2717');
     });
   });
+});
 
 
-  describe('VerifyInstallButton', function () {
-    var container, el;
-
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+describe('VerifyInstallButton', function () {
+  var container, el;
 
-    it('calls verify function on click', function () {
-      var stub = { func: function () { } };
-      var spy = sinon.spy(stub, 'func');
-      el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={false} />, container);
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el))[0]);
-      assert.ok(spy.calledOnce);
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    it('does not call verify function when verification already ongoing', function () {
-      var stub = { func: function () { } };
-      var spy = sinon.spy(stub, 'func');
-      el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={true} />, container);
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(el))[0]);
-      assert.notOk(spy.calledOnce);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('shows appropriate default label', function () {
-      var stub = { func: function () { } };
-      el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={false} />, container);
-      assert.equal($(ReactDOM.findDOMNode(el)).html(), 'Verify Installation');
-    });
+  it('calls verify function on click', function () {
+    var stub = { func: function () { } };
+    var spy = sinon.spy(stub, 'func');
+    el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={false} />, container);
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(el))[0]);
+    assert.ok(spy.calledOnce);
+  });
 
-    it('shows appropriate label during verification', function () {
-      var stub = { func: function () { } };
-      el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={true} />, container);
-      assert.equal($(ReactDOM.findDOMNode(el)).html(), 'Verifying');
-    });
+  it('does not call verify function when verification already ongoing', function () {
+    var stub = { func: function () { } };
+    var spy = sinon.spy(stub, 'func');
+    el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={true} />, container);
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(el))[0]);
+    assert.notOk(spy.calledOnce);
+  });
 
+  it('shows appropriate default label', function () {
+    var stub = { func: function () { } };
+    el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={false} />, container);
+    assert.equal($(ReactDOM.findDOMNode(el)).html(), 'Verify Installation');
   });
 
+  it('shows appropriate label during verification', function () {
+    var stub = { func: function () { } };
+    el = TestUtils.renderIntoDocument(<Components.VerifyInstallButton verify={stub.func} isVerifying={true} />, container);
+    assert.equal($(ReactDOM.findDOMNode(el)).html(), 'Verifying');
+  });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/verifyinstall/tests/verifyinstall.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/verifyinstall/tests/verifyinstall.storesSpec.js b/app/addons/verifyinstall/tests/verifyinstall.storesSpec.js
index 01d0647..eeddf7d 100644
--- a/app/addons/verifyinstall/tests/verifyinstall.storesSpec.js
+++ b/app/addons/verifyinstall/tests/verifyinstall.storesSpec.js
@@ -10,42 +10,38 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  '../../../../test/mocha/testUtils',
-  '../stores',
-  '../actiontypes'
-], function (app, FauxtonAPI, testUtils, Stores, ActionTypes) {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import testUtils from "../../../../test/mocha/testUtils";
+import Stores from "../stores";
+import ActionTypes from "../actiontypes";
 
-  var assert = testUtils.assert;
+var assert = testUtils.assert;
 
-  describe('VerifyInstallStore', function () {
+describe('VerifyInstallStore', function () {
 
-    afterEach(function () {
-      Stores.verifyInstallStore.reset();
-    });
-
-    it('check store defaults', function () {
-      assert.ok(Stores.verifyInstallStore.checkIsVerifying() === false);
+  afterEach(function () {
+    Stores.verifyInstallStore.reset();
+  });
 
-      // confirm all the tests are initially marked as incomplete
-      var tests = Stores.verifyInstallStore.getTestResults();
-      _.each(tests, function (test) {
-        assert.ok(test.complete === false);
-      });
-    });
+  it('check store defaults', function () {
+    assert.ok(Stores.verifyInstallStore.checkIsVerifying() === false);
 
-    it('publishing start event changes state in store', function () {
-      FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_START });
-      assert.ok(Stores.verifyInstallStore.checkIsVerifying() === true);
+    // confirm all the tests are initially marked as incomplete
+    var tests = Stores.verifyInstallStore.getTestResults();
+    _.each(tests, function (test) {
+      assert.ok(test.complete === false);
     });
+  });
 
-    it('publishing completion event changes state in store', function () {
-      FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_ALL_TESTS_COMPLETE });
-      assert.ok(Stores.verifyInstallStore.checkIsVerifying() === false);
-    });
+  it('publishing start event changes state in store', function () {
+    FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_START });
+    assert.ok(Stores.verifyInstallStore.checkIsVerifying() === true);
+  });
 
+  it('publishing completion event changes state in store', function () {
+    FauxtonAPI.dispatch({ type: ActionTypes.VERIFY_INSTALL_ALL_TESTS_COMPLETE });
+    assert.ok(Stores.verifyInstallStore.checkIsVerifying() === false);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/app.js
----------------------------------------------------------------------
diff --git a/app/app.js b/app/app.js
index 06fa67a..bb449fa 100644
--- a/app/app.js
+++ b/app/app.js
@@ -10,123 +10,110 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  // application.
-  './initialize',
-
-  // libraries
-  'jquery',
-  'lodash',
-  'backbone',
-  'bootstrap',
-  './helpers',
-  './core/utils',
-
-  // modules
-  './core/api',
-  './core/couchdbSession',
-
-  // plugins
-  'backbone.layoutmanager',
-  "../assets/less/fauxton.less"
-],
-
-function (app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI, Couchdb) {
-
-  // Make sure we have a console.log
-  if (_.isUndefined(console)) {
-    console = {
-      log: function () {},
-      trace: function () {},
-      debug: function () {}
-    };
+import app from "./initialize";
+import $ from "jquery";
+import _ from "lodash";
+import Backbone from "backbone";
+import Bootstrap from "bootstrap";
+import Helpers from "./helpers";
+import Utils from "./core/utils";
+import FauxtonAPI from "./core/api";
+import Couchdb from "./core/couchdbSession";
+import "backbone.layoutmanager";
+import "../assets/less/fauxton.less";
+
+// Make sure we have a console.log
+if (_.isUndefined(console)) {
+  console = {
+    log: function () {},
+    trace: function () {},
+    debug: function () {}
+  };
+}
+
+// make sure we have location.origin
+if (_.isUndefined(window.location.origin)) {
+  var port = '';
+  if (window.location.port) {
+    port = ':' + window.location.port;
   }
+  window.location.origin = window.location.protocol + '//' +
+    window.location.hostname + port;
+}
+
+// Provide a global location to place configuration settings and module
+// creation also mix in Backbone.Events
+Object.assign(app, {
+  utils: Utils,
+  getParams: FauxtonAPI.utils.getParams,
+  helpers: Helpers
+});
 
-  // make sure we have location.origin
-  if (_.isUndefined(window.location.origin)) {
-    var port = '';
-    if (window.location.port) {
-      port = ':' + window.location.port;
-    }
-    window.location.origin = window.location.protocol + '//' +
-      window.location.hostname + port;
-  }
-
-  // Provide a global location to place configuration settings and module
-  // creation also mix in Backbone.Events
-  _.extend(app, {
-    utils: Utils,
-    getParams: FauxtonAPI.utils.getParams,
-    helpers: Helpers
-  });
-
-  // Localize or create a new JavaScript Template object
-  var JST = window.JST = window.JST || {};
-
-  // Configure LayoutManager with Backbone Boilerplate defaults
-  FauxtonAPI.Layout.configure({
-    // Allow LayoutManager to augment Backbone.View.prototype.
-    manage: true,
-    prefix: 'app/',
-
-    // Inject app/helper.js for shared functionality across all html templates
-    renderTemplate: function (template, context) {
-      return template(_.extend(Helpers, context));
-    },
-
-    fetchTemplate: function (path) {
-      // Initialize done for use in async-mode
-      var done;
-
-      // Concatenate the file extension.
-      path = path + '.html';
-
-      // If cached, use the compiled template.
-      if (JST[path]) {
-        return JST[path];
-      } else {
-        // Put fetch into `async-mode`.
-        done = this.async();
-        // Seek out the template asynchronously.
-        return $.ajax({ url: app.root + path }).then(function (contents) {
-          done(JST[path] = _.template(contents));
-        });
-      }
-    }
-  });
-
-  FauxtonAPI.setSession(new Couchdb.Session());
-
-
-  // Define your master router on the application namespace and trigger all
-  // navigation from this instance.
-  FauxtonAPI.config({
-    el: '.wrapper',
-    masterLayout: new FauxtonAPI.Layout(),
-
-    // I haven't wrapped these dispatch methods in a action
-    // because I don't want to require fauxton/actions in this method.
-    addHeaderLink: function (link) {
-      FauxtonAPI.dispatch({
-        type: 'ADD_NAVBAR_LINK',
-        link: link
-      });
-    },
-
-    updateHeaderLink: function (link) {
-      FauxtonAPI.dispatch({
-        type: 'UPDATE_NAVBAR_LINK',
-        link: link
-      });
-    },
-
-    removeHeaderLink: function (link) {
-      FauxtonAPI.dispatch({
-        type: 'REMOVE_NAVBAR_LINK',
-        link: link
+// Localize or create a new JavaScript Template object
+const JST = window.JST = window.JST || {};
+
+// Configure LayoutManager with Backbone Boilerplate defaults
+FauxtonAPI.Layout.configure({
+  // Allow LayoutManager to augment Backbone.View.prototype.
+  manage: true,
+  prefix: 'app/',
+
+  // Inject app/helper.js for shared functionality across all html templates
+  renderTemplate: function (template, context) {
+    return template(_.extend(Helpers, context));
+  },
+
+  fetchTemplate: function (path) {
+    // Initialize done for use in async-mode
+    let done;
+
+    // Concatenate the file extension.
+    path = path + '.html';
+
+    // If cached, use the compiled template.
+    if (JST[path]) {
+      return JST[path];
+    } else {
+      // Put fetch into `async-mode`.
+      done = this.async();
+      // Seek out the template asynchronously.
+      return $.ajax({ url: app.root + path }).then(function (contents) {
+        done(JST[path] = _.template(contents));
       });
     }
-  });
+  }
+});
 
-  return app;
+FauxtonAPI.setSession(new Couchdb.Session());
+
+// Define your master router on the application namespace and trigger all
+// navigation from this instance.
+FauxtonAPI.config({
+  el: '.wrapper',
+  masterLayout: new FauxtonAPI.Layout(),
+
+  // I haven't wrapped these dispatch methods in a action
+  // because I don't want to require fauxton/actions in this method.
+  addHeaderLink: function (link) {
+    FauxtonAPI.dispatch({
+      type: 'ADD_NAVBAR_LINK',
+      link: link
+    });
+  },
+
+  updateHeaderLink: function (link) {
+    FauxtonAPI.dispatch({
+      type: 'UPDATE_NAVBAR_LINK',
+      link: link
+    });
+  },
+
+  removeHeaderLink: function (link) {
+    FauxtonAPI.dispatch({
+      type: 'REMOVE_NAVBAR_LINK',
+      link: link
+    });
+  }
 });
+
+export default app;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/constants.js
----------------------------------------------------------------------
diff --git a/app/constants.js b/app/constants.js
index a90b21d..cbda246 100644
--- a/app/constants.js
+++ b/app/constants.js
@@ -10,51 +10,47 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
+export default {
 
-  var constants = {
+  MISC: {
+    TRAY_TOGGLE_SPEED: 250,
+    DEFAULT_PAGE_SIZE: 20,
+    MODAL_BACKDROP_Z_INDEX: 1025
+  },
 
-    MISC: {
-      TRAY_TOGGLE_SPEED: 250,
-      DEFAULT_PAGE_SIZE: 20,
-      MODAL_BACKDROP_Z_INDEX: 1025
-    },
+  DATABASES: {
+    DOCUMENT_LIMIT: 100
+  },
 
-    DATABASES: {
-      DOCUMENT_LIMIT: 100
-    },
+  // global events for common used components
+  EVENTS: {
+    TRAY_OPENED: 'tray:opened',
+    NAVBAR_SIZE_CHANGED: 'navbar:size_changed'
+  },
 
-    // global events for common used components
-    EVENTS: {
-      TRAY_OPENED: 'tray:opened',
-      NAVBAR_SIZE_CHANGED: 'navbar:size_changed'
-    },
+  // documentation URLs
+  DOC_URLS: {
+    GENERAL: '/_utils/docs/intro/api.html#documents',
+    ALL_DBS: '/_utils/docs/api/server/common.html?highlight=all_dbs#get--_all_dbs',
+    REPLICATION: '/_utils/docs/replication/replicator.html#basics',
+    DESIGN_DOCS: '/_utils/docs/couchapp/ddocs.html#design-docs',
+    DESIGN_DOC_METADATA: '/_utils/docs/api/ddoc/common.html#api-ddoc-view-index-info',
+    VIEW_FUNCS: '/_utils/docs/couchapp/ddocs.html#view-functions',
+    MAP_FUNCS: '/_utils/docs/couchapp/ddocs.html#map-functions',
+    REDUCE_FUNCS: '/_utils/docs/couchapp/ddocs.html#reduce-and-rereduce-functions',
+    API_REF: '/_utils/docs/http-api.html',
+    DB_PERMISSION: '/_utils/docs/api/database/security.html#db-security',
+    STATS: '/_utils/docs/api/server/common.html?highlight=stats#get--_stats',
+    ACTIVE_TASKS: '/_utils/docs/api/server/common.html?highlight=stats#active-tasks',
+    LOG: '/_utils/docs/api/server/common.html?highlight=stats#log',
+    CONFIG: '/_utils/docs/config/index.html',
+    VIEWS: '/_utils/docs/intro/overview.html#views',
+    MANGO_INDEX: '/_utils/docs/intro/api.html#documents',
+    MANGO_SEARCH: '/_utils/docs/intro/api.html#documents',
+    CHANGES: '/_utils/docs/api/database/changes.html?highlight=changes#post--db-_changes'
+  },
 
-    // documentation URLs
-    DOC_URLS: {
-      GENERAL: '/_utils/docs/intro/api.html#documents',
-      ALL_DBS: '/_utils/docs/api/server/common.html?highlight=all_dbs#get--_all_dbs',
-      REPLICATION: '/_utils/docs/replication/replicator.html#basics',
-      DESIGN_DOCS: '/_utils/docs/couchapp/ddocs.html#design-docs',
-      DESIGN_DOC_METADATA: '/_utils/docs/api/ddoc/common.html#api-ddoc-view-index-info',
-      VIEW_FUNCS: '/_utils/docs/couchapp/ddocs.html#view-functions',
-      MAP_FUNCS: '/_utils/docs/couchapp/ddocs.html#map-functions',
-      REDUCE_FUNCS: '/_utils/docs/couchapp/ddocs.html#reduce-and-rereduce-functions',
-      API_REF: '/_utils/docs/http-api.html',
-      DB_PERMISSION: '/_utils/docs/api/database/security.html#db-security',
-      STATS: '/_utils/docs/api/server/common.html?highlight=stats#get--_stats',
-      ACTIVE_TASKS: '/_utils/docs/api/server/common.html?highlight=stats#active-tasks',
-      LOG: '/_utils/docs/api/server/common.html?highlight=stats#log',
-      CONFIG: '/_utils/docs/config/index.html',
-      VIEWS: '/_utils/docs/intro/overview.html#views',
-      MANGO_INDEX: '/_utils/docs/intro/api.html#documents',
-      MANGO_SEARCH: '/_utils/docs/intro/api.html#documents',
-      CHANGES: '/_utils/docs/api/database/changes.html?highlight=changes#post--db-_changes'
-    },
-
-    LOCAL_STORAGE: {
-      SIDEBAR_MINIMIZED: 'sidebar-minimized'
-    }
-  };
-  return constants;
-});
+  LOCAL_STORAGE: {
+    SIDEBAR_MINIMIZED: 'sidebar-minimized'
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/api.js
----------------------------------------------------------------------
diff --git a/app/core/api.js b/app/core/api.js
index 5573cf6..6240337 100644
--- a/app/core/api.js
+++ b/app/core/api.js
@@ -10,108 +10,102 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  './base',
-  './layout',
-  './router',
-  './routeObject',
-  './utils',
-  './store',
-  '../constants',
-
-  'flux',
-  'jquery',
-  'backbone'
-],
-
-function (FauxtonAPI, Layout, Router, RouteObject, utils, Store, constants, Flux, $, Backbone) {
-  Backbone.$ = $;
-  Backbone.ajax = function () {
-	  return Backbone.$.ajax.apply(Backbone.$, arguments);
-	};
-
-  FauxtonAPI = _.extend(FauxtonAPI, {
-    Layout: Layout,
-    Router: Router,
-    RouteObject: RouteObject,
-    utils: utils,
-    Store: Store,
-    Events: _.extend({}, Backbone.Events),
-    dispatcher: new Flux.Dispatcher()
-  });
+import FauxtonAPI from "./base";
+import Layout from "./layout";
+import Router from "./router";
+import RouteObject from "./routeObject";
+import utils from "./utils";
+import Store from "./store";
+import constants from "../constants";
+import Flux from "flux";
+import $ from "jquery";
+import Backbone from "backbone";
+Backbone.$ = $;
+Backbone.ajax = function () {
+    return Backbone.$.ajax.apply(Backbone.$, arguments);
+  };
 
-  // Pass along all constants
-  FauxtonAPI.constants = constants;
+Object.assign(FauxtonAPI, {
+  Layout: Layout,
+  Router: Router,
+  RouteObject: RouteObject,
+  utils: utils,
+  Store: Store,
+  Events: _.extend({}, Backbone.Events),
+  dispatcher: new Flux.Dispatcher()
+});
 
-  FauxtonAPI.dispatch = _.bind(FauxtonAPI.dispatcher.dispatch, FauxtonAPI.dispatcher);
+// Pass along all constants
+FauxtonAPI.constants = constants;
 
-  FauxtonAPI.navigate = function (url, _opts) {
-    var options = _.extend({trigger: true}, _opts);
-    FauxtonAPI.router.navigate(url, options);
-  };
+FauxtonAPI.dispatch = _.bind(FauxtonAPI.dispatcher.dispatch, FauxtonAPI.dispatcher);
 
-  FauxtonAPI.beforeUnload = function () {
-    FauxtonAPI.router.beforeUnload.apply(FauxtonAPI.router, arguments);
-  };
+FauxtonAPI.navigate = function (url, _opts) {
+  var options = _.extend({trigger: true}, _opts);
+  FauxtonAPI.router.navigate(url, options);
+};
 
-  FauxtonAPI.removeBeforeUnload = function () {
-    FauxtonAPI.router.removeBeforeUnload.apply(FauxtonAPI.router, arguments);
-  };
+FauxtonAPI.beforeUnload = function () {
+  FauxtonAPI.router.beforeUnload.apply(FauxtonAPI.router, arguments);
+};
 
-  FauxtonAPI.addRoute = function (route) {
-    FauxtonAPI.router.route(route.route, route.name, route.callback);
-  };
+FauxtonAPI.removeBeforeUnload = function () {
+  FauxtonAPI.router.removeBeforeUnload.apply(FauxtonAPI.router, arguments);
+};
 
-  FauxtonAPI.triggerRouteEvent = function (routeEvent, args) {
-    FauxtonAPI.router.triggerRouteEvent('route:' + routeEvent, args);
-  };
+FauxtonAPI.addRoute = function (route) {
+  FauxtonAPI.router.route(route.route, route.name, route.callback);
+};
 
-  var urlPaths = {};
+FauxtonAPI.triggerRouteEvent = function (routeEvent, args) {
+  FauxtonAPI.router.triggerRouteEvent('route:' + routeEvent, args);
+};
 
-  FauxtonAPI.registerUrls = function (namespace, urls) {
-    urlPaths[namespace] = urls;
-  };
+var urlPaths = {};
 
-  //This is a little rough and needs some improvement. But the basic concept is there
-  FauxtonAPI.urls = function (name, context) {
-    var interceptors = FauxtonAPI.getExtensions('urls:interceptors');
-    var url;
+FauxtonAPI.registerUrls = function (namespace, urls) {
+  urlPaths[namespace] = urls;
+};
 
-    var args = arguments;
-    _.find(interceptors, function (interceptor) {
-      var out = interceptor.apply(null, args);
+//This is a little rough and needs some improvement. But the basic concept is there
+FauxtonAPI.urls = function (name, context) {
+  var interceptors = FauxtonAPI.getExtensions('urls:interceptors');
+  var url;
 
-      if (out) {
-        url = out;
-        return true;
-      }
-      return false;
-    });
+  var args = arguments;
+  _.find(interceptors, function (interceptor) {
+    var out = interceptor.apply(null, args);
 
-    if (!_.isUndefined(url)) { return url; }
-
-    if (!urlPaths[name]) {
-      console.error('could not find name ', name);
-      return '';
+    if (out) {
+      url = out;
+      return true;
     }
+    return false;
+  });
 
-    if (!urlPaths[name][context]) {
-      console.error('could not find context ', context);
-      return '';
-    }
+  if (!_.isUndefined(url)) { return url; }
 
-    args = Array.prototype.slice.call(arguments, 2);
-    url = urlPaths[name][context].apply(null, args);
-    return url;
-  };
+  if (!urlPaths[name]) {
+    console.error('could not find name ', name);
+    return '';
+  }
 
-  // out-the-box Fauxton has only Views, but scripts extending Fauxton may introduce others (search indexes, geospatial
-  // indexes, etc). This returns an array of the special design doc property names for the index types
-  FauxtonAPI.getIndexTypePropNames = function () {
-    var indexTypes = FauxtonAPI.getExtensions('IndexTypes:propNames');
-    indexTypes.push('views');
-    return indexTypes;
-  };
+  if (!urlPaths[name][context]) {
+    console.error('could not find context ', context);
+    return '';
+  }
 
-  return FauxtonAPI;
-});
+  args = Array.prototype.slice.call(arguments, 2);
+  url = urlPaths[name][context].apply(null, args);
+  return url;
+};
+
+// out-the-box Fauxton has only Views, but scripts extending Fauxton may introduce others (search indexes, geospatial
+// indexes, etc). This returns an array of the special design doc property names for the index types
+FauxtonAPI.getIndexTypePropNames = function () {
+  var indexTypes = FauxtonAPI.getExtensions('IndexTypes:propNames');
+  indexTypes.push('views');
+  return indexTypes;
+};
+
+export default FauxtonAPI;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/auth.js
----------------------------------------------------------------------
diff --git a/app/core/auth.js b/app/core/auth.js
index 09c854b..f0a82f1 100644
--- a/app/core/auth.js
+++ b/app/core/auth.js
@@ -10,55 +10,51 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "./base",
-  "backbone"
-],
-function (FauxtonAPI, Backbone) {
+import FauxtonAPI from "./base";
+import Backbone from "backbone";
 
-  // This is not exposed externally as it should not need to be accessed or overridden
-  var Auth = function (options) {
-    this._options = options;
-    this.initialize.apply(this, arguments);
-  };
+// This is not exposed externally as it should not need to be accessed or overridden
+var Auth = function (options) {
+  this._options = options;
+  this.initialize.apply(this, arguments);
+};
 
-  // Piggy-back on Backbone's self-propagating extend function,
-  Auth.extend = Backbone.Model.extend;
+// Piggy-back on Backbone's self-propagating extend function,
+Auth.extend = Backbone.Model.extend;
 
-  _.extend(Auth.prototype, Backbone.Events, {
-    authDeniedCb: function () {},
+_.extend(Auth.prototype, Backbone.Events, {
+  authDeniedCb: function () {},
 
-    initialize: function () {
-      var that = this;
-    },
+  initialize: function () {
+    var that = this;
+  },
 
-    authHandlerCb : function (roles) {
-      var deferred = $.Deferred();
-      deferred.resolve();
-      return deferred;
-    },
+  authHandlerCb : function (roles) {
+    var deferred = $.Deferred();
+    deferred.resolve();
+    return deferred;
+  },
 
-    registerAuth: function (authHandlerCb) {
-      this.authHandlerCb = authHandlerCb;
-    },
+  registerAuth: function (authHandlerCb) {
+    this.authHandlerCb = authHandlerCb;
+  },
 
-    registerAuthDenied: function (authDeniedCb) {
-      this.authDeniedCb = authDeniedCb;
-    },
+  registerAuthDenied: function (authDeniedCb) {
+    this.authDeniedCb = authDeniedCb;
+  },
 
-    checkAccess: function (roles) {
-      var requiredRoles = roles || [],
-      that = this;
+  checkAccess: function (roles) {
+    var requiredRoles = roles || [],
+    that = this;
 
-      if (!FauxtonAPI.session) {
-        throw new Error("Fauxton.session is not configured.");
-      }
-
-      return FauxtonAPI.session.fetchUser().then(function (user) {
-        return FauxtonAPI.when(that.authHandlerCb(FauxtonAPI.session, requiredRoles));
-      });
+    if (!FauxtonAPI.session) {
+      throw new Error("Fauxton.session is not configured.");
     }
-  });
 
-  return Auth;
+    return FauxtonAPI.session.fetchUser().then(function (user) {
+      return FauxtonAPI.when(that.authHandlerCb(FauxtonAPI.session, requiredRoles));
+    });
+  }
 });
+
+export default Auth;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/base.js
----------------------------------------------------------------------
diff --git a/app/core/base.js b/app/core/base.js
index 5825d79..cf3b2dc 100644
--- a/app/core/base.js
+++ b/app/core/base.js
@@ -10,134 +10,129 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "backbone",
-  "backbone.layoutmanager"
-],
-
-function (Backbone, LayoutManager) {
-  var FauxtonAPI = {
-    //add default objects
-    router: {
-      navigate: function () {}
-    },
-
-    masterLayout: {},
+import Backbone from "backbone";
+import LayoutManager from "backbone.layoutmanager";
+var FauxtonAPI = {
+  //add default objects
+  router: {
+    navigate: function () {}
+  },
+
+  masterLayout: {},
+
+  addNotification: function () {},
+
+  config: function (options) {
+    return _.extend(this, options);
+  }
+};
+
+FauxtonAPI.Deferred = function () {
+  return $.Deferred();
+};
+
+FauxtonAPI.when = function (deferreds) {
+  if (deferreds instanceof Array) {
+    return $.when.apply(null, deferreds);
+  }
+
+  return $.when(deferreds);
+};
+
+FauxtonAPI.addonExtensions = {
+  initialize: function () {},
+  RouteObjects: {},
+  Views: {}
+};
+
+FauxtonAPI.addon = function (extra) {
+  return _.extend(_.clone(FauxtonAPI.addonExtensions), extra);
+};
+
+FauxtonAPI.View = Backbone.View.extend({
+  // This should return an array of promises, an empty array, or null
+  establish: function () {
+    return null;
+  },
+  loaderClassname: 'loader',
+  manage: true,
+  disableLoader: false,
+
+  forceRender: function () {
+    this.hasRendered = false;
+  }
+});
 
-    addNotification: function () {},
+var caching = {
+  fetchOnce: function (opt) {
+    var options = _.extend({}, opt);
 
-    config: function (options) {
-      return _.extend(this, options);
+    if (!this._deferred || this._deferred.state() === "rejected" || options.forceFetch ) {
+      this._deferred = this.fetch();
     }
-  };
 
-  FauxtonAPI.Deferred = function () {
-    return $.Deferred();
-  };
+    return this._deferred;
+  }
+};
 
-  FauxtonAPI.when = function (deferreds) {
-    if (deferreds instanceof Array) {
-      return $.when.apply(null, deferreds);
-    }
-
-    return $.when(deferreds);
-  };
-
-  FauxtonAPI.addonExtensions = {
-    initialize: function () {},
-    RouteObjects: {},
-    Views: {}
-  };
-
-  FauxtonAPI.addon = function (extra) {
-    return _.extend(_.clone(FauxtonAPI.addonExtensions), extra);
-  };
-
-  FauxtonAPI.View = Backbone.View.extend({
-    // This should return an array of promises, an empty array, or null
-    establish: function () {
-      return null;
-    },
-    loaderClassname: 'loader',
-    manage: true,
-    disableLoader: false,
-
-    forceRender: function () {
-      this.hasRendered = false;
-    }
-  });
+FauxtonAPI.Model = Backbone.Model.extend({ });
 
-  var caching = {
-    fetchOnce: function (opt) {
-      var options = _.extend({}, opt);
+FauxtonAPI.Collection = Backbone.Collection.extend({ });
 
-      if (!this._deferred || this._deferred.state() === "rejected" || options.forceFetch ) {
-        this._deferred = this.fetch();
-      }
-
-      return this._deferred;
-    }
-  };
-
-  FauxtonAPI.Model = Backbone.Model.extend({ });
-
-  FauxtonAPI.Collection = Backbone.Collection.extend({ });
+_.each([FauxtonAPI.Model, FauxtonAPI.Collection], function (ctor) {
+  _.extend(ctor.prototype, caching);
+});
 
-  _.each([FauxtonAPI.Model, FauxtonAPI.Collection], function (ctor) {
-    _.extend(ctor.prototype, caching);
+var extensions = _.extend({}, Backbone.Events);
+// Can look at a remove function later.
+FauxtonAPI.registerExtension = function (name, view) {
+  if (!extensions[name]) {
+    extensions[name] = [];
+  }
+
+  extensions.trigger('add:' + name, view);
+  extensions[name].push(view);
+};
+
+FauxtonAPI.unRegisterExtension = function (name) {
+  var views = extensions[name];
+
+  if (!views) { return; }
+  extensions.trigger('remove:' + name, views);
+  delete extensions[name];
+};
+
+FauxtonAPI.getExtensions = function (name) {
+  var views = extensions[name];
+
+  if (!views) {
+    views = [];
+  }
+  return views;
+};
+
+FauxtonAPI.removeExtensionItem = function (name, view, cb) {
+  var views = extensions[name];
+  if (!views) { return; }
+
+  var _cb = arguments[arguments.length - 1];
+  if (_.isObject(view) && !cb) {
+    _cb = function (item) { return _.isEqual(item, view);};
+  }
+
+  views = _.filter(views, function (item) {
+    return !_cb(item);
   });
 
-  var extensions = _.extend({}, Backbone.Events);
-  // Can look at a remove function later.
-  FauxtonAPI.registerExtension = function (name, view) {
-    if (!extensions[name]) {
-      extensions[name] = [];
-    }
+  extensions[name] = views;
+  extensions.trigger('removeItem:' + name, view);
+};
 
-    extensions.trigger('add:' + name, view);
-    extensions[name].push(view);
-  };
+FauxtonAPI.extensions = extensions;
 
-  FauxtonAPI.unRegisterExtension = function (name) {
-    var views = extensions[name];
+FauxtonAPI.setSession = function (newSession) {
+  FauxtonAPI.session = newSession;
+  return FauxtonAPI.session.fetchUser();
+};
 
-    if (!views) { return; }
-    extensions.trigger('remove:' + name, views);
-    delete extensions[name];
-  };
-
-  FauxtonAPI.getExtensions = function (name) {
-    var views = extensions[name];
-
-    if (!views) {
-      views = [];
-    }
-    return views;
-  };
-
-  FauxtonAPI.removeExtensionItem = function (name, view, cb) {
-    var views = extensions[name];
-    if (!views) { return; }
-
-    var _cb = arguments[arguments.length - 1];
-    if (_.isObject(view) && !cb) {
-      _cb = function (item) { return _.isEqual(item, view);};
-    }
-
-    views = _.filter(views, function (item) {
-      return !_cb(item);
-    });
-
-    extensions[name] = views;
-    extensions.trigger('removeItem:' + name, view);
-  };
-
-  FauxtonAPI.extensions = extensions;
-
-  FauxtonAPI.setSession = function (newSession) {
-    FauxtonAPI.session = newSession;
-    return FauxtonAPI.session.fetchUser();
-  };
-
-  return FauxtonAPI;
-});
+export default FauxtonAPI;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/couchdbSession.js
----------------------------------------------------------------------
diff --git a/app/core/couchdbSession.js b/app/core/couchdbSession.js
index bbc0d6e..5f18c6b 100644
--- a/app/core/couchdbSession.js
+++ b/app/core/couchdbSession.js
@@ -10,61 +10,57 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "./base"
-],
-function (FauxtonAPI) {
-  var CouchdbSession = {
-    Session: FauxtonAPI.Model.extend({
-      url: '/_session',
+import FauxtonAPI from "./base";
+var CouchdbSession = {
+  Session: FauxtonAPI.Model.extend({
+    url: '/_session',
 
-      user: function () {
-        var userCtx = this.get('userCtx');
+    user: function () {
+      var userCtx = this.get('userCtx');
 
-        if (!userCtx || !userCtx.name) { return null; }
+      if (!userCtx || !userCtx.name) { return null; }
 
-        return {
-          name: userCtx.name,
-          roles: userCtx.roles
-        };
-      },
+      return {
+        name: userCtx.name,
+        roles: userCtx.roles
+      };
+    },
 
-      isAdmin: function () {
-        var userCtx = this.get('userCtx');
-        return userCtx.roles.indexOf('_admin') !== -1;
-      },
+    isAdmin: function () {
+      var userCtx = this.get('userCtx');
+      return userCtx.roles.indexOf('_admin') !== -1;
+    },
 
-      fetchUser: function (opt) {
-        var options = opt || {},
-            currentUser = this.user(),
-            fetch = _.bind(this.fetchOnce, this);
+    fetchUser: function (opt) {
+      var options = opt || {},
+          currentUser = this.user(),
+          fetch = _.bind(this.fetchOnce, this);
 
-        if (options.forceFetch) {
-          fetch = _.bind(this.fetch, this);
-        }
+      if (options.forceFetch) {
+        fetch = _.bind(this.fetch, this);
+      }
 
-        return fetch(opt).then(function () {
-          var user = this.user();
+      return fetch(opt).then(function () {
+        var user = this.user();
 
-          // Notify anyone listening on these events that either a user has changed
-          // or current user is the same
-          if (currentUser !== user) {
-            this.trigger('session:userChanged');
-          } else {
-            this.trigger('session:userFetched');
-          }
+        // Notify anyone listening on these events that either a user has changed
+        // or current user is the same
+        if (currentUser !== user) {
+          this.trigger('session:userChanged');
+        } else {
+          this.trigger('session:userFetched');
+        }
 
-          // this will return the user as a value to all function that calls done on this
-          // eg. session.fetchUser().done(user) { .. do something with user ..}
-          return user;
-        }.bind(this), this.triggerError.bind(this));
-      },
+        // this will return the user as a value to all function that calls done on this
+        // eg. session.fetchUser().done(user) { .. do something with user ..}
+        return user;
+      }.bind(this), this.triggerError.bind(this));
+    },
 
-      triggerError: function (xhr, type, message) {
-        this.trigger('session:error', xhr, type, message);
-      }
-    })
-  };
+    triggerError: function (xhr, type, message) {
+      this.trigger('session:error', xhr, type, message);
+    }
+  })
+};
 
-  return CouchdbSession;
-});
+export default CouchdbSession;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/layout.js
----------------------------------------------------------------------
diff --git a/app/core/layout.js b/app/core/layout.js
index 24afc84..c277889 100644
--- a/app/core/layout.js
+++ b/app/core/layout.js
@@ -10,88 +10,84 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  'backbone',
-  'backbone.layoutmanager'
-], function (Backbone) {
-
-  // A wrapper of the main Backbone.layoutmanager
-  // Allows the main layout of the page to be changed by any plugin.
-  var Layout = function () {
-    this.layout = new Backbone.Layout({
-      template: "templates/layouts/with_sidebar",
-      className: 'pusher'
-    });
+import Backbone from "backbone";
+import "backbone.layoutmanager";
+
+// A wrapper of the main Backbone.layoutmanager
+// Allows the main layout of the page to be changed by any plugin.
+var Layout = function () {
+  this.layout = new Backbone.Layout({
+    template: "templates/layouts/with_sidebar",
+    className: 'pusher'
+  });
 
+  this.layoutViews = {};
+  this.reactComponents = {};
+  //this views don't ever get removed. An example of this is the main navigation sidebar
+  this.permanentViews = {};
+  this.el = this.layout.el;
+};
+
+Layout.configure = function (options) {
+  Backbone.Layout.configure(options);
+};
+
+// creatings the dashboard object same way backbone does
+_.extend(Layout.prototype, {
+  render: function () {
+    return this.layout.render();
+  },
+
+  setTemplate: function (template) {
+    if (template.prefix) {
+      this.layout.template = template.prefix + template.name;
+    } else {
+      this.layout.template = "templates/layouts/" + template;
+    }
+    // If we're changing layouts all bets are off, so kill off all the
+    // existing views in the layout.
+    _.each(this.layoutViews, function (view) {view.removeView();});
     this.layoutViews = {};
-    this.reactComponents = {};
-    //this views don't ever get removed. An example of this is the main navigation sidebar
-    this.permanentViews = {};
-    this.el = this.layout.el;
-  };
-
-  Layout.configure = function (options) {
-    Backbone.Layout.configure(options);
-  };
-
-  // creatings the dashboard object same way backbone does
-  _.extend(Layout.prototype, {
-    render: function () {
-      return this.layout.render();
-    },
-
-    setTemplate: function (template) {
-      if (template.prefix) {
-        this.layout.template = template.prefix + template.name;
-      } else {
-        this.layout.template = "templates/layouts/" + template;
-      }
-      // If we're changing layouts all bets are off, so kill off all the
-      // existing views in the layout.
-      _.each(this.layoutViews, function (view) {view.removeView();});
-      this.layoutViews = {};
-      return this.render().promise();
-    },
-
-    setView: function (selector, view, keep) {
-      this.layout.setView(selector, view, false);
-
-      if (!keep) {
-        this.layoutViews[selector] = view;
-      } else {
-        this.permanentViews[selector] = view;
-      }
-
-      return view;
-    },
-
-    renderView: function (selector) {
-      var view = this.layoutViews[selector];
-      if (!view) {
-        return false;
-      } else {
-        return view.render();
-      }
-    },
-
-    removeView: function (selector) {
-      var view = this.layout.getView(selector);
-
-      if (!view) {
-        return false;
-      }
-
-      this.layout.removeView(selector);
-
-      if (this.layoutViews[selector]) {
-        delete this.layoutViews[selector];
-      }
-
-      return true;
+    return this.render().promise();
+  },
+
+  setView: function (selector, view, keep) {
+    this.layout.setView(selector, view, false);
+
+    if (!keep) {
+      this.layoutViews[selector] = view;
+    } else {
+      this.permanentViews[selector] = view;
     }
 
-  });
+    return view;
+  },
+
+  renderView: function (selector) {
+    var view = this.layoutViews[selector];
+    if (!view) {
+      return false;
+    } else {
+      return view.render();
+    }
+  },
 
-  return Layout;
+  removeView: function (selector) {
+    var view = this.layout.getView(selector);
+
+    if (!view) {
+      return false;
+    }
+
+    this.layout.removeView(selector);
+
+    if (this.layoutViews[selector]) {
+      delete this.layoutViews[selector];
+    }
+
+    return true;
+  }
 
 });
+
+export default Layout;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/routeObject.js
----------------------------------------------------------------------
diff --git a/app/core/routeObject.js b/app/core/routeObject.js
index 1543cfd..07552ed 100644
--- a/app/core/routeObject.js
+++ b/app/core/routeObject.js
@@ -10,358 +10,354 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  './base',
-  'react',
-  'react-dom',
-  'backbone'
-],
-function (FauxtonAPI, React, ReactDOM, Backbone) {
-
-  var RouteObject = function (options) {
-    this._options = options;
-    this.reactComponents = {};
+import FauxtonAPI from "./base";
+import React from "react";
+import ReactDOM from "react-dom";
+import Backbone from "backbone";
+
+var RouteObject = function (options) {
+  this._options = options;
+  this.reactComponents = {};
 
-    this._configure(options || {});
-    this.initialize.apply(this, arguments);
-    this.addEvents();
-  };
+  this._configure(options || {});
+  this.initialize.apply(this, arguments);
+  this.addEvents();
+};
 
-  var broadcaster = {};
-  _.extend(broadcaster, Backbone.Events);
+var broadcaster = {};
+_.extend(broadcaster, Backbone.Events);
 
-  RouteObject.on = function (eventName, fn) {
-    broadcaster.on(eventName, fn);
-  };
+RouteObject.on = function (eventName, fn) {
+  broadcaster.on(eventName, fn);
+};
 
-  /* How Route Object events work
-   To listen to a specific route objects events:
+/* How Route Object events work
+ To listen to a specific route objects events:
 
-   myRouteObject = FauxtonAPI.RouteObject.extend({
-    events: {
-      "beforeRender": "beforeRenderEvent"
-    },
+ myRouteObject = FauxtonAPI.RouteObject.extend({
+  events: {
+    "beforeRender": "beforeRenderEvent"
+  },
 
-    beforeRenderEvent: function (view, selector) {
-      console.log('Hey, beforeRenderEvent triggered',arguments);
-    },
-   });
+  beforeRenderEvent: function (view, selector) {
+    console.log('Hey, beforeRenderEvent triggered',arguments);
+  },
+ });
 
-    It is also possible to listen to events triggered from all Routeobjects.
-    This is great for more general things like adding loaders, hooks.
+  It is also possible to listen to events triggered from all Routeobjects.
+  This is great for more general things like adding loaders, hooks.
 
-    FauxtonAPI.RouteObject.on('beforeRender', function (routeObject, view, selector) {
-      console.log('hey, this will trigger when any routeobject renders a view');
+  FauxtonAPI.RouteObject.on('beforeRender', function (routeObject, view, selector) {
+    console.log('hey, this will trigger when any routeobject renders a view');
+  });
+
+ Current Events to subscribe to:
+  * beforeFullRender -- before a full render is being done
+  * beforeEstablish -- before the routeobject calls establish
+  * AfterEstablish -- after the routeobject has run establish
+  * beforeRender -- before a view is rendered
+  * afterRender -- a view is finished being rendered
+  * renderComplete -- all rendering is complete
+
+*/
+
+// Piggy-back on Backbone's self-propagating extend function
+RouteObject.extend = Backbone.Model.extend;
+
+var routeObjectOptions = ["views", "routes", "events", "roles", "crumbs", "layout", "apiUrl", "establish"];
+
+_.extend(RouteObject.prototype, Backbone.Events, {
+  // Should these be default vals or empty funcs?
+  views: {},
+  routes: {},
+  events: {},
+  crumbs: [],
+  layout: "with_sidebar",
+  apiUrl: null,
+  hideNotificationPanel: null,
+  disableLoader: false,
+  loaderClassname: 'loader',
+  renderedState: false,
+  establish: function () {},
+  route: function () {},
+  roles: [],
+  _promises: [],
+  initialize: function () {}
+}, {
+
+  renderWith: function (route, masterLayout, args) {
+
+    // set the options for this render
+    var options = {
+      masterLayout: masterLayout,
+      route: route,
+      args: args
+    };
+
+    var promiseLayout = this.setTemplateOnFullRender(masterLayout);
+
+    this.triggerBroadcast('beforeEstablish');
+
+    var renderAllViews = _.bind(this.renderAllViews, this, options),
+        establishError = _.bind(this.establishError, this),
+        renderComplete = _.bind(this.renderComplete, this),
+        callEstablish = _.bind(this.callEstablish, this),
+        renderReactComponents = _.bind(this.renderReactComponents, this),
+        promise = this.establish();
+
+    // Only start the view rendering process once the template has been rendered
+    // otherwise we get double renders
+    promiseLayout.then(function () {
+      renderReactComponents();
+      callEstablish(promise)
+        .then(renderAllViews, establishError)
+        .then(renderComplete);
     });
+  },
+
+  setTemplateOnFullRender: function (masterLayout) {
+
+    var promise = $.Deferred();
+
+    // Only want to redo the template if its a full render
+    if (!this.renderedState) {
+      this.triggerBroadcast('beforeFullRender');
+      masterLayout.setTemplate(this.layout).then(promise.resolve, promise.reject);
+    } else {
+      promise.resolve();
+    }
+
+    return promise;
+  },
 
-   Current Events to subscribe to:
-    * beforeFullRender -- before a full render is being done
-    * beforeEstablish -- before the routeobject calls establish
-    * AfterEstablish -- after the routeobject has run establish
-    * beforeRender -- before a view is rendered
-    * afterRender -- a view is finished being rendered
-    * renderComplete -- all rendering is complete
-
-  */
-
-  // Piggy-back on Backbone's self-propagating extend function
-  RouteObject.extend = Backbone.Model.extend;
-
-  var routeObjectOptions = ["views", "routes", "events", "roles", "crumbs", "layout", "apiUrl", "establish"];
-
-  _.extend(RouteObject.prototype, Backbone.Events, {
-    // Should these be default vals or empty funcs?
-    views: {},
-    routes: {},
-    events: {},
-    crumbs: [],
-    layout: "with_sidebar",
-    apiUrl: null,
-    hideNotificationPanel: null,
-    disableLoader: false,
-    loaderClassname: 'loader',
-    renderedState: false,
-    establish: function () {},
-    route: function () {},
-    roles: [],
-    _promises: [],
-    initialize: function () {}
-  }, {
-
-    renderWith: function (route, masterLayout, args) {
-
-      // set the options for this render
-      var options = {
-        masterLayout: masterLayout,
-        route: route,
-        args: args
-      };
-
-      var promiseLayout = this.setTemplateOnFullRender(masterLayout);
-
-      this.triggerBroadcast('beforeEstablish');
-
-      var renderAllViews = _.bind(this.renderAllViews, this, options),
-          establishError = _.bind(this.establishError, this),
-          renderComplete = _.bind(this.renderComplete, this),
-          callEstablish = _.bind(this.callEstablish, this),
-          renderReactComponents = _.bind(this.renderReactComponents, this),
-          promise = this.establish();
-
-      // Only start the view rendering process once the template has been rendered
-      // otherwise we get double renders
-      promiseLayout.then(function () {
-        renderReactComponents();
-        callEstablish(promise)
-          .then(renderAllViews, establishError)
-          .then(renderComplete);
-      });
-    },
-
-    setTemplateOnFullRender: function (masterLayout) {
-
-      var promise = $.Deferred();
-
-      // Only want to redo the template if its a full render
-      if (!this.renderedState) {
-        this.triggerBroadcast('beforeFullRender');
-        masterLayout.setTemplate(this.layout).then(promise.resolve, promise.reject);
-      } else {
-        promise.resolve();
+  renderReactComponents: function () {
+    _.each(this.reactComponents, function (componentInfo, selector) {
+      if ($(selector)[0]) {
+        ReactDOM.render(React.createElement(componentInfo.component, componentInfo.props), $(selector)[0]);
       }
+    });
+  },
 
-      return promise;
-    },
+  callEstablish: function (establishPromise) {
+    this.addPromise(establishPromise);
+    return FauxtonAPI.when(establishPromise);
+  },
 
-    renderReactComponents: function () {
-      _.each(this.reactComponents, function (componentInfo, selector) {
-        if ($(selector)[0]) {
-          ReactDOM.render(React.createElement(componentInfo.component, componentInfo.props), $(selector)[0]);
-        }
-      });
-    },
+  renderAllViews: function (options, resp) {
+    var routeObject = this,
+        renderView = _.bind(this.renderView, this, routeObject, options);
 
-    callEstablish: function (establishPromise) {
-      this.addPromise(establishPromise);
-      return FauxtonAPI.when(establishPromise);
-    },
+    this.triggerBroadcast('afterEstablish');
 
-    renderAllViews: function (options, resp) {
-      var routeObject = this,
-          renderView = _.bind(this.renderView, this, routeObject, options);
+    var promises = _.map(routeObject.getViews(), renderView, this);
+    return FauxtonAPI.when(promises);
+  },
 
-      this.triggerBroadcast('afterEstablish');
+  renderView: function (routeObject, options, view, selector) {
+    var viewInfo = {
+      view: view,
+      selector: selector,
+      masterLayout: options.masterLayout
+    };
 
-      var promises = _.map(routeObject.getViews(), renderView, this);
-      return FauxtonAPI.when(promises);
-    },
+    var renderViewOnLayout = _.bind(this.renderViewOnLayout, this, viewInfo);
 
-    renderView: function (routeObject, options, view, selector) {
-      var viewInfo = {
-        view: view,
-        selector: selector,
-        masterLayout: options.masterLayout
-      };
+    if (view.hasRendered) {
+      this.triggerBroadcast('viewHasRendered', view, selector);
+      return;
+    }
 
-      var renderViewOnLayout = _.bind(this.renderViewOnLayout, this, viewInfo);
+    this.triggerBroadcast('beforeRender', view, selector);
 
-      if (view.hasRendered) {
-        this.triggerBroadcast('viewHasRendered', view, selector);
-        return;
-      }
+    return this.callEstablish(view.establish()).then(renderViewOnLayout, this.establishError);
+  },
 
-      this.triggerBroadcast('beforeRender', view, selector);
-
-      return this.callEstablish(view.establish()).then(renderViewOnLayout, this.establishError);
-    },
-
-    renderViewOnLayout: function (viewInfo, resp, xhr) {
-      var masterLayout = viewInfo.masterLayout,
-          triggerBroadcast = _.bind(this.triggerBroadcast, this);
-
-      masterLayout.setView(viewInfo.selector, viewInfo.view);
-      var promise = masterLayout.renderView(viewInfo.selector).promise();
-
-      promise.then(function () {
-        triggerBroadcast('afterRender', viewInfo.view, viewInfo.selector);
-      });
-
-      return promise;
-    },
-
-    establishError: function (resp) {
-      if (!resp || !resp.responseText) { return; }
-      FauxtonAPI.addNotification({
-            msg: 'An Error occurred: ' + JSON.parse(resp.responseText).reason,
-            type: 'error',
-            clear: true
-      });
-    },
-
-    renderComplete: function () {
-      // Track that we've done a full initial render
-      this.setRenderedState(true);
-      this.triggerBroadcast('renderComplete');
-    },
-
-    setRenderedState: function (bool) {
-      this.renderedState = bool;
-    },
-
-    triggerBroadcast: function (eventName) {
-      var args = Array.prototype.slice.call(arguments);
-      this.trigger.apply(this, args);
-
-      args.splice(0, 1, eventName, this);
-      broadcaster.trigger.apply(broadcaster, args);
-    },
-
-    get: function (key) {
-      return _.isFunction(this[key]) ? this[key]() : this[key];
-    },
-
-    addEvents: function (events) {
-      events = events || this.get('events');
-      _.each(events, function (method, event) {
-        if (!_.isFunction(method) && !_.isFunction (this[method])) {
-          throw new Error("Invalid method: " + method);
-        }
-        method = _.isFunction(method) ? method : this[method];
-
-        this.on(event, method);
-      }, this);
-    },
-
-    _configure: function (options) {
-      _.each(_.intersection(_.keys(options), routeObjectOptions), function (key) {
-        this[key] = options[key];
-      }, this);
-    },
-
-    getView: function (selector) {
-      return this.views[selector];
-    },
-
-    setView: function (selector, view) {
-      this.removeView(selector);
-      this.removeComponent(selector);
-      this.views[selector] = view;
-      return view;
-    },
+  renderViewOnLayout: function (viewInfo, resp, xhr) {
+    var masterLayout = viewInfo.masterLayout,
+        triggerBroadcast = _.bind(this.triggerBroadcast, this);
 
-    setComponent: function (selector, component, props) {
-      this.removeView(selector);
-      this.removeComponent(selector);
-      this.reactComponents[selector] = {
-        component: component,
-        props: props || null
-      };
-    },
-
-    removeComponent: function (selector) {
-      if (_.has(this.reactComponents, selector)) {
-        if ($(selector)[0]) {
-          ReactDOM.unmountComponentAtNode($(selector)[0]);
-        }
-        this.reactComponents[selector] = null;
-        delete this.reactComponents[selector];
+    masterLayout.setView(viewInfo.selector, viewInfo.view);
+    var promise = masterLayout.renderView(viewInfo.selector).promise();
+
+    promise.then(function () {
+      triggerBroadcast('afterRender', viewInfo.view, viewInfo.selector);
+    });
+
+    return promise;
+  },
+
+  establishError: function (resp) {
+    if (!resp || !resp.responseText) { return; }
+    FauxtonAPI.addNotification({
+          msg: 'An Error occurred: ' + JSON.parse(resp.responseText).reason,
+          type: 'error',
+          clear: true
+    });
+  },
+
+  renderComplete: function () {
+    // Track that we've done a full initial render
+    this.setRenderedState(true);
+    this.triggerBroadcast('renderComplete');
+  },
+
+  setRenderedState: function (bool) {
+    this.renderedState = bool;
+  },
+
+  triggerBroadcast: function (eventName) {
+    var args = Array.prototype.slice.call(arguments);
+    this.trigger.apply(this, args);
+
+    args.splice(0, 1, eventName, this);
+    broadcaster.trigger.apply(broadcaster, args);
+  },
+
+  get: function (key) {
+    return _.isFunction(this[key]) ? this[key]() : this[key];
+  },
+
+  addEvents: function (events) {
+    events = events || this.get('events');
+    _.each(events, function (method, event) {
+      if (!_.isFunction(method) && !_.isFunction (this[method])) {
+        throw new Error("Invalid method: " + method);
+      }
+      method = _.isFunction(method) ? method : this[method];
+
+      this.on(event, method);
+    }, this);
+  },
+
+  _configure: function (options) {
+    _.each(_.intersection(_.keys(options), routeObjectOptions), function (key) {
+      this[key] = options[key];
+    }, this);
+  },
+
+  getView: function (selector) {
+    return this.views[selector];
+  },
+
+  setView: function (selector, view) {
+    this.removeView(selector);
+    this.removeComponent(selector);
+    this.views[selector] = view;
+    return view;
+  },
+
+  setComponent: function (selector, component, props) {
+    this.removeView(selector);
+    this.removeComponent(selector);
+    this.reactComponents[selector] = {
+      component: component,
+      props: props || null
+    };
+  },
+
+  removeComponent: function (selector) {
+    if (_.has(this.reactComponents, selector)) {
+      if ($(selector)[0]) {
+        ReactDOM.unmountComponentAtNode($(selector)[0]);
       }
-    },
+      this.reactComponents[selector] = null;
+      delete this.reactComponents[selector];
+    }
+  },
 
-    removeComponents: function () {
-      _.each(this.reactComponents, function (component, selector) {
-        this.removeComponent(selector);
-      }, this);
+  removeComponents: function () {
+    _.each(this.reactComponents, function (component, selector) {
+      this.removeComponent(selector);
+    }, this);
 
-      this.reactComponents = {};
-    },
+    this.reactComponents = {};
+  },
 
-    getViews: function () {
-      return this.views;
-    },
+  getViews: function () {
+    return this.views;
+  },
 
-    removeView: function (selector) {
-      if (_.has(this.views, selector)) {
-        this.views[selector].remove();
-        this.views[selector] = null;
-        delete this.views[selector];
-      }
-    },
+  removeView: function (selector) {
+    if (_.has(this.views, selector)) {
+      this.views[selector].remove();
+      this.views[selector] = null;
+      delete this.views[selector];
+    }
+  },
 
-    removeViews: function () {
-      _.each(this.views, function (view, selector) {
-        view.remove();
-        delete this.views[selector];
-        view = null;
-      }, this);
-    },
+  removeViews: function () {
+    _.each(this.views, function (view, selector) {
+      view.remove();
+      delete this.views[selector];
+      view = null;
+    }, this);
+  },
 
-    addPromise: function (promise) {
-      if (_.isEmpty(promise)) { return; }
+  addPromise: function (promise) {
+    if (_.isEmpty(promise)) { return; }
 
-      if (!_.isArray(promise)) {
-        return this._promises.push(promise);
-      }
+    if (!_.isArray(promise)) {
+      return this._promises.push(promise);
+    }
 
-      _.each(promise, function (p) {
-        this._promises.push(p);
-      }, this);
-    },
-
-    cleanup: function () {
-      this.removeComponents();
-      this.removeViews();
-      this.rejectPromises();
-    },
-
-    rejectPromises: function () {
-      _.each(this._promises, function (promise) {
-        if (promise.state() === "resolved") { return; }
-        if (promise.abort) {
-          return promise.abort("Route change");
-        }
-
-        promise.reject && promise.reject();
-      }, this);
-
-      this._promises = [];
-    },
-
-    getRouteUrls: function () {
-      return _.keys(this.get('routes'));
-    },
-
-    hasRoute: function (route) {
-      if (this.get('routes')[route]) {
-        return true;
-      }
-      return false;
-    },
-
-    routeCallback: function (route, args) {
-      var routes = this.get('routes'),
-      routeObj = routes[route],
-      routeCallback;
-
-      if (typeof routeObj === 'object') {
-        routeCallback = this[routeObj.route];
-      } else {
-        routeCallback = this[routeObj];
+    _.each(promise, function (p) {
+      this._promises.push(p);
+    }, this);
+  },
+
+  cleanup: function () {
+    this.removeComponents();
+    this.removeViews();
+    this.rejectPromises();
+  },
+
+  rejectPromises: function () {
+    _.each(this._promises, function (promise) {
+      if (promise.state() === "resolved") { return; }
+      if (promise.abort) {
+        return promise.abort("Route change");
       }
 
-      routeCallback.apply(this, args);
-    },
+      promise.reject && promise.reject();
+    }, this);
 
-    getRouteRoles: function (routeUrl) {
-      var route = this.get('routes')[routeUrl];
+    this._promises = [];
+  },
 
-      if ((typeof route === 'object') && route.roles) {
-        return route.roles;
-      }
+  getRouteUrls: function () {
+    return _.keys(this.get('routes'));
+  },
 
-      return this.roles;
+  hasRoute: function (route) {
+    if (this.get('routes')[route]) {
+      return true;
+    }
+    return false;
+  },
+
+  routeCallback: function (route, args) {
+    var routes = this.get('routes'),
+    routeObj = routes[route],
+    routeCallback;
+
+    if (typeof routeObj === 'object') {
+      routeCallback = this[routeObj.route];
+    } else {
+      routeCallback = this[routeObj];
     }
 
-  });
-  return RouteObject;
+    routeCallback.apply(this, args);
+  },
+
+  getRouteRoles: function (routeUrl) {
+    var route = this.get('routes')[routeUrl];
+
+    if ((typeof route === 'object') && route.roles) {
+      return route.roles;
+    }
+
+    return this.roles;
+  }
+
 });
+export default RouteObject;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/router.js
----------------------------------------------------------------------
diff --git a/app/core/router.js b/app/core/router.js
index f8d160f..35cbc6d 100644
--- a/app/core/router.js
+++ b/app/core/router.js
@@ -10,112 +10,105 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "./base",
-  "./auth",
-  "backbone"
-],
+import FauxtonAPI from "./base";
+import Auth from "./auth";
+import Backbone from "backbone";
 
-function (FauxtonAPI, Auth, Backbone) {
+var beforeUnloads = {};
 
-  var beforeUnloads = {};
+export default Backbone.Router.extend({
+  routes: {},
 
-  var Router = Backbone.Router.extend({
-    routes: {},
+  beforeUnload: function (name, fn) {
+    beforeUnloads[name] = fn;
+  },
 
-    beforeUnload: function (name, fn) {
-      beforeUnloads[name] = fn;
-    },
+  removeBeforeUnload: function (name) {
+    delete beforeUnloads[name];
+  },
 
-    removeBeforeUnload: function (name) {
-      delete beforeUnloads[name];
-    },
-
-    navigate: function (fragment, trigger) {
-      var continueNav  = true,
-          msg = _.find(_.map(beforeUnloads, function (fn) { return fn(); }), function (beforeReturn) {
-            if (beforeReturn) { return true; }
-          });
+  navigate: function (fragment, trigger) {
+    var continueNav  = true,
+        msg = _.find(_.map(beforeUnloads, function (fn) { return fn(); }), function (beforeReturn) {
+          if (beforeReturn) { return true; }
+        });
 
-      if (msg) {
-        continueNav = window.confirm(msg);
-      }
+    if (msg) {
+      continueNav = window.confirm(msg);
+    }
 
-      if (continueNav) {
-        Backbone.Router.prototype.navigate(fragment, trigger);
-      }
-    },
-
-    addModuleRouteObject: function (RouteObject) {
-      var that = this;
-      var masterLayout = FauxtonAPI.masterLayout,
-      routeUrls = RouteObject.prototype.getRouteUrls();
-
-      _.each(routeUrls, function (route) {
-        this.route(route, route.toString(), function () {
-          var args = Array.prototype.slice.call(arguments),
-          roles = RouteObject.prototype.getRouteRoles(route),
-          authPromise = FauxtonAPI.auth.checkAccess(roles);
-
-          authPromise.then(function () {
-            if (!that.activeRouteObject || !that.activeRouteObject.hasRoute(route)) {
-              that.activeRouteObject && that.activeRouteObject.cleanup();
-              that.activeRouteObject = new RouteObject(route, masterLayout, args);
-            }
-
-            var routeObject = that.activeRouteObject;
-            routeObject.rejectPromises();
-            routeObject.routeCallback(route, args);
-            routeObject.renderWith(route, masterLayout, args);
-          }, function () {
-            FauxtonAPI.auth.authDeniedCb();
-          });
+    if (continueNav) {
+      Backbone.Router.prototype.navigate(fragment, trigger);
+    }
+  },
+
+  addModuleRouteObject: function (RouteObject) {
+    var that = this;
+    var masterLayout = FauxtonAPI.masterLayout,
+    routeUrls = RouteObject.prototype.getRouteUrls();
+
+    _.each(routeUrls, function (route) {
+      this.route(route, route.toString(), function () {
+        var args = Array.prototype.slice.call(arguments),
+        roles = RouteObject.prototype.getRouteRoles(route),
+        authPromise = FauxtonAPI.auth.checkAccess(roles);
+
+        authPromise.then(function () {
+          if (!that.activeRouteObject || !that.activeRouteObject.hasRoute(route)) {
+            that.activeRouteObject && that.activeRouteObject.cleanup();
+            that.activeRouteObject = new RouteObject(route, masterLayout, args);
+          }
 
+          var routeObject = that.activeRouteObject;
+          routeObject.rejectPromises();
+          routeObject.routeCallback(route, args);
+          routeObject.renderWith(route, masterLayout, args);
+        }, function () {
+          FauxtonAPI.auth.authDeniedCb();
         });
-      }, this);
-    },
-
-    setModuleRoutes: function (addons) {
-      _.each(addons, function (module) {
-        if (module) {
-          module.initialize();
-          // This is pure routes the addon provides
-          if (module.RouteObjects) {
-            _.each(module.RouteObjects, this.addModuleRouteObject, this);
-          }
-        }
-      }, this);
-    },
-
-    initialize: function (addons) {
-      this.addons = addons;
-      this.auth = FauxtonAPI.auth = new Auth();
-      // NOTE: This must be below creation of the layout
-      // FauxtonAPI header links and others depend on existence of the layout
-      this.setModuleRoutes(addons);
-
-      $(FauxtonAPI.el).append(FauxtonAPI.masterLayout.el);
-      FauxtonAPI.masterLayout.render();
-
-      this.lastPages = [];
-      //keep last pages visited in Fauxton
-      Backbone.history.on('route', function () {
-        this.lastPages.push(Backbone.history.fragment);
-        if (this.lastPages.length > 2) {
-          this.lastPages.shift();
+
+      });
+    }, this);
+  },
+
+  setModuleRoutes: function (addons) {
+    _.each(addons, function (module) {
+      if (module) {
+        module.initialize();
+        // This is pure routes the addon provides
+        if (module.RouteObjects) {
+          _.each(module.RouteObjects, this.addModuleRouteObject, this);
         }
-      }, this);
-    },
+      }
+    }, this);
+  },
+
+  initialize: function (addons) {
+    this.addons = addons;
+    this.auth = FauxtonAPI.auth = new Auth();
+    // NOTE: This must be below creation of the layout
+    // FauxtonAPI header links and others depend on existence of the layout
+    this.setModuleRoutes(addons);
+
+    $(FauxtonAPI.el).append(FauxtonAPI.masterLayout.el);
+    FauxtonAPI.masterLayout.render();
+
+    this.lastPages = [];
+    //keep last pages visited in Fauxton
+    Backbone.history.on('route', function () {
+      this.lastPages.push(Backbone.history.fragment);
+      if (this.lastPages.length > 2) {
+        this.lastPages.shift();
+      }
+    }, this);
+  },
 
-    triggerRouteEvent: function (event, args) {
-      if (this.activeRouteObject) {
-        var eventArgs = [event].concat(args);
+  triggerRouteEvent: function (event, args) {
+    if (this.activeRouteObject) {
+      var eventArgs = [event].concat(args);
 
-        this.activeRouteObject.trigger.apply(this.activeRouteObject, eventArgs);
-        this.activeRouteObject.renderWith(eventArgs, FauxtonAPI.masterLayout, args);
-      }
+      this.activeRouteObject.trigger.apply(this.activeRouteObject, eventArgs);
+      this.activeRouteObject.renderWith(eventArgs, FauxtonAPI.masterLayout, args);
     }
-  });
-
-  return Router;
+  }
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/store.js
----------------------------------------------------------------------
diff --git a/app/core/store.js b/app/core/store.js
index 6614372..21d371a 100644
--- a/app/core/store.js
+++ b/app/core/store.js
@@ -10,25 +10,20 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "backbone"
-],
-function (Backbone) {
+import Backbone from "backbone";
 
-  var Store = function () {
-    this.initialize.apply(this, arguments);
-    _.bindAll(this);
-  };
+var Store = function () {
+  this.initialize.apply(this, arguments);
+  _.bindAll(this);
+};
 
-  Store.extend = Backbone.Model.extend;
-  _.extend(Store.prototype, Backbone.Events, {
-    triggerChange: function () {
-      this.trigger('change');
-    },
+Store.extend = Backbone.Model.extend;
+_.extend(Store.prototype, Backbone.Events, {
+  triggerChange: function () {
+    this.trigger('change');
+  },
 
-    initialize: function () {}
-  });
-
-  return Store;
+  initialize: function () {}
 });
 
+export default Store;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/tests/apiSpec.js
----------------------------------------------------------------------
diff --git a/app/core/tests/apiSpec.js b/app/core/tests/apiSpec.js
index 0851f64..28e4f45 100644
--- a/app/core/tests/apiSpec.js
+++ b/app/core/tests/apiSpec.js
@@ -9,41 +9,37 @@
 // 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',
-  '../../../test/mocha/testUtils',
-], function (FauxtonAPI, testUtils) {
-  var assert = testUtils.assert;
+import FauxtonAPI from "../api";
+import testUtils from "../../../test/mocha/testUtils";
+var assert = testUtils.assert;
 
-  describe('URLs', function () {
+describe('URLs', function () {
 
-    it('can register and get url', function () {
-      var testUrl = 'this_is_a_test_url';
-
-      FauxtonAPI.registerUrls('testURL', {
-        server: function () {
-          return testUrl;
-        }
-      });
-
-      assert.equal(FauxtonAPI.urls('testURL', 'server'), testUrl);
+  it('can register and get url', function () {
+    var testUrl = 'this_is_a_test_url';
 
+    FauxtonAPI.registerUrls('testURL', {
+      server: function () {
+        return testUrl;
+      }
     });
 
-    it('can register interceptor to change url', function () {
-      var testUrl = 'interceptor_url';
+    assert.equal(FauxtonAPI.urls('testURL', 'server'), testUrl);
+
+  });
 
-      FauxtonAPI.registerExtension('urls:interceptors', function (name, context) {
-        if (name === 'testURL' && context === 'intercept') {
-          return testUrl;
-        }
+  it('can register interceptor to change url', function () {
+    var testUrl = 'interceptor_url';
 
-        return false;
-      });
+    FauxtonAPI.registerExtension('urls:interceptors', function (name, context) {
+      if (name === 'testURL' && context === 'intercept') {
+        return testUrl;
+      }
 
-      assert.equal(FauxtonAPI.urls('testURL', 'intercept'), testUrl);
+      return false;
     });
 
+    assert.equal(FauxtonAPI.urls('testURL', 'intercept'), testUrl);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/tests/couchdbSessionSpec.js
----------------------------------------------------------------------
diff --git a/app/core/tests/couchdbSessionSpec.js b/app/core/tests/couchdbSessionSpec.js
index 8b91a8f..7155037 100644
--- a/app/core/tests/couchdbSessionSpec.js
+++ b/app/core/tests/couchdbSessionSpec.js
@@ -9,42 +9,38 @@
 // 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',
-  '../../../test/mocha/testUtils',
-  'sinon'
-], function (app, FauxtonAPI, testUtils, sinon) {
-  var assert = testUtils.assert;
-
-  describe('CouchDBSession', function () {
-
-    before(function (done) {
-      sinon.stub(FauxtonAPI.session, 'fetch', function () {
-        var promise = FauxtonAPI.Deferred();
-        promise.reject();
-        return promise;
-      });
-
-      done();
+import app from "../../app";
+import FauxtonAPI from "../api";
+import testUtils from "../../../test/mocha/testUtils";
+import sinon from "sinon";
+var assert = testUtils.assert;
+
+describe('CouchDBSession', function () {
+
+  before(function (done) {
+    sinon.stub(FauxtonAPI.session, 'fetch', function () {
+      var promise = FauxtonAPI.Deferred();
+      promise.reject();
+      return promise;
     });
 
-    after(function (done) {
-      testUtils.restore(FauxtonAPI.session.fetch);
-      testUtils.restore(FauxtonAPI.session.triggerError);
+    done();
+  });
 
-      done();
-    });
+  after(function (done) {
+    testUtils.restore(FauxtonAPI.session.fetch);
+    testUtils.restore(FauxtonAPI.session.triggerError);
 
-    it('triggers error on failed fetch', function (done) {
+    done();
+  });
 
-      sinon.stub(FauxtonAPI.session, 'triggerError', function () {
-        done();
-      });
+  it('triggers error on failed fetch', function (done) {
 
-      FauxtonAPI.session.fetchUser();
+    sinon.stub(FauxtonAPI.session, 'triggerError', function () {
+      done();
     });
 
+    FauxtonAPI.session.fetchUser();
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/core/tests/layoutSpec.js
----------------------------------------------------------------------
diff --git a/app/core/tests/layoutSpec.js b/app/core/tests/layoutSpec.js
index fb19111..d2aa4b6 100644
--- a/app/core/tests/layoutSpec.js
+++ b/app/core/tests/layoutSpec.js
@@ -9,121 +9,118 @@
 // 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',
-  '../../../test/mocha/testUtils',
-], function (FauxtonAPI, testUtils) {
-  var assert = testUtils.assert;
+import FauxtonAPI from "../api";
+import testUtils from "../../../test/mocha/testUtils";
+var assert = testUtils.assert;
 
-  describe("Fauxton Layout", function () {
-    var layout;
+describe("Fauxton Layout", function () {
+  var layout;
 
-    beforeEach(function () {
-      layout = new FauxtonAPI.Layout();
-    });
-
-    describe('#setTemplate', function () {
+  beforeEach(function () {
+    layout = new FauxtonAPI.Layout();
+  });
 
-      it("Should set template without prefix", function () {
-        layout.setTemplate('myTemplate');
+  describe('#setTemplate', function () {
 
-        assert.equal(layout.layout.template, 'templates/layouts/myTemplate');
+    it("Should set template without prefix", function () {
+      layout.setTemplate('myTemplate');
 
-      });
+      assert.equal(layout.layout.template, 'templates/layouts/myTemplate');
 
-      it("Should set template with prefix", function () {
-        layout.setTemplate({name: 'myTemplate', prefix: 'myPrefix/'});
+    });
 
-        assert.equal(layout.layout.template, 'myPrefix/myTemplate');
-      });
+    it("Should set template with prefix", function () {
+      layout.setTemplate({name: 'myTemplate', prefix: 'myPrefix/'});
 
-      it("Should remove old views", function () {
-        var view = new FauxtonAPI.View();
+      assert.equal(layout.layout.template, 'myPrefix/myTemplate');
+    });
 
-        layout.setView('#selector', view);
+    it("Should remove old views", function () {
+      var view = new FauxtonAPI.View();
 
-        var removeSpy = sinon.spy(view, 'removeView');
-        layout.setTemplate('myTemplate');
-        assert.ok(removeSpy.calledOnce);
+      layout.setView('#selector', view);
 
-      });
+      var removeSpy = sinon.spy(view, 'removeView');
+      layout.setTemplate('myTemplate');
+      assert.ok(removeSpy.calledOnce);
 
-      it("Should render", function () {
-        var mockRender = sinon.spy(layout, 'render');
+    });
 
-        layout.setTemplate('myTemplate');
+    it("Should render", function () {
+      var mockRender = sinon.spy(layout, 'render');
 
-        assert.ok(mockRender.calledOnce);
+      layout.setTemplate('myTemplate');
 
-      });
+      assert.ok(mockRender.calledOnce);
 
     });
 
-    describe('#setView', function () {
-      var view;
-      beforeEach(function () {
-        view = new FauxtonAPI.View();
-      });
+  });
 
-      it("Should keep record of view", function () {
-        layout.setView('.selector', view);
-        assert.equal(view, layout.layoutViews['.selector']);
-      });
+  describe('#setView', function () {
+    var view;
+    beforeEach(function () {
+      view = new FauxtonAPI.View();
+    });
 
-      it("Should not keep record of view if keep is false", function () {
-        layout.setView('.selector', view, true);
-        assert.ok(_.isUndefined(layout.layoutViews['.selector']));
-        assert.equal(view, layout.permanentViews['.selector']);
-      });
+    it("Should keep record of view", function () {
+      layout.setView('.selector', view);
+      assert.equal(view, layout.layoutViews['.selector']);
+    });
 
+    it("Should not keep record of view if keep is false", function () {
+      layout.setView('.selector', view, true);
+      assert.ok(_.isUndefined(layout.layoutViews['.selector']));
+      assert.equal(view, layout.permanentViews['.selector']);
     });
 
-    describe('#removeView', function () {
-      var view;
+  });
 
-      beforeEach(function () {
-        view = new FauxtonAPI.View();
-        layout.setView('#selector', view);
-      });
+  describe('#removeView', function () {
+    var view;
 
-      it('Should remove view from layout', function () {
-        var removeSpy = sinon.spy(layout.layout, 'removeView');
+    beforeEach(function () {
+      view = new FauxtonAPI.View();
+      layout.setView('#selector', view);
+    });
 
-        layout.removeView('#selector');
-        assert.ok(removeSpy.calledOnce);
-      });
+    it('Should remove view from layout', function () {
+      var removeSpy = sinon.spy(layout.layout, 'removeView');
 
-      it('Should remove view from list of active views', function () {
-        layout.setView('#selector', view);
-        layout.removeView('#selector');
+      layout.removeView('#selector');
+      assert.ok(removeSpy.calledOnce);
+    });
 
-        assert.ok(_.isUndefined(layout.layoutViews['#selector']));
-      });
+    it('Should remove view from list of active views', function () {
+      layout.setView('#selector', view);
+      layout.removeView('#selector');
 
-      it("should return false if view doesn't exist", function () {
-        assert.notOk(layout.removeView('#fake'));
-      });
+      assert.ok(_.isUndefined(layout.layoutViews['#selector']));
+    });
 
+    it("should return false if view doesn't exist", function () {
+      assert.notOk(layout.removeView('#fake'));
     });
 
-    describe('#renderView', function () {
-      var view;
+  });
 
-      beforeEach(function () {
-        view = new FauxtonAPI.View();
-        layout.setView('#selector', view);
-      });
+  describe('#renderView', function () {
+    var view;
 
-      it('should render view', function () {
-        var renderSpy = sinon.spy(view, 'render');
-        layout.renderView('#selector');
-        assert.ok(renderSpy.calledOnce);
-      });
+    beforeEach(function () {
+      view = new FauxtonAPI.View();
+      layout.setView('#selector', view);
+    });
 
-      it('should not render a non-existing view', function () {
-        assert.notOk(layout.renderView('#fake'));
-      });
+    it('should render view', function () {
+      var renderSpy = sinon.spy(view, 'render');
+      layout.renderView('#selector');
+      assert.ok(renderSpy.calledOnce);
+    });
 
+    it('should not render a non-existing view', function () {
+      assert.notOk(layout.renderView('#fake'));
     });
+
   });
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/rev-browser/rev-browser.components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/rev-browser/rev-browser.components.react.jsx b/app/addons/documents/rev-browser/rev-browser.components.react.jsx
index 89c44eb..d49a6cc 100644
--- a/app/addons/documents/rev-browser/rev-browser.components.react.jsx
+++ b/app/addons/documents/rev-browser/rev-browser.components.react.jsx
@@ -11,431 +11,419 @@
 // the License.
 
 
-define([
-  '../../../core/api',
-  '../../../app',
-  'react',
-  'react-dom',
-  './rev-browser.actions',
-  './rev-browser.stores',
-  '../../components/react-components.react',
+import FauxtonAPI from "../../../core/api";
+import app from "../../../app";
+import React from "react";
+import ReactDOM from "react-dom";
+import RevActions from "./rev-browser.actions";
+import RevStores from "./rev-browser.stores";
+import ReactComponents from "../../components/react-components.react";
+import { ButtonGroup, Button, Modal } from "react-bootstrap";
+import ReactSelect from "react-select";
+import jdp from "jsondiffpatch";
+import jdpformatters from "jsondiffpatch/src/formatters/html";
+import ace from "brace";
+import "jsondiffpatch/public/formatters-styles/html.css";
 
-  'react-bootstrap',
-  'react-select',
-  'jsondiffpatch',
-  'jsondiffpatch/src/formatters/html',
+const storageKeyDeleteConflictsModal = 'deleteConflictsHideModal';
 
-  'brace',
+const store = RevStores.revBrowserStore;
+const ConfirmButton = ReactComponents.ConfirmButton;
 
-  'jsondiffpatch/public/formatters-styles/html.css'
-], (FauxtonAPI, app, React, ReactDOM, RevActions, RevStores, ReactComponents,
-    ReactBootstrap, ReactSelect, jdp, jdpformatters, ace) => {
+require('brace/ext/static_highlight');
+const highlight = ace.acequire('ace/ext/static_highlight');
 
-  const storageKeyDeleteConflictsModal = 'deleteConflictsHideModal';
+require('brace/mode/json');
+const JavaScriptMode = ace.acequire('ace/mode/json').Mode;
 
-  const store = RevStores.revBrowserStore;
-  const ConfirmButton = ReactComponents.ConfirmButton;
+require('brace/theme/idle_fingers');
+const theme = ace.acequire('ace/theme/idle_fingers');
 
-  const ButtonGroup = ReactBootstrap.ButtonGroup;
-  const Button = ReactBootstrap.Button;
-  const Modal = ReactBootstrap.Modal;
 
-  require('brace/ext/static_highlight');
-  const highlight = ace.acequire('ace/ext/static_highlight');
+class DiffyController extends React.Component {
 
-  require('brace/mode/json');
-  const JavaScriptMode = ace.acequire('ace/mode/json').Mode;
-
-  require('brace/theme/idle_fingers');
-  const theme = ace.acequire('ace/theme/idle_fingers');
+  constructor (props) {
+    super(props);
 
+    this.state = this.getStoreState();
+  }
 
-  class DiffyController extends React.Component {
+  getStoreState () {
+
+    return {
+      tree: store.getRevTree(),
+      ours: store.getOurs(),
+      theirs: store.getTheirs(),
+      conflictingRevs: store.getConflictingRevs(),
+      dropdownData: store.getDropdownData(),
+      isDiffViewEnabled: store.getIsDiffViewEnabled(),
+      databaseName: store.getDatabaseName()
+    };
+  }
 
-    constructor (props) {
-      super(props);
+  componentDidMount () {
+    store.on('change', this.onChange, this);
+  }
 
-      this.state = this.getStoreState();
-    }
+  componentWillUnmount () {
+    store.off('change', this.onChange);
+  }
 
-    getStoreState () {
-
-      return {
-        tree: store.getRevTree(),
-        ours: store.getOurs(),
-        theirs: store.getTheirs(),
-        conflictingRevs: store.getConflictingRevs(),
-        dropdownData: store.getDropdownData(),
-        isDiffViewEnabled: store.getIsDiffViewEnabled(),
-        databaseName: store.getDatabaseName()
-      };
-    }
+  onChange () {
+    this.setState(this.getStoreState());
+  }
 
-    componentDidMount () {
-      store.on('change', this.onChange, this);
-    }
+  toggleDiffView (enableDiff) {
+    RevActions.toggleDiffView(enableDiff);
+  }
 
-    componentWillUnmount () {
-      store.off('change', this.onChange);
-    }
+  render () {
+    const {tree, ours, theirs, dropdownData, conflictingRevs, isDiffViewEnabled} = this.state;
 
-    onChange () {
-      this.setState(this.getStoreState());
+    if (!tree) {
+      return null;
     }
 
-    toggleDiffView (enableDiff) {
-      RevActions.toggleDiffView(enableDiff);
+    // no conflicts happened for this doc
+    if (!theirs || !conflictingRevs.length) {
+      return <div style={{textAlign: 'center', color: '#fff'}}><h2>No conflicts</h2></div>;
     }
 
-    render () {
-      const {tree, ours, theirs, dropdownData, conflictingRevs, isDiffViewEnabled} = this.state;
-
-      if (!tree) {
-        return null;
-      }
-
-      // no conflicts happened for this doc
-      if (!theirs || !conflictingRevs.length) {
-        return <div style={{textAlign: 'center', color: '#fff'}}><h2>No conflicts</h2></div>;
-      }
-
-      return (
-        <div className="revision-wrapper scrollable">
-          <RevisionBrowserControls {...this.state} />
-          <div className="revision-view-controls">
-            <ButtonGroup className="two-sides-toggle-button">
-              <Button
-                style={{width: '120px'}}
-                className={isDiffViewEnabled ? 'active' : ''}
-                onClick={this.toggleDiffView.bind(this, true)}
-              >
-                <i className="icon-columns" /> Diff
-              </Button>
-              <Button
-                style={{width: '120px'}}
-                className={isDiffViewEnabled ? '' : 'active'}
-                onClick={this.toggleDiffView.bind(this, false)}
-              >
-                <i className="icon-file-text" /> Document
-              </Button>
-            </ButtonGroup>
-          </div>
-
-          {isDiffViewEnabled ?
-            <RevisionDiffArea ours={ours} theirs={theirs} /> :
-            <SplitScreenArea ours={ours} theirs={theirs} /> }
+    return (
+      <div className="revision-wrapper scrollable">
+        <RevisionBrowserControls {...this.state} />
+        <div className="revision-view-controls">
+          <ButtonGroup className="two-sides-toggle-button">
+            <Button
+              style={{width: '120px'}}
+              className={isDiffViewEnabled ? 'active' : ''}
+              onClick={this.toggleDiffView.bind(this, true)}
+            >
+              <i className="icon-columns" /> Diff
+            </Button>
+            <Button
+              style={{width: '120px'}}
+              className={isDiffViewEnabled ? '' : 'active'}
+              onClick={this.toggleDiffView.bind(this, false)}
+            >
+              <i className="icon-file-text" /> Document
+            </Button>
+          </ButtonGroup>
         </div>
-      );
-    }
-  };
-
-
-  class SplitScreenArea extends React.Component {
-
-    constructor (props) {
-      super(props);
-    }
 
-    componentDidUpdate () {
-      this.hightlightAfterRender();
-    }
+        {isDiffViewEnabled ?
+          <RevisionDiffArea ours={ours} theirs={theirs} /> :
+          <SplitScreenArea ours={ours} theirs={theirs} /> }
+      </div>
+    );
+  }
+}
 
-    componentDidMount () {
-      this.hightlightAfterRender();
-    }
 
-    hightlightAfterRender () {
-      const format = (input) => { return JSON.stringify(input, null, '  '); };
+class SplitScreenArea extends React.Component {
 
-      const jsmode = new JavaScriptMode();
-      const left = ReactDOM.findDOMNode(this.refs.revLeftOurs);
-      const right = ReactDOM.findDOMNode(this.refs.revRightTheirs);
+  constructor (props) {
+    super(props);
+  }
 
-      const leftRes = highlight.render(format(this.props.ours), jsmode, theme, 0, true);
-      left.innerHTML = leftRes.html;
-      const rightRes = highlight.render(format(this.props.theirs), jsmode, theme, 0, true);
-      right.innerHTML = rightRes.html;
-    }
+  componentDidUpdate () {
+    this.hightlightAfterRender();
+  }
 
-    render () {
-      const {ours, theirs} = this.props;
+  componentDidMount () {
+    this.hightlightAfterRender();
+  }
 
-      if (!ours || !theirs) {
-        return <div></div>;
-      }
+  hightlightAfterRender () {
+    const format = (input) => { return JSON.stringify(input, null, '  '); };
 
-      return (
-        <div className="revision-split-area">
-          <div data-id="ours" style={{width: '50%'}}>
-            <div style={{marginBottom: '20px'}}>{ours._rev} (Server-Selected Rev)</div>
-            <pre ref="revLeftOurs"></pre>
-          </div>
+    const jsmode = new JavaScriptMode();
+    const left = ReactDOM.findDOMNode(this.refs.revLeftOurs);
+    const right = ReactDOM.findDOMNode(this.refs.revRightTheirs);
 
-          <div data-id="theirs" style={{width: '50%'}}>
-            <div style={{marginBottom: '20px'}}>{theirs._rev}</div>
-            <pre ref="revRightTheirs"></pre>
-          </div>
-        </div>
-      );
-    }
+    const leftRes = highlight.render(format(this.props.ours), jsmode, theme, 0, true);
+    left.innerHTML = leftRes.html;
+    const rightRes = highlight.render(format(this.props.theirs), jsmode, theme, 0, true);
+    right.innerHTML = rightRes.html;
   }
 
-  const RevisionDiffArea = ({ours, theirs}) => {
+  render () {
+    const {ours, theirs} = this.props;
+
     if (!ours || !theirs) {
       return <div></div>;
     }
 
-    const delta = jdp.diff(ours, theirs);
-    const html = jdpformatters.format(delta, ours);
-
     return (
-      <div className="revision-diff-area">
-        <div
-          style={{marginTop: '30px'}}
-          dangerouslySetInnerHTML={{__html: html}}
-        >
+      <div className="revision-split-area">
+        <div data-id="ours" style={{width: '50%'}}>
+          <div style={{marginBottom: '20px'}}>{ours._rev} (Server-Selected Rev)</div>
+          <pre ref="revLeftOurs"></pre>
         </div>
-      </div>
-    );
-  };
-  RevisionDiffArea.propTypes = {
-    ours: React.PropTypes.object,
-    theirs: React.PropTypes.object,
-    currentRev: React.PropTypes.string
-  };
 
-
-  const ConflictingRevisionsDropDown = ({options, selected, onRevisionClick, onBackwardClick, onForwardClick}) => {
-    return (
-      <div className="conflicting-revs-dropdown">
-        <BackForwardControls backward onClick={onBackwardClick} />
-        <div style={{width: '345px', margin: '0 5px'}}>
-          <ReactSelect
-            name="form-field-name"
-            value={selected}
-            options={options}
-            clearable={false}
-            onChange={onRevisionClick} />
+        <div data-id="theirs" style={{width: '50%'}}>
+          <div style={{marginBottom: '20px'}}>{theirs._rev}</div>
+          <pre ref="revRightTheirs"></pre>
         </div>
-        <BackForwardControls forward onClick={onForwardClick} />
       </div>
     );
-  };
-  ConflictingRevisionsDropDown.propTypes = {
-    options: React.PropTypes.array.isRequired,
-    selected: React.PropTypes.string.isRequired,
-    onRevisionClick: React.PropTypes.func.isRequired,
-    onBackwardClick: React.PropTypes.func.isRequired,
-    onForwardClick: React.PropTypes.func.isRequired,
-  };
+  }
+}
 
-  class RevisionBrowserControls extends React.Component {
+const RevisionDiffArea = ({ours, theirs}) => {
+  if (!ours || !theirs) {
+    return <div></div>;
+  }
 
-    constructor (props) {
-      super(props);
+  const delta = jdp.diff(ours, theirs);
+  const html = jdpformatters.format(delta, ours);
 
-      this.state = {showModal: false};
-    }
-
-    onRevisionClick (revTheirs) {
+  return (
+    <div className="revision-diff-area">
+      <div
+        style={{marginTop: '30px'}}
+        dangerouslySetInnerHTML={{__html: html}}
+      >
+      </div>
+    </div>
+  );
+};
+RevisionDiffArea.propTypes = {
+  ours: React.PropTypes.object,
+  theirs: React.PropTypes.object,
+  currentRev: React.PropTypes.string
+};
+
+
+const ConflictingRevisionsDropDown = ({options, selected, onRevisionClick, onBackwardClick, onForwardClick}) => {
+  return (
+    <div className="conflicting-revs-dropdown">
+      <BackForwardControls backward onClick={onBackwardClick} />
+      <div style={{width: '345px', margin: '0 5px'}}>
+        <ReactSelect
+          name="form-field-name"
+          value={selected}
+          options={options}
+          clearable={false}
+          onChange={onRevisionClick} />
+      </div>
+      <BackForwardControls forward onClick={onForwardClick} />
+    </div>
+  );
+};
+ConflictingRevisionsDropDown.propTypes = {
+  options: React.PropTypes.array.isRequired,
+  selected: React.PropTypes.string.isRequired,
+  onRevisionClick: React.PropTypes.func.isRequired,
+  onBackwardClick: React.PropTypes.func.isRequired,
+  onForwardClick: React.PropTypes.func.isRequired,
+};
+
+class RevisionBrowserControls extends React.Component {
+
+  constructor (props) {
+    super(props);
+
+    this.state = {showModal: false};
+  }
 
-      RevActions.chooseLeaves(this.props.ours, revTheirs.value);
-    }
+  onRevisionClick (revTheirs) {
 
-    onForwardClick () {
-      const conflictingRevs = this.props.conflictingRevs;
-      const index = conflictingRevs.indexOf(this.props.theirs._rev);
+    RevActions.chooseLeaves(this.props.ours, revTheirs.value);
+  }
 
-      const next = conflictingRevs[index + 1];
+  onForwardClick () {
+    const conflictingRevs = this.props.conflictingRevs;
+    const index = conflictingRevs.indexOf(this.props.theirs._rev);
 
-      if (!next) {
-        return;
-      }
+    const next = conflictingRevs[index + 1];
 
-      RevActions.chooseLeaves(this.props.ours, next);
+    if (!next) {
+      return;
     }
 
-    onBackwardClick () {
-      const conflictingRevs = this.props.conflictingRevs;
-      const index = conflictingRevs.indexOf(this.props.theirs._rev);
+    RevActions.chooseLeaves(this.props.ours, next);
+  }
 
-      const next = conflictingRevs[index - 1];
+  onBackwardClick () {
+    const conflictingRevs = this.props.conflictingRevs;
+    const index = conflictingRevs.indexOf(this.props.theirs._rev);
 
-      if (!next) {
-        return;
-      }
+    const next = conflictingRevs[index - 1];
 
-      RevActions.chooseLeaves(this.props.ours, next);
+    if (!next) {
+      return;
     }
 
-    selectAsWinner (docToWin, doNotShowModalAgain) {
-      if (doNotShowModalAgain) {
-        app.utils.localStorageSet(storageKeyDeleteConflictsModal, true);
-      }
+    RevActions.chooseLeaves(this.props.ours, next);
+  }
 
-      RevActions.selectRevAsWinner(this.props.databaseName, docToWin._id, this.props.tree.paths, docToWin._rev);
+  selectAsWinner (docToWin, doNotShowModalAgain) {
+    if (doNotShowModalAgain) {
+      app.utils.localStorageSet(storageKeyDeleteConflictsModal, true);
     }
 
-    onSelectAsWinnerClick (docToWin) {
-      if (app.utils.localStorageGet(storageKeyDeleteConflictsModal) !== true) {
-        RevActions.showConfirmModal(true, docToWin);
-        return;
-      }
+    RevActions.selectRevAsWinner(this.props.databaseName, docToWin._id, this.props.tree.paths, docToWin._rev);
+  }
 
-      this.selectAsWinner(docToWin);
+  onSelectAsWinnerClick (docToWin) {
+    if (app.utils.localStorageGet(storageKeyDeleteConflictsModal) !== true) {
+      RevActions.showConfirmModal(true, docToWin);
+      return;
     }
 
-    render () {
-      const {tree, conflictingRevs} = this.props;
-      const cellStyle = {paddingRight: '30px'};
-
-      return (
-        <div className="revision-browser-controls">
-          <ConfirmModal onConfirm={this.selectAsWinner.bind(this)} />
-          <table style={{margin: '10px 60px', width: '100%'}}>
-            <tbody>
-              <tr style={{height: '60px'}}>
-                <td style={cellStyle}>Server-Selected Rev: </td>
-                <td style={cellStyle}>
-                  <div style={{lineHeight: '36px', height: '36px', width: '337px', color: '#000', backgroundColor: '#ffbbbb'}}>
-                    <b style={{paddingLeft: '10px'}}>{tree.winner}</b>
-                  </div>
-                </td>
-                <td>
-                  <ConfirmButton
-                    onClick={this.onSelectAsWinnerClick.bind(this, this.props.ours)}
-                    style={{marginRight: '10px', width: '220px'}}
-                    text="Delete Other Conflicts"
-                    buttonType="btn-info"
-                    customIcon="icon-trophy" />
-                </td>
-              </tr>
-              <tr style={{height: '60px'}}>
-                <td style={cellStyle}>Conflicting Revisions: </td>
-                <td style={cellStyle}>
-                  <ConflictingRevisionsDropDown
-                    onRevisionClick={this.onRevisionClick.bind(this)}
-                    onForwardClick={this.onForwardClick.bind(this)}
-                    onBackwardClick={this.onBackwardClick.bind(this)}
-                    options={this.props.dropdownData}
-                    selected={this.props.theirs._rev} />
-                </td>
-                <td>
-                  <ConfirmButton
-                    data-id="button-select-theirs"
-                    onClick={this.onSelectAsWinnerClick.bind(this, this.props.theirs)}
-                    style={{marginRight: '10px', width: '220px'}}
-                    text="Select as Winner"
-                    buttonType="btn-info"
-                    customIcon="icon-trophy" />
-                </td>
-              </tr>
-            </tbody>
-          </table>
-        </div>
+    this.selectAsWinner(docToWin);
+  }
 
-      );
-    }
+  render () {
+    const {tree, conflictingRevs} = this.props;
+    const cellStyle = {paddingRight: '30px'};
+
+    return (
+      <div className="revision-browser-controls">
+        <ConfirmModal onConfirm={this.selectAsWinner.bind(this)} />
+        <table style={{margin: '10px 60px', width: '100%'}}>
+          <tbody>
+            <tr style={{height: '60px'}}>
+              <td style={cellStyle}>Server-Selected Rev: </td>
+              <td style={cellStyle}>
+                <div style={{lineHeight: '36px', height: '36px', width: '337px', color: '#000', backgroundColor: '#ffbbbb'}}>
+                  <b style={{paddingLeft: '10px'}}>{tree.winner}</b>
+                </div>
+              </td>
+              <td>
+                <ConfirmButton
+                  onClick={this.onSelectAsWinnerClick.bind(this, this.props.ours)}
+                  style={{marginRight: '10px', width: '220px'}}
+                  text="Delete Other Conflicts"
+                  buttonType="btn-info"
+                  customIcon="icon-trophy" />
+              </td>
+            </tr>
+            <tr style={{height: '60px'}}>
+              <td style={cellStyle}>Conflicting Revisions: </td>
+              <td style={cellStyle}>
+                <ConflictingRevisionsDropDown
+                  onRevisionClick={this.onRevisionClick.bind(this)}
+                  onForwardClick={this.onForwardClick.bind(this)}
+                  onBackwardClick={this.onBackwardClick.bind(this)}
+                  options={this.props.dropdownData}
+                  selected={this.props.theirs._rev} />
+              </td>
+              <td>
+                <ConfirmButton
+                  data-id="button-select-theirs"
+                  onClick={this.onSelectAsWinnerClick.bind(this, this.props.theirs)}
+                  style={{marginRight: '10px', width: '220px'}}
+                  text="Select as Winner"
+                  buttonType="btn-info"
+                  customIcon="icon-trophy" />
+              </td>
+            </tr>
+          </tbody>
+        </table>
+      </div>
+
+    );
   }
-  RevisionBrowserControls.propTypes = {
-    tree: React.PropTypes.object.isRequired,
-    ours: React.PropTypes.object.isRequired,
-    conflictingRevs: React.PropTypes.array.isRequired,
-  };
+}
+RevisionBrowserControls.propTypes = {
+  tree: React.PropTypes.object.isRequired,
+  ours: React.PropTypes.object.isRequired,
+  conflictingRevs: React.PropTypes.array.isRequired,
+};
 
-  class ConfirmModal extends React.Component {
+class ConfirmModal extends React.Component {
 
-    constructor (props) {
-      super(props);
+  constructor (props) {
+    super(props);
 
-      this.state = this.getStoreState();
-    }
+    this.state = this.getStoreState();
+  }
 
-    getStoreState () {
-      return {
-        show: store.getShowConfirmModal(),
-        docToWin: store.getDocToWin(),
-        checked: false
-      };
-    }
+  getStoreState () {
+    return {
+      show: store.getShowConfirmModal(),
+      docToWin: store.getDocToWin(),
+      checked: false
+    };
+  }
 
-    componentDidMount () {
-      store.on('change', this.onChange, this);
-    }
+  componentDidMount () {
+    store.on('change', this.onChange, this);
+  }
 
-    componentWillUnmount () {
-      store.off('change', this.onChange);
-    }
+  componentWillUnmount () {
+    store.off('change', this.onChange);
+  }
 
-    onChange () {
-      this.setState(this.getStoreState());
-    }
+  onChange () {
+    this.setState(this.getStoreState());
+  }
 
-    close () {
-      RevActions.showConfirmModal(false, null);
-    }
+  close () {
+    RevActions.showConfirmModal(false, null);
+  }
 
-    onDeleteConflicts () {
-      const hideModal = this.state.checked;
-      this.props.onConfirm(this.state.docToWin, hideModal);
-    }
+  onDeleteConflicts () {
+    const hideModal = this.state.checked;
+    this.props.onConfirm(this.state.docToWin, hideModal);
+  }
 
-    render () {
-      return (
-        <Modal dialogClassName="delete-conflicts-modal" show={this.state.show} onHide={this.close}>
-          <Modal.Header closeButton={false}>
-            <Modal.Title>Solve Conflicts</Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-            <p>
-            <i className="icon-warning-sign"></i> Do you want to delete all conflicting revisions for this document?
-            </p>
-
-
-          </Modal.Body>
-          <Modal.Footer>
-            <div style={{float: 'left', marginTop: '10px'}}>
-              <label>
-                <input
-                  style={{margin: '0 5px 3px 0'}}
-                  onChange={() => { this.setState({checked: !this.state.checked }); }}
-                  type="checkbox" />
-                  Do not show this warning message again
-              </label>
-            </div>
-            <a
-              style={{marginRight: '10px', cursor: 'pointer'}}
-              onClick={this.close}
-              data-bypass="true"
-            >
-              Cancel
-            </a>
-
-            <ConfirmButton
-              onClick={this.onDeleteConflicts.bind(this)}
-              text="Delete Revisions"
-              buttonType="btn-danger" />
-          </Modal.Footer>
-        </Modal>
-      );
-    }
-  };
-  ConfirmModal.propTypes = {
-    onConfirm: React.PropTypes.func.isRequired,
-  };
-
-  const BackForwardControls = ({onClick, forward, backward}) => {
-    const icon = forward ? 'fonticon-right-open' : 'fonticon-left-open';
-    const style = {height: '20px', width: '11px', marginTop: '7px'};
-
-    return <div style={style} className={icon} onClick={onClick}></div>;
-  };
-  BackForwardControls.propTypes = {
-    onClick: React.PropTypes.func.isRequired,
-  };
-
-  return {
-    DiffyController: DiffyController
-  };
-
-});
+  render () {
+    return (
+      <Modal dialogClassName="delete-conflicts-modal" show={this.state.show} onHide={this.close}>
+        <Modal.Header closeButton={false}>
+          <Modal.Title>Solve Conflicts</Modal.Title>
+        </Modal.Header>
+        <Modal.Body>
+          <p>
+          <i className="icon-warning-sign"></i> Do you want to delete all conflicting revisions for this document?
+          </p>
+
+
+        </Modal.Body>
+        <Modal.Footer>
+          <div style={{float: 'left', marginTop: '10px'}}>
+            <label>
+              <input
+                style={{margin: '0 5px 3px 0'}}
+                onChange={() => { this.setState({checked: !this.state.checked }); }}
+                type="checkbox" />
+                Do not show this warning message again
+            </label>
+          </div>
+          <a
+            style={{marginRight: '10px', cursor: 'pointer'}}
+            onClick={this.close}
+            data-bypass="true"
+          >
+            Cancel
+          </a>
+
+          <ConfirmButton
+            onClick={this.onDeleteConflicts.bind(this)}
+            text="Delete Revisions"
+            buttonType="btn-danger" />
+        </Modal.Footer>
+      </Modal>
+    );
+  }
+}
+ConfirmModal.propTypes = {
+  onConfirm: React.PropTypes.func.isRequired,
+};
+
+const BackForwardControls = ({onClick, forward, backward}) => {
+  const icon = forward ? 'fonticon-right-open' : 'fonticon-left-open';
+  const style = {height: '20px', width: '11px', marginTop: '7px'};
+
+  return <div style={style} className={icon} onClick={onClick}></div>;
+};
+BackForwardControls.propTypes = {
+  onClick: React.PropTypes.func.isRequired,
+};
+
+export default {
+  DiffyController: DiffyController
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/rev-browser/rev-browser.stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/rev-browser/rev-browser.stores.js b/app/addons/documents/rev-browser/rev-browser.stores.js
index 28a6dfd..c4b4afa 100644
--- a/app/addons/documents/rev-browser/rev-browser.stores.js
+++ b/app/addons/documents/rev-browser/rev-browser.stores.js
@@ -10,114 +10,111 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  './rev-browser.actiontypes'
-], (FauxtonAPI, ActionTypes) => {
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./rev-browser.actiontypes";
 
-  const Stores = {};
+const Stores = {};
 
-  Stores.RevBrowserStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
+Stores.RevBrowserStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
 
-    reset: function () {
-      this._revTree = null;
+  reset: function () {
+    this._revTree = null;
 
-      this._ours = null;
-      this._theirs = null;
+    this._ours = null;
+    this._theirs = null;
 
-      this._dropDownData = null;
-      this._isDiffViewEnabled = true;
+    this._dropDownData = null;
+    this._isDiffViewEnabled = true;
 
-      this._databaseName = null;
+    this._databaseName = null;
 
-      this._showConfirmModal = false;
-      this._docToWin = null;
-    },
+    this._showConfirmModal = false;
+    this._docToWin = null;
+  },
 
-    prepareDropdownData: function (revs) {
-      return revs.map((el) => {
+  prepareDropdownData: function (revs) {
+    return revs.map((el) => {
 
-        return { value: el, label: el };
-      });
-    },
+      return { value: el, label: el };
+    });
+  },
 
-    getRevTree: function () {
-      return this._revTree;
-    },
+  getRevTree: function () {
+    return this._revTree;
+  },
 
-    getDatabaseName: function () {
-      return this._databaseName;
-    },
+  getDatabaseName: function () {
+    return this._databaseName;
+  },
 
-    getOurs: function () {
-      return this._ours;
-    },
+  getOurs: function () {
+    return this._ours;
+  },
 
-    getTheirs: function () {
-      return this._theirs;
-    },
+  getTheirs: function () {
+    return this._theirs;
+  },
 
-    getConflictingRevs: function () {
-      return this._conflictingRevs;
-    },
+  getConflictingRevs: function () {
+    return this._conflictingRevs;
+  },
 
-    getDropdownData: function () {
-      return this._dropDownData;
-    },
+  getDropdownData: function () {
+    return this._dropDownData;
+  },
 
-    getIsDiffViewEnabled: function () {
-      return this._isDiffViewEnabled;
-    },
+  getIsDiffViewEnabled: function () {
+    return this._isDiffViewEnabled;
+  },
 
-    getShowConfirmModal: function () {
-      return this._showConfirmModal;
-    },
+  getShowConfirmModal: function () {
+    return this._showConfirmModal;
+  },
 
-    getDocToWin: function () {
-      return this._docToWin;
-    },
+  getDocToWin: function () {
+    return this._docToWin;
+  },
 
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.REV_BROWSER_REV_TREE_LOADED:
-          this._revTree = action.options.tree;
-          this._ours = action.options.doc;
-          this._conflictingRevs = action.options.conflictingRevs;
-          this._theirs = action.options.conflictDoc;
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.REV_BROWSER_REV_TREE_LOADED:
+        this._revTree = action.options.tree;
+        this._ours = action.options.doc;
+        this._conflictingRevs = action.options.conflictingRevs;
+        this._theirs = action.options.conflictDoc;
 
-          this._dropDownData = this.prepareDropdownData(this._conflictingRevs);
+        this._dropDownData = this.prepareDropdownData(this._conflictingRevs);
 
-          this._databaseName = action.options.databaseName;
-        break;
+        this._databaseName = action.options.databaseName;
+      break;
 
-        case ActionTypes.REV_BROWSER_DIFF_DOCS_READY:
-          this._theirs = action.options.theirs;
-        break;
+      case ActionTypes.REV_BROWSER_DIFF_DOCS_READY:
+        this._theirs = action.options.theirs;
+      break;
 
-        case ActionTypes.REV_BROWSER_DIFF_ENABLE_DIFF_VIEW:
-          this._isDiffViewEnabled = action.options.enableDiff;
-        break;
+      case ActionTypes.REV_BROWSER_DIFF_ENABLE_DIFF_VIEW:
+        this._isDiffViewEnabled = action.options.enableDiff;
+      break;
 
-        case ActionTypes.REV_BROWSER_SHOW_CONFIRM_MODAL:
-          this._showConfirmModal = action.options.show;
-          this._docToWin = action.options.docToWin;
-        break;
+      case ActionTypes.REV_BROWSER_SHOW_CONFIRM_MODAL:
+        this._showConfirmModal = action.options.show;
+        this._docToWin = action.options.docToWin;
+      break;
 
-        default:
-        return;
-        // do nothing
-      }
-
-      this.triggerChange();
+      default:
+      return;
+      // do nothing
     }
 
-  });
-
-  Stores.revBrowserStore = new Stores.RevBrowserStore();
-  Stores.revBrowserStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.revBrowserStore.dispatch);
+    this.triggerChange();
+  }
 
-  return Stores;
 });
+
+Stores.revBrowserStore = new Stores.RevBrowserStore();
+Stores.revBrowserStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.revBrowserStore.dispatch);
+
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/rev-browser/tests/fixtures.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/rev-browser/tests/fixtures.js b/app/addons/documents/rev-browser/tests/fixtures.js
index f8f2e3a..650d9a9 100644
--- a/app/addons/documents/rev-browser/tests/fixtures.js
+++ b/app/addons/documents/rev-browser/tests/fixtures.js
@@ -10,63 +10,60 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], () => {
-
-  const twoPaths = {
-    "paths": [
-      [
-        "4-2868f2429e2211f74e656663f39b0cb8",
-        "3-b1a15f62533e8d3344504855c7c006f7",
-        "2-3016a16f8d02b6062c0f85af048974df",
-        "1-a2701a97f75439f13e9062ad8a9e2b9c"
-      ],
-      [
-        "6-9831e318304c35efafa6faa57a54809f",
-        "5-8eadb1a781b835cce132a339250bba53",
-        "4-3c1720cc9f559444f7e717a070f8eaec",
-        "3-b1a15f62533e8d3344504855c7c006f7",
-        "2-3016a16f8d02b6062c0f85af048974df",
-        "1-a2701a97f75439f13e9062ad8a9e2b9c"
-      ]
+const twoPaths = {
+  "paths": [
+    [
+      "4-2868f2429e2211f74e656663f39b0cb8",
+      "3-b1a15f62533e8d3344504855c7c006f7",
+      "2-3016a16f8d02b6062c0f85af048974df",
+      "1-a2701a97f75439f13e9062ad8a9e2b9c"
     ],
-    "deleted": {},
-    "winner": "6-9831e318304c35efafa6faa57a54809f"
-  };
+    [
+      "6-9831e318304c35efafa6faa57a54809f",
+      "5-8eadb1a781b835cce132a339250bba53",
+      "4-3c1720cc9f559444f7e717a070f8eaec",
+      "3-b1a15f62533e8d3344504855c7c006f7",
+      "2-3016a16f8d02b6062c0f85af048974df",
+      "1-a2701a97f75439f13e9062ad8a9e2b9c"
+    ]
+  ],
+  "deleted": {},
+  "winner": "6-9831e318304c35efafa6faa57a54809f"
+};
 
-  const threePaths = {
-    "paths": [
-      [
-        "5-5555f2429e2211f74e656663f39b0cb8",
-        "4-2868f2429e2211f74e656663f39b0cb8",
-        "3-b1a15f62533e8d3344504855c7c006f7",
-        "2-3016a16f8d02b6062c0f85af048974df",
-        "1-a2701a97f75439f13e9062ad8a9e2b9c"
-      ],
-      [
-        "7-1309b41d34787f7ba95280802f327dc2",
-        "6-9831e318304c35efafa6faa57a54809f",
-        "5-8eadb1a781b835cce132a339250bba53",
-        "4-3c1720cc9f559444f7e717a070f8eaec",
-        "3-b1a15f62533e8d3344504855c7c006f7",
-        "2-3016a16f8d02b6062c0f85af048974df",
-        "1-a2701a97f75439f13e9062ad8a9e2b9c"
-      ],
-      [
-        "7-1f1bb5806f33c8922277ea053d6fc4ed",
-        "6-9831e318304c35efafa6faa57a54809f",
-        "5-8eadb1a781b835cce132a339250bba53",
-        "4-3c1720cc9f559444f7e717a070f8eaec",
-        "3-b1a15f62533e8d3344504855c7c006f7",
-        "2-3016a16f8d02b6062c0f85af048974df",
-        "1-a2701a97f75439f13e9062ad8a9e2b9c"
-      ]
+const threePaths = {
+  "paths": [
+    [
+      "5-5555f2429e2211f74e656663f39b0cb8",
+      "4-2868f2429e2211f74e656663f39b0cb8",
+      "3-b1a15f62533e8d3344504855c7c006f7",
+      "2-3016a16f8d02b6062c0f85af048974df",
+      "1-a2701a97f75439f13e9062ad8a9e2b9c"
+    ],
+    [
+      "7-1309b41d34787f7ba95280802f327dc2",
+      "6-9831e318304c35efafa6faa57a54809f",
+      "5-8eadb1a781b835cce132a339250bba53",
+      "4-3c1720cc9f559444f7e717a070f8eaec",
+      "3-b1a15f62533e8d3344504855c7c006f7",
+      "2-3016a16f8d02b6062c0f85af048974df",
+      "1-a2701a97f75439f13e9062ad8a9e2b9c"
     ],
-    "deleted": {},
-    "winner": "7-1f1bb5806f33c8922277ea053d6fc4ed"
-  };
+    [
+      "7-1f1bb5806f33c8922277ea053d6fc4ed",
+      "6-9831e318304c35efafa6faa57a54809f",
+      "5-8eadb1a781b835cce132a339250bba53",
+      "4-3c1720cc9f559444f7e717a070f8eaec",
+      "3-b1a15f62533e8d3344504855c7c006f7",
+      "2-3016a16f8d02b6062c0f85af048974df",
+      "1-a2701a97f75439f13e9062ad8a9e2b9c"
+    ]
+  ],
+  "deleted": {},
+  "winner": "7-1f1bb5806f33c8922277ea053d6fc4ed"
+};
 
-  return {
-    twoPaths: twoPaths,
-    threePaths: threePaths
-  };
-});
+export default {
+  twoPaths: twoPaths,
+  threePaths: threePaths
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/rev-browser/tests/rev-browser.actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/rev-browser/tests/rev-browser.actionsSpec.js b/app/addons/documents/rev-browser/tests/rev-browser.actionsSpec.js
index f43962e..b0678ce 100644
--- a/app/addons/documents/rev-browser/tests/rev-browser.actionsSpec.js
+++ b/app/addons/documents/rev-browser/tests/rev-browser.actionsSpec.js
@@ -10,85 +10,81 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../rev-browser.actions',
-  './fixtures',
+import FauxtonAPI from "../../../../core/api";
+import RevActions from "../rev-browser.actions";
+import fixtures from "./fixtures";
+import utils from "../../../../../test/mocha/testUtils";
 
-  '../../../../../test/mocha/testUtils'
-], (FauxtonAPI, RevActions, fixtures, utils) => {
+const assert = utils.assert;
 
-  const assert = utils.assert;
+describe('RevActions', () => {
 
-  describe('RevActions', () => {
 
+  it('getConflictingRevs gets the revisions which are obsolete, winner', () => {
 
-    it('getConflictingRevs gets the revisions which are obsolete, winner', () => {
+    const res = RevActions.getConflictingRevs(
+      fixtures.threePaths.paths,
+      "7-1f1bb5806f33c8922277ea053d6fc4ed",
+      Object.keys({})
+    );
 
-      const res = RevActions.getConflictingRevs(
-        fixtures.threePaths.paths,
-        "7-1f1bb5806f33c8922277ea053d6fc4ed",
-        Object.keys({})
-      );
+    const expected = [
+      "5-5555f2429e2211f74e656663f39b0cb8",
+      "7-1309b41d34787f7ba95280802f327dc2"
+    ];
 
-      const expected = [
-        "5-5555f2429e2211f74e656663f39b0cb8",
-        "7-1309b41d34787f7ba95280802f327dc2"
-      ];
-
-      assert.deepEqual(expected, res);
-    });
-
-    it('getConflictingRevs gets the revisions which are obsolete, sidetrack with a lot lower rev', () => {
-
-      const res = RevActions.getConflictingRevs(
-        fixtures.threePaths.paths,
-        "5-5555f2429e2211f74e656663f39b0cb8",
-        Object.keys({})
-      );
-
-      const expected = [
-        "7-1309b41d34787f7ba95280802f327dc2",
-        "7-1f1bb5806f33c8922277ea053d6fc4ed"
-      ];
+    assert.deepEqual(expected, res);
+  });
 
-      assert.deepEqual(expected, res);
-    });
+  it('getConflictingRevs gets the revisions which are obsolete, sidetrack with a lot lower rev', () => {
 
-    it('getConflictingRevs filters out deleted revisions', () => {
+    const res = RevActions.getConflictingRevs(
+      fixtures.threePaths.paths,
+      "5-5555f2429e2211f74e656663f39b0cb8",
+      Object.keys({})
+    );
 
-      const res = RevActions.getConflictingRevs(
-        fixtures.threePaths.paths,
-        "5-5555f2429e2211f74e656663f39b0cb8",
-        Object.keys({ '7-1f1bb5806f33c8922277ea053d6fc4ed': true })
-      );
+    const expected = [
+      "7-1309b41d34787f7ba95280802f327dc2",
+      "7-1f1bb5806f33c8922277ea053d6fc4ed"
+    ];
 
-      const expected = [
-        "7-1309b41d34787f7ba95280802f327dc2"
-      ];
+    assert.deepEqual(expected, res);
+  });
 
-      assert.deepEqual(expected, res);
-    });
+  it('getConflictingRevs filters out deleted revisions', () => {
 
-    it('buildBulkDeletePayload prepares the payload for bulkdocs', () => {
+    const res = RevActions.getConflictingRevs(
+      fixtures.threePaths.paths,
+      "5-5555f2429e2211f74e656663f39b0cb8",
+      Object.keys({ '7-1f1bb5806f33c8922277ea053d6fc4ed': true })
+    );
 
-      const data = [
-        "7-1309b41d34787f7ba95280802f327dc2",
-        "6-9831e318304c35efafa6faa57a54809f",
-        "5-8eadb1a781b835cce132a339250bba53",
-        "4-3c1720cc9f559444f7e717a070f8eaec",
-        "7-1f1bb5806f33c8922277ea053d6fc4ed"
-      ];
+    const expected = [
+      "7-1309b41d34787f7ba95280802f327dc2"
+    ];
 
-      const res = RevActions.buildBulkDeletePayload('fooId', data);
+    assert.deepEqual(expected, res);
+  });
 
-      assert.deepEqual([
-        { "_id": "fooId", "_rev": "7-1309b41d34787f7ba95280802f327dc2", "_deleted": true },
-        { "_id": "fooId", "_rev": "6-9831e318304c35efafa6faa57a54809f", "_deleted": true },
-        { "_id": "fooId", "_rev": "5-8eadb1a781b835cce132a339250bba53", "_deleted": true },
-        { "_id": "fooId", "_rev": "4-3c1720cc9f559444f7e717a070f8eaec", "_deleted": true },
-        { "_id": "fooId", "_rev": "7-1f1bb5806f33c8922277ea053d6fc4ed", "_deleted": true },
-      ], res.docs);
-    });
+  it('buildBulkDeletePayload prepares the payload for bulkdocs', () => {
+
+    const data = [
+      "7-1309b41d34787f7ba95280802f327dc2",
+      "6-9831e318304c35efafa6faa57a54809f",
+      "5-8eadb1a781b835cce132a339250bba53",
+      "4-3c1720cc9f559444f7e717a070f8eaec",
+      "7-1f1bb5806f33c8922277ea053d6fc4ed"
+    ];
+
+    const res = RevActions.buildBulkDeletePayload('fooId', data);
+
+    assert.deepEqual([
+      { "_id": "fooId", "_rev": "7-1309b41d34787f7ba95280802f327dc2", "_deleted": true },
+      { "_id": "fooId", "_rev": "6-9831e318304c35efafa6faa57a54809f", "_deleted": true },
+      { "_id": "fooId", "_rev": "5-8eadb1a781b835cce132a339250bba53", "_deleted": true },
+      { "_id": "fooId", "_rev": "4-3c1720cc9f559444f7e717a070f8eaec", "_deleted": true },
+      { "_id": "fooId", "_rev": "7-1f1bb5806f33c8922277ea053d6fc4ed", "_deleted": true },
+    ], res.docs);
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/routes-doc-editor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js
index 0702a40..59d91b6 100644
--- a/app/addons/documents/routes-doc-editor.js
+++ b/app/addons/documents/routes-doc-editor.js
@@ -10,160 +10,152 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './helpers',
-  './resources',
-  '../databases/base',
-  './doc-editor/actions',
-  './doc-editor/components.react',
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Helpers from "./helpers";
+import Documents from "./resources";
+import Databases from "../databases/base";
+import Actions from "./doc-editor/actions";
+import ReactComponents from "./doc-editor/components.react";
+import RevBrowserActions from "./rev-browser/rev-browser.actions";
+import RevBrowserComponents from "./rev-browser/rev-browser.components.react";
+
+
+const RevBrowserRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'doc_editor',
+  disableLoader: true,
+  selectedHeader: 'Databases',
+  roles: ['fx_loggedIn'],
+
+  routes: {
+    'database/:database/:doc/conflicts': 'revisionBrowser'
+  },
+
+  initialize: function (route, masterLayout, options) {
+    const databaseName = options[0];
+
+    this.docId = options[1];
+    this.database = this.database || new Databases.Model({ id: databaseName });
+    this.doc = new Documents.Doc({ _id: this.docId }, { database: this.database });
+  },
+
+  crumbs: function () {
+    const previousPage = Helpers.getPreviousPageForDoc(this.database, this.wasCloned);
+    const docUrl = FauxtonAPI.urls('document', 'app', this.database.safeID(), this.docId);
+
+    return [
+      { type: 'back', link: previousPage },
+      { name: this.docId + ' > Conflicts', link: '#' }
+    ];
+  },
+
+  apiUrl: function () {
+    return [this.doc.url('apiurl'), this.doc.documentation()];
+  },
+
+  revisionBrowser: function (databaseName, docId) {
+    RevBrowserActions.showConfirmModal(false, null);
+    RevBrowserActions.initDiffEditor(databaseName, docId);
+    this.setComponent('#dashboard-content', RevBrowserComponents.DiffyController);
+  }
 
-  './rev-browser/rev-browser.actions',
-  './rev-browser/rev-browser.components.react'
-],
+});
 
-(app, FauxtonAPI, Helpers, Documents, Databases, Actions, ReactComponents,
-RevBrowserActions, RevBrowserComponents) => {
+const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'doc_editor',
+  disableLoader: true,
+  selectedHeader: 'Databases',
 
+  roles: ['fx_loggedIn'],
 
-  const RevBrowserRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'doc_editor',
-    disableLoader: true,
-    selectedHeader: 'Databases',
-    roles: ['fx_loggedIn'],
+  initialize: function (route, masterLayout, options) {
+    this.databaseName = options[0];
+    this.docId = options[1];
+    this.database = this.database || new Databases.Model({ id: this.databaseName });
+    this.doc = new Documents.NewDoc(null, { database: this.database });
+    this.wasCloned = false;
+  },
 
-    routes: {
-      'database/:database/:doc/conflicts': 'revisionBrowser'
-    },
+  routes: {
+    'database/:database/:doc/code_editor': 'codeEditor',
+    'database/:database/_design/:ddoc': 'showDesignDoc',
+    'database/:database/:doc': 'codeEditor',
+    'database/:database/new': 'codeEditor'
+  },
 
-    initialize: function (route, masterLayout, options) {
-      const databaseName = options[0];
+  events: {
+    'route:duplicateDoc': 'duplicateDoc'
+  },
 
-      this.docId = options[1];
-      this.database = this.database || new Databases.Model({ id: databaseName });
-      this.doc = new Documents.Doc({ _id: this.docId }, { database: this.database });
-    },
+  crumbs: function () {
 
-    crumbs: function () {
-      const previousPage = Helpers.getPreviousPageForDoc(this.database, this.wasCloned);
-      const docUrl = FauxtonAPI.urls('document', 'app', this.database.safeID(), this.docId);
+    if (this.docId) {
+      let previousPage = Helpers.getPreviousPageForDoc(this.database, this.wasCloned);
 
       return [
         { type: 'back', link: previousPage },
-        { name: this.docId + ' > Conflicts', link: '#' }
+        { name: this.docId, link: '#' }
       ];
-    },
-
-    apiUrl: function () {
-      return [this.doc.url('apiurl'), this.doc.documentation()];
-    },
-
-    revisionBrowser: function (databaseName, docId) {
-      RevBrowserActions.showConfirmModal(false, null);
-      RevBrowserActions.initDiffEditor(databaseName, docId);
-      this.setComponent('#dashboard-content', RevBrowserComponents.DiffyController);
     }
 
-  });
-
-  const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'doc_editor',
-    disableLoader: true,
-    selectedHeader: 'Databases',
+    let previousPage = Helpers.getPreviousPageForDoc(this.database);
+    return [
+      { type: 'back', link: previousPage },
+      { name: 'New Document', link: '#' }
+    ];
+  },
 
-    roles: ['fx_loggedIn'],
+  codeEditor: function (databaseName, docId) {
+    this.database = new Databases.Model({ id: databaseName });
 
-    initialize: function (route, masterLayout, options) {
-      this.databaseName = options[0];
-      this.docId = options[1];
-      this.database = this.database || new Databases.Model({ id: this.databaseName });
-      this.doc = new Documents.NewDoc(null, { database: this.database });
-      this.wasCloned = false;
-    },
-
-    routes: {
-      'database/:database/:doc/code_editor': 'codeEditor',
-      'database/:database/_design/:ddoc': 'showDesignDoc',
-      'database/:database/:doc': 'codeEditor',
-      'database/:database/new': 'codeEditor'
-    },
-
-    events: {
-      'route:duplicateDoc': 'duplicateDoc'
-    },
-
-    crumbs: function () {
+    if (docId) {
+      this.doc = new Documents.Doc({ _id: docId }, { database: this.database, fetchConflicts: true });
+    }
 
-      if (this.docId) {
-        let previousPage = Helpers.getPreviousPageForDoc(this.database, this.wasCloned);
+    Actions.initDocEditor({ doc: this.doc, database: this.database });
+    this.setComponent('#dashboard-content', ReactComponents.DocEditorController, {
+      database: this.database,
+      isNewDoc: docId ? false : true,
+      previousPage: '#/' + Helpers.getPreviousPageForDoc(this.database)
+    });
+  },
 
-        return [
-          { type: 'back', link: previousPage },
-          { name: this.docId, link: '#' }
-        ];
-      }
+  showDesignDoc: function (database, ddoc) {
+    this.codeEditor(database, '_design/' + ddoc);
+  },
 
-      let previousPage = Helpers.getPreviousPageForDoc(this.database);
-      return [
-        { type: 'back', link: previousPage },
-        { name: 'New Document', link: '#' }
-      ];
-    },
+  duplicateDoc: function (newId) {
+    var doc = this.doc,
+        database = this.database;
 
-    codeEditor: function (databaseName, docId) {
-      this.database = new Databases.Model({ id: databaseName });
+    this.docID = newId;
 
-      if (docId) {
-        this.doc = new Documents.Doc({ _id: docId }, { database: this.database, fetchConflicts: true });
-      }
+    var that = this;
+    doc.copy(newId).then(function () {
+      doc.set({ _id: newId });
+      that.wasCloned = true;
 
-      Actions.initDocEditor({ doc: this.doc, database: this.database });
-      this.setComponent('#dashboard-content', ReactComponents.DocEditorController, {
-        database: this.database,
-        isNewDoc: docId ? false : true,
-        previousPage: '#/' + Helpers.getPreviousPageForDoc(this.database)
-      });
-    },
-
-    showDesignDoc: function (database, ddoc) {
-      this.codeEditor(database, '_design/' + ddoc);
-    },
-
-    duplicateDoc: function (newId) {
-      var doc = this.doc,
-          database = this.database;
-
-      this.docID = newId;
-
-      var that = this;
-      doc.copy(newId).then(function () {
-        doc.set({ _id: newId });
-        that.wasCloned = true;
-
-        FauxtonAPI.navigate('/database/' + database.safeID() + '/' + app.utils.safeURLName(newId), { trigger: true });
-        FauxtonAPI.addNotification({
-          msg: 'Document has been duplicated.'
-        });
-
-      }, function (error) {
-        var errorMsg = 'Could not duplicate document, reason: ' + error.responseText + '.';
-        FauxtonAPI.addNotification({
-          msg: errorMsg,
-          type: 'error'
-        });
+      FauxtonAPI.navigate('/database/' + database.safeID() + '/' + app.utils.safeURLName(newId), { trigger: true });
+      FauxtonAPI.addNotification({
+        msg: 'Document has been duplicated.'
       });
-    },
 
-    apiUrl: function () {
-      return [this.doc.url('apiurl'), this.doc.documentation()];
-    }
-  });
+    }, function (error) {
+      var errorMsg = 'Could not duplicate document, reason: ' + error.responseText + '.';
+      FauxtonAPI.addNotification({
+        msg: errorMsg,
+        type: 'error'
+      });
+    });
+  },
 
+  apiUrl: function () {
+    return [this.doc.url('apiurl'), this.doc.documentation()];
+  }
+});
 
-  return {
-    DocEditorRouteObject: DocEditorRouteObject,
-    RevBrowserRouteObject: RevBrowserRouteObject
-  };
 
-});
+export default {
+  DocEditorRouteObject: DocEditorRouteObject,
+  RevBrowserRouteObject: RevBrowserRouteObject
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js
index 29ab8da..32f67c7 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -10,201 +10,192 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-
-  // Modules
-  './shared-routes',
-  './views',
-  './changes/components.react',
-  './changes/actions',
-  '../databases/base',
-  './resources',
-  '../fauxton/components',
-   './index-results/stores',
-   './index-results/actions',
-   './index-results/index-results.components.react',
-   './pagination/pagination.react',
-   './header/header.react',
-   './header/header.actions',
-   './sidebar/actions',
-   './designdocinfo/actions',
-   './designdocinfo/components.react',
-   '../components/actions'
-],
-
-function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, Databases, Resources, Components,
-  IndexResultStores, IndexResultsActions, IndexResultsComponents, ReactPagination, ReactHeader, ReactActions,
-  SidebarActions, DesignDocInfoActions, DesignDocInfoComponents, ComponentsActions) {
-
-    var DocumentsRouteObject = BaseRoute.extend({
-      layout: "with_tabs_sidebar",
-      routes: {
-        "database/:database/_all_docs(:extra)": {
-          route: "allDocs",
-          roles: ["fx_loggedIn"]
-        },
-        "database/:database/_design/:ddoc/_info": {
-          route: "designDocMetadata",
-          roles: ['fx_loggedIn']
-        },
-        'database/:database/_changes': 'changes'
-      },
-
-      events: {
-        "route:reloadDesignDocs": "reloadDesignDocs"
-      },
-
-      initialize: function (route, masterLayout, options) {
-        this.initViews(options[0]);
-        this.listenToLookaheadTray();
-      },
-
-      establish: function () {
-        return [
-          this.designDocs.fetch({ reset: true }),
-          this.allDatabases.fetchOnce()
-        ];
-      },
-
-      initViews: function (dbName) {
-        this.databaseName = dbName;
-        this.database = new Databases.Model({id: this.databaseName});
-        this.allDatabases = this.getAllDatabases();
-
-        this.createDesignDocsCollection();
-
-        this.rightHeader = this.setView("#right-header", new Documents.Views.RightAllDocsHeader({
-          database: this.database
-        }));
-
-        this.addLeftHeader();
-        this.addSidebar();
-      },
-
-      designDocMetadata: function (database, ddoc) {
-        this.removeComponent('#footer');
-        this.removeComponent('#react-headerbar');
-        this.removeComponent('#dashboard-upper-content');
-
-        var designDocInfo = new Resources.DdocInfo({ _id: "_design/" + ddoc }, { database: this.database });
-        DesignDocInfoActions.fetchDesignDocInfo({
-          ddocName: ddoc,
-          designDocInfo: designDocInfo
-        });
-        this.setComponent("#dashboard-lower-content", DesignDocInfoComponents.DesignDocInfo);
-
-        SidebarActions.selectNavItem('designDoc', {
-          designDocName: ddoc,
-          designDocSection: 'metadata'
-        });
-
-        this.leftheader.updateCrumbs(this.getCrumbs(this.database));
-        this.rightHeader.hideQueryOptions();
-
-        this.apiUrl = [designDocInfo.url('apiurl'), designDocInfo.documentation()];
-      },
-
-      /*
-      * docParams are the options collection uses to fetch from the server
-      * urlParams are what are shown in the url and to the user
-      * They are not the same when paginating
-      */
-      allDocs: function (databaseName, options) {
-        var params = this.createParams(options),
-            urlParams = params.urlParams,
-            docParams = params.docParams,
-            collection;
-
-        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) {
-          docParams.include_docs = true;
-          urlParams = params.docParams;
-          var updatedURL = FauxtonAPI.urls('allDocs', 'app', databaseName, '?' + $.param(urlParams));
-          FauxtonAPI.navigate(updatedURL, {trigger: false, replace: true});
-        }
-
-        this.database.buildAllDocs(docParams);
-        collection = this.database.allDocs;
-
-        var tab = 'all-docs';
-        if (docParams.startkey && docParams.startkey.indexOf("_design") > -1) {
-          tab = 'design-docs';
-        }
-
-        SidebarActions.selectNavItem(tab);
-        ComponentsActions.showDeleteDatabaseModal({showDeleteModal: false, dbId: ''});
-
-        this.removeComponent('#dashboard-upper-content');
-
-        if (!docParams) {
-          docParams = {};
-        }
-
-        var frozenCollection = app.utils.localStorageGet('include_docs_bulkdocs');
-        window.localStorage.removeItem('include_docs_bulkdocs');
-
-        IndexResultsActions.newResultsList({
-          collection: collection,
-          textEmptyIndex: 'No Documents Found',
-          bulkCollection: new Documents.BulkDeleteDocCollection(frozenCollection, { databaseId: this.database.safeID() }),
-        });
-
-        this.database.allDocs.paging.pageSize = IndexResultStores.indexResultsStore.getPerPage();
-
-        this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
-
-        // this used to be a function that returned the object, but be warned: it caused a closure with a reference to
-        // the initial this.database object which can change
-        this.apiUrl = [this.database.allDocs.urlRef("apiurl", urlParams), this.database.allDocs.documentation()];
-
-        // update the rightHeader with the latest & greatest info
-        this.rightHeader.resetQueryOptions({ queryParams: urlParams });
-        this.rightHeader.showQueryOptions();
-      },
-
-      reloadDesignDocs: function (event) {
-        this.addSidebar(); // this ensures the design docs get reloaded
-        if (event && event.selectedTab) {
-          SidebarActions.selectNavItem(event.selectedTab);
-        }
-      },
-
-      changes: function () {
-        ChangesActions.initChanges({
-          databaseName: this.database.id
-        });
-        this.setComponent('#dashboard-upper-content', Changes.ChangesHeaderController);
-        this.setComponent("#dashboard-lower-content", Changes.ChangesController);
-
-        this.removeComponent('#footer');
-        this.removeComponent('#react-headerbar');
-
-        this.viewEditor && this.viewEditor.remove();
-
-        SidebarActions.selectNavItem('changes');
-        this.leftheader.updateCrumbs(this.getCrumbs(this.database));
-        this.rightHeader.hideQueryOptions();
-
-        this.apiUrl = function () {
-          return [FauxtonAPI.urls('changes', 'apiurl', this.database.id, ''), this.database.documentation()];
-        };
-      },
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import BaseRoute from "./shared-routes";
+import Documents from "./views";
+import Changes from "./changes/components.react";
+import ChangesActions from "./changes/actions";
+import Databases from "../databases/base";
+import Resources from "./resources";
+import Components from "../fauxton/components";
+import IndexResultStores from "./index-results/stores";
+import IndexResultsActions from "./index-results/actions";
+import IndexResultsComponents from "./index-results/index-results.components.react";
+import ReactPagination from "./pagination/pagination.react";
+import ReactHeader from "./header/header.react";
+import ReactActions from "./header/header.actions";
+import SidebarActions from "./sidebar/actions";
+import DesignDocInfoActions from "./designdocinfo/actions";
+import DesignDocInfoComponents from "./designdocinfo/components.react";
+import ComponentsActions from "../components/actions";
+
+var DocumentsRouteObject = BaseRoute.extend({
+  layout: "with_tabs_sidebar",
+  routes: {
+    "database/:database/_all_docs(:extra)": {
+      route: "allDocs",
+      roles: ["fx_loggedIn"]
+    },
+    "database/:database/_design/:ddoc/_info": {
+      route: "designDocMetadata",
+      roles: ['fx_loggedIn']
+    },
+    'database/:database/_changes': 'changes'
+  },
+
+  events: {
+    "route:reloadDesignDocs": "reloadDesignDocs"
+  },
+
+  initialize: function (route, masterLayout, options) {
+    this.initViews(options[0]);
+    this.listenToLookaheadTray();
+  },
+
+  establish: function () {
+    return [
+      this.designDocs.fetch({ reset: true }),
+      this.allDatabases.fetchOnce()
+    ];
+  },
+
+  initViews: function (dbName) {
+    this.databaseName = dbName;
+    this.database = new Databases.Model({id: this.databaseName});
+    this.allDatabases = this.getAllDatabases();
+
+    this.createDesignDocsCollection();
+
+    this.rightHeader = this.setView("#right-header", new Documents.Views.RightAllDocsHeader({
+      database: this.database
+    }));
+
+    this.addLeftHeader();
+    this.addSidebar();
+  },
+
+  designDocMetadata: function (database, ddoc) {
+    this.removeComponent('#footer');
+    this.removeComponent('#react-headerbar');
+    this.removeComponent('#dashboard-upper-content');
+
+    var designDocInfo = new Resources.DdocInfo({ _id: "_design/" + ddoc }, { database: this.database });
+    DesignDocInfoActions.fetchDesignDocInfo({
+      ddocName: ddoc,
+      designDocInfo: designDocInfo
+    });
+    this.setComponent("#dashboard-lower-content", DesignDocInfoComponents.DesignDocInfo);
+
+    SidebarActions.selectNavItem('designDoc', {
+      designDocName: ddoc,
+      designDocSection: 'metadata'
+    });
+
+    this.leftheader.updateCrumbs(this.getCrumbs(this.database));
+    this.rightHeader.hideQueryOptions();
+
+    this.apiUrl = [designDocInfo.url('apiurl'), designDocInfo.documentation()];
+  },
+
+  /*
+  * docParams are the options collection uses to fetch from the server
+  * urlParams are what are shown in the url and to the user
+  * They are not the same when paginating
+  */
+  allDocs: function (databaseName, options) {
+    var params = this.createParams(options),
+        urlParams = params.urlParams,
+        docParams = params.docParams,
+        collection;
+
+    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) {
+      docParams.include_docs = true;
+      urlParams = params.docParams;
+      var updatedURL = FauxtonAPI.urls('allDocs', 'app', databaseName, '?' + $.param(urlParams));
+      FauxtonAPI.navigate(updatedURL, {trigger: false, replace: true});
+    }
+
+    this.database.buildAllDocs(docParams);
+    collection = this.database.allDocs;
+
+    var tab = 'all-docs';
+    if (docParams.startkey && docParams.startkey.indexOf("_design") > -1) {
+      tab = 'design-docs';
+    }
+
+    SidebarActions.selectNavItem(tab);
+    ComponentsActions.showDeleteDatabaseModal({showDeleteModal: false, dbId: ''});
+
+    this.removeComponent('#dashboard-upper-content');
 
-      cleanup: function () {
-        // we're no longer interested in listening to the lookahead tray event on this route object
-        this.stopListening(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
-        FauxtonAPI.RouteObject.prototype.cleanup.apply(this);
-      }
+    if (!docParams) {
+      docParams = {};
+    }
 
+    var frozenCollection = app.utils.localStorageGet('include_docs_bulkdocs');
+    window.localStorage.removeItem('include_docs_bulkdocs');
+
+    IndexResultsActions.newResultsList({
+      collection: collection,
+      textEmptyIndex: 'No Documents Found',
+      bulkCollection: new Documents.BulkDeleteDocCollection(frozenCollection, { databaseId: this.database.safeID() }),
+    });
+
+    this.database.allDocs.paging.pageSize = IndexResultStores.indexResultsStore.getPerPage();
+
+    this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
+
+    // this used to be a function that returned the object, but be warned: it caused a closure with a reference to
+    // the initial this.database object which can change
+    this.apiUrl = [this.database.allDocs.urlRef("apiurl", urlParams), this.database.allDocs.documentation()];
+
+    // update the rightHeader with the latest & greatest info
+    this.rightHeader.resetQueryOptions({ queryParams: urlParams });
+    this.rightHeader.showQueryOptions();
+  },
+
+  reloadDesignDocs: function (event) {
+    this.addSidebar(); // this ensures the design docs get reloaded
+    if (event && event.selectedTab) {
+      SidebarActions.selectNavItem(event.selectedTab);
+    }
+  },
+
+  changes: function () {
+    ChangesActions.initChanges({
+      databaseName: this.database.id
     });
+    this.setComponent('#dashboard-upper-content', Changes.ChangesHeaderController);
+    this.setComponent("#dashboard-lower-content", Changes.ChangesController);
+
+    this.removeComponent('#footer');
+    this.removeComponent('#react-headerbar');
+
+    this.viewEditor && this.viewEditor.remove();
+
+    SidebarActions.selectNavItem('changes');
+    this.leftheader.updateCrumbs(this.getCrumbs(this.database));
+    this.rightHeader.hideQueryOptions();
+
+    this.apiUrl = function () {
+      return [FauxtonAPI.urls('changes', 'apiurl', this.database.id, ''), this.database.documentation()];
+    };
+  },
+
+  cleanup: function () {
+    // we're no longer interested in listening to the lookahead tray event on this route object
+    this.stopListening(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
+    FauxtonAPI.RouteObject.prototype.cleanup.apply(this);
+  }
+
+});
 
-    return DocumentsRouteObject;
-  });
+export default DocumentsRouteObject;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/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 d1f760a..d371433 100644
--- a/app/addons/documents/routes-index-editor.js
+++ b/app/addons/documents/routes-index-editor.js
@@ -10,174 +10,165 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-
-  // Modules
-  "./helpers",
-  './shared-routes',
-  './views',
-  './index-editor/components.react',
-  './index-editor/actions',
-  '../databases/base',
-  '../fauxton/components',
-  './index-results/stores',
-  './index-results/actions',
-  './index-results/index-results.components.react',
-  './pagination/pagination.react',
-  './header/header.react',
-  './header/header.actions',
-  './sidebar/actions'
-],
-
-function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents, ActionsIndexEditor,
-          Databases, Components, IndexResultsStores, IndexResultsActions,
-          IndexResultsComponents, ReactPagination, ReactHeader, ReactHeaderActions, SidebarActions) {
-
-
-  var IndexEditorAndResults = BaseRoute.extend({
-    layout: 'with_tabs_sidebar',
-    routes: {
-      'database/:database/new_view': {
-        route: 'createView',
-        roles: ['fx_loggedIn']
-      },
-      'database/:database/new_view/:designDoc': {
-        route: 'createView',
-        roles: ['fx_loggedIn']
-      },
-      'database/:database/_design/:ddoc/_view/:view': {
-        route: 'showView',
-        roles: ['fx_loggedIn']
-      },
-      'database/:database/_design/:ddoc/_view/:view/edit': {
-        route: 'editView',
-        roles: ['fx_loggedIn']
-      }
-    },
-
-    initialize: function (route, masterLayout, options) {
-      var databaseName = options[0];
-      this.databaseName = databaseName;
-      this.database = new Databases.Model({id: databaseName});
-      this.allDatabases = new Databases.List();
-      this.createDesignDocsCollection();
-      this.addLeftHeader();
-      this.addSidebar();
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Helpers from "./helpers";
+import BaseRoute from "./shared-routes";
+import Documents from "./views";
+import IndexEditorComponents from "./index-editor/components.react";
+import ActionsIndexEditor from "./index-editor/actions";
+import Databases from "../databases/base";
+import Components from "../fauxton/components";
+import IndexResultsStores from "./index-results/stores";
+import IndexResultsActions from "./index-results/actions";
+import IndexResultsComponents from "./index-results/index-results.components.react";
+import ReactPagination from "./pagination/pagination.react";
+import ReactHeader from "./header/header.react";
+import ReactHeaderActions from "./header/header.actions";
+import SidebarActions from "./sidebar/actions";
+
+
+var IndexEditorAndResults = BaseRoute.extend({
+  layout: 'with_tabs_sidebar',
+  routes: {
+    'database/:database/new_view': {
+      route: 'createView',
+      roles: ['fx_loggedIn']
     },
-
-    establish: function () {
-      return [
-        this.designDocs.fetch({ reset: true }),
-        this.allDatabases.fetchOnce()
-      ];
+    'database/:database/new_view/:designDoc': {
+      route: 'createView',
+      roles: ['fx_loggedIn']
     },
-
-    showView: function (databaseName, ddoc, viewName) {
-      var params = this.createParams(),
-          urlParams = params.urlParams,
-          docParams = params.docParams,
-          decodeDdoc = decodeURIComponent(ddoc);
-
-      this.rightHeader = this.setView('#right-header', new Documents.Views.RightAllDocsHeader({
-        database: this.database
-      }));
-
-      viewName = viewName.replace(/\?.*$/, '');
-      this.setComponent('#footer', ReactPagination.Footer);
-
-      this.indexedDocs = new Documents.IndexCollection(null, {
-        database: this.database,
-        design: decodeDdoc,
-        view: viewName,
-        params: docParams,
-        paging: {
-          pageSize: IndexResultsStores.indexResultsStore.getPerPage()
-        }
-      });
-
-      ActionsIndexEditor.clearIndex();
-
-      IndexResultsActions.newResultsList({
-        collection: this.indexedDocs,
-        bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
-      });
-
-      ActionsIndexEditor.fetchDesignDocsBeforeEdit({
-        viewName: viewName,
-        newView: false,
-        database: this.database,
-        designDocs: this.designDocs,
-        designDocId: '_design/' + decodeDdoc
-      });
-
-      SidebarActions.selectNavItem('designDoc', {
-        designDocName: ddoc,
-        designDocSection: 'Views',
-        indexName: viewName
-      });
-
-      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: true});
-      this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
-
-      this.apiUrl = function () {
-        return [this.indexedDocs.urlRef('apiurl'), FauxtonAPI.constants.DOC_URLS.GENERAL];
-      };
-
-      this.showQueryOptions(urlParams, ddoc, viewName);
+    'database/:database/_design/:ddoc/_view/:view': {
+      route: 'showView',
+      roles: ['fx_loggedIn']
     },
-
-    createView: function (database, _designDoc) {
-      var newDesignDoc = true;
-      var designDoc = 'new-doc';
-
-      if (_designDoc) {
-        designDoc = '_design/' + _designDoc;
-        newDesignDoc = false;
+    'database/:database/_design/:ddoc/_view/:view/edit': {
+      route: 'editView',
+      roles: ['fx_loggedIn']
+    }
+  },
+
+  initialize: function (route, masterLayout, options) {
+    var databaseName = options[0];
+    this.databaseName = databaseName;
+    this.database = new Databases.Model({id: databaseName});
+    this.allDatabases = new Databases.List();
+    this.createDesignDocsCollection();
+    this.addLeftHeader();
+    this.addSidebar();
+  },
+
+  establish: function () {
+    return [
+      this.designDocs.fetch({ reset: true }),
+      this.allDatabases.fetchOnce()
+    ];
+  },
+
+  showView: function (databaseName, ddoc, viewName) {
+    var params = this.createParams(),
+        urlParams = params.urlParams,
+        docParams = params.docParams,
+        decodeDdoc = decodeURIComponent(ddoc);
+
+    this.rightHeader = this.setView('#right-header', new Documents.Views.RightAllDocsHeader({
+      database: this.database
+    }));
+
+    viewName = viewName.replace(/\?.*$/, '');
+    this.setComponent('#footer', ReactPagination.Footer);
+
+    this.indexedDocs = new Documents.IndexCollection(null, {
+      database: this.database,
+      design: decodeDdoc,
+      view: viewName,
+      params: docParams,
+      paging: {
+        pageSize: IndexResultsStores.indexResultsStore.getPerPage()
       }
-
-      ActionsIndexEditor.fetchDesignDocsBeforeEdit({
-        viewName: 'new-view',
-        newView: true,
-        database: this.database,
-        designDocs: this.designDocs,
-        designDocId: designDoc,
-        newDesignDoc: newDesignDoc
-      });
-
-      this.removeComponent('#react-headerbar');
-      this.removeComponent('#footer');
-      this.setComponent('#dashboard-lower-content', IndexEditorComponents.EditorController);
-      SidebarActions.selectNavItem('');
-    },
-
-    editView: function (databaseName, ddocName, viewName) {
-      ActionsIndexEditor.fetchDesignDocsBeforeEdit({
-        viewName: viewName,
-        newView: false,
-        database: this.database,
-        designDocs: this.designDocs,
-        designDocId: '_design/' + ddocName
-      });
-
-      SidebarActions.selectNavItem('designDoc', {
-        designDocName: ddocName,
-        designDocSection: 'Views',
-        indexName: viewName
-      });
-
-      this.apiUrl = function () {
-        return [FauxtonAPI.urls('view', 'apiurl', databaseName, ddocName, viewName), FauxtonAPI.constants.DOC_URLS.GENERAL];
-      };
-
-      this.removeView('#right-header');
-      this.removeComponent('#react-headerbar');
-      this.removeComponent('#footer');
-      this.setComponent('#dashboard-lower-content', IndexEditorComponents.EditorController);
+    });
+
+    ActionsIndexEditor.clearIndex();
+
+    IndexResultsActions.newResultsList({
+      collection: this.indexedDocs,
+      bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
+    });
+
+    ActionsIndexEditor.fetchDesignDocsBeforeEdit({
+      viewName: viewName,
+      newView: false,
+      database: this.database,
+      designDocs: this.designDocs,
+      designDocId: '_design/' + decodeDdoc
+    });
+
+    SidebarActions.selectNavItem('designDoc', {
+      designDocName: ddoc,
+      designDocSection: 'Views',
+      indexName: viewName
+    });
+
+    this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: true});
+    this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
+
+    this.apiUrl = function () {
+      return [this.indexedDocs.urlRef('apiurl'), FauxtonAPI.constants.DOC_URLS.GENERAL];
+    };
+
+    this.showQueryOptions(urlParams, ddoc, viewName);
+  },
+
+  createView: function (database, _designDoc) {
+    var newDesignDoc = true;
+    var designDoc = 'new-doc';
+
+    if (_designDoc) {
+      designDoc = '_design/' + _designDoc;
+      newDesignDoc = false;
     }
 
-  });
+    ActionsIndexEditor.fetchDesignDocsBeforeEdit({
+      viewName: 'new-view',
+      newView: true,
+      database: this.database,
+      designDocs: this.designDocs,
+      designDocId: designDoc,
+      newDesignDoc: newDesignDoc
+    });
+
+    this.removeComponent('#react-headerbar');
+    this.removeComponent('#footer');
+    this.setComponent('#dashboard-lower-content', IndexEditorComponents.EditorController);
+    SidebarActions.selectNavItem('');
+  },
+
+  editView: function (databaseName, ddocName, viewName) {
+    ActionsIndexEditor.fetchDesignDocsBeforeEdit({
+      viewName: viewName,
+      newView: false,
+      database: this.database,
+      designDocs: this.designDocs,
+      designDocId: '_design/' + ddocName
+    });
+
+    SidebarActions.selectNavItem('designDoc', {
+      designDocName: ddocName,
+      designDocSection: 'Views',
+      indexName: viewName
+    });
+
+    this.apiUrl = function () {
+      return [FauxtonAPI.urls('view', 'apiurl', databaseName, ddocName, viewName), FauxtonAPI.constants.DOC_URLS.GENERAL];
+    };
+
+    this.removeView('#right-header');
+    this.removeComponent('#react-headerbar');
+    this.removeComponent('#footer');
+    this.setComponent('#dashboard-lower-content', IndexEditorComponents.EditorController);
+  }
 
-  return IndexEditorAndResults;
 });
+
+export default IndexEditorAndResults;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/routes-mango.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-mango.js b/app/addons/documents/routes-mango.js
index ee11d34..b76f799 100644
--- a/app/addons/documents/routes-mango.js
+++ b/app/addons/documents/routes-mango.js
@@ -10,158 +10,145 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  // Modules
-  './helpers',
-  './shared-routes',
-  '../databases/resources',
-
-  '../fauxton/components',
-  './resources',
-  './views',
-  './index-results/actions',
-  './index-results/stores',
-
-  './header/header.react',
-  './header/header.actions',
-  './pagination/pagination.react',
-
-  './mango/mango.components.react',
-  './mango/mango.actions',
-  './mango/mango.stores',
-  './index-results/index-results.components.react',
-  './sidebar/actions',
-],
-
-
-function (app, FauxtonAPI, Helpers, BaseRoute, Databases,
-  Components, Resources, Documents, IndexResultsActions, IndexResultStores,
-  ReactHeader, ReactActions, ReactPagination,
-  MangoComponents, MangoActions, MangoStores, IndexResultsComponents, SidebarActions) {
-
-  var MangoIndexEditorAndQueryEditor = BaseRoute.extend({
-    layout: 'two_pane',
-    routes: {
-      'database/:database/_index': {
-        route: 'createIndex',
-        roles: ['fx_loggedIn']
-      },
-      'database/:database/_find': {
-        route: 'findUsingIndex',
-        roles: ['fx_loggedIn']
-      },
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Helpers from "./helpers";
+import BaseRoute from "./shared-routes";
+import Databases from "../databases/resources";
+import Components from "../fauxton/components";
+import Resources from "./resources";
+import Documents from "./views";
+import IndexResultsActions from "./index-results/actions";
+import IndexResultStores from "./index-results/stores";
+import ReactHeader from "./header/header.react";
+import ReactActions from "./header/header.actions";
+import ReactPagination from "./pagination/pagination.react";
+import MangoComponents from "./mango/mango.components.react";
+import MangoActions from "./mango/mango.actions";
+import MangoStores from "./mango/mango.stores";
+import IndexResultsComponents from "./index-results/index-results.components.react";
+import SidebarActions from "./sidebar/actions";
+
+var MangoIndexEditorAndQueryEditor = BaseRoute.extend({
+  layout: 'two_pane',
+  routes: {
+    'database/:database/_index': {
+      route: 'createIndex',
+      roles: ['fx_loggedIn']
     },
-
-    initialize: function (route, masterLayout, options) {
-      var databaseName = options[0];
-      this.databaseName = databaseName;
-      this.database = new Databases.Model({id: databaseName});
-
-      // magic methods
-      this.allDatabases = this.getAllDatabases();
-      this.createDesignDocsCollection();
-      this.addLeftHeader();
-
-      MangoActions.setDatabase({
-        database: this.database
-      });
+    'database/:database/_find': {
+      route: 'findUsingIndex',
+      roles: ['fx_loggedIn']
     },
-
-    findUsingIndex: function () {
-      var params = this.createParams(),
-          urlParams = params.urlParams,
-          mangoResultCollection = new Resources.MangoDocumentCollection(null, {
-            database: this.database,
-            paging: {
-              pageSize: IndexResultStores.indexResultsStore.getPerPage()
-            }
-          }),
-          mangoIndexList = new Resources.MangoIndexCollection(null, {
-            database: this.database,
-            params: null,
-            paging: {
-              pageSize: IndexResultStores.indexResultsStore.getPerPage()
-            }
-          });
-
-      SidebarActions.selectNavItem('mango-query');
-      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
-      this.setComponent('#footer', ReactPagination.Footer);
-
-      IndexResultsActions.newMangoResultsList({
-        collection: mangoResultCollection,
-        textEmptyIndex: 'No Results',
-        bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
-      });
-
-      MangoActions.getIndexList({
-        indexList: mangoIndexList
-      });
-
-      var url = FauxtonAPI.urls('allDocs', 'app', this.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT);
-      this.breadcrumbs = this.setView('#breadcrumbs', new Components.Breadcrumbs({
-        toggleDisabled: true,
-        crumbs: [
-          {'type': 'back', 'link': url},
-          {'name': app.i18n.en_US['mango-title-editor'], 'link': url}
-        ]
-      }));
-
-      this.setComponent('#left-content', MangoComponents.MangoQueryEditorController, {
-        description: app.i18n.en_US['mango-descripton'],
-        editorTitle: app.i18n.en_US['mango-title-editor'],
-        additionalIndexesText: app.i18n.en_US['mango-additional-indexes-heading']
-      });
-      this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
-
-      this.apiUrl = function () {
-        return [mangoResultCollection.urlRef('query-apiurl', urlParams), FauxtonAPI.constants.DOC_URLS.MANGO_SEARCH];
-      };
-    },
-
-    createIndex: function (database) {
-      var params = this.createParams(),
-          urlParams = params.urlParams,
-          mangoIndexCollection = new Resources.MangoIndexCollection(null, {
-            database: this.database,
-            params: null,
-            paging: {
-              pageSize: IndexResultStores.indexResultsStore.getPerPage()
-            }
-          });
-
-      IndexResultsActions.newResultsList({
-        collection: mangoIndexCollection,
-        bulkCollection: new Documents.MangoBulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
-        typeOfIndex: 'mango'
-      });
-
-      var url = FauxtonAPI.urls('allDocs', 'app', this.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT);
-      this.breadcrumbs = this.setView('#breadcrumbs', new Components.Breadcrumbs({
-        toggleDisabled: true,
-        crumbs: [
-          {'type': 'back', 'link': url},
-          {'name': app.i18n.en_US['mango-indexeditor-title'], 'link': url }
-        ]
-      }));
-
-      this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
-      this.setComponent('#footer', ReactPagination.Footer);
-
-      this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
-      this.setComponent('#left-content', MangoComponents.MangoIndexEditorController, {
-        description: app.i18n.en_US['mango-descripton-index-editor']
-      });
-
-      this.apiUrl = function () {
-        return [mangoIndexCollection.urlRef('index-apiurl', urlParams), FauxtonAPI.constants.DOC_URLS.MANGO_INDEX];
-      };
-    }
-  });
-
-  return {
-    MangoIndexEditorAndQueryEditor: MangoIndexEditorAndQueryEditor
-  };
+  },
+
+  initialize: function (route, masterLayout, options) {
+    var databaseName = options[0];
+    this.databaseName = databaseName;
+    this.database = new Databases.Model({id: databaseName});
+
+    // magic methods
+    this.allDatabases = this.getAllDatabases();
+    this.createDesignDocsCollection();
+    this.addLeftHeader();
+
+    MangoActions.setDatabase({
+      database: this.database
+    });
+  },
+
+  findUsingIndex: function () {
+    var params = this.createParams(),
+        urlParams = params.urlParams,
+        mangoResultCollection = new Resources.MangoDocumentCollection(null, {
+          database: this.database,
+          paging: {
+            pageSize: IndexResultStores.indexResultsStore.getPerPage()
+          }
+        }),
+        mangoIndexList = new Resources.MangoIndexCollection(null, {
+          database: this.database,
+          params: null,
+          paging: {
+            pageSize: IndexResultStores.indexResultsStore.getPerPage()
+          }
+        });
+
+    SidebarActions.selectNavItem('mango-query');
+    this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
+    this.setComponent('#footer', ReactPagination.Footer);
+
+    IndexResultsActions.newMangoResultsList({
+      collection: mangoResultCollection,
+      textEmptyIndex: 'No Results',
+      bulkCollection: new Documents.BulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
+    });
+
+    MangoActions.getIndexList({
+      indexList: mangoIndexList
+    });
+
+    var url = FauxtonAPI.urls('allDocs', 'app', this.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT);
+    this.breadcrumbs = this.setView('#breadcrumbs', new Components.Breadcrumbs({
+      toggleDisabled: true,
+      crumbs: [
+        {'type': 'back', 'link': url},
+        {'name': app.i18n.en_US['mango-title-editor'], 'link': url}
+      ]
+    }));
+
+    this.setComponent('#left-content', MangoComponents.MangoQueryEditorController, {
+      description: app.i18n.en_US['mango-descripton'],
+      editorTitle: app.i18n.en_US['mango-title-editor'],
+      additionalIndexesText: app.i18n.en_US['mango-additional-indexes-heading']
+    });
+    this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
+
+    this.apiUrl = function () {
+      return [mangoResultCollection.urlRef('query-apiurl', urlParams), FauxtonAPI.constants.DOC_URLS.MANGO_SEARCH];
+    };
+  },
+
+  createIndex: function (database) {
+    var params = this.createParams(),
+        urlParams = params.urlParams,
+        mangoIndexCollection = new Resources.MangoIndexCollection(null, {
+          database: this.database,
+          params: null,
+          paging: {
+            pageSize: IndexResultStores.indexResultsStore.getPerPage()
+          }
+        });
+
+    IndexResultsActions.newResultsList({
+      collection: mangoIndexCollection,
+      bulkCollection: new Documents.MangoBulkDeleteDocCollection([], { databaseId: this.database.safeID() }),
+      typeOfIndex: 'mango'
+    });
+
+    var url = FauxtonAPI.urls('allDocs', 'app', this.database.safeID(), '?limit=' + FauxtonAPI.constants.DATABASES.DOCUMENT_LIMIT);
+    this.breadcrumbs = this.setView('#breadcrumbs', new Components.Breadcrumbs({
+      toggleDisabled: true,
+      crumbs: [
+        {'type': 'back', 'link': url},
+        {'name': app.i18n.en_US['mango-indexeditor-title'], 'link': url }
+      ]
+    }));
+
+    this.setComponent('#react-headerbar', ReactHeader.BulkDocumentHeaderController, {showIncludeAllDocs: false});
+    this.setComponent('#footer', ReactPagination.Footer);
+
+    this.setComponent('#dashboard-lower-content', IndexResultsComponents.List);
+    this.setComponent('#left-content', MangoComponents.MangoIndexEditorController, {
+      description: app.i18n.en_US['mango-descripton-index-editor']
+    });
+
+    this.apiUrl = function () {
+      return [mangoIndexCollection.urlRef('index-apiurl', urlParams), FauxtonAPI.constants.DOC_URLS.MANGO_INDEX];
+    };
+  }
 });
+
+export default {
+  MangoIndexEditorAndQueryEditor: MangoIndexEditorAndQueryEditor
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index f994780..3d09471 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -10,23 +10,17 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  './views',
-  './routes-documents',
-  './routes-doc-editor',
-  './routes-index-editor',
-  './routes-mango'
-],
+import Documents from "./views";
+import DocumentsRouteObject from "./routes-documents";
+import docEditor from "./routes-doc-editor";
+import IndexEditorRouteObject from "./routes-index-editor";
+import Mango from "./routes-mango";
+Documents.RouteObjects = [
+  docEditor.DocEditorRouteObject,
+  docEditor.RevBrowserRouteObject,
+  DocumentsRouteObject,
+  IndexEditorRouteObject,
+  Mango.MangoIndexEditorAndQueryEditor
+];
 
-
-function (Documents, DocumentsRouteObject, docEditor, IndexEditorRouteObject, Mango) {
-  Documents.RouteObjects = [
-    docEditor.DocEditorRouteObject,
-    docEditor.RevBrowserRouteObject,
-    DocumentsRouteObject,
-    IndexEditorRouteObject,
-    Mango.MangoIndexEditorAndQueryEditor
-  ];
-
-  return Documents;
-});
+export default Documents;


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/shared-resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/shared-resources.js b/app/addons/documents/shared-resources.js
index 0dc3346..3499ae9 100644
--- a/app/addons/documents/shared-resources.js
+++ b/app/addons/documents/shared-resources.js
@@ -10,300 +10,297 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  '../../../assets/js/plugins/cloudant.pagingcollection'
-], function (app, FauxtonAPI, PagingCollection) {
-
-  // defined here because this is contains the base resources used throughout the addon and outside,
-  // so it's the first code that gets run
-  var Documents = FauxtonAPI.addon();
-
-
-  Documents.Doc = FauxtonAPI.Model.extend({
-    idAttribute: "_id",
-    documentation: function () {
-      return FauxtonAPI.constants.DOC_URLS.GENERAL;
-    },
-
-    url: function (context) {
-      if (context === undefined) {
-        context = 'server';
-      }
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import PagingCollection from "../../../assets/js/plugins/cloudant.pagingcollection";
 
-      // new without id make a POST to the DB and not a PUT on a DB
-      let id = this.safeID();
-      if (!id) {
-        id = '';
-      }
+// defined here because this is contains the base resources used throughout the addon and outside,
+// so it's the first code that gets run
+var Documents = FauxtonAPI.addon();
 
-      const query = this.fetchConflicts ? '?conflicts=true' : '';
-      return FauxtonAPI.urls('document', context, this.getDatabase().safeID(), id, query);
-    },
 
-    initialize: function (_attrs, options) {
-      if (this.collection && this.collection.database) {
-        this.database = this.collection.database;
-      } else if (options.database) {
-        this.database = options.database;
-      }
+Documents.Doc = FauxtonAPI.Model.extend({
+  idAttribute: "_id",
+  documentation: function () {
+    return FauxtonAPI.constants.DOC_URLS.GENERAL;
+  },
 
-      if (options.fetchConflicts) {
-        this.fetchConflicts = true;
-      }
-    },
+  url: function (context) {
+    if (context === undefined) {
+      context = 'server';
+    }
 
-    // HACK: the doc needs to know about the database, but it may be
-    // set directly or indirectly in all docs
-    getDatabase: function () {
-      return this.database ? this.database : this.collection.database;
-    },
+    // new without id make a POST to the DB and not a PUT on a DB
+    let id = this.safeID();
+    if (!id) {
+      id = '';
+    }
 
-    validate: function (attrs, options) {
-      if (this.id && this.id !== attrs._id && this.get('_rev') ) {
-        return "Cannot change a documents id.";
-      }
-    },
+    const query = this.fetchConflicts ? '?conflicts=true' : '';
+    return FauxtonAPI.urls('document', context, this.getDatabase().safeID(), id, query);
+  },
 
-    docType: function () {
-      return app.utils.getDocTypeFromId(this.id);
-    },
+  initialize: function (_attrs, options) {
+    if (this.collection && this.collection.database) {
+      this.database = this.collection.database;
+    } else if (options.database) {
+      this.database = options.database;
+    }
 
-    // @deprecated, see isJSONDocBulkDeletable
-    isBulkDeletable: function () {
-      return !!this.id && !!this.get('_rev');
-    },
+    if (options.fetchConflicts) {
+      this.fetchConflicts = true;
+    }
+  },
 
-    isDeletable: function () {
-      return !!this.id;
-    },
+  // HACK: the doc needs to know about the database, but it may be
+  // set directly or indirectly in all docs
+  getDatabase: function () {
+    return this.database ? this.database : this.collection.database;
+  },
 
-    isFromView: function () {
-      return !this.id;
-    },
+  validate: function (attrs, options) {
+    if (this.id && this.id !== attrs._id && this.get('_rev') ) {
+      return "Cannot change a documents id.";
+    }
+  },
 
-    isMangoDoc: function () {
-      if (!this.isDdoc()) return false;
-      if (this.get('language') === 'query') {
-        return true;
-      }
+  docType: function () {
+    return app.utils.getDocTypeFromId(this.id);
+  },
 
-      if (this.get('doc') && this.get('doc').language === 'query') {
-        return true;
-      }
+  // @deprecated, see isJSONDocBulkDeletable
+  isBulkDeletable: function () {
+    return !!this.id && !!this.get('_rev');
+  },
 
-      return false;
-    },
+  isDeletable: function () {
+    return !!this.id;
+  },
 
-    isDdoc: function () {
-      return this.docType() === "design doc";
-    },
+  isFromView: function () {
+    return !this.id;
+  },
 
-    setDdocView: function (view, map, reduce) {
-      if (!this.isDdoc()) {
-        return false;
-      }
+  isMangoDoc: function () {
+    if (!this.isDdoc()) return false;
+    if (this.get('language') === 'query') {
+      return true;
+    }
 
-      var views = this.get('views'),
-          tempView = views[view] || {};
+    if (this.get('doc') && this.get('doc').language === 'query') {
+      return true;
+    }
 
-      if (reduce) {
-        tempView.reduce = reduce;
-      } else {
-        delete tempView.reduce;
-      }
-      tempView.map = map;
+    return false;
+  },
 
-      views[view] = tempView;
-      this.set({views: views});
+  isDdoc: function () {
+    return this.docType() === "design doc";
+  },
 
-      return true;
-    },
+  setDdocView: function (view, map, reduce) {
+    if (!this.isDdoc()) {
+      return false;
+    }
 
-    removeDdocView: function (viewName) {
-      if (!this.isDdoc()) return false;
-      var views = this.get('views');
+    var views = this.get('views'),
+        tempView = views[view] || {};
 
-      delete views[viewName];
-      this.set({views: views});
-    },
+    if (reduce) {
+      tempView.reduce = reduce;
+    } else {
+      delete tempView.reduce;
+    }
+    tempView.map = map;
 
-    dDocModel: function () {
-      if (!this.isDdoc()) return false;
-      var doc = this.get('doc');
+    views[view] = tempView;
+    this.set({views: views});
 
-      if (doc) {
-        doc._rev = this.get('_rev');
-        return new Documents.Doc(doc, {database: this.database});
-      }
+    return true;
+  },
 
-      return this;
-    },
-
-    safeID: function () {
-      return app.utils.getSafeIdForDoc(this.id);
-    },
-
-    destroy: function () {
-      var url = this.url() + "?rev=" + this.get('_rev');
-      return $.ajax({
-        url: url,
-        dataType: 'json',
-        type: 'DELETE'
-      });
-    },
-
-    parse: function (resp) {
-      if (resp.rev) {
-        resp._rev = resp.rev;
-        delete resp.rev;
-      }
-      if (resp.id) {
-        if (_.isUndefined(this.id)) {
-          resp._id = resp.id;
-        }
-      }
+  removeDdocView: function (viewName) {
+    if (!this.isDdoc()) return false;
+    var views = this.get('views');
 
-      if (resp.ok) {
-        delete resp.id;
-        delete resp.ok;
+    delete views[viewName];
+    this.set({views: views});
+  },
+
+  dDocModel: function () {
+    if (!this.isDdoc()) return false;
+    var doc = this.get('doc');
+
+    if (doc) {
+      doc._rev = this.get('_rev');
+      return new Documents.Doc(doc, {database: this.database});
+    }
+
+    return this;
+  },
+
+  safeID: function () {
+    return app.utils.getSafeIdForDoc(this.id);
+  },
+
+  destroy: function () {
+    var url = this.url() + "?rev=" + this.get('_rev');
+    return $.ajax({
+      url: url,
+      dataType: 'json',
+      type: 'DELETE'
+    });
+  },
+
+  parse: function (resp) {
+    if (resp.rev) {
+      resp._rev = resp.rev;
+      delete resp.rev;
+    }
+    if (resp.id) {
+      if (_.isUndefined(this.id)) {
+        resp._id = resp.id;
       }
+    }
 
-      return resp;
-    },
+    if (resp.ok) {
+      delete resp.id;
+      delete resp.ok;
+    }
 
-    prettyJSON: function () {
-      var data = this.get("doc") ? this.get("doc") : this.attributes;
+    return resp;
+  },
 
-      return JSON.stringify(data, null, "  ");
-    },
+  prettyJSON: function () {
+    var data = this.get("doc") ? this.get("doc") : this.attributes;
 
-    copy: function (copyId) {
-      return $.ajax({
-        type: 'COPY',
-        url: '/' + this.database.safeID() + '/' + this.safeID(),
-        headers: {Destination: copyId}
-      });
-    },
+    return JSON.stringify(data, null, "  ");
+  },
 
-    isNewDoc: function () {
-      return this.get('_rev') ? false : true;
-    }
-  });
+  copy: function (copyId) {
+    return $.ajax({
+      type: 'COPY',
+      url: '/' + this.database.safeID() + '/' + this.safeID(),
+      headers: {Destination: copyId}
+    });
+  },
 
+  isNewDoc: function () {
+    return this.get('_rev') ? false : true;
+  }
+});
 
-  Documents.AllDocs = PagingCollection.extend({
-    model: Documents.Doc,
-    documentation: function () {
-      return FauxtonAPI.constants.DOC_URLS.GENERAL;
-    },
-    initialize: function (_models, options) {
-      this.viewMeta = options.viewMeta;
-      this.database = options.database;
-      this.params = _.clone(options.params);
 
-      this.on("remove", this.decrementTotalRows, this);
-      this.perPageLimit = options.perPageLimit || 20;
+Documents.AllDocs = PagingCollection.extend({
+  model: Documents.Doc,
+  documentation: function () {
+    return FauxtonAPI.constants.DOC_URLS.GENERAL;
+  },
+  initialize: function (_models, options) {
+    this.viewMeta = options.viewMeta;
+    this.database = options.database;
+    this.params = _.clone(options.params);
 
-      if (!this.params.limit) {
-        this.params.limit = this.perPageLimit;
-      }
-    },
+    this.on("remove", this.decrementTotalRows, this);
+    this.perPageLimit = options.perPageLimit || 20;
 
-    isEditable: function () {
-      return true;
-    },
-
-    urlRef: function (context, params) {
-      var query = "";
-
-      if (params) {
-        if (!_.isEmpty(params)) {
-          query = "?" + $.param(params);
-        } else {
-          query = '';
-        }
-      } else if (this.params) {
-        query = "?" + $.param(this.params);
-      }
-      if (_.isUndefined(context)) {
-        context = 'server';
-      }
-      return FauxtonAPI.urls('allDocs', context, this.database.safeID(), query);
-    },
-
-    url: function () {
-      return this.urlRef.apply(this, arguments);
-    },
-
-    simple: function () {
-      var docs = this.map(function (item) {
-        return {
-          _id: item.id,
-          _rev: item.get('_rev'),
-        };
-      });
-
-      return new Documents.AllDocs(docs, {
-        database: this.database,
-        params: this.params
-      });
-    },
-
-    totalRows: function () {
-      return this.viewMeta.total_rows || "unknown";
-    },
-
-    decrementTotalRows: function () {
-      if (this.viewMeta.total_rows) {
-        this.viewMeta.total_rows = this.viewMeta.total_rows - 1;
-        this.trigger('totalRows:decrement');
-      }
-    },
+    if (!this.params.limit) {
+      this.params.limit = this.perPageLimit;
+    }
+  },
+
+  isEditable: function () {
+    return true;
+  },
+
+  urlRef: function (context, params) {
+    var query = "";
 
-    updateSeq: function () {
-      if (!this.viewMeta) {
-        return false;
+    if (params) {
+      if (!_.isEmpty(params)) {
+        query = "?" + $.param(params);
+      } else {
+        query = '';
       }
-      return this.viewMeta.update_seq || false;
-    },
-
-    parse: function (resp) {
-      var rows = resp.rows;
-
-      // remove any query errors that may return without doc info
-      // important for when querying keys on all docs
-      var cleanRows = _.filter(rows, function (row) {
-        return row.value;
-      });
-
-      resp.rows = _.map(cleanRows, function (row) {
-        var res = {
-          _id: row.id,
-          _rev: row.value.rev,
-          value: row.value,
-          key: row.key
-        };
-
-        if (row.doc) {
-          res.doc = row.doc;
-        }
-
-        return res;
-      });
-
-      return PagingCollection.prototype.parse.call(this, resp);
-    },
-
-    clone: function () {
-      return new this.constructor(this.models, {
-        database: this.database,
-        params: this.params,
-        paging: this.paging
-      });
+    } else if (this.params) {
+      query = "?" + $.param(this.params);
+    }
+    if (_.isUndefined(context)) {
+      context = 'server';
+    }
+    return FauxtonAPI.urls('allDocs', context, this.database.safeID(), query);
+  },
+
+  url: function () {
+    return this.urlRef.apply(this, arguments);
+  },
+
+  simple: function () {
+    var docs = this.map(function (item) {
+      return {
+        _id: item.id,
+        _rev: item.get('_rev'),
+      };
+    });
+
+    return new Documents.AllDocs(docs, {
+      database: this.database,
+      params: this.params
+    });
+  },
+
+  totalRows: function () {
+    return this.viewMeta.total_rows || "unknown";
+  },
+
+  decrementTotalRows: function () {
+    if (this.viewMeta.total_rows) {
+      this.viewMeta.total_rows = this.viewMeta.total_rows - 1;
+      this.trigger('totalRows:decrement');
     }
-  });
+  },
 
-  return Documents;
+  updateSeq: function () {
+    if (!this.viewMeta) {
+      return false;
+    }
+    return this.viewMeta.update_seq || false;
+  },
+
+  parse: function (resp) {
+    var rows = resp.rows;
+
+    // remove any query errors that may return without doc info
+    // important for when querying keys on all docs
+    var cleanRows = _.filter(rows, function (row) {
+      return row.value;
+    });
+
+    resp.rows = _.map(cleanRows, function (row) {
+      var res = {
+        _id: row.id,
+        _rev: row.value.rev,
+        value: row.value,
+        key: row.key
+      };
+
+      if (row.doc) {
+        res.doc = row.doc;
+      }
+
+      return res;
+    });
+
+    return PagingCollection.prototype.parse.call(this, resp);
+  },
+
+  clone: function () {
+    return new this.constructor(this.models, {
+      database: this.database,
+      params: this.params,
+      paging: this.paging
+    });
+  }
 });
+
+export default Documents;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/shared-routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/shared-routes.js b/app/addons/documents/shared-routes.js
index 9dd7a29..7a2c620 100644
--- a/app/addons/documents/shared-routes.js
+++ b/app/addons/documents/shared-routes.js
@@ -10,142 +10,138 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './shared-resources',
-  '../databases/base',
-  '../fauxton/components',
-  './pagination/actions',
-  './index-results/stores',
-   './sidebar/sidebar.react',
-   './sidebar/actions'
-], function (app, FauxtonAPI, Documents, Databases, Components, PaginationActions, IndexResultStores,
-  SidebarComponents, SidebarActions) {
-
-
-  // The Documents section is built up a lot of different route object which share code. This contains
-  // base functionality that can be used across routes / addons
-  var BaseRoute = FauxtonAPI.RouteObject.extend({
-    layout: 'with_tabs_sidebar',
-    selectedHeader: 'Databases',
-    overrideBreadcrumbs: true,
-
-    createDesignDocsCollection: function () {
-      this.designDocs = new Documents.AllDocs(null, {
-        database: this.database,
-        paging: {
-          pageSize: 500
-        },
-        params: {
-          startkey: '_design/',
-          endkey: '_design0',
-          include_docs: true,
-          limit: 500
-        }
-      });
-    },
-
-    onSelectDatabase: function (dbName) {
-      this.cleanup();
-      this.initViews(dbName);
-
-      var url = FauxtonAPI.urls('allDocs', 'app',  app.utils.safeURLName(dbName), '');
-      FauxtonAPI.navigate(url, {
-        trigger: true
-      });
-
-      // we need to start listening again because cleanup() removed the listener, but in this case
-      // initialize() doesn't fire to re-set up the listener
-      this.listenToLookaheadTray();
-    },
-
-    listenToLookaheadTray: function () {
-      this.listenTo(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
-    },
-
-    getAllDatabases: function () {
-      return new Databases.List();  //getAllDatabases() can be overwritten instead of hard coded into initViews
-    },
-
-    showQueryOptions: function (urlParams, ddoc, viewName) {
-      var promise = this.designDocs.fetch({reset: true}),
-      that = this,
-      hasReduceFunction;
-
-      promise.then(function (resp) {
-        var design = _.findWhere(that.designDocs.models, {id: '_design/' + ddoc});
-        !_.isUndefined(hasReduceFunction = design.attributes.doc.views[viewName].reduce);
-
-        that.rightHeader.showQueryOptions();
-        that.rightHeader.resetQueryOptions({
-          queryParams: urlParams,
-          hasReduce: hasReduceFunction,
-          showReduce: !_.isUndefined(hasReduceFunction),
-          viewName: viewName,
-          ddocName: ddoc
-        });
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Documents from "./shared-resources";
+import Databases from "../databases/base";
+import Components from "../fauxton/components";
+import PaginationActions from "./pagination/actions";
+import IndexResultStores from "./index-results/stores";
+import SidebarComponents from "./sidebar/sidebar.react";
+import SidebarActions from "./sidebar/actions";
+
+
+// The Documents section is built up a lot of different route object which share code. This contains
+// base functionality that can be used across routes / addons
+var BaseRoute = FauxtonAPI.RouteObject.extend({
+  layout: 'with_tabs_sidebar',
+  selectedHeader: 'Databases',
+  overrideBreadcrumbs: true,
+
+  createDesignDocsCollection: function () {
+    this.designDocs = new Documents.AllDocs(null, {
+      database: this.database,
+      paging: {
+        pageSize: 500
+      },
+      params: {
+        startkey: '_design/',
+        endkey: '_design0',
+        include_docs: true,
+        limit: 500
+      }
+    });
+  },
+
+  onSelectDatabase: function (dbName) {
+    this.cleanup();
+    this.initViews(dbName);
+
+    var url = FauxtonAPI.urls('allDocs', 'app',  app.utils.safeURLName(dbName), '');
+    FauxtonAPI.navigate(url, {
+      trigger: true
+    });
+
+    // we need to start listening again because cleanup() removed the listener, but in this case
+    // initialize() doesn't fire to re-set up the listener
+    this.listenToLookaheadTray();
+  },
+
+  listenToLookaheadTray: function () {
+    this.listenTo(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
+  },
+
+  getAllDatabases: function () {
+    return new Databases.List();  //getAllDatabases() can be overwritten instead of hard coded into initViews
+  },
+
+  showQueryOptions: function (urlParams, ddoc, viewName) {
+    var promise = this.designDocs.fetch({reset: true}),
+    that = this,
+    hasReduceFunction;
+
+    promise.then(function (resp) {
+      var design = _.findWhere(that.designDocs.models, {id: '_design/' + ddoc});
+      !_.isUndefined(hasReduceFunction = design.attributes.doc.views[viewName].reduce);
+
+      that.rightHeader.showQueryOptions();
+      that.rightHeader.resetQueryOptions({
+        queryParams: urlParams,
+        hasReduce: hasReduceFunction,
+        showReduce: !_.isUndefined(hasReduceFunction),
+        viewName: viewName,
+        ddocName: ddoc
       });
-    },
-
-    addLeftHeader: function () {
-      this.leftheader = this.setView('#breadcrumbs', new Components.LeftHeader({
-        databaseName: this.database.safeID(),
-        crumbs: this.getCrumbs(this.database),
-        lookaheadTrayOptions: {
-          databaseCollection: this.allDatabases,
-          toggleEventName: 'lookaheadTray:toggle',
-          onUpdateEventName: 'lookaheadTray:update',
-          placeholder: 'Enter database name'
-        }
-      }));
-    },
-
-    addSidebar: function (selectedNavItem) {
-      var options = {
-        designDocs: this.designDocs,
-        database: this.database
-      };
-      if (selectedNavItem) {
-        options.selectedNavItem = selectedNavItem;
+    });
+  },
+
+  addLeftHeader: function () {
+    this.leftheader = this.setView('#breadcrumbs', new Components.LeftHeader({
+      databaseName: this.database.safeID(),
+      crumbs: this.getCrumbs(this.database),
+      lookaheadTrayOptions: {
+        databaseCollection: this.allDatabases,
+        toggleEventName: 'lookaheadTray:toggle',
+        onUpdateEventName: 'lookaheadTray:update',
+        placeholder: 'Enter database name'
       }
-
-      SidebarActions.newOptions(options);
-      this.setComponent("#sidebar-content", SidebarComponents.SidebarController);
-    },
-
-    getCrumbs: function (database) {
-      var name = _.isObject(database) ? database.id : database,
-        dbname = app.utils.safeURLName(name);
-
-      return [
-        { "type": "back", "link": FauxtonAPI.urls('allDBs', 'app')},
-        { "name": database.id, "link": FauxtonAPI.urls('allDocs', 'app', dbname, '?limit=' + Databases.DocLimit), className: "lookahead-tray-link" }
-      ];
-    },
-
-    ddocInfo: function (designDoc, designDocs, view) {
-      return {
-        id: "_design/" + designDoc,
-        currView: view,
-        designDocs: designDocs
-      };
-    },
-
-    createParams: function (options) {
-      var urlParams = app.getParams(options),
-          params = Documents.QueryParams.parse(urlParams);
-
-      PaginationActions.setDocumentLimit(parseInt(urlParams.limit, 10));
-
-      var limit = IndexResultStores.indexResultsStore.getPerPage();
-      return {
-        urlParams: urlParams,
-        docParams: _.extend(params, {limit: limit})
-      };
+    }));
+  },
+
+  addSidebar: function (selectedNavItem) {
+    var options = {
+      designDocs: this.designDocs,
+      database: this.database
+    };
+    if (selectedNavItem) {
+      options.selectedNavItem = selectedNavItem;
     }
-  });
-
 
-  return BaseRoute;
+    SidebarActions.newOptions(options);
+    this.setComponent("#sidebar-content", SidebarComponents.SidebarController);
+  },
+
+  getCrumbs: function (database) {
+    var name = _.isObject(database) ? database.id : database,
+      dbname = app.utils.safeURLName(name);
+
+    return [
+      { "type": "back", "link": FauxtonAPI.urls('allDBs', 'app')},
+      { "name": database.id, "link": FauxtonAPI.urls('allDocs', 'app', dbname, '?limit=' + Databases.DocLimit), className: "lookahead-tray-link" }
+    ];
+  },
+
+  ddocInfo: function (designDoc, designDocs, view) {
+    return {
+      id: "_design/" + designDoc,
+      currView: view,
+      designDocs: designDocs
+    };
+  },
+
+  createParams: function (options) {
+    var urlParams = app.getParams(options),
+        params = Documents.QueryParams.parse(urlParams);
+
+    PaginationActions.setDocumentLimit(parseInt(urlParams.limit, 10));
+
+    var limit = IndexResultStores.indexResultsStore.getPerPage();
+    return {
+      urlParams: urlParams,
+      docParams: _.extend(params, {limit: limit})
+    };
+  }
 });
+
+
+export default BaseRoute;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/sidebar/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/actions.js b/app/addons/documents/sidebar/actions.js
index 92782a8..1dc238e 100644
--- a/app/addons/documents/sidebar/actions.js
+++ b/app/addons/documents/sidebar/actions.js
@@ -10,149 +10,144 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes',
-  './stores.react'
-],
-function (app, FauxtonAPI, ActionTypes, Stores) {
-  var store = Stores.sidebarStore;
-
-  function newOptions (options) {
-    if (options.database.safeID() !== store.getDatabaseName()) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.SIDEBAR_FETCHING
-      });
-    }
-
-    options.designDocs.fetch().then(function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.SIDEBAR_NEW_OPTIONS,
-        options: options
-      });
-    });
-  }
-
-  function updateDesignDocs (designDocs) {
-    designDocs.fetch().then(function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.SIDEBAR_UPDATED_DESIGN_DOCS,
-        options: {
-          designDocs: designDocs
-        }
-      });
-    });
-  }
-
-  function toggleContent (designDoc, indexGroup) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.SIDEBAR_TOGGLE_CONTENT,
-      designDoc: designDoc,
-      indexGroup: indexGroup
-    });
-  }
-
-  // This selects any item in the sidebar, including nested nav items to ensure the appropriate item is visible
-  // and highlighted. Params:
-  // - `navItem`: 'permissions', 'changes', 'all-docs', 'compact', 'mango-query', 'designDoc' (or anything thats been
-  //    extended)
-  // - `params`: optional object if you passed designDoc as the first param. This lets you specify which sub-page
-  //    should be selected, e.g.
-  //       Actions.selectNavItem('designDoc', { designDocName: 'my-design-doc', section: 'metadata' });
-  //       Actions.selectNavItem('designDoc', { designDocName: 'my-design-doc', section: 'Views', indexName: 'my-view' });
-  function selectNavItem (navItem, params) {
-    var settings = $.extend(true, {}, {
-      designDocName: '',
-      designDocSection: '',
-      indexName: ''
-    }, params);
-    settings.navItem = navItem;
-
-    FauxtonAPI.dispatch({
-      type: ActionTypes.SIDEBAR_SET_SELECTED_NAV_ITEM,
-      options: settings
-    });
-  }
-
-  function refresh () {
-    FauxtonAPI.dispatch({ type: ActionTypes.SIDEBAR_REFRESH });
-  }
-
-  function showDeleteIndexModal (indexName, designDocName, indexLabel, onDelete) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.SIDEBAR_SHOW_DELETE_INDEX_MODAL,
-      options: {
-        indexName: indexName,
-        indexLabel: indexLabel,
-        designDocName: designDocName,
-        onDelete: onDelete
-      }
-    });
-  }
-
-  function hideDeleteIndexModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.SIDEBAR_HIDE_DELETE_INDEX_MODAL });
-  }
-
-  function showCloneIndexModal (indexName, designDocName, indexLabel, onSubmit) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.SIDEBAR_SHOW_CLONE_INDEX_MODAL,
-      options: {
-        sourceIndexName: indexName,
-        sourceDesignDocName: designDocName,
-        onSubmit: onSubmit,
-        indexLabel: indexLabel,
-        cloneIndexModalTitle: 'Clone ' + indexLabel
-      }
-    });
-  }
-
-  function hideCloneIndexModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.SIDEBAR_HIDE_CLONE_INDEX_MODAL });
-  }
-
-  function updateNewDesignDocName (designDocName) {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import Stores from "./stores.react";
+var store = Stores.sidebarStore;
+
+function newOptions (options) {
+  if (options.database.safeID() !== store.getDatabaseName()) {
     FauxtonAPI.dispatch({
-      type: ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED,
-      options: {
-        value: designDocName
-      }
+      type: ActionTypes.SIDEBAR_FETCHING
     });
   }
 
-  function selectDesignDoc (designDoc) {
+  options.designDocs.fetch().then(function () {
     FauxtonAPI.dispatch({
-      type: ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE,
-      options: {
-        value: designDoc
-      }
+      type: ActionTypes.SIDEBAR_NEW_OPTIONS,
+      options: options
     });
-  }
+  });
+}
 
-  function setNewCloneIndexName (indexName) {
+function updateDesignDocs (designDocs) {
+  designDocs.fetch().then(function () {
     FauxtonAPI.dispatch({
-      type: ActionTypes.SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME,
+      type: ActionTypes.SIDEBAR_UPDATED_DESIGN_DOCS,
       options: {
-        value: indexName
+        designDocs: designDocs
       }
     });
-  }
-
-
-  return {
-    newOptions: newOptions,
-    updateDesignDocs: updateDesignDocs,
-    toggleContent: toggleContent,
-    selectNavItem: selectNavItem,
-    refresh: refresh,
-    showDeleteIndexModal: showDeleteIndexModal,
-    hideDeleteIndexModal: hideDeleteIndexModal,
-    showCloneIndexModal: showCloneIndexModal,
-    hideCloneIndexModal: hideCloneIndexModal,
-    updateNewDesignDocName: updateNewDesignDocName,
-    selectDesignDoc: selectDesignDoc,
-    setNewCloneIndexName: setNewCloneIndexName
-  };
-
-});
+  });
+}
+
+function toggleContent (designDoc, indexGroup) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SIDEBAR_TOGGLE_CONTENT,
+    designDoc: designDoc,
+    indexGroup: indexGroup
+  });
+}
+
+// This selects any item in the sidebar, including nested nav items to ensure the appropriate item is visible
+// and highlighted. Params:
+// - `navItem`: 'permissions', 'changes', 'all-docs', 'compact', 'mango-query', 'designDoc' (or anything thats been
+//    extended)
+// - `params`: optional object if you passed designDoc as the first param. This lets you specify which sub-page
+//    should be selected, e.g.
+//       Actions.selectNavItem('designDoc', { designDocName: 'my-design-doc', section: 'metadata' });
+//       Actions.selectNavItem('designDoc', { designDocName: 'my-design-doc', section: 'Views', indexName: 'my-view' });
+function selectNavItem (navItem, params) {
+  var settings = $.extend(true, {}, {
+    designDocName: '',
+    designDocSection: '',
+    indexName: ''
+  }, params);
+  settings.navItem = navItem;
+
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SIDEBAR_SET_SELECTED_NAV_ITEM,
+    options: settings
+  });
+}
+
+function refresh () {
+  FauxtonAPI.dispatch({ type: ActionTypes.SIDEBAR_REFRESH });
+}
+
+function showDeleteIndexModal (indexName, designDocName, indexLabel, onDelete) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SIDEBAR_SHOW_DELETE_INDEX_MODAL,
+    options: {
+      indexName: indexName,
+      indexLabel: indexLabel,
+      designDocName: designDocName,
+      onDelete: onDelete
+    }
+  });
+}
+
+function hideDeleteIndexModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.SIDEBAR_HIDE_DELETE_INDEX_MODAL });
+}
+
+function showCloneIndexModal (indexName, designDocName, indexLabel, onSubmit) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SIDEBAR_SHOW_CLONE_INDEX_MODAL,
+    options: {
+      sourceIndexName: indexName,
+      sourceDesignDocName: designDocName,
+      onSubmit: onSubmit,
+      indexLabel: indexLabel,
+      cloneIndexModalTitle: 'Clone ' + indexLabel
+    }
+  });
+}
+
+function hideCloneIndexModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.SIDEBAR_HIDE_CLONE_INDEX_MODAL });
+}
+
+function updateNewDesignDocName (designDocName) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED,
+    options: {
+      value: designDocName
+    }
+  });
+}
+
+function selectDesignDoc (designDoc) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE,
+    options: {
+      value: designDoc
+    }
+  });
+}
+
+function setNewCloneIndexName (indexName) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME,
+    options: {
+      value: indexName
+    }
+  });
+}
+
+
+export default {
+  newOptions: newOptions,
+  updateDesignDocs: updateDesignDocs,
+  toggleContent: toggleContent,
+  selectNavItem: selectNavItem,
+  refresh: refresh,
+  showDeleteIndexModal: showDeleteIndexModal,
+  hideDeleteIndexModal: hideDeleteIndexModal,
+  showCloneIndexModal: showCloneIndexModal,
+  hideCloneIndexModal: hideCloneIndexModal,
+  updateNewDesignDocName: updateNewDesignDocName,
+  selectDesignDoc: selectDesignDoc,
+  setNewCloneIndexName: setNewCloneIndexName
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/sidebar/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/actiontypes.js b/app/addons/documents/sidebar/actiontypes.js
index b05e3e1..6a1ebd4 100644
--- a/app/addons/documents/sidebar/actiontypes.js
+++ b/app/addons/documents/sidebar/actiontypes.js
@@ -10,20 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    SIDEBAR_SET_SELECTED_NAV_ITEM: 'SIDEBAR_SET_SELECTED_NAV_ITEM',
-    SIDEBAR_NEW_OPTIONS: 'SIDEBAR_NEW_OPTIONS',
-    SIDEBAR_TOGGLE_CONTENT: 'SIDEBAR_TOGGLE_CONTENT',
-    SIDEBAR_FETCHING: 'SIDEBAR_FETCHING',
-    SIDEBAR_REFRESH: 'SIDEBAR_REFRESH',
-    SIDEBAR_SHOW_DELETE_INDEX_MODAL: 'SIDEBAR_SHOW_DELETE_INDEX_MODAL',
-    SIDEBAR_HIDE_DELETE_INDEX_MODAL: 'SIDEBAR_HIDE_DELETE_INDEX_MODAL',
-    SIDEBAR_SHOW_CLONE_INDEX_MODAL: 'SIDEBAR_SHOW_CLONE_INDEX_MODAL',
-    SIDEBAR_HIDE_CLONE_INDEX_MODAL: 'SIDEBAR_HIDE_CLONE_INDEX_MODAL',
-    SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE: 'SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE',
-    SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED: 'SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED',
-    SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME: 'SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME',
-    SIDEBAR_UPDATED_DESIGN_DOCS: 'SIDEBAR_UPDATED_DESIGN_DOCS'
-  };
-});
+export default {
+  SIDEBAR_SET_SELECTED_NAV_ITEM: 'SIDEBAR_SET_SELECTED_NAV_ITEM',
+  SIDEBAR_NEW_OPTIONS: 'SIDEBAR_NEW_OPTIONS',
+  SIDEBAR_TOGGLE_CONTENT: 'SIDEBAR_TOGGLE_CONTENT',
+  SIDEBAR_FETCHING: 'SIDEBAR_FETCHING',
+  SIDEBAR_REFRESH: 'SIDEBAR_REFRESH',
+  SIDEBAR_SHOW_DELETE_INDEX_MODAL: 'SIDEBAR_SHOW_DELETE_INDEX_MODAL',
+  SIDEBAR_HIDE_DELETE_INDEX_MODAL: 'SIDEBAR_HIDE_DELETE_INDEX_MODAL',
+  SIDEBAR_SHOW_CLONE_INDEX_MODAL: 'SIDEBAR_SHOW_CLONE_INDEX_MODAL',
+  SIDEBAR_HIDE_CLONE_INDEX_MODAL: 'SIDEBAR_HIDE_CLONE_INDEX_MODAL',
+  SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE: 'SIDEBAR_CLONE_MODAL_DESIGN_DOC_CHANGE',
+  SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED: 'SIDEBAR_CLONE_MODAL_DESIGN_DOC_NEW_NAME_UPDATED',
+  SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME: 'SIDEBAR_CLONE_MODAL_UPDATE_INDEX_NAME',
+  SIDEBAR_UPDATED_DESIGN_DOCS: 'SIDEBAR_UPDATED_DESIGN_DOCS'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/sidebar/sidebar.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/sidebar/sidebar.react.jsx b/app/addons/documents/sidebar/sidebar.react.jsx
index ce38840..66f21c0 100644
--- a/app/addons/documents/sidebar/sidebar.react.jsx
+++ b/app/addons/documents/sidebar/sidebar.react.jsx
@@ -10,662 +10,652 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-   '../../../app',
-  '../../../core/api',
-  'react',
-  'react-dom',
-  './stores.react',
-  './actions',
-  '../../components/react-components.react',
-  '../../components/stores',
-  '../../components/actions',
-  '../index-editor/actions',
-  '../index-editor/components.react',
-  '../../fauxton/components.react',
-  '../../documents/views',
-  '../../documents/helpers',
-  'react-bootstrap',
-  '../../../../assets/js/plugins/prettify'
-],
-
-function (app, FauxtonAPI, React, ReactDOM, Stores, Actions, Components, ComponentsStore, ComponentsActions,
-  IndexEditorActions, IndexEditorComponents, GeneralComponents, DocumentViews, DocumentHelper, ReactBootstrap) {
-
-  var DeleteDBModal = DocumentViews.Views.DeleteDBModal;
-
-  var store = Stores.sidebarStore;
-  var LoadLines = Components.LoadLines;
-  var DesignDocSelector = IndexEditorComponents.DesignDocSelector;
-  var OverlayTrigger = ReactBootstrap.OverlayTrigger;
-  var Popover = ReactBootstrap.Popover;
-  var Modal = ReactBootstrap.Modal;
-  var ConfirmationModal = GeneralComponents.ConfirmationModal;
-
-  var DeleteDatabaseModal = Components.DeleteDatabaseModal;
-  var deleteDbModalStore = ComponentsStore.deleteDbModalStore;
-
-
-  var MainSidebar = React.createClass({
-    propTypes: {
-      selectedNavItem: React.PropTypes.string.isRequired
-    },
-
-    getNewButtonLinks: function () {  // these are links for the sidebar '+' on All Docs and All Design Docs
-      return DocumentHelper.getNewButtonLinks(this.props.databaseName);
-    },
-
-    buildDocLinks: function () {
-      var base = FauxtonAPI.urls('base', 'app', this.props.databaseName);
-      return FauxtonAPI.getExtensions('docLinks').map(function (link) {
-        return (
-          <li key={link.url} className={this.getNavItemClass(link.url)}>
-            <a id={link.url} href={base + link.url}>{link.title}</a>
-          </li>
-        );
-      }, this);
-    },
-
-    getNavItemClass: function (navItem) {
-      return (navItem === this.props.selectedNavItem) ? 'active' : '';
-    },
-
-    render: function () {
-      var docLinks = this.buildDocLinks();
-      var changesUrl     = '#' + FauxtonAPI.urls('changes', 'app', this.props.databaseName, '');
-      var permissionsUrl = '#' + FauxtonAPI.urls('permissions', 'app', this.props.databaseName);
-      var databaseUrl    = FauxtonAPI.urls('allDocs', 'app', this.props.databaseName, '');
-      var mangoQueryUrl  = FauxtonAPI.urls('mango', 'query-app', this.props.databaseName);
-      var runQueryWithMangoText = app.i18n.en_US['run-query-with-mango'];
-      var buttonLinks = this.getNewButtonLinks();
-
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Stores from "./stores.react";
+import Actions from "./actions";
+import Components from "../../components/react-components.react";
+import ComponentsStore from "../../components/stores";
+import ComponentsActions from "../../components/actions";
+import IndexEditorActions from "../index-editor/actions";
+import IndexEditorComponents from "../index-editor/components.react";
+import GeneralComponents from "../../fauxton/components.react";
+import DocumentViews from "../../documents/views";
+import DocumentHelper from "../../documents/helpers";
+import { OverlayTrigger, Popover, Modal } from "react-bootstrap";
+import "../../../../assets/js/plugins/prettify";
+
+var DeleteDBModal = DocumentViews.Views.DeleteDBModal;
+
+var store = Stores.sidebarStore;
+var LoadLines = Components.LoadLines;
+var DesignDocSelector = IndexEditorComponents.DesignDocSelector;
+var ConfirmationModal = GeneralComponents.ConfirmationModal;
+
+var DeleteDatabaseModal = Components.DeleteDatabaseModal;
+var deleteDbModalStore = ComponentsStore.deleteDbModalStore;
+
+
+var MainSidebar = React.createClass({
+  propTypes: {
+    selectedNavItem: React.PropTypes.string.isRequired
+  },
+
+  getNewButtonLinks: function () {  // these are links for the sidebar '+' on All Docs and All Design Docs
+    return DocumentHelper.getNewButtonLinks(this.props.databaseName);
+  },
+
+  buildDocLinks: function () {
+    var base = FauxtonAPI.urls('base', 'app', this.props.databaseName);
+    return FauxtonAPI.getExtensions('docLinks').map(function (link) {
       return (
-        <ul className="nav nav-list">
-          <li className={this.getNavItemClass('all-docs')}>
-            <a id="all-docs"
-              href={"#/" + databaseUrl}
-              className="toggle-view">
-              All Documents
-            </a>
-            <div id="new-all-docs-button" className="add-dropdown">
-              <Components.MenuDropDown links={buttonLinks} />
-            </div>
-          </li>
-          <li className={this.getNavItemClass('mango-query')}>
-            <a
-              id="mango-query"
-              href={'#' + mangoQueryUrl}
-              className="toggle-view">
-              {runQueryWithMangoText}
-            </a>
-          </li>
-          <li className={this.getNavItemClass('permissions')}>
-            <a id="permissions" href={permissionsUrl}>Permissions</a>
-          </li>
-          <li className={this.getNavItemClass('changes')}>
-            <a id="changes" href={changesUrl}>Changes</a>
-          </li>
-          {docLinks}
-          <li className={this.getNavItemClass('design-docs')}>
-            <a
-              id="design-docs"
-              href={"#/" + databaseUrl + '?startkey="_design"&endkey="_design0"'}
-              className="toggle-view">
-              Design Documents
-            </a>
-            <div id="new-design-docs-button" className="add-dropdown">
-              <Components.MenuDropDown links={buttonLinks} />
-            </div>
-          </li>
-        </ul>
+        <li key={link.url} className={this.getNavItemClass(link.url)}>
+          <a id={link.url} href={base + link.url}>{link.title}</a>
+        </li>
       );
-    }
-  });
-
-
-  var IndexSection = React.createClass({
-
-    propTypes: {
-      urlNamespace: React.PropTypes.string.isRequired,
-      indexLabel: React.PropTypes.string.isRequired,
-      database: React.PropTypes.object.isRequired,
-      designDocName: React.PropTypes.string.isRequired,
-      items: React.PropTypes.array.isRequired,
-      isExpanded: React.PropTypes.bool.isRequired,
-      selectedIndex: React.PropTypes.string.isRequired,
-      onDelete: React.PropTypes.func.isRequired,
-      onClone: React.PropTypes.func.isRequired
-    },
-
-    getInitialState: function () {
-      return {
-        placement: 'bottom'
-      };
-    },
-
-    // this dynamically changes the placement of the menu (top/bottom) to prevent it going offscreen and causing some
-    // unsightly shifting
-    setPlacement: function (rowId) {
-      var rowTop = document.getElementById(rowId).getBoundingClientRect().top;
-      var toggleHeight = 150; // the height of the menu overlay, arrow, view row
-      var placement = (rowTop + toggleHeight > window.innerHeight) ? 'top' : 'bottom';
-      this.setState({ placement: placement });
-    },
-
-    createItems: function () {
-
-      // sort the indexes alphabetically
-      var sortedItems = this.props.items.sort();
-
-      return _.map(sortedItems, function (indexName, index) {
-        var href = FauxtonAPI.urls(this.props.urlNamespace, 'app', this.props.database.id, this.props.designDocName);
-        var className = (this.props.selectedIndex === indexName) ? 'active' : '';
-
-        return (
-          <li className={className} key={index}>
-            <a
-              id={this.props.designDocName + '_' + indexName}
-              href={"#/" + href + indexName}
-              className="toggle-view">
-              {indexName}
-            </a>
-            <OverlayTrigger
-              ref={"indexMenu-" + index}
-              trigger="click"
-              onEnter={this.setPlacement.bind(this, this.props.designDocName + '_' + indexName)}
-              placement={this.state.placement}
-              rootClose={true}
-              overlay={
-                <Popover id="index-menu-component-popover">
-                  <ul>
-                    <li onClick={this.indexAction.bind(this, 'edit', { indexName: indexName, onEdit: this.props.onEdit })}>
-                      <span className="fonticon fonticon-file-code-o"></span>
-                      Edit
-                    </li>
-                    <li onClick={this.indexAction.bind(this, 'clone', { indexName: indexName, onClone: this.props.onClone })}>
-                      <span className="fonticon fonticon-files-o"></span>
-                      Clone
-                    </li>
-                    <li onClick={this.indexAction.bind(this, 'delete', { indexName: indexName, onDelete: this.props.onDelete })}>
-                      <span className="fonticon fonticon-trash"></span>
-                      Delete
-                    </li>
-                  </ul>
-                </Popover>
-              }>
-              <span className="index-menu-toggle fonticon fonticon-wrench2"></span>
-            </OverlayTrigger>
-          </li>
-        );
-      }, this);
-    },
-
-    indexAction: function (action, params, e) {
-      e.preventDefault();
-
-      // ensures the menu gets closed. The hide() on the ref doesn't consistently close it
-      $('body').trigger('click');
-
-      switch (action) {
-        case 'delete':
-          Actions.showDeleteIndexModal(params.indexName, this.props.designDocName, this.props.indexLabel, params.onDelete);
-        break;
-        case 'clone':
-          Actions.showCloneIndexModal(params.indexName, this.props.designDocName, this.props.indexLabel, params.onClone);
-        break;
-        case 'edit':
-          params.onEdit(this.props.database.id, this.props.designDocName, params.indexName);
-        break;
-      }
-    },
-
-    toggle: function (e) {
-      e.preventDefault();
-      var newToggleState = !this.props.isExpanded;
-      var state = newToggleState ? 'show' : 'hide';
-      $(ReactDOM.findDOMNode(this)).find('.accordion-body').collapse(state);
-      this.props.toggle(this.props.designDocName, this.props.title);
-    },
-
-    render: function () {
-
-      // if this section has no content, omit it to prevent clutter. Otherwise it would show a toggle option that
-      // would hide/show nothing
-      if (this.props.items.length === 0) {
-        return null;
-      }
+    }, this);
+  },
+
+  getNavItemClass: function (navItem) {
+    return (navItem === this.props.selectedNavItem) ? 'active' : '';
+  },
+
+  render: function () {
+    var docLinks = this.buildDocLinks();
+    var changesUrl     = '#' + FauxtonAPI.urls('changes', 'app', this.props.databaseName, '');
+    var permissionsUrl = '#' + FauxtonAPI.urls('permissions', 'app', this.props.databaseName);
+    var databaseUrl    = FauxtonAPI.urls('allDocs', 'app', this.props.databaseName, '');
+    var mangoQueryUrl  = FauxtonAPI.urls('mango', 'query-app', this.props.databaseName);
+    var runQueryWithMangoText = app.i18n.en_US['run-query-with-mango'];
+    var buttonLinks = this.getNewButtonLinks();
+
+    return (
+      <ul className="nav nav-list">
+        <li className={this.getNavItemClass('all-docs')}>
+          <a id="all-docs"
+            href={"#/" + databaseUrl}
+            className="toggle-view">
+            All Documents
+          </a>
+          <div id="new-all-docs-button" className="add-dropdown">
+            <Components.MenuDropDown links={buttonLinks} />
+          </div>
+        </li>
+        <li className={this.getNavItemClass('mango-query')}>
+          <a
+            id="mango-query"
+            href={'#' + mangoQueryUrl}
+            className="toggle-view">
+            {runQueryWithMangoText}
+          </a>
+        </li>
+        <li className={this.getNavItemClass('permissions')}>
+          <a id="permissions" href={permissionsUrl}>Permissions</a>
+        </li>
+        <li className={this.getNavItemClass('changes')}>
+          <a id="changes" href={changesUrl}>Changes</a>
+        </li>
+        {docLinks}
+        <li className={this.getNavItemClass('design-docs')}>
+          <a
+            id="design-docs"
+            href={"#/" + databaseUrl + '?startkey="_design"&endkey="_design0"'}
+            className="toggle-view">
+            Design Documents
+          </a>
+          <div id="new-design-docs-button" className="add-dropdown">
+            <Components.MenuDropDown links={buttonLinks} />
+          </div>
+        </li>
+      </ul>
+    );
+  }
+});
 
-      var toggleClassNames = 'accordion-header index-group-header';
-      var toggleBodyClassNames = 'index-list accordion-body collapse';
-      if (this.props.isExpanded) {
-        toggleClassNames += ' down';
-        toggleBodyClassNames += ' in';
-      }
 
-      var title = this.props.title;
-      var designDocName = this.props.designDocName;
-      var linkId = "nav-design-function-" + designDocName + this.props.selector;
+var IndexSection = React.createClass({
+
+  propTypes: {
+    urlNamespace: React.PropTypes.string.isRequired,
+    indexLabel: React.PropTypes.string.isRequired,
+    database: React.PropTypes.object.isRequired,
+    designDocName: React.PropTypes.string.isRequired,
+    items: React.PropTypes.array.isRequired,
+    isExpanded: React.PropTypes.bool.isRequired,
+    selectedIndex: React.PropTypes.string.isRequired,
+    onDelete: React.PropTypes.func.isRequired,
+    onClone: React.PropTypes.func.isRequired
+  },
+
+  getInitialState: function () {
+    return {
+      placement: 'bottom'
+    };
+  },
+
+  // this dynamically changes the placement of the menu (top/bottom) to prevent it going offscreen and causing some
+  // unsightly shifting
+  setPlacement: function (rowId) {
+    var rowTop = document.getElementById(rowId).getBoundingClientRect().top;
+    var toggleHeight = 150; // the height of the menu overlay, arrow, view row
+    var placement = (rowTop + toggleHeight > window.innerHeight) ? 'top' : 'bottom';
+    this.setState({ placement: placement });
+  },
+
+  createItems: function () {
+
+    // sort the indexes alphabetically
+    var sortedItems = this.props.items.sort();
+
+    return _.map(sortedItems, function (indexName, index) {
+      var href = FauxtonAPI.urls(this.props.urlNamespace, 'app', this.props.database.id, this.props.designDocName);
+      var className = (this.props.selectedIndex === indexName) ? 'active' : '';
 
       return (
-        <li id={linkId}>
-          <a className={toggleClassNames} data-toggle="collapse" onClick={this.toggle}>
-            <div className="fonticon-play"></div>
-            {title}
+        <li className={className} key={index}>
+          <a
+            id={this.props.designDocName + '_' + indexName}
+            href={"#/" + href + indexName}
+            className="toggle-view">
+            {indexName}
           </a>
-          <ul className={toggleBodyClassNames}>
-            {this.createItems()}
-          </ul>
+          <OverlayTrigger
+            ref={"indexMenu-" + index}
+            trigger="click"
+            onEnter={this.setPlacement.bind(this, this.props.designDocName + '_' + indexName)}
+            placement={this.state.placement}
+            rootClose={true}
+            overlay={
+              <Popover id="index-menu-component-popover">
+                <ul>
+                  <li onClick={this.indexAction.bind(this, 'edit', { indexName: indexName, onEdit: this.props.onEdit })}>
+                    <span className="fonticon fonticon-file-code-o"></span>
+                    Edit
+                  </li>
+                  <li onClick={this.indexAction.bind(this, 'clone', { indexName: indexName, onClone: this.props.onClone })}>
+                    <span className="fonticon fonticon-files-o"></span>
+                    Clone
+                  </li>
+                  <li onClick={this.indexAction.bind(this, 'delete', { indexName: indexName, onDelete: this.props.onDelete })}>
+                    <span className="fonticon fonticon-trash"></span>
+                    Delete
+                  </li>
+                </ul>
+              </Popover>
+            }>
+            <span className="index-menu-toggle fonticon fonticon-wrench2"></span>
+          </OverlayTrigger>
         </li>
       );
+    }, this);
+  },
+
+  indexAction: function (action, params, e) {
+    e.preventDefault();
+
+    // ensures the menu gets closed. The hide() on the ref doesn't consistently close it
+    $('body').trigger('click');
+
+    switch (action) {
+      case 'delete':
+        Actions.showDeleteIndexModal(params.indexName, this.props.designDocName, this.props.indexLabel, params.onDelete);
+      break;
+      case 'clone':
+        Actions.showCloneIndexModal(params.indexName, this.props.designDocName, this.props.indexLabel, params.onClone);
+      break;
+      case 'edit':
+        params.onEdit(this.props.database.id, this.props.designDocName, params.indexName);
+      break;
+    }
+  },
+
+  toggle: function (e) {
+    e.preventDefault();
+    var newToggleState = !this.props.isExpanded;
+    var state = newToggleState ? 'show' : 'hide';
+    $(ReactDOM.findDOMNode(this)).find('.accordion-body').collapse(state);
+    this.props.toggle(this.props.designDocName, this.props.title);
+  },
+
+  render: function () {
+
+    // if this section has no content, omit it to prevent clutter. Otherwise it would show a toggle option that
+    // would hide/show nothing
+    if (this.props.items.length === 0) {
+      return null;
     }
-  });
-
-
-  var DesignDoc = React.createClass({
-    propTypes: {
-      database: React.PropTypes.object.isRequired,
-      sidebarListTypes: React.PropTypes.array.isRequired,
-      isExpanded: React.PropTypes.bool.isRequired,
-      selectedNavInfo: React.PropTypes.object.isRequired,
-      toggledSections: React.PropTypes.object.isRequired
-    },
-
-    getInitialState: function () {
-      return {
-        updatedSidebarListTypes: this.props.sidebarListTypes
-      };
-    },
-
-    componentWillMount: function () {
-      if (_.isEmpty(this.state.updatedSidebarListTypes) ||
-        (_.has(this.state.updatedSidebarListTypes[0], 'selector') && this.state.updatedSidebarListTypes[0].selector !== 'views')) {
-
-        var newList = this.state.updatedSidebarListTypes;
-        newList.unshift({
-          selector: 'views',
-          name: 'Views',
-          urlNamespace: 'view',
-          indexLabel: 'view',
-          onDelete: IndexEditorActions.deleteView,
-          onClone: IndexEditorActions.cloneView,
-          onEdit: IndexEditorActions.gotoEditViewPage
-        });
-        this.setState({ updatedSidebarListTypes: newList });
-      }
-    },
-
-    indexList: function () {
-      return _.map(this.state.updatedSidebarListTypes, function (index, key) {
-        var expanded = _.has(this.props.toggledSections, index.name) && this.props.toggledSections[index.name];
-
-        // if an index in this list is selected, pass that down
-        var selectedIndex = '';
-        if (this.props.selectedNavInfo.designDocSection === index.name) {
-          selectedIndex = this.props.selectedNavInfo.indexName;
-        }
-
-        return (
-          <IndexSection
-            icon={index.icon}
-            isExpanded={expanded}
-            urlNamespace={index.urlNamespace}
-            indexLabel={index.indexLabel}
-            onEdit={index.onEdit}
-            onDelete={index.onDelete}
-            onClone={index.onClone}
-            selectedIndex={selectedIndex}
-            toggle={this.props.toggle}
-            database={this.props.database}
-            designDocName={this.props.designDocName}
-            key={key}
-            title={index.name}
-            selector={index.selector}
-            items={_.keys(this.props.designDoc[index.selector])} />
-        );
-      }.bind(this));
-    },
-
-    toggle: function (e) {
-      e.preventDefault();
-      var newToggleState = !this.props.isExpanded;
-      var state = newToggleState ? 'show' : 'hide';
-      $(ReactDOM.findDOMNode(this)).find('#' + this.props.designDocName).collapse(state);
-      this.props.toggle(this.props.designDocName);
-    },
-
-    getNewButtonLinks: function () {
-      var newUrlPrefix = FauxtonAPI.urls('databaseBaseURL', 'app', this.props.database.id);
-      var designDocName = this.props.designDocName;
-
-      var addNewLinks = _.reduce(FauxtonAPI.getExtensions('sidebar:links'), function (menuLinks, link) {
-        menuLinks.push({
-          title: link.title,
-          url: '#' + newUrlPrefix + '/' + link.url + '/' + designDocName,
-          icon: 'fonticon-plus-circled'
-        });
-        return menuLinks;
-      }, [{
-        title: 'New View',
-        url: '#' + FauxtonAPI.urls('new', 'addView', this.props.database.id, designDocName),
-        icon: 'fonticon-plus-circled'
-      }]);
-
-      return [{
-        title: 'Add New',
-        links: addNewLinks
-      }];
-    },
-
-    render: function () {
-      var buttonLinks = this.getNewButtonLinks();
-      var toggleClassNames = 'design-doc-section accordion-header';
-      var toggleBodyClassNames = 'design-doc-body accordion-body collapse';
-
-      if (this.props.isExpanded) {
-        toggleClassNames += ' down';
-        toggleBodyClassNames += ' in';
-      }
-      var designDocName = this.props.designDocName;
-      var designDocMetaUrl = FauxtonAPI.urls('designDocs', 'app', this.props.database.id, designDocName);
-      var metadataRowClass = (this.props.selectedNavInfo.designDocSection === 'metadata') ? 'active' : '';
 
-      return (
-        <li className="nav-header">
-          <div id={"sidebar-tab-" + designDocName} className={toggleClassNames}>
-            <div id={"nav-header-" + designDocName} onClick={this.toggle} className='accordion-list-item'>
-              <div className="fonticon-play"></div>
-              <p className='design-doc-name'>
-                <span title={'_design/' + designDocName}>{designDocName}</span>
-              </p>
-            </div>
-            <div className='new-button add-dropdown'>
-              <Components.MenuDropDown links={buttonLinks} />
-            </div>
-          </div>
-          <ul className={toggleBodyClassNames} id={this.props.designDocName}>
-            <li className={metadataRowClass}>
-              <a href={"#/" + designDocMetaUrl} className="toggle-view accordion-header">
-                Metadata
-              </a>
-            </li>
-            {this.indexList()}
-          </ul>
-        </li>
-      );
+    var toggleClassNames = 'accordion-header index-group-header';
+    var toggleBodyClassNames = 'index-list accordion-body collapse';
+    if (this.props.isExpanded) {
+      toggleClassNames += ' down';
+      toggleBodyClassNames += ' in';
     }
-  });
-
-
-  var DesignDocList = React.createClass({
-    componentWillMount: function () {
-      var list = FauxtonAPI.getExtensions('sidebar:list');
-      this.sidebarListTypes = _.isUndefined(list) ? [] : list;
-    },
-
-    designDocList: function () {
-      return _.map(this.props.designDocs, function (designDoc, key) {
-        var ddName = designDoc.safeId;
-
-        // only pass down the selected nav info and toggle info if they're relevant for this particular design doc
-        var expanded = false,
-          toggledSections = {};
-        if (_.has(this.props.toggledSections, ddName)) {
-          expanded = this.props.toggledSections[ddName].visible;
-          toggledSections = this.props.toggledSections[ddName].indexGroups;
-        }
-
-        var selectedNavInfo = {};
-        if (this.props.selectedNav.navItem === 'designDoc' && this.props.selectedNav.designDocName === ddName) {
-          selectedNavInfo = this.props.selectedNav;
-        }
-
-        return (
-          <DesignDoc
-            toggle={this.props.toggle}
-            sidebarListTypes={this.sidebarListTypes}
-            isExpanded={expanded}
-            toggledSections={toggledSections}
-            selectedNavInfo={selectedNavInfo}
-            key={key}
-            designDoc={designDoc}
-            designDocName={ddName}
-            database={this.props.database} />
-        );
-      }.bind(this));
-    },
-
-    render: function () {
-      return (
-        <ul className="nav nav-list">
-          {this.designDocList()}
+
+    var title = this.props.title;
+    var designDocName = this.props.designDocName;
+    var linkId = "nav-design-function-" + designDocName + this.props.selector;
+
+    return (
+      <li id={linkId}>
+        <a className={toggleClassNames} data-toggle="collapse" onClick={this.toggle}>
+          <div className="fonticon-play"></div>
+          {title}
+        </a>
+        <ul className={toggleBodyClassNames}>
+          {this.createItems()}
         </ul>
-      );
-    }
-  });
-
-  var SidebarController = React.createClass({
-    getStoreState: function () {
-      return {
-        database: store.getDatabase(),
-        selectedNav: store.getSelected(),
-        designDocs: store.getDesignDocs(),
-        designDocList: store.getDesignDocList(),
-        availableDesignDocIds: store.getAvailableDesignDocs(),
-        toggledSections: store.getToggledSections(),
-        isLoading: store.isLoading(),
-        database: store.getDatabase(),
-        deleteDbModalProperties: deleteDbModalStore.getShowDeleteDatabaseModal(),
-
-        deleteIndexModalVisible: store.isDeleteIndexModalVisible(),
-        deleteIndexModalText: store.getDeleteIndexModalText(),
-        deleteIndexModalOnSubmit: store.getDeleteIndexModalOnSubmit(),
-        deleteIndexModalIndexName: store.getDeleteIndexModalIndexName(),
-        deleteIndexModalDesignDoc: store.getDeleteIndexDesignDoc(),
-
-        cloneIndexModalVisible: store.isCloneIndexModalVisible(),
-        cloneIndexModalTitle: store.getCloneIndexModalTitle(),
-        cloneIndexModalSelectedDesignDoc: store.getCloneIndexModalSelectedDesignDoc(),
-        cloneIndexModalNewDesignDocName: store.getCloneIndexModalNewDesignDocName(),
-        cloneIndexModalOnSubmit: store.getCloneIndexModalOnSubmit(),
-        cloneIndexDesignDocProp: store.getCloneIndexDesignDocProp(),
-        cloneIndexModalNewIndexName: store.getCloneIndexModalNewIndexName(),
-        cloneIndexSourceIndexName: store.getCloneIndexModalSourceIndexName(),
-        cloneIndexSourceDesignDocName: store.getCloneIndexModalSourceDesignDocName(),
-        cloneIndexModalIndexLabel: store.getCloneIndexModalIndexLabel()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      store.on('change', this.onChange, this);
-      deleteDbModalStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      store.off('change', this.onChange);
-      deleteDbModalStore.off('change', this.onChange, this);
-    },
-
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
-
-    showDeleteDatabaseModal: function (payload) {
-      ComponentsActions.showDeleteDatabaseModal(payload);
-    },
-
-    // handles deleting of any index regardless of type. The delete handler and all relevant info is set when the user
-    // clicks the delete action for a particular index
-    deleteIndex: function () {
-
-      // if the user is currently on the index that's being deleted, pass that info along to the delete handler. That can
-      // be used to redirect the user to somewhere appropriate
-      var isOnIndex = this.state.selectedNav.navItem === 'designDoc' &&
-                      ('_design/' + this.state.selectedNav.designDocName) === this.state.deleteIndexModalDesignDoc.id &&
-                      this.state.selectedNav.indexName === this.state.deleteIndexModalIndexName;
-
-      this.state.deleteIndexModalOnSubmit({
-        isOnIndex: isOnIndex,
-        indexName: this.state.deleteIndexModalIndexName,
-        designDoc: this.state.deleteIndexModalDesignDoc,
-        designDocs: this.state.designDocs,
-        database: this.state.database
-      });
-    },
-
-    cloneIndex: function () {
-      this.state.cloneIndexModalOnSubmit({
-        sourceIndexName: this.state.cloneIndexSourceIndexName,
-        sourceDesignDocName: this.state.cloneIndexSourceDesignDocName,
-        targetDesignDocName: this.state.cloneIndexModalSelectedDesignDoc,
-        newDesignDocName: this.state.cloneIndexModalNewDesignDocName,
-        newIndexName: this.state.cloneIndexModalNewIndexName,
-        designDocs: this.state.designDocs,
-        database: this.state.database,
-        onComplete: Actions.hideCloneIndexModal
+      </li>
+    );
+  }
+});
+
+
+var DesignDoc = React.createClass({
+  propTypes: {
+    database: React.PropTypes.object.isRequired,
+    sidebarListTypes: React.PropTypes.array.isRequired,
+    isExpanded: React.PropTypes.bool.isRequired,
+    selectedNavInfo: React.PropTypes.object.isRequired,
+    toggledSections: React.PropTypes.object.isRequired
+  },
+
+  getInitialState: function () {
+    return {
+      updatedSidebarListTypes: this.props.sidebarListTypes
+    };
+  },
+
+  componentWillMount: function () {
+    if (_.isEmpty(this.state.updatedSidebarListTypes) ||
+      (_.has(this.state.updatedSidebarListTypes[0], 'selector') && this.state.updatedSidebarListTypes[0].selector !== 'views')) {
+
+      var newList = this.state.updatedSidebarListTypes;
+      newList.unshift({
+        selector: 'views',
+        name: 'Views',
+        urlNamespace: 'view',
+        indexLabel: 'view',
+        onDelete: IndexEditorActions.deleteView,
+        onClone: IndexEditorActions.cloneView,
+        onEdit: IndexEditorActions.gotoEditViewPage
       });
-    },
+      this.setState({ updatedSidebarListTypes: newList });
+    }
+  },
+
+  indexList: function () {
+    return _.map(this.state.updatedSidebarListTypes, function (index, key) {
+      var expanded = _.has(this.props.toggledSections, index.name) && this.props.toggledSections[index.name];
 
-    render: function () {
-      if (this.state.isLoading) {
-        return <LoadLines />;
+      // if an index in this list is selected, pass that down
+      var selectedIndex = '';
+      if (this.props.selectedNavInfo.designDocSection === index.name) {
+        selectedIndex = this.props.selectedNavInfo.indexName;
       }
 
       return (
-        <nav className="sidenav">
-          <MainSidebar
-            selectedNavItem={this.state.selectedNav.navItem}
-            databaseName={this.state.database.id} />
-          <DesignDocList
-            selectedNav={this.state.selectedNav}
-            toggle={Actions.toggleContent}
-            toggledSections={this.state.toggledSections}
-            designDocs={this.state.designDocList}
-            database={this.state.database} />
-          <DeleteDatabaseModal
-            showHide={this.showDeleteDatabaseModal}
-            modalProps={this.state.deleteDbModalProperties} />
-
-          {/* the delete and clone index modals handle all index types, hence the props all being pulled from the store */}
-          <ConfirmationModal
-            title="Confirm Deletion"
-            visible={this.state.deleteIndexModalVisible}
-            text={this.state.deleteIndexModalText}
-            onClose={Actions.hideDeleteIndexModal}
-            onSubmit={this.deleteIndex} />
-          <CloneIndexModal
-            visible={this.state.cloneIndexModalVisible}
-            title={this.state.cloneIndexModalTitle}
-            close={Actions.hideCloneIndexModal}
-            submit={this.cloneIndex}
-            designDocArray={this.state.availableDesignDocIds}
-            selectedDesignDoc={this.state.cloneIndexModalSelectedDesignDoc}
-            newDesignDocName={this.state.cloneIndexModalNewDesignDocName}
-            newIndexName={this.state.cloneIndexModalNewIndexName}
-            indexLabel={this.state.cloneIndexModalIndexLabel} />
-        </nav>
+        <IndexSection
+          icon={index.icon}
+          isExpanded={expanded}
+          urlNamespace={index.urlNamespace}
+          indexLabel={index.indexLabel}
+          onEdit={index.onEdit}
+          onDelete={index.onDelete}
+          onClone={index.onClone}
+          selectedIndex={selectedIndex}
+          toggle={this.props.toggle}
+          database={this.props.database}
+          designDocName={this.props.designDocName}
+          key={key}
+          title={index.name}
+          selector={index.selector}
+          items={_.keys(this.props.designDoc[index.selector])} />
       );
+    }.bind(this));
+  },
+
+  toggle: function (e) {
+    e.preventDefault();
+    var newToggleState = !this.props.isExpanded;
+    var state = newToggleState ? 'show' : 'hide';
+    $(ReactDOM.findDOMNode(this)).find('#' + this.props.designDocName).collapse(state);
+    this.props.toggle(this.props.designDocName);
+  },
+
+  getNewButtonLinks: function () {
+    var newUrlPrefix = FauxtonAPI.urls('databaseBaseURL', 'app', this.props.database.id);
+    var designDocName = this.props.designDocName;
+
+    var addNewLinks = _.reduce(FauxtonAPI.getExtensions('sidebar:links'), function (menuLinks, link) {
+      menuLinks.push({
+        title: link.title,
+        url: '#' + newUrlPrefix + '/' + link.url + '/' + designDocName,
+        icon: 'fonticon-plus-circled'
+      });
+      return menuLinks;
+    }, [{
+      title: 'New View',
+      url: '#' + FauxtonAPI.urls('new', 'addView', this.props.database.id, designDocName),
+      icon: 'fonticon-plus-circled'
+    }]);
+
+    return [{
+      title: 'Add New',
+      links: addNewLinks
+    }];
+  },
+
+  render: function () {
+    var buttonLinks = this.getNewButtonLinks();
+    var toggleClassNames = 'design-doc-section accordion-header';
+    var toggleBodyClassNames = 'design-doc-body accordion-body collapse';
+
+    if (this.props.isExpanded) {
+      toggleClassNames += ' down';
+      toggleBodyClassNames += ' in';
     }
-  });
-
-
-  var CloneIndexModal = React.createClass({
-    propTypes: {
-      visible: React.PropTypes.bool.isRequired,
-      title: React.PropTypes.string,
-      close: React.PropTypes.func.isRequired,
-      submit: React.PropTypes.func.isRequired,
-      designDocArray: React.PropTypes.array.isRequired,
-      selectedDesignDoc: React.PropTypes.string.isRequired,
-      newDesignDocName: React.PropTypes.string.isRequired,
-      newIndexName: React.PropTypes.string.isRequired,
-      indexLabel: React.PropTypes.string.isRequired
-    },
-
-    getDefaultProps: function () {
-      return {
-        title: 'Clone Index',
-        visible: false
-      };
-    },
-
-    submit: function () {
-      if (!this.refs.designDocSelector.validate()) {
-        return;
-      }
-      if (this.props.newIndexName === '') {
-        FauxtonAPI.addNotification({
-          msg: 'Please enter the new index name.',
-          type: 'error',
-          clear: true
-        });
-        return;
-      }
-      this.props.submit();
-    },
+    var designDocName = this.props.designDocName;
+    var designDocMetaUrl = FauxtonAPI.urls('designDocs', 'app', this.props.database.id, designDocName);
+    var metadataRowClass = (this.props.selectedNavInfo.designDocSection === 'metadata') ? 'active' : '';
+
+    return (
+      <li className="nav-header">
+        <div id={"sidebar-tab-" + designDocName} className={toggleClassNames}>
+          <div id={"nav-header-" + designDocName} onClick={this.toggle} className='accordion-list-item'>
+            <div className="fonticon-play"></div>
+            <p className='design-doc-name'>
+              <span title={'_design/' + designDocName}>{designDocName}</span>
+            </p>
+          </div>
+          <div className='new-button add-dropdown'>
+            <Components.MenuDropDown links={buttonLinks} />
+          </div>
+        </div>
+        <ul className={toggleBodyClassNames} id={this.props.designDocName}>
+          <li className={metadataRowClass}>
+            <a href={"#/" + designDocMetaUrl} className="toggle-view accordion-header">
+              Metadata
+            </a>
+          </li>
+          {this.indexList()}
+        </ul>
+      </li>
+    );
+  }
+});
+
+
+var DesignDocList = React.createClass({
+  componentWillMount: function () {
+    var list = FauxtonAPI.getExtensions('sidebar:list');
+    this.sidebarListTypes = _.isUndefined(list) ? [] : list;
+  },
+
+  designDocList: function () {
+    return _.map(this.props.designDocs, function (designDoc, key) {
+      var ddName = designDoc.safeId;
 
-    close: function (e) {
-      if (e) {
-        e.preventDefault();
+      // only pass down the selected nav info and toggle info if they're relevant for this particular design doc
+      var expanded = false,
+        toggledSections = {};
+      if (_.has(this.props.toggledSections, ddName)) {
+        expanded = this.props.toggledSections[ddName].visible;
+        toggledSections = this.props.toggledSections[ddName].indexGroups;
       }
-      this.props.close();
-    },
 
-    setNewIndexName: function (e) {
-      Actions.setNewCloneIndexName(e.target.value);
-    },
+      var selectedNavInfo = {};
+      if (this.props.selectedNav.navItem === 'designDoc' && this.props.selectedNav.designDocName === ddName) {
+        selectedNavInfo = this.props.selectedNav;
+      }
 
-    render: function () {
       return (
-        <Modal dialogClassName="clone-index-modal" show={this.props.visible} onHide={this.close}>
-          <Modal.Header closeButton={true}>
-            <Modal.Title>{this.props.title}</Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-
-            <form className="form" method="post" onSubmit={this.submit}>
-              <p>
-                Select the design document where the cloned {this.props.indexLabel} will be created, and then enter
-                a name for the cloned {this.props.indexLabel}.
-              </p>
-
-              <div className="row">
-                <DesignDocSelector
-                  ref="designDocSelector"
-                  designDocList={this.props.designDocArray}
-                  selectedDesignDocName={this.props.selectedDesignDoc}
-                  newDesignDocName={this.props.newDesignDocName}
-                  onSelectDesignDoc={Actions.selectDesignDoc}
-                  onChangeNewDesignDocName={Actions.updateNewDesignDocName} />
-              </div>
-
-              <div className="clone-index-name-row">
-                <label className="new-index-title-label" htmlFor="new-index-name">{this.props.indexLabel} Name</label>
-                <input type="text" id="new-index-name" value={this.props.newIndexName} onChange={this.setNewIndexName}
-                   placeholder="Enter new view name" />
-              </div>
-            </form>
-
-          </Modal.Body>
-          <Modal.Footer>
-            <a href="#" className="cancel-link" onClick={this.close} data-bypass="true">Cancel</a>
-            <button onClick={this.submit} data-bypass="true" className="btn btn-success save">
-              <i className="icon fonticon-ok-circled" /> Clone {this.props.indexLabel}</button>
-          </Modal.Footer>
-        </Modal>
+        <DesignDoc
+          toggle={this.props.toggle}
+          sidebarListTypes={this.sidebarListTypes}
+          isExpanded={expanded}
+          toggledSections={toggledSections}
+          selectedNavInfo={selectedNavInfo}
+          key={key}
+          designDoc={designDoc}
+          designDocName={ddName}
+          database={this.props.database} />
       );
+    }.bind(this));
+  },
+
+  render: function () {
+    return (
+      <ul className="nav nav-list">
+        {this.designDocList()}
+      </ul>
+    );
+  }
+});
+
+var SidebarController = React.createClass({
+  getStoreState: function () {
+    return {
+      database: store.getDatabase(),
+      selectedNav: store.getSelected(),
+      designDocs: store.getDesignDocs(),
+      designDocList: store.getDesignDocList(),
+      availableDesignDocIds: store.getAvailableDesignDocs(),
+      toggledSections: store.getToggledSections(),
+      isLoading: store.isLoading(),
+      database: store.getDatabase(),
+      deleteDbModalProperties: deleteDbModalStore.getShowDeleteDatabaseModal(),
+
+      deleteIndexModalVisible: store.isDeleteIndexModalVisible(),
+      deleteIndexModalText: store.getDeleteIndexModalText(),
+      deleteIndexModalOnSubmit: store.getDeleteIndexModalOnSubmit(),
+      deleteIndexModalIndexName: store.getDeleteIndexModalIndexName(),
+      deleteIndexModalDesignDoc: store.getDeleteIndexDesignDoc(),
+
+      cloneIndexModalVisible: store.isCloneIndexModalVisible(),
+      cloneIndexModalTitle: store.getCloneIndexModalTitle(),
+      cloneIndexModalSelectedDesignDoc: store.getCloneIndexModalSelectedDesignDoc(),
+      cloneIndexModalNewDesignDocName: store.getCloneIndexModalNewDesignDocName(),
+      cloneIndexModalOnSubmit: store.getCloneIndexModalOnSubmit(),
+      cloneIndexDesignDocProp: store.getCloneIndexDesignDocProp(),
+      cloneIndexModalNewIndexName: store.getCloneIndexModalNewIndexName(),
+      cloneIndexSourceIndexName: store.getCloneIndexModalSourceIndexName(),
+      cloneIndexSourceDesignDocName: store.getCloneIndexModalSourceDesignDocName(),
+      cloneIndexModalIndexLabel: store.getCloneIndexModalIndexLabel()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+    deleteDbModalStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+    deleteDbModalStore.off('change', this.onChange, this);
+  },
+
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
+    }
+  },
+
+  showDeleteDatabaseModal: function (payload) {
+    ComponentsActions.showDeleteDatabaseModal(payload);
+  },
+
+  // handles deleting of any index regardless of type. The delete handler and all relevant info is set when the user
+  // clicks the delete action for a particular index
+  deleteIndex: function () {
+
+    // if the user is currently on the index that's being deleted, pass that info along to the delete handler. That can
+    // be used to redirect the user to somewhere appropriate
+    var isOnIndex = this.state.selectedNav.navItem === 'designDoc' &&
+                    ('_design/' + this.state.selectedNav.designDocName) === this.state.deleteIndexModalDesignDoc.id &&
+                    this.state.selectedNav.indexName === this.state.deleteIndexModalIndexName;
+
+    this.state.deleteIndexModalOnSubmit({
+      isOnIndex: isOnIndex,
+      indexName: this.state.deleteIndexModalIndexName,
+      designDoc: this.state.deleteIndexModalDesignDoc,
+      designDocs: this.state.designDocs,
+      database: this.state.database
+    });
+  },
+
+  cloneIndex: function () {
+    this.state.cloneIndexModalOnSubmit({
+      sourceIndexName: this.state.cloneIndexSourceIndexName,
+      sourceDesignDocName: this.state.cloneIndexSourceDesignDocName,
+      targetDesignDocName: this.state.cloneIndexModalSelectedDesignDoc,
+      newDesignDocName: this.state.cloneIndexModalNewDesignDocName,
+      newIndexName: this.state.cloneIndexModalNewIndexName,
+      designDocs: this.state.designDocs,
+      database: this.state.database,
+      onComplete: Actions.hideCloneIndexModal
+    });
+  },
+
+  render: function () {
+    if (this.state.isLoading) {
+      return <LoadLines />;
+    }
+
+    return (
+      <nav className="sidenav">
+        <MainSidebar
+          selectedNavItem={this.state.selectedNav.navItem}
+          databaseName={this.state.database.id} />
+        <DesignDocList
+          selectedNav={this.state.selectedNav}
+          toggle={Actions.toggleContent}
+          toggledSections={this.state.toggledSections}
+          designDocs={this.state.designDocList}
+          database={this.state.database} />
+        <DeleteDatabaseModal
+          showHide={this.showDeleteDatabaseModal}
+          modalProps={this.state.deleteDbModalProperties} />
+
+        {/* the delete and clone index modals handle all index types, hence the props all being pulled from the store */}
+        <ConfirmationModal
+          title="Confirm Deletion"
+          visible={this.state.deleteIndexModalVisible}
+          text={this.state.deleteIndexModalText}
+          onClose={Actions.hideDeleteIndexModal}
+          onSubmit={this.deleteIndex} />
+        <CloneIndexModal
+          visible={this.state.cloneIndexModalVisible}
+          title={this.state.cloneIndexModalTitle}
+          close={Actions.hideCloneIndexModal}
+          submit={this.cloneIndex}
+          designDocArray={this.state.availableDesignDocIds}
+          selectedDesignDoc={this.state.cloneIndexModalSelectedDesignDoc}
+          newDesignDocName={this.state.cloneIndexModalNewDesignDocName}
+          newIndexName={this.state.cloneIndexModalNewIndexName}
+          indexLabel={this.state.cloneIndexModalIndexLabel} />
+      </nav>
+    );
+  }
+});
+
+
+var CloneIndexModal = React.createClass({
+  propTypes: {
+    visible: React.PropTypes.bool.isRequired,
+    title: React.PropTypes.string,
+    close: React.PropTypes.func.isRequired,
+    submit: React.PropTypes.func.isRequired,
+    designDocArray: React.PropTypes.array.isRequired,
+    selectedDesignDoc: React.PropTypes.string.isRequired,
+    newDesignDocName: React.PropTypes.string.isRequired,
+    newIndexName: React.PropTypes.string.isRequired,
+    indexLabel: React.PropTypes.string.isRequired
+  },
+
+  getDefaultProps: function () {
+    return {
+      title: 'Clone Index',
+      visible: false
+    };
+  },
+
+  submit: function () {
+    if (!this.refs.designDocSelector.validate()) {
+      return;
+    }
+    if (this.props.newIndexName === '') {
+      FauxtonAPI.addNotification({
+        msg: 'Please enter the new index name.',
+        type: 'error',
+        clear: true
+      });
+      return;
     }
-  });
+    this.props.submit();
+  },
 
-  return {
-    SidebarController: SidebarController,
-    DesignDoc: DesignDoc,
-    CloneIndexModal: CloneIndexModal
-  };
+  close: function (e) {
+    if (e) {
+      e.preventDefault();
+    }
+    this.props.close();
+  },
+
+  setNewIndexName: function (e) {
+    Actions.setNewCloneIndexName(e.target.value);
+  },
+
+  render: function () {
+    return (
+      <Modal dialogClassName="clone-index-modal" show={this.props.visible} onHide={this.close}>
+        <Modal.Header closeButton={true}>
+          <Modal.Title>{this.props.title}</Modal.Title>
+        </Modal.Header>
+        <Modal.Body>
+
+          <form className="form" method="post" onSubmit={this.submit}>
+            <p>
+              Select the design document where the cloned {this.props.indexLabel} will be created, and then enter
+              a name for the cloned {this.props.indexLabel}.
+            </p>
+
+            <div className="row">
+              <DesignDocSelector
+                ref="designDocSelector"
+                designDocList={this.props.designDocArray}
+                selectedDesignDocName={this.props.selectedDesignDoc}
+                newDesignDocName={this.props.newDesignDocName}
+                onSelectDesignDoc={Actions.selectDesignDoc}
+                onChangeNewDesignDocName={Actions.updateNewDesignDocName} />
+            </div>
 
+            <div className="clone-index-name-row">
+              <label className="new-index-title-label" htmlFor="new-index-name">{this.props.indexLabel} Name</label>
+              <input type="text" id="new-index-name" value={this.props.newIndexName} onChange={this.setNewIndexName}
+                 placeholder="Enter new view name" />
+            </div>
+          </form>
+
+        </Modal.Body>
+        <Modal.Footer>
+          <a href="#" className="cancel-link" onClick={this.close} data-bypass="true">Cancel</a>
+          <button onClick={this.submit} data-bypass="true" className="btn btn-success save">
+            <i className="icon fonticon-ok-circled" /> Clone {this.props.indexLabel}</button>
+        </Modal.Footer>
+      </Modal>
+    );
+  }
 });
+
+export default {
+  SidebarController: SidebarController,
+  DesignDoc: DesignDoc,
+  CloneIndexModal: CloneIndexModal
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/tests/activetasks.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/tests/activetasks.storesSpec.js b/app/addons/activetasks/tests/activetasks.storesSpec.js
index 82f47d0..d408ef2 100644
--- a/app/addons/activetasks/tests/activetasks.storesSpec.js
+++ b/app/addons/activetasks/tests/activetasks.storesSpec.js
@@ -9,183 +9,180 @@
 // 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',
-  '../stores',
-  './fakeActiveTaskResponse',
-  'react',
-  '../../../../test/mocha/testUtils',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, ActiveTasks, Stores, fakedResponse, React, utils, TestUtils, sinon) {
-  var assert = utils.assert;
-  var restore = utils.restore;
-
-  var activeTasksStore = Stores.activeTasksStore;
-  var activeTasksCollection = new ActiveTasks.AllTasks();
-  activeTasksCollection.parse(fakedResponse);
-
-  describe('Active Tasks -- Stores', function () {
-    var spy, clock;
+import FauxtonAPI from "../../../core/api";
+import ActiveTasks from "../resources";
+import Stores from "../stores";
+import fakedResponse from "./fakeActiveTaskResponse";
+import React from "react";
+import utils from "../../../../test/mocha/testUtils";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+var assert = utils.assert;
+var restore = utils.restore;
+
+var activeTasksStore = Stores.activeTasksStore;
+var activeTasksCollection = new ActiveTasks.AllTasks();
+activeTasksCollection.parse(fakedResponse);
+
+describe('Active Tasks -- Stores', function () {
+  var spy, clock;
+
+  beforeEach(function () {
+    activeTasksStore.initAfterFetching(activeTasksCollection.table, activeTasksCollection);
+    clock = sinon.useFakeTimers();
+  });
+
+  afterEach(function () {
+    restore(spy);
+    clock.restore();
+  });
+
+  describe('Active Task Stores - Polling', function () {
+    var pollingWidgetDiv, pollingWidget;
 
     beforeEach(function () {
       activeTasksStore.initAfterFetching(activeTasksCollection.table, activeTasksCollection);
-      clock = sinon.useFakeTimers();
     });
 
     afterEach(function () {
-      restore(spy);
-      clock.restore();
+      restore(activeTasksStore.getPollingInterval);
+      restore(window.clearInterval);
     });
 
-    describe('Active Task Stores - Polling', function () {
-      var pollingWidgetDiv, pollingWidget;
-
-      beforeEach(function () {
-        activeTasksStore.initAfterFetching(activeTasksCollection.table, activeTasksCollection);
-      });
-
-      afterEach(function () {
-        restore(activeTasksStore.getPollingInterval);
-        restore(window.clearInterval);
-      });
-
-      it('should poll at the min time', function () {
-        spy = sinon.spy(activeTasksStore, 'getPollingInterval');
-        var minTime = 1;
-        activeTasksStore.setPollingInterval(minTime);
-        activeTasksStore.setPolling();
-        assert.ok(spy.calledOnce);
+    it('should poll at the min time', function () {
+      spy = sinon.spy(activeTasksStore, 'getPollingInterval');
+      var minTime = 1;
+      activeTasksStore.setPollingInterval(minTime);
+      activeTasksStore.setPolling();
+      assert.ok(spy.calledOnce);
 
-        setInterval(spy, minTime * 1000);
-        clock.tick(minTime * 1000);
-        assert.ok(spy.calledTwice);
+      setInterval(spy, minTime * 1000);
+      clock.tick(minTime * 1000);
+      assert.ok(spy.calledTwice);
 
-        clock.tick(minTime * 1000);
-        assert.ok(spy.calledThrice);
-      });
+      clock.tick(minTime * 1000);
+      assert.ok(spy.calledThrice);
+    });
 
-      it('should poll at the max time', function () {
-        spy = sinon.spy(activeTasksStore, 'getPollingInterval');
+    it('should poll at the max time', function () {
+      spy = sinon.spy(activeTasksStore, 'getPollingInterval');
 
-        var maxTime = 30;
-        activeTasksStore.setPollingInterval(maxTime);
-        activeTasksStore.setPolling();
-        assert.ok(spy.calledOnce);
+      var maxTime = 30;
+      activeTasksStore.setPollingInterval(maxTime);
+      activeTasksStore.setPolling();
+      assert.ok(spy.calledOnce);
 
-        setInterval(spy, maxTime * 1000);
-        clock.tick(maxTime * 1000);
-        assert.ok(spy.calledTwice);
+      setInterval(spy, maxTime * 1000);
+      clock.tick(maxTime * 1000);
+      assert.ok(spy.calledTwice);
 
-        clock.tick(maxTime * 1000);
-        assert.ok(spy.calledThrice);
-      });
+      clock.tick(maxTime * 1000);
+      assert.ok(spy.calledThrice);
+    });
 
-      it('should poll at a mid time', function () {
-        spy = sinon.spy(activeTasksStore, 'getPollingInterval');
+    it('should poll at a mid time', function () {
+      spy = sinon.spy(activeTasksStore, 'getPollingInterval');
 
-        var midtime = 15;
-        activeTasksStore.setPollingInterval(midtime);
-        activeTasksStore.setPolling();
-        assert.ok(spy.calledOnce);
+      var midtime = 15;
+      activeTasksStore.setPollingInterval(midtime);
+      activeTasksStore.setPolling();
+      assert.ok(spy.calledOnce);
 
-        setInterval(spy, midtime * 1000);
-        clock.tick(midtime * 1000);
-        assert.ok(spy.calledTwice);
+      setInterval(spy, midtime * 1000);
+      clock.tick(midtime * 1000);
+      assert.ok(spy.calledTwice);
 
-        clock.tick(midtime * 1000);
-        assert.ok(spy.calledThrice);
-      });
+      clock.tick(midtime * 1000);
+      assert.ok(spy.calledThrice);
+    });
 
-      it('should clear interval each time', function () {
-        var spy = sinon.spy(window, 'clearInterval');
-        activeTasksStore.setPolling();
-        assert.ok(spy.calledOnce);
-      });
+    it('should clear interval each time', function () {
+      var spy = sinon.spy(window, 'clearInterval');
+      activeTasksStore.setPolling();
+      assert.ok(spy.calledOnce);
+    });
 
-      it('should set the isLoading variable so that the loading lines show up', function () {
-        spy = sinon.spy(activeTasksStore, 'setIsLoading');
-        var date = new Date();
+    it('should set the isLoading variable so that the loading lines show up', function () {
+      spy = sinon.spy(activeTasksStore, 'setIsLoading');
+      var date = new Date();
 
-        activeTasksCollection.pollingFetch();
-        assert.ok(spy.withArgs(true, date).calledOnce);
+      activeTasksCollection.pollingFetch();
+      assert.ok(spy.withArgs(true, date).calledOnce);
 
-        activeTasksCollection.parse(fakedResponse);
-        assert.ok(spy.withArgs(false, date).calledOnce);
+      activeTasksCollection.parse(fakedResponse);
+      assert.ok(spy.withArgs(false, date).calledOnce);
 
-        restore(activeTasksStore.setIsLoading);
-      });
+      restore(activeTasksStore.setIsLoading);
     });
+  });
 
-    describe('Active Task Stores - Filter Tab Tray', function () {
-      var fakeFilteredTable, storeFilteredtable;
-      function sort (a, b, sortBy) {  //sorts array by objects with key 'sortBy', with default started_on
-        if (_.isUndefined(sortBy)) {
-          sortBy = 'started-on';
-        }
-        return b[sortBy] - a[sortBy];
+  describe('Active Task Stores - Filter Tab Tray', function () {
+    var fakeFilteredTable, storeFilteredtable;
+    function sort (a, b, sortBy) {  //sorts array by objects with key 'sortBy', with default started_on
+      if (_.isUndefined(sortBy)) {
+        sortBy = 'started-on';
       }
+      return b[sortBy] - a[sortBy];
+    }
 
-      afterEach(function () {
-        fakeFilteredTable = [];
-      });
+    afterEach(function () {
+      fakeFilteredTable = [];
+    });
 
-      it('should filter the table correctly, by radio -- All Tasks', function () {
-        activeTasksStore.setSelectedRadio('all_tasks');
-        //parse table and check that it only contains objects any type
-        var table = activeTasksStore.getFilteredTable(activeTasksStore._collection);
-        assert.ok(activeTasksStore._collection.length, table.length);
-      });
+    it('should filter the table correctly, by radio -- All Tasks', function () {
+      activeTasksStore.setSelectedRadio('all_tasks');
+      //parse table and check that it only contains objects any type
+      var table = activeTasksStore.getFilteredTable(activeTasksStore._collection);
+      assert.ok(activeTasksStore._collection.length, table.length);
+    });
 
-      it('should filter the table correctly, by radio', function () {
-        activeTasksStore.setSelectedRadio('replication');
-        var storeFilteredtable = activeTasksStore.getFilteredTable(activeTasksStore._collection);
+    it('should filter the table correctly, by radio', function () {
+      activeTasksStore.setSelectedRadio('replication');
+      var storeFilteredtable = activeTasksStore.getFilteredTable(activeTasksStore._collection);
 
-        //parse table and check that it only contains objects with type: Replication
-        _.each(storeFilteredtable, function (activeTask) {
-          assert.ok(activeTasksStore.passesRadioFilter(activeTask));
-          assert.deepEqual(activeTask.type, activeTasksStore.getSelectedRadio());
-        });
+      //parse table and check that it only contains objects with type: Replication
+      _.each(storeFilteredtable, function (activeTask) {
+        assert.ok(activeTasksStore.passesRadioFilter(activeTask));
+        assert.deepEqual(activeTask.type, activeTasksStore.getSelectedRadio());
       });
+    });
 
-      it('should search the table correctly', function () {
-        activeTasksStore.setSelectedRadio('all_tasks');
-        var searchTerm = 'base';
-        activeTasksStore.setSearchTerm(searchTerm);
-        var storeGeneratedTable = activeTasksStore.getFilteredTable(activeTasksStore._collection);
-        var regEx = new RegExp(searchTerm);
+    it('should search the table correctly', function () {
+      activeTasksStore.setSelectedRadio('all_tasks');
+      var searchTerm = 'base';
+      activeTasksStore.setSearchTerm(searchTerm);
+      var storeGeneratedTable = activeTasksStore.getFilteredTable(activeTasksStore._collection);
+      var regEx = new RegExp(searchTerm);
 
-        fakeFilteredTable = [
-          { user: 'information'},
-          { user: 'ooo'}
-        ];
+      fakeFilteredTable = [
+        { user: 'information'},
+        { user: 'ooo'}
+      ];
 
-        assert.equal(fakeFilteredTable[0].user, storeGeneratedTable[0].user);
-        assert.equal(fakeFilteredTable[1].user, storeGeneratedTable[1].user);
-      });
+      assert.equal(fakeFilteredTable[0].user, storeGeneratedTable[0].user);
+      assert.equal(fakeFilteredTable[1].user, storeGeneratedTable[1].user);
     });
+  });
 
-    describe('Active Task Stores - Table Header Sort - Select Ascending/Descending', function () {
+  describe('Active Task Stores - Table Header Sort - Select Ascending/Descending', function () {
 
-      it('should set header as ascending, on default', function () {
-        activeTasksStore.setSelectedRadio('all-tasks');
-        activeTasksStore._headerIsAscending = true;
-        assert.ok(activeTasksStore.getHeaderIsAscending());
-      });
+    it('should set header as ascending, on default', function () {
+      activeTasksStore.setSelectedRadio('all-tasks');
+      activeTasksStore._headerIsAscending = true;
+      assert.ok(activeTasksStore.getHeaderIsAscending());
+    });
 
-      it('should set header as descending, if same header is selected again', function () {
-        activeTasksStore._prevSortbyHeader = 'sameHeader';
-        activeTasksStore._sortByHeader = 'sameHeader';
-        activeTasksStore.toggleHeaderIsAscending();
-        assert.notOk(activeTasksStore.getHeaderIsAscending());
-      });
+    it('should set header as descending, if same header is selected again', function () {
+      activeTasksStore._prevSortbyHeader = 'sameHeader';
+      activeTasksStore._sortByHeader = 'sameHeader';
+      activeTasksStore.toggleHeaderIsAscending();
+      assert.notOk(activeTasksStore.getHeaderIsAscending());
+    });
 
-      it('should set header as ascending, if different header is selected', function () {
-        activeTasksStore._sortByHeader = 'differentHeader';
-        activeTasksStore.toggleHeaderIsAscending();
-        assert.ok(activeTasksStore.getHeaderIsAscending());
-      });
+    it('should set header as ascending, if different header is selected', function () {
+      activeTasksStore._sortByHeader = 'differentHeader';
+      activeTasksStore.toggleHeaderIsAscending();
+      assert.ok(activeTasksStore.getHeaderIsAscending());
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/activetasks/tests/fakeActiveTaskResponse.js
----------------------------------------------------------------------
diff --git a/app/addons/activetasks/tests/fakeActiveTaskResponse.js b/app/addons/activetasks/tests/fakeActiveTaskResponse.js
index 687e566..823b7f2 100644
--- a/app/addons/activetasks/tests/fakeActiveTaskResponse.js
+++ b/app/addons/activetasks/tests/fakeActiveTaskResponse.js
@@ -9,113 +9,111 @@
 // 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([], function () {
-  var fakeData = [
-    {
-      "user": "okra",
-      "updated_on": 10,
-      "type": "replication",
-      "target": "https://okra.fake.com/okra_rep/",
-      "doc_write_failures": 0,
-      "doc_id": "rep_1",
-      "continuous": true,
-      "checkpointed_source_seq": "3-g1AAAAEkeJyFzkEOgjAQBdAJkHgOPUBDQS1dyVVmaE0l0CaIa72Z3qyOwahscPMn-Zm8_A4AMpca2BhqwmBrQzIXfQj-7E7eiqYLF4N-FN6OHf8mCHSIMbYuwbTnYiUllUbJl7H-GNUSQTUnXd8KTEqR467Qc0UtKT7jhBsfhu5fCa3SFR3nUvlfekzS76a9Vmi37RPEPVpb",
-      "checkpoint_interval": 5000,
-      "changes_pending": null,
-      "pid": "<0.10487.5819>",
-      "node": "fake1@fake.net",
-      "docs_read": 0,
-      "docs_written": 0,
-      "missing_revisions_found": 0,
-      "replication_id": "07d9a41f181ce11b93ba1855ca7+continuous+create_target",
-      "revisions_checked": 0,
-      "source": "https://okra.fake.com/okra/",
-      "source_seq": 0,
-      "started_on": 9
-    },
-    {
-      "user": "ooo",
-      "updated_on": 8,
-      "type": "indexer",
-      "node": "fake2@fake2.net",
-      "pid": "<0.10541.4469>",
-      "changes_done": 145,
-      "database": "shards/00000000-3fffffff/ooo/fakedatabase.1234567890abc",
-      "design_document": "_design/superpurple",
-      "progress": 0,
-      "started_on": 7,
-      "total_changes": 22942
-    },
-    {
-      "updated_on": 6,
-      "node": "fake3@fake3.net",
-      "pid": "<0.1152.4474>",
-      "changes_done": 144001,
-      "database": "shards/00000000-3fffffff/global_changes.1398718618",
-      "progress": 66,
-      "started_on": 5,
-      "total_changes": 218052,
-      "type": "database_compaction"
-    },
-    {
-      "user": "information",
-      "updated_on": 4,
-      "type": "replication",
-      "target": "https://information.com/somedatabase/",
-      "doc_write_failures": 0,
-      "doc_id": "c0ffb663f75cd940aadb4a4eaa",
-      "continuous": true,
-      "checkpointed_source_seq": 58717,
-      "checkpoint_interval": 3600000,
-      "changes_pending": 0,
-      "pid": "<0.11612.3684>",
-      "node": "fake.fake.com",
-      "docs_read": 108,
-      "docs_written": 108,
-      "missing_revisions_found": 108,
-      "replication_id": "a546c13951c6bd4f2d187d388+continuous",
-      "revisions_checked": 1024,
-      "source": "http://software:*****@123.123.123:5984/somedatabase/",
-      "source_seq": 58717,
-      "started_on": 3
-    },
-    {
-      "user": "abc",
-      "updated_on": 2,
-      "type": "replication",
-      "target": "https://fake.com/db_abc/",
-      "doc_write_failures": 0,
-      "doc_id": "replication_2014",
-      "continuous": true,
-      "checkpointed_source_seq": "2-g1AAAAEXeJzLYWBgYMlgTyrNSS3QS87JL01JzCvRy0styQGqY0pkSLL___9_VgZTImMuUIA9JSUx1cTIAE2_IS79SQ5AMqkexQiLNAPzNAsjYp2QxwIkGRqAFNCU_SBjGMDGGFokp6WZJ6IZY4TfmAMQY_4jjDE2SDE3TzHJAgBp5FSv",
-      "checkpoint_interval": 5000,
-      "changes_pending": 0,
-      "pid": "<0.14029.1733>",
-      "node": "node.node.node..net",
-      "docs_read": 0,
-      "docs_written": 0,
-      "missing_revisions_found": 0,
-      "replication_id": "33af566bab6a58aee04e+continuous",
-      "revisions_checked": 7,
-      "source": "https://fake.fake123.com/db_abc/",
-      "source_seq": "2-g1AAAAEXeJzLYWBgYMlgS3QS87JL01JzCvRy0styQGqY0pkSLL___9_VgZTImMuUIA9JSUx1cTIAE2_IS79SQ5AMqkexQiLNAPzNAsjYp2QxwIkGRqAFNCU_SBjGMDGGFokp6WZJ6IZY4TfmAMQY_4jjDE2SDE3TzHJAgBp5FSv",
-      "started_on": 1
-    },
-    {
-      "view": 5,
-      "user": "treeman",
-      "updated_on": 1426614009,
-      "type": "view_compaction",
-      "total_changes": 1108953,
-      "node": "treeman.net",
-      "pid": "<0.19668.4045>",
-      "changes_done": 430000,
-      "database": "shards/c0000000-ffffffff/treecompany/fake.1234567890",
-      "design_document": "_design/trunk",
-      "phase": "view",
-      "progress": 38,
-      "started_on": 1426602505
-    },
-  ];
-  return fakeData;
-});
+var fakeData = [
+  {
+    "user": "okra",
+    "updated_on": 10,
+    "type": "replication",
+    "target": "https://okra.fake.com/okra_rep/",
+    "doc_write_failures": 0,
+    "doc_id": "rep_1",
+    "continuous": true,
+    "checkpointed_source_seq": "3-g1AAAAEkeJyFzkEOgjAQBdAJkHgOPUBDQS1dyVVmaE0l0CaIa72Z3qyOwahscPMn-Zm8_A4AMpca2BhqwmBrQzIXfQj-7E7eiqYLF4N-FN6OHf8mCHSIMbYuwbTnYiUllUbJl7H-GNUSQTUnXd8KTEqR467Qc0UtKT7jhBsfhu5fCa3SFR3nUvlfekzS76a9Vmi37RPEPVpb",
+    "checkpoint_interval": 5000,
+    "changes_pending": null,
+    "pid": "<0.10487.5819>",
+    "node": "fake1@fake.net",
+    "docs_read": 0,
+    "docs_written": 0,
+    "missing_revisions_found": 0,
+    "replication_id": "07d9a41f181ce11b93ba1855ca7+continuous+create_target",
+    "revisions_checked": 0,
+    "source": "https://okra.fake.com/okra/",
+    "source_seq": 0,
+    "started_on": 9
+  },
+  {
+    "user": "ooo",
+    "updated_on": 8,
+    "type": "indexer",
+    "node": "fake2@fake2.net",
+    "pid": "<0.10541.4469>",
+    "changes_done": 145,
+    "database": "shards/00000000-3fffffff/ooo/fakedatabase.1234567890abc",
+    "design_document": "_design/superpurple",
+    "progress": 0,
+    "started_on": 7,
+    "total_changes": 22942
+  },
+  {
+    "updated_on": 6,
+    "node": "fake3@fake3.net",
+    "pid": "<0.1152.4474>",
+    "changes_done": 144001,
+    "database": "shards/00000000-3fffffff/global_changes.1398718618",
+    "progress": 66,
+    "started_on": 5,
+    "total_changes": 218052,
+    "type": "database_compaction"
+  },
+  {
+    "user": "information",
+    "updated_on": 4,
+    "type": "replication",
+    "target": "https://information.com/somedatabase/",
+    "doc_write_failures": 0,
+    "doc_id": "c0ffb663f75cd940aadb4a4eaa",
+    "continuous": true,
+    "checkpointed_source_seq": 58717,
+    "checkpoint_interval": 3600000,
+    "changes_pending": 0,
+    "pid": "<0.11612.3684>",
+    "node": "fake.fake.com",
+    "docs_read": 108,
+    "docs_written": 108,
+    "missing_revisions_found": 108,
+    "replication_id": "a546c13951c6bd4f2d187d388+continuous",
+    "revisions_checked": 1024,
+    "source": "http://software:*****@123.123.123:5984/somedatabase/",
+    "source_seq": 58717,
+    "started_on": 3
+  },
+  {
+    "user": "abc",
+    "updated_on": 2,
+    "type": "replication",
+    "target": "https://fake.com/db_abc/",
+    "doc_write_failures": 0,
+    "doc_id": "replication_2014",
+    "continuous": true,
+    "checkpointed_source_seq": "2-g1AAAAEXeJzLYWBgYMlgTyrNSS3QS87JL01JzCvRy0styQGqY0pkSLL___9_VgZTImMuUIA9JSUx1cTIAE2_IS79SQ5AMqkexQiLNAPzNAsjYp2QxwIkGRqAFNCU_SBjGMDGGFokp6WZJ6IZY4TfmAMQY_4jjDE2SDE3TzHJAgBp5FSv",
+    "checkpoint_interval": 5000,
+    "changes_pending": 0,
+    "pid": "<0.14029.1733>",
+    "node": "node.node.node..net",
+    "docs_read": 0,
+    "docs_written": 0,
+    "missing_revisions_found": 0,
+    "replication_id": "33af566bab6a58aee04e+continuous",
+    "revisions_checked": 7,
+    "source": "https://fake.fake123.com/db_abc/",
+    "source_seq": "2-g1AAAAEXeJzLYWBgYMlgS3QS87JL01JzCvRy0styQGqY0pkSLL___9_VgZTImMuUIA9JSUx1cTIAE2_IS79SQ5AMqkexQiLNAPzNAsjYp2QxwIkGRqAFNCU_SBjGMDGGFokp6WZJ6IZY4TfmAMQY_4jjDE2SDE3TzHJAgBp5FSv",
+    "started_on": 1
+  },
+  {
+    "view": 5,
+    "user": "treeman",
+    "updated_on": 1426614009,
+    "type": "view_compaction",
+    "total_changes": 1108953,
+    "node": "treeman.net",
+    "pid": "<0.19668.4045>",
+    "changes_done": 430000,
+    "database": "shards/c0000000-ffffffff/treecompany/fake.1234567890",
+    "design_document": "_design/trunk",
+    "phase": "view",
+    "progress": 38,
+    "started_on": 1426602505
+  },
+];
+export default fakeData;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/actions.js b/app/addons/auth/actions.js
index 088a220..104f057 100644
--- a/app/addons/auth/actions.js
+++ b/app/addons/auth/actions.js
@@ -9,112 +9,107 @@
 // 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',
-  './actiontypes',
-  '../cluster/cluster.stores'
-],
-function (FauxtonAPI, ActionTypes, ClusterStore) {
-
-  var nodesStore = ClusterStore.nodesStore;
-
-  var errorHandler = function (xhr, type, msg) {
-    msg = xhr;
-    if (arguments.length === 3) {
-      msg = xhr.responseJSON.reason;
-    }
-
-    FauxtonAPI.addNotification({
-      msg: msg,
-      type: 'error'
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+import ClusterStore from "../cluster/cluster.stores";
+
+var nodesStore = ClusterStore.nodesStore;
+
+var errorHandler = function (xhr, type, msg) {
+  msg = xhr;
+  if (arguments.length === 3) {
+    msg = xhr.responseJSON.reason;
+  }
+
+  FauxtonAPI.addNotification({
+    msg: msg,
+    type: 'error'
+  });
+};
+
+
+export default {
+
+  login: function (username, password, urlBack) {
+    var promise = FauxtonAPI.session.login(username, password);
+
+    promise.then(function () {
+      FauxtonAPI.addNotification({ msg: FauxtonAPI.session.messages.loggedIn });
+      if (urlBack) {
+        return FauxtonAPI.navigate(urlBack);
+      }
+      FauxtonAPI.navigate('/');
+    });
+    promise.fail(errorHandler);
+  },
+
+  changePassword: function (password, passwordConfirm) {
+    var nodes = nodesStore.getNodes();
+    var promise = FauxtonAPI.session.changePassword(password, passwordConfirm, nodes[0].node);
+
+    promise.done(function () {
+      FauxtonAPI.addNotification({ msg: FauxtonAPI.session.messages.changePassword });
+      FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS });
     });
-  };
 
+    promise.fail(errorHandler);
+  },
 
-  return {
+  updateChangePasswordField: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD,
+      value: value
+    });
+  },
 
-    login: function (username, password, urlBack) {
-      var promise = FauxtonAPI.session.login(username, password);
+  updateChangePasswordConfirmField: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD,
+      value: value
+    });
+  },
 
-      promise.then(function () {
-        FauxtonAPI.addNotification({ msg: FauxtonAPI.session.messages.loggedIn });
-        if (urlBack) {
-          return FauxtonAPI.navigate(urlBack);
-        }
+  createAdmin: function (username, password, loginAfter) {
+    var nodes = nodesStore.getNodes();
+    var promise = FauxtonAPI.session.createAdmin(username, password, loginAfter, nodes[0].node);
+
+    promise.then(function () {
+      FauxtonAPI.addNotification({ msg: FauxtonAPI.session.messages.adminCreated });
+      if (loginAfter) {
         FauxtonAPI.navigate('/');
-      });
-      promise.fail(errorHandler);
-    },
-
-    changePassword: function (password, passwordConfirm) {
-      var nodes = nodesStore.getNodes();
-      var promise = FauxtonAPI.session.changePassword(password, passwordConfirm, nodes[0].node);
-
-      promise.done(function () {
-        FauxtonAPI.addNotification({ msg: FauxtonAPI.session.messages.changePassword });
-        FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS });
-      });
-
-      promise.fail(errorHandler);
-    },
-
-    updateChangePasswordField: function (value) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD,
-        value: value
-      });
-    },
-
-    updateChangePasswordConfirmField: function (value) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD,
-        value: value
-      });
-    },
-
-    createAdmin: function (username, password, loginAfter) {
-      var nodes = nodesStore.getNodes();
-      var promise = FauxtonAPI.session.createAdmin(username, password, loginAfter, nodes[0].node);
-
-      promise.then(function () {
-        FauxtonAPI.addNotification({ msg: FauxtonAPI.session.messages.adminCreated });
-        if (loginAfter) {
-          FauxtonAPI.navigate('/');
-        } else {
-          FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS });
-        }
-      });
-
-      promise.fail(function (xhr, type, msg) {
-        msg = xhr;
-        if (arguments.length === 3) {
-          msg = xhr.responseJSON.reason;
-        }
-        errorHandler(FauxtonAPI.session.messages.adminCreationFailedPrefix + ' ' + msg);
-      });
-    },
-
-    updateCreateAdminUsername: function (value) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD,
-        value: value
-      });
-    },
-
-    updateCreateAdminPassword: function (value) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD,
-        value: value
-      });
-    },
-
-    selectPage: function (page) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.AUTH_SELECT_PAGE,
-        page: page
-      });
-    }
-
-  };
-
-});
+      } else {
+        FauxtonAPI.dispatch({ type: ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS });
+      }
+    });
+
+    promise.fail(function (xhr, type, msg) {
+      msg = xhr;
+      if (arguments.length === 3) {
+        msg = xhr.responseJSON.reason;
+      }
+      errorHandler(FauxtonAPI.session.messages.adminCreationFailedPrefix + ' ' + msg);
+    });
+  },
+
+  updateCreateAdminUsername: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD,
+      value: value
+    });
+  },
+
+  updateCreateAdminPassword: function (value) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD,
+      value: value
+    });
+  },
+
+  selectPage: function (page) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.AUTH_SELECT_PAGE,
+      page: page
+    });
+  }
+
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/actiontypes.js b/app/addons/auth/actiontypes.js
index 29ce9bf..af3d02a 100644
--- a/app/addons/auth/actiontypes.js
+++ b/app/addons/auth/actiontypes.js
@@ -10,14 +10,12 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    AUTH_CLEAR_CHANGE_PWD_FIELDS: 'AUTH_CLEAR_CHANGE_PWD_FIELDS',
-    AUTH_UPDATE_CHANGE_PWD_FIELD: 'AUTH_UPDATE_CHANGE_PWD_FIELD',
-    AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD: 'AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD',
-    AUTH_CLEAR_CREATE_ADMIN_FIELDS: 'AUTH_CLEAR_CREATE_ADMIN_FIELDS',
-    AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD: 'AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD',
-    AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD: 'AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD',
-    AUTH_SELECT_PAGE: 'AUTH_SELECT_PAGE'
-  };
-});
+export default {
+  AUTH_CLEAR_CHANGE_PWD_FIELDS: 'AUTH_CLEAR_CHANGE_PWD_FIELDS',
+  AUTH_UPDATE_CHANGE_PWD_FIELD: 'AUTH_UPDATE_CHANGE_PWD_FIELD',
+  AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD: 'AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD',
+  AUTH_CLEAR_CREATE_ADMIN_FIELDS: 'AUTH_CLEAR_CREATE_ADMIN_FIELDS',
+  AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD: 'AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD',
+  AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD: 'AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD',
+  AUTH_SELECT_PAGE: 'AUTH_SELECT_PAGE'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/base.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/base.js b/app/addons/auth/base.js
index 07619c5..5956401 100644
--- a/app/addons/auth/base.js
+++ b/app/addons/auth/base.js
@@ -10,106 +10,101 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './routes',
-  './assets/less/auth.less'
-],
-
-function (app, FauxtonAPI, Auth) {
-
-  Auth.session = new Auth.Session();
-  FauxtonAPI.setSession(Auth.session);
-  app.session = Auth.session;
-
-  Auth.initialize = function () {
-
-    FauxtonAPI.addHeaderLink({
-      id: 'auth',
-      title: 'Login',
-      href: '#login',
-      icon: 'fonticon-user',
-      bottomNav: true
-    });
-
-    Auth.session.on('change', function () {
-      var session = Auth.session;
-      var link = {};
-
-      if (session.isAdminParty()) {
-        link = {
-          id: 'auth',
-          title: 'Admin Party!',
-          href: '#createAdmin',
-          icon: 'fonticon-user',
-          bottomNav: true
-        };
-      } else if (session.isLoggedIn()) {
-        link = {
-          id: 'auth',
-          title: session.user().name,
-          href: '#changePassword',
-          icon: 'fonticon-user',
-          bottomNav: true
-        };
-
-        // ensure the footer link is removed before adding it
-        FauxtonAPI.removeHeaderLink({ id: 'logout', footerNav: true });
-        FauxtonAPI.addHeaderLink({
-          id: 'logout',
-          footerNav: true,
-          href: '#logout',
-          title: 'Logout',
-          icon: '',
-          className: 'logout'
-        });
-      } else {
-        link = {
-          id: 'auth',
-          title: 'Login',
-          href: '#login',
-          icon: 'fonticon-user',
-          bottomNav: true
-        };
-        FauxtonAPI.removeHeaderLink({ id: 'logout', footerNav: true });
-      }
-      FauxtonAPI.updateHeaderLink(link);
-    });
-
-    Auth.session.fetchUser().then(function () {
-      Auth.session.trigger('change');
-    });
-
-    var auth = function (session, roles) {
-      var deferred = $.Deferred();
-
-      if (session.isAdminParty()) {
-        session.trigger('authenticated');
-        deferred.resolve();
-      } else if (session.matchesRoles(roles)) {
-        session.trigger('authenticated');
-        deferred.resolve();
-      } else {
-        deferred.reject();
-      }
-
-      return [deferred];
-    };
-
-    var authDenied = function () {
-      var url = window.location.hash.replace('#', '');
-      var pattern = /login\?urlback=/g;
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Auth from "./routes";
+import "./assets/less/auth.less";
+
+Auth.session = new Auth.Session();
+FauxtonAPI.setSession(Auth.session);
+app.session = Auth.session;
+
+Auth.initialize = function () {
+
+  FauxtonAPI.addHeaderLink({
+    id: 'auth',
+    title: 'Login',
+    href: '#login',
+    icon: 'fonticon-user',
+    bottomNav: true
+  });
+
+  Auth.session.on('change', function () {
+    var session = Auth.session;
+    var link = {};
+
+    if (session.isAdminParty()) {
+      link = {
+        id: 'auth',
+        title: 'Admin Party!',
+        href: '#createAdmin',
+        icon: 'fonticon-user',
+        bottomNav: true
+      };
+    } else if (session.isLoggedIn()) {
+      link = {
+        id: 'auth',
+        title: session.user().name,
+        href: '#changePassword',
+        icon: 'fonticon-user',
+        bottomNav: true
+      };
+
+      // ensure the footer link is removed before adding it
+      FauxtonAPI.removeHeaderLink({ id: 'logout', footerNav: true });
+      FauxtonAPI.addHeaderLink({
+        id: 'logout',
+        footerNav: true,
+        href: '#logout',
+        title: 'Logout',
+        icon: '',
+        className: 'logout'
+      });
+    } else {
+      link = {
+        id: 'auth',
+        title: 'Login',
+        href: '#login',
+        icon: 'fonticon-user',
+        bottomNav: true
+      };
+      FauxtonAPI.removeHeaderLink({ id: 'logout', footerNav: true });
+    }
+    FauxtonAPI.updateHeaderLink(link);
+  });
+
+  Auth.session.fetchUser().then(function () {
+    Auth.session.trigger('change');
+  });
+
+  var auth = function (session, roles) {
+    var deferred = $.Deferred();
+
+    if (session.isAdminParty()) {
+      session.trigger('authenticated');
+      deferred.resolve();
+    } else if (session.matchesRoles(roles)) {
+      session.trigger('authenticated');
+      deferred.resolve();
+    } else {
+      deferred.reject();
+    }
+
+    return [deferred];
+  };
 
-      if (pattern.test(url)) {
-        url = url.replace('login?urlback=', '');
-      }
-      FauxtonAPI.navigate('/login?urlback=' + url, { replace: true });
-    };
+  var authDenied = function () {
+    var url = window.location.hash.replace('#', '');
+    var pattern = /login\?urlback=/g;
 
-    FauxtonAPI.auth.registerAuth(auth);
-    FauxtonAPI.auth.registerAuthDenied(authDenied);
+    if (pattern.test(url)) {
+      url = url.replace('login?urlback=', '');
+    }
+    FauxtonAPI.navigate('/login?urlback=' + url, { replace: true });
   };
 
-  return Auth;
-});
+  FauxtonAPI.auth.registerAuth(auth);
+  FauxtonAPI.auth.registerAuthDenied(authDenied);
+};
+
+export default Auth;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/auth/components.react.jsx b/app/addons/auth/components.react.jsx
index fc9d29a..fda85de 100644
--- a/app/addons/auth/components.react.jsx
+++ b/app/addons/auth/components.react.jsx
@@ -10,306 +10,301 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  'react-dom',
-  './stores',
-  './actions'
-], function (app, FauxtonAPI, React, ReactDOM, AuthStores, AuthActions) {
-
-  var changePasswordStore = AuthStores.changePasswordStore;
-  var createAdminStore = AuthStores.createAdminStore;
-  var createAdminSidebarStore = AuthStores.createAdminSidebarStore;
-
-
-  var LoginForm = React.createClass({
-    propTypes: {
-      urlBack: React.PropTypes.string.isRequired
-    },
-
-    getInitialState: function () {
-      return {
-        username: '',
-        password: ''
-      };
-    },
-
-    getDefaultProps: function () {
-      return {
-        urlBack: '',
-
-        // for testing purposes only
-        testBlankUsername: null,
-        testBlankPassword: null
-      };
-    },
-
-    onInputChange: function (e) {
-      var change = (e.target.name === 'name') ? { username: e.target.value } : { password: e.target.value };
-      this.setState(change);
-    },
-
-    submit: function (e) {
-      e.preventDefault();
-
-      if (!this.checkUnrecognizedAutoFill()) {
-        this.login(this.state.username, this.state.password);
-      }
-    },
-
-    // Safari has a bug where autofill doesn't trigger a change event. This checks for the condition where the state
-    // and form fields have a mismatch. See: https://issues.apache.org/jira/browse/COUCHDB-2829
-    checkUnrecognizedAutoFill: function () {
-      if (this.state.username !== '' || this.state.password !== '') {
-        return false;
-      }
-      var username = (this.props.testBlankUsername) ? this.props.testBlankUsername : ReactDOM.findDOMNode(this.refs.username).value;
-      var password = (this.props.testBlankPassword) ? this.props.testBlankPassword : ReactDOM.findDOMNode(this.refs.password).value;
-      this.setState({ username: username, password: password }); // doesn't set immediately, hence separate login() call
-      this.login(username, password);
-
-      return true;
-    },
-
-    login: function (username, password) {
-      AuthActions.login(username, password, this.props.urlBack);
-    },
-
-    componentDidMount: function () {
-      ReactDOM.findDOMNode(this.refs.username).focus();
-    },
-
-    render: function () {
-      return (
-        <div className="couch-login-wrapper">
-          <div className="row-fluid">
-            <div className="span12">
-              <form id="login" onSubmit={this.submit}>
-                <p className="help-block">
-                  Enter your username and password.
-                </p>
-                <input id="username" type="text" name="name" ref="username" placeholder="Username" size="24"
-                  onChange={this.onInputChange} value={this.state.username} />
-                <br/>
-                <input id="password" type="password" name="password" ref="password" placeholder="Password" size="24"
-                  onChange={this.onInputChange} value={this.state.password} />
-                <br/>
-                <button id="submit" className="btn btn-success" type="submit">Log In</button>
-              </form>
-            </div>
-          </div>
-        </div>
-      );
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import AuthStores from "./stores";
+import AuthActions from "./actions";
+
+var changePasswordStore = AuthStores.changePasswordStore;
+var createAdminStore = AuthStores.createAdminStore;
+var createAdminSidebarStore = AuthStores.createAdminSidebarStore;
+
+
+var LoginForm = React.createClass({
+  propTypes: {
+    urlBack: React.PropTypes.string.isRequired
+  },
+
+  getInitialState: function () {
+    return {
+      username: '',
+      password: ''
+    };
+  },
+
+  getDefaultProps: function () {
+    return {
+      urlBack: '',
+
+      // for testing purposes only
+      testBlankUsername: null,
+      testBlankPassword: null
+    };
+  },
+
+  onInputChange: function (e) {
+    var change = (e.target.name === 'name') ? { username: e.target.value } : { password: e.target.value };
+    this.setState(change);
+  },
+
+  submit: function (e) {
+    e.preventDefault();
+
+    if (!this.checkUnrecognizedAutoFill()) {
+      this.login(this.state.username, this.state.password);
     }
-  });
-
-
-  var ChangePasswordForm = React.createClass({
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        password: changePasswordStore.getChangePassword(),
-        passwordConfirm: changePasswordStore.getChangePasswordConfirm()
-      };
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    onChangePassword: function (e) {
-      AuthActions.updateChangePasswordField(e.target.value);
-    },
-
-    onChangePasswordConfirm: function (e) {
-      AuthActions.updateChangePasswordConfirmField(e.target.value);
-    },
-
-    componentDidMount: function () {
-      ReactDOM.findDOMNode(this.refs.password).focus();
-      changePasswordStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      changePasswordStore.off('change', this.onChange);
-    },
-
-    changePassword: function (e) {
-      e.preventDefault();
-      AuthActions.changePassword(this.state.password, this.state.passwordConfirm);
-    },
-
-    render: function () {
-      return (
-        <div className="auth-page">
-          <h3>Change Password</h3>
-
-          <form id="change-password" onSubmit={this.changePassword}>
-            <p>
-              Enter your new password.
-            </p>
-
-            <input id="password" type="password" ref="password" name="password" placeholder="Password"
-              size="24" onChange={this.onChangePassword} value={this.state.password} />
-            <br />
-            <input id="password-confirm" type="password" name="password_confirm" placeholder= "Verify Password"
-              size="24" onChange={this.onChangePasswordConfirm} value={this.state.passwordConfirm} />
-
-            <br />
-            <p>
-              <button type="submit" className="btn btn-primary">Change</button>
-            </p>
-          </form>
-        </div>
-      );
+  },
+
+  // Safari has a bug where autofill doesn't trigger a change event. This checks for the condition where the state
+  // and form fields have a mismatch. See: https://issues.apache.org/jira/browse/COUCHDB-2829
+  checkUnrecognizedAutoFill: function () {
+    if (this.state.username !== '' || this.state.password !== '') {
+      return false;
     }
-  });
-
-
-  var CreateAdminForm = React.createClass({
-    propTypes: {
-      loginAfter: React.PropTypes.bool.isRequired
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        username: createAdminStore.getUsername(),
-        password: createAdminStore.getPassword()
-      };
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    getDefaultProps: function () {
-      return {
-        loginAfter: ''
-      };
-    },
-
-    onChangeUsername: function (e) {
-      AuthActions.updateCreateAdminUsername(e.target.value);
-    },
-
-    onChangePassword: function (e) {
-      AuthActions.updateCreateAdminPassword(e.target.value);
-    },
-
-    componentDidMount: function () {
-      ReactDOM.findDOMNode(this.refs.username).focus();
-      createAdminStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      createAdminStore.off('change', this.onChange);
-    },
-
-    createAdmin: function (e) {
-      e.preventDefault();
-      AuthActions.createAdmin(this.state.username, this.state.password, this.props.loginAfter);
-    },
-
-    render: function () {
-      return (
-        <div className="auth-page">
-          <h3>Create Admins</h3>
+    var username = (this.props.testBlankUsername) ? this.props.testBlankUsername : ReactDOM.findDOMNode(this.refs.username).value;
+    var password = (this.props.testBlankPassword) ? this.props.testBlankPassword : ReactDOM.findDOMNode(this.refs.password).value;
+    this.setState({ username: username, password: password }); // doesn't set immediately, hence separate login() call
+    this.login(username, password);
+
+    return true;
+  },
+
+  login: function (username, password) {
+    AuthActions.login(username, password, this.props.urlBack);
+  },
+
+  componentDidMount: function () {
+    ReactDOM.findDOMNode(this.refs.username).focus();
+  },
+
+  render: function () {
+    return (
+      <div className="couch-login-wrapper">
+        <div className="row-fluid">
+          <div className="span12">
+            <form id="login" onSubmit={this.submit}>
+              <p className="help-block">
+                Enter your username and password.
+              </p>
+              <input id="username" type="text" name="name" ref="username" placeholder="Username" size="24"
+                onChange={this.onInputChange} value={this.state.username} />
+              <br/>
+              <input id="password" type="password" name="password" ref="password" placeholder="Password" size="24"
+                onChange={this.onInputChange} value={this.state.password} />
+              <br/>
+              <button id="submit" className="btn btn-success" type="submit">Log In</button>
+            </form>
+          </div>
+        </div>
+      </div>
+    );
+  }
+});
+
+
+var ChangePasswordForm = React.createClass({
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      password: changePasswordStore.getChangePassword(),
+      passwordConfirm: changePasswordStore.getChangePasswordConfirm()
+    };
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  onChangePassword: function (e) {
+    AuthActions.updateChangePasswordField(e.target.value);
+  },
+
+  onChangePasswordConfirm: function (e) {
+    AuthActions.updateChangePasswordConfirmField(e.target.value);
+  },
+
+  componentDidMount: function () {
+    ReactDOM.findDOMNode(this.refs.password).focus();
+    changePasswordStore.on('change', this.onChange, this);
+  },
 
+  componentWillUnmount: function () {
+    changePasswordStore.off('change', this.onChange);
+  },
+
+  changePassword: function (e) {
+    e.preventDefault();
+    AuthActions.changePassword(this.state.password, this.state.passwordConfirm);
+  },
+
+  render: function () {
+    return (
+      <div className="auth-page">
+        <h3>Change Password</h3>
+
+        <form id="change-password" onSubmit={this.changePassword}>
           <p>
-            Before a server admin is configured, all clients have admin privileges. This is fine when
-            HTTP access is restricted to trusted users. <strong>If end-users will be accessing this
-            CouchDB, you must create an admin account to prevent accidental (or malicious) data
-            loss.</strong>
+            Enter your new password.
           </p>
+
+          <input id="password" type="password" ref="password" name="password" placeholder="Password"
+            size="24" onChange={this.onChangePassword} value={this.state.password} />
+          <br />
+          <input id="password-confirm" type="password" name="password_confirm" placeholder= "Verify Password"
+            size="24" onChange={this.onChangePasswordConfirm} value={this.state.passwordConfirm} />
+
+          <br />
           <p>
-            Server admins can create and destroy databases, install and update _design documents, run
-            the test suite, and edit all aspects of CouchDB configuration.
+            <button type="submit" className="btn btn-primary">Change</button>
           </p>
+        </form>
+      </div>
+    );
+  }
+});
 
-          <form id="create-admin-form" onSubmit={this.createAdmin}>
-            <input id="username" type="text" ref="username" name="name" placeholder="Username" size="24"
-              onChange={this.onChangeUsername} />
-            <br/>
-            <input id="password" type="password" name="password" placeholder= "Password" size="24"
-              onChange={this.onChangePassword} />
-            <p>
-              Non-admin users have read and write access to all databases, which
-              are controlled by validation functions. CouchDB can be configured to block all
-              access to anonymous users.
-            </p>
-            <button type="submit" id="create-admin" className="btn btn-primary">Create Admin</button>
-          </form>
-        </div>
-      );
-    }
-  });
-
-
-  var CreateAdminSidebar = React.createClass({
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        selectedPage: createAdminSidebarStore.getSelectedPage()
-      };
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    componentDidMount: function () {
-      createAdminSidebarStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      createAdminSidebarStore.off('change', this.onChange);
-    },
-
-    selectPage: function (e) {
-      var newPage = e.target.href.split('#')[1];
-      AuthActions.selectPage(newPage);
-    },
-
-    render: function () {
-      var user = FauxtonAPI.session.user();
-      var userName = _.isNull(user) ? '' : FauxtonAPI.session.user().name;
-
-      return (
-        <div className="sidenav">
-          <header className="row-fluid">
-            <h3>{userName}</h3>
-          </header>
-          <ul className="nav nav-list" onClick={this.selectPage}>
-            <li className={this.state.selectedPage === 'changePassword' ? 'active' : ''} data-page="changePassword">
-              <a href="#changePassword">Change Password</a>
-            </li>
-            <li className={this.state.selectedPage === 'addAdmin' ? 'active' : ''} data-page="addAdmin">
-              <a href="#addAdmin">Create Admins</a>
-            </li>
-          </ul>
-        </div>
-      );
-    }
-  });
 
-  return {
-    LoginForm: LoginForm,
-    ChangePasswordForm: ChangePasswordForm,
-    CreateAdminForm: CreateAdminForm,
-    CreateAdminSidebar: CreateAdminSidebar
-  };
+var CreateAdminForm = React.createClass({
+  propTypes: {
+    loginAfter: React.PropTypes.bool.isRequired
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      username: createAdminStore.getUsername(),
+      password: createAdminStore.getPassword()
+    };
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  getDefaultProps: function () {
+    return {
+      loginAfter: ''
+    };
+  },
+
+  onChangeUsername: function (e) {
+    AuthActions.updateCreateAdminUsername(e.target.value);
+  },
+
+  onChangePassword: function (e) {
+    AuthActions.updateCreateAdminPassword(e.target.value);
+  },
+
+  componentDidMount: function () {
+    ReactDOM.findDOMNode(this.refs.username).focus();
+    createAdminStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    createAdminStore.off('change', this.onChange);
+  },
+
+  createAdmin: function (e) {
+    e.preventDefault();
+    AuthActions.createAdmin(this.state.username, this.state.password, this.props.loginAfter);
+  },
+
+  render: function () {
+    return (
+      <div className="auth-page">
+        <h3>Create Admins</h3>
+
+        <p>
+          Before a server admin is configured, all clients have admin privileges. This is fine when
+          HTTP access is restricted to trusted users. <strong>If end-users will be accessing this
+          CouchDB, you must create an admin account to prevent accidental (or malicious) data
+          loss.</strong>
+        </p>
+        <p>
+          Server admins can create and destroy databases, install and update _design documents, run
+          the test suite, and edit all aspects of CouchDB configuration.
+        </p>
+
+        <form id="create-admin-form" onSubmit={this.createAdmin}>
+          <input id="username" type="text" ref="username" name="name" placeholder="Username" size="24"
+            onChange={this.onChangeUsername} />
+          <br/>
+          <input id="password" type="password" name="password" placeholder= "Password" size="24"
+            onChange={this.onChangePassword} />
+          <p>
+            Non-admin users have read and write access to all databases, which
+            are controlled by validation functions. CouchDB can be configured to block all
+            access to anonymous users.
+          </p>
+          <button type="submit" id="create-admin" className="btn btn-primary">Create Admin</button>
+        </form>
+      </div>
+    );
+  }
+});
 
 
+var CreateAdminSidebar = React.createClass({
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      selectedPage: createAdminSidebarStore.getSelectedPage()
+    };
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  componentDidMount: function () {
+    createAdminSidebarStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    createAdminSidebarStore.off('change', this.onChange);
+  },
+
+  selectPage: function (e) {
+    var newPage = e.target.href.split('#')[1];
+    AuthActions.selectPage(newPage);
+  },
+
+  render: function () {
+    var user = FauxtonAPI.session.user();
+    var userName = _.isNull(user) ? '' : FauxtonAPI.session.user().name;
+
+    return (
+      <div className="sidenav">
+        <header className="row-fluid">
+          <h3>{userName}</h3>
+        </header>
+        <ul className="nav nav-list" onClick={this.selectPage}>
+          <li className={this.state.selectedPage === 'changePassword' ? 'active' : ''} data-page="changePassword">
+            <a href="#changePassword">Change Password</a>
+          </li>
+          <li className={this.state.selectedPage === 'addAdmin' ? 'active' : ''} data-page="addAdmin">
+            <a href="#addAdmin">Create Admins</a>
+          </li>
+        </ul>
+      </div>
+    );
+  }
 });
+
+export default {
+  LoginForm: LoginForm,
+  ChangePasswordForm: ChangePasswordForm,
+  CreateAdminForm: CreateAdminForm,
+  CreateAdminSidebar: CreateAdminSidebar
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/resources.js b/app/addons/auth/resources.js
index 3732828..91f4456 100644
--- a/app/addons/auth/resources.js
+++ b/app/addons/auth/resources.js
@@ -10,204 +10,199 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  "../../core/couchdbSession"
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import CouchdbSession from "../../core/couchdbSession";
 
-function (app, FauxtonAPI, CouchdbSession) {
+var Auth = new FauxtonAPI.addon();
 
-  var Auth = new FauxtonAPI.addon();
 
+var Admin = Backbone.Model.extend({
 
-  var Admin = Backbone.Model.extend({
+  initialize: function (props, options) {
+    this.node = options.node;
+  },
 
-    initialize: function (props, options) {
-      this.node = options.node;
-    },
-
-    url: function () {
-      if (!this.node) {
-        throw new Error('no node set');
-      }
+  url: function () {
+    if (!this.node) {
+      throw new Error('no node set');
+    }
 
-      return app.host + '/_node/' + this.node + '/_config/admins/' + this.get('name');
-    },
+    return app.host + '/_node/' + this.node + '/_config/admins/' + this.get('name');
+  },
 
-    isNew: function () { return false; },
+  isNew: function () { return false; },
 
-    sync: function (method, model, options) {
-      var params = {
-        url: model.url(),
-        contentType: 'application/json',
-        dataType: 'json',
-        data: JSON.stringify(model.get('value'))
-      };
+  sync: function (method, model, options) {
+    var params = {
+      url: model.url(),
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(model.get('value'))
+    };
 
-      if (method === 'delete') {
-        params.type = 'DELETE';
-      } else {
-        params.type = 'PUT';
-      }
-
-      return $.ajax(params);
+    if (method === 'delete') {
+      params.type = 'DELETE';
+    } else {
+      params.type = 'PUT';
     }
-  });
 
-  Auth.Session = CouchdbSession.Session.extend({
-    url: app.host + '/_session',
+    return $.ajax(params);
+  }
+});
 
-    initialize: function (options) {
-      if (!options) { options = {}; }
+Auth.Session = CouchdbSession.Session.extend({
+  url: app.host + '/_session',
 
-      _.bindAll(this);
+  initialize: function (options) {
+    if (!options) { options = {}; }
 
-      this.messages = _.extend({},  {
-          missingCredentials: 'Username or password cannot be blank.',
-          loggedIn: 'You have been logged in.',
-          adminCreated: 'CouchDB admin created',
-          changePassword: 'Your password has been updated.',
-          adminCreationFailedPrefix: 'Could not create admin.'
-        }, options.messages);
-    },
+    _.bindAll(this);
 
-    isAdminParty: function () {
-      var userCtx = this.get('userCtx');
+    this.messages = _.extend({},  {
+        missingCredentials: 'Username or password cannot be blank.',
+        loggedIn: 'You have been logged in.',
+        adminCreated: 'CouchDB admin created',
+        changePassword: 'Your password has been updated.',
+        adminCreationFailedPrefix: 'Could not create admin.'
+      }, options.messages);
+  },
 
+  isAdminParty: function () {
+    var userCtx = this.get('userCtx');
 
-      if (!userCtx.name && userCtx.roles.indexOf("_admin") > -1) {
-        return true;
-      }
 
-      return false;
-    },
+    if (!userCtx.name && userCtx.roles.indexOf("_admin") > -1) {
+      return true;
+    }
 
-    isLoggedIn: function () {
-      var userCtx = this.get('userCtx');
+    return false;
+  },
 
-      if (!userCtx) { return false;}
-      if (userCtx.name) {
-        return true;
-      }
+  isLoggedIn: function () {
+    var userCtx = this.get('userCtx');
 
-      return false;
-    },
+    if (!userCtx) { return false;}
+    if (userCtx.name) {
+      return true;
+    }
 
-    userRoles: function () {
-      var user = this.user();
+    return false;
+  },
 
-      if (user && user.roles) {
-        if (user.roles.indexOf('fx_loggedIn') === -1) {
-          user.roles.push('fx_loggedIn');
-        }
+  userRoles: function () {
+    var user = this.user();
 
-        return user.roles;
+    if (user && user.roles) {
+      if (user.roles.indexOf('fx_loggedIn') === -1) {
+        user.roles.push('fx_loggedIn');
       }
 
-      return [];
-    },
+      return user.roles;
+    }
 
-    matchesRoles: function (roles) {
-      if (roles.length === 0) {
-        return true;
-      }
+    return [];
+  },
 
-      var numberMatchingRoles = _.intersection(this.userRoles(), roles).length;
+  matchesRoles: function (roles) {
+    if (roles.length === 0) {
+      return true;
+    }
 
-      if (numberMatchingRoles > 0) {
-        return true;
-      }
+    var numberMatchingRoles = _.intersection(this.userRoles(), roles).length;
 
-      return false;
-    },
+    if (numberMatchingRoles > 0) {
+      return true;
+    }
 
-    validateUser: function (username, password, msg) {
-      if (_.isEmpty(username) || _.isEmpty(password)) {
-        var deferred = FauxtonAPI.Deferred();
+    return false;
+  },
 
-        deferred.rejectWith(this, [msg]);
-        return deferred;
-      }
-    },
+  validateUser: function (username, password, msg) {
+    if (_.isEmpty(username) || _.isEmpty(password)) {
+      var deferred = FauxtonAPI.Deferred();
 
-    validatePasswords: function (password, password_confirm, msg) {
-      if (_.isEmpty(password) || _.isEmpty(password_confirm) || (password !== password_confirm)) {
-        var deferred = FauxtonAPI.Deferred();
+      deferred.rejectWith(this, [msg]);
+      return deferred;
+    }
+  },
 
-        deferred.rejectWith(this, [msg]);
-        return deferred;
-      }
-    },
-
-    createAdmin: function (username, password, login, node) {
-      var errorPromise = this.validateUser(username, password, this.messages.missingCredentials);
-
-      if (errorPromise) { return errorPromise; }
-
-      var admin = new Admin({
-        name: username,
-        value: password
-      }, {node: node});
-
-      return admin.save().then(function () {
-        if (login) {
-          return this.login(username, password);
-        }
-
-        return this.fetchUser({forceFetch: true});
-
-      }.bind(this));
-    },
-
-    login: function (username, password) {
-      var errorPromise = this.validateUser(username, password, this.messages.missingCredentials);
-
-      if (errorPromise) { return errorPromise; }
-
-      return $.ajax({
-        cache: false,
-        type: "POST",
-        url: app.host + "/_session",
-        dataType: "json",
-        data: {name: username, password: password}
-      }).then(function () {
-        return this.fetchUser({forceFetch: true});
-      }.bind(this));
-    },
-
-    logout: function () {
-      var that = this;
-
-      return $.ajax({
-        type: "DELETE",
-        url: app.host + "/_session",
-        dataType: "json",
-        username : "_",
-        password : "_"
-      }).then(function () {
-        return that.fetchUser({forceFetch: true });
-      });
-    },
-
-    changePassword: function (password, confirmedPassword, node) {
-      var errorMessage = 'Passwords do not match.';
-      var errorPromise = this.validatePasswords(password, confirmedPassword, errorMessage);
-
-      if (errorPromise) { return errorPromise; }
-
-      var userName = this.get('userCtx').name;
-      var admin = new Admin({
-        name: userName,
-        value: password
-      }, {node: node});
-
-      return admin.save().then(function () {
-        return this.login(userName, password);
-      }.bind(this));
+  validatePasswords: function (password, password_confirm, msg) {
+    if (_.isEmpty(password) || _.isEmpty(password_confirm) || (password !== password_confirm)) {
+      var deferred = FauxtonAPI.Deferred();
+
+      deferred.rejectWith(this, [msg]);
+      return deferred;
     }
-  });
+  },
 
+  createAdmin: function (username, password, login, node) {
+    var errorPromise = this.validateUser(username, password, this.messages.missingCredentials);
 
-  return Auth;
+    if (errorPromise) { return errorPromise; }
+
+    var admin = new Admin({
+      name: username,
+      value: password
+    }, {node: node});
+
+    return admin.save().then(function () {
+      if (login) {
+        return this.login(username, password);
+      }
+
+      return this.fetchUser({forceFetch: true});
+
+    }.bind(this));
+  },
+
+  login: function (username, password) {
+    var errorPromise = this.validateUser(username, password, this.messages.missingCredentials);
+
+    if (errorPromise) { return errorPromise; }
+
+    return $.ajax({
+      cache: false,
+      type: "POST",
+      url: app.host + "/_session",
+      dataType: "json",
+      data: {name: username, password: password}
+    }).then(function () {
+      return this.fetchUser({forceFetch: true});
+    }.bind(this));
+  },
+
+  logout: function () {
+    var that = this;
+
+    return $.ajax({
+      type: "DELETE",
+      url: app.host + "/_session",
+      dataType: "json",
+      username : "_",
+      password : "_"
+    }).then(function () {
+      return that.fetchUser({forceFetch: true });
+    });
+  },
+
+  changePassword: function (password, confirmedPassword, node) {
+    var errorMessage = 'Passwords do not match.';
+    var errorPromise = this.validatePasswords(password, confirmedPassword, errorMessage);
+
+    if (errorPromise) { return errorPromise; }
+
+    var userName = this.get('userCtx').name;
+    var admin = new Admin({
+      name: userName,
+      value: password
+    }, {node: node});
+
+    return admin.save().then(function () {
+      return this.login(userName, password);
+    }.bind(this));
+  }
 });
+
+
+export default Auth;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/routes.js b/app/addons/auth/routes.js
index 8b7eb6d..2ba3931 100644
--- a/app/addons/auth/routes.js
+++ b/app/addons/auth/routes.js
@@ -10,108 +10,103 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './resources',
-  './actions',
-  './components.react',
-  '../cluster/cluster.actions'
-],
-
-function (app, FauxtonAPI, Auth, AuthActions, Components, ClusterActions) {
-
-  var AuthRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'one_pane',
-
-    routes: {
-      'login?*extra': 'login',
-      'login': 'login',
-      'logout': 'logout',
-      'createAdmin': 'checkNodes',
-      'createAdmin/:node': 'createAdminForNode'
-    },
-    disableLoader: true,
-    hideNotificationCenter: true,
-
-    checkNodes: function () {
-      ClusterActions.navigateToNodeBasedOnNodeCount('/createAdmin/');
-    },
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Auth from "./resources";
+import AuthActions from "./actions";
+import Components from "./components.react";
+import ClusterActions from "../cluster/cluster.actions";
+
+var AuthRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'one_pane',
+
+  routes: {
+    'login?*extra': 'login',
+    'login': 'login',
+    'logout': 'logout',
+    'createAdmin': 'checkNodes',
+    'createAdmin/:node': 'createAdminForNode'
+  },
+  disableLoader: true,
+  hideNotificationCenter: true,
+
+  checkNodes: function () {
+    ClusterActions.navigateToNodeBasedOnNodeCount('/createAdmin/');
+  },
+
+  login: function () {
+    this.crumbs = [{ name: 'Log In to CouchDB', link: "#" }];
+    this.setComponent('#dashboard-content', Components.LoginForm, { urlBack: app.getParams().urlback });
+  },
+
+  logout: function () {
+    FauxtonAPI.addNotification({ msg: 'You have been logged out.' });
+    FauxtonAPI.session.logout().then(function () {
+      FauxtonAPI.navigate('/');
+    });
+  },
+
+  createAdminForNode: function () {
+    ClusterActions.fetchNodes();
+    this.crumbs = [{name: 'Create Admin', link: '#'}];
+    this.setComponent('#dashboard-content', Components.CreateAdminForm, { loginAfter: true });
+  }
+});
 
-    login: function () {
-      this.crumbs = [{ name: 'Log In to CouchDB', link: "#" }];
-      this.setComponent('#dashboard-content', Components.LoginForm, { urlBack: app.getParams().urlback });
-    },
 
-    logout: function () {
-      FauxtonAPI.addNotification({ msg: 'You have been logged out.' });
-      FauxtonAPI.session.logout().then(function () {
-        FauxtonAPI.navigate('/');
-      });
-    },
+var UserRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'with_sidebar',
 
-    createAdminForNode: function () {
-      ClusterActions.fetchNodes();
-      this.crumbs = [{name: 'Create Admin', link: '#'}];
-      this.setComponent('#dashboard-content', Components.CreateAdminForm, { loginAfter: true });
-    }
-  });
-
-
-  var UserRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'with_sidebar',
-
-    routes: {
-      'changePassword': {
-        route: 'checkNodesForPasswordChange',
-        roles: ['fx_loggedIn']
-      },
-      'changePassword/:node': {
-        route: 'changePassword',
-        roles: ['fx_loggedIn']
-      },
-      'addAdmin': {
-        route: 'checkNodesForAddAdmin',
-        roles: ['_admin']
-      },
-      'addAdmin/:node': {
-        route: 'addAdmin',
-        roles: ['_admin']
-      }
+  routes: {
+    'changePassword': {
+      route: 'checkNodesForPasswordChange',
+      roles: ['fx_loggedIn']
     },
-
-    checkNodesForPasswordChange: function () {
-      ClusterActions.navigateToNodeBasedOnNodeCount('/changePassword/');
+    'changePassword/:node': {
+      route: 'changePassword',
+      roles: ['fx_loggedIn']
     },
-
-    checkNodesForAddAdmin: function () {
-      ClusterActions.navigateToNodeBasedOnNodeCount('/addAdmin/');
+    'addAdmin': {
+      route: 'checkNodesForAddAdmin',
+      roles: ['_admin']
     },
+    'addAdmin/:node': {
+      route: 'addAdmin',
+      roles: ['_admin']
+    }
+  },
 
-    selectedHeader: function () {
-      return FauxtonAPI.session.user().name;
-    },
+  checkNodesForPasswordChange: function () {
+    ClusterActions.navigateToNodeBasedOnNodeCount('/changePassword/');
+  },
 
-    initialize: function () {
-      this.setComponent('#sidebar-content', Components.CreateAdminSidebar);
-    },
+  checkNodesForAddAdmin: function () {
+    ClusterActions.navigateToNodeBasedOnNodeCount('/addAdmin/');
+  },
 
-    changePassword: function () {
-      ClusterActions.fetchNodes();
-      AuthActions.selectPage('changePassword');
-      this.setComponent('#dashboard-content', Components.ChangePasswordForm);
-    },
+  selectedHeader: function () {
+    return FauxtonAPI.session.user().name;
+  },
 
-    addAdmin: function () {
-      ClusterActions.fetchNodes();
-      AuthActions.selectPage('addAdmin');
-      this.setComponent('#dashboard-content', Components.CreateAdminForm, { loginAfter: false });
-    },
+  initialize: function () {
+    this.setComponent('#sidebar-content', Components.CreateAdminSidebar);
+  },
 
-    crumbs: [{name: 'User Management', link: '#'}]
-  });
+  changePassword: function () {
+    ClusterActions.fetchNodes();
+    AuthActions.selectPage('changePassword');
+    this.setComponent('#dashboard-content', Components.ChangePasswordForm);
+  },
 
-  Auth.RouteObjects = [AuthRouteObject, UserRouteObject];
+  addAdmin: function () {
+    ClusterActions.fetchNodes();
+    AuthActions.selectPage('addAdmin');
+    this.setComponent('#dashboard-content', Components.CreateAdminForm, { loginAfter: false });
+  },
 
-  return Auth;
+  crumbs: [{name: 'User Management', link: '#'}]
 });
+
+Auth.RouteObjects = [AuthRouteObject, UserRouteObject];
+
+export default Auth;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/auth/stores.js b/app/addons/auth/stores.js
index f2142b7..25ef23a 100644
--- a/app/addons/auth/stores.js
+++ b/app/addons/auth/stores.js
@@ -10,162 +10,158 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './actiontypes'
-], function (app, FauxtonAPI, ActionTypes) {
-
-
-  // Not thrilled with this. The sole purpose of these next two stores is because the Create Admin + Change Password
-  // forms need to clear after a successful post. Since those events occur in actions.js, we need a way to tell the
-  // component to update + clear the fields. That's why all this code exists.
-
-  var ChangePasswordStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._changePassword = '';
-      this._changePasswordConfirm = '';
-    },
-
-    getChangePassword: function () {
-      return this._changePassword;
-    },
-
-    getChangePasswordConfirm: function () {
-      return this._changePasswordConfirm;
-    },
-
-    setChangePassword: function (val) {
-      this._changePassword = val;
-    },
-
-    setChangePasswordConfirm: function (val) {
-      this._changePasswordConfirm = val;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-
-        case ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS:
-          this.reset();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD:
-          this.setChangePassword(action.value);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD:
-          this.setChangePasswordConfirm(action.value);
-          this.triggerChange();
-        break;
-
-        default:
-        return;
-      }
-    }
-  });
-
-  var changePasswordStore = new ChangePasswordStore();
-  changePasswordStore.dispatchToken = FauxtonAPI.dispatcher.register(changePasswordStore.dispatch.bind(changePasswordStore));
-
-
-  var CreateAdminStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._username = '';
-      this._password = '';
-    },
-
-    getUsername: function () {
-      return this._username;
-    },
-
-    getPassword: function () {
-      return this._password;
-    },
-
-    setUsername: function (val) {
-      this._username = val;
-    },
-
-    setPassword: function (val) {
-      this._password = val;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS:
-          this.reset();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD:
-          this.setUsername(action.value);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD:
-          this.setPassword(action.value);
-          this.triggerChange();
-        break;
-
-        default:
-        return;
-      }
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+
+
+// Not thrilled with this. The sole purpose of these next two stores is because the Create Admin + Change Password
+// forms need to clear after a successful post. Since those events occur in actions.js, we need a way to tell the
+// component to update + clear the fields. That's why all this code exists.
+
+var ChangePasswordStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._changePassword = '';
+    this._changePasswordConfirm = '';
+  },
+
+  getChangePassword: function () {
+    return this._changePassword;
+  },
+
+  getChangePasswordConfirm: function () {
+    return this._changePasswordConfirm;
+  },
+
+  setChangePassword: function (val) {
+    this._changePassword = val;
+  },
+
+  setChangePasswordConfirm: function (val) {
+    this._changePasswordConfirm = val;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+
+      case ActionTypes.AUTH_CLEAR_CHANGE_PWD_FIELDS:
+        this.reset();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.AUTH_UPDATE_CHANGE_PWD_FIELD:
+        this.setChangePassword(action.value);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.AUTH_UPDATE_CHANGE_PWD_CONFIRM_FIELD:
+        this.setChangePasswordConfirm(action.value);
+        this.triggerChange();
+      break;
+
+      default:
+      return;
     }
-  });
+  }
+});
+
+var changePasswordStore = new ChangePasswordStore();
+changePasswordStore.dispatchToken = FauxtonAPI.dispatcher.register(changePasswordStore.dispatch.bind(changePasswordStore));
+
+
+var CreateAdminStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
 
-  var createAdminStore = new CreateAdminStore();
-  createAdminStore.dispatchToken = FauxtonAPI.dispatcher.register(createAdminStore.dispatch.bind(createAdminStore));
+  reset: function () {
+    this._username = '';
+    this._password = '';
+  },
 
+  getUsername: function () {
+    return this._username;
+  },
 
-  var CreateAdminSidebarStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
+  getPassword: function () {
+    return this._password;
+  },
 
-    reset: function () {
-      this._selectedPage = 'changePassword';
-    },
+  setUsername: function (val) {
+    this._username = val;
+  },
 
-    getSelectedPage: function () {
-      return this._selectedPage;
-    },
+  setPassword: function (val) {
+    this._password = val;
+  },
 
-    setSelectedPage: function (val) {
-      this._selectedPage = val;
-    },
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.AUTH_CLEAR_CREATE_ADMIN_FIELDS:
+        this.reset();
+        this.triggerChange();
+      break;
 
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.AUTH_SELECT_PAGE:
-          this.setSelectedPage(action.page);
-          this.triggerChange();
-        break;
+      case ActionTypes.AUTH_UPDATE_CREATE_ADMIN_USERNAME_FIELD:
+        this.setUsername(action.value);
+        this.triggerChange();
+      break;
 
-        default:
-        return;
-      }
+      case ActionTypes.AUTH_UPDATE_CREATE_ADMIN_PWD_FIELD:
+        this.setPassword(action.value);
+        this.triggerChange();
+      break;
+
+      default:
+      return;
     }
-  });
+  }
+});
+
+var createAdminStore = new CreateAdminStore();
+createAdminStore.dispatchToken = FauxtonAPI.dispatcher.register(createAdminStore.dispatch.bind(createAdminStore));
 
-  var createAdminSidebarStore = new CreateAdminSidebarStore();
-  createAdminSidebarStore.dispatchToken = FauxtonAPI.dispatcher.register(createAdminSidebarStore.dispatch.bind(createAdminSidebarStore));
 
+var CreateAdminSidebarStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
 
-  return {
-    changePasswordStore: changePasswordStore,
-    createAdminStore: createAdminStore,
-    createAdminSidebarStore: createAdminSidebarStore
-  };
+  reset: function () {
+    this._selectedPage = 'changePassword';
+  },
 
+  getSelectedPage: function () {
+    return this._selectedPage;
+  },
+
+  setSelectedPage: function (val) {
+    this._selectedPage = val;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.AUTH_SELECT_PAGE:
+        this.setSelectedPage(action.page);
+        this.triggerChange();
+      break;
+
+      default:
+      return;
+    }
+  }
 });
+
+var createAdminSidebarStore = new CreateAdminSidebarStore();
+createAdminSidebarStore.dispatchToken = FauxtonAPI.dispatcher.register(createAdminSidebarStore.dispatch.bind(createAdminSidebarStore));
+
+
+export default {
+  changePasswordStore: changePasswordStore,
+  createAdminStore: createAdminStore,
+  createAdminSidebarStore: createAdminSidebarStore
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/auth/test/auth.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/auth/test/auth.componentsSpec.react.jsx b/app/addons/auth/test/auth.componentsSpec.react.jsx
index 23d4c55..81eebfe 100644
--- a/app/addons/auth/test/auth.componentsSpec.react.jsx
+++ b/app/addons/auth/test/auth.componentsSpec.react.jsx
@@ -9,143 +9,139 @@
 // 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',
-  'react',
-  'react-dom',
-  '../../../../test/mocha/testUtils',
-  '../components.react',
-  '../stores',
-  '../actions',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, React, ReactDOM, utils, Components, Stores, Actions, TestUtils, sinon) {
-  var assert = utils.assert;
-
-  var createAdminSidebarStore = Stores.createAdminSidebarStore;
-
-  describe('Auth -- Components', function () {
-
-    describe('LoginForm', function () {
-      var container, loginForm, stub;
-
-      beforeEach(function () {
-        stub = sinon.stub(Actions, 'login');
-        container = document.createElement('div');
-      });
-
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(container);
-        createAdminSidebarStore.reset();
-        Actions.login.restore();
-      });
-
-      it('should trigger login event when form submitted', function () {
-        loginForm = TestUtils.renderIntoDocument(<Components.LoginForm />, container);
-        TestUtils.Simulate.submit($(ReactDOM.findDOMNode(loginForm)).find('#login')[0]);
-        assert.ok(stub.calledOnce);
-      });
-
-      it('in case of nothing in state, should pass actual values to Actions.login()', function () {
-        var username = 'bob';
-        var password = 'smith';
-
-        loginForm = TestUtils.renderIntoDocument(
-          <Components.LoginForm
-            testBlankUsername={username}
-            testBlankPassword={password}
-          />, container);
-
-        TestUtils.Simulate.submit($(ReactDOM.findDOMNode(loginForm)).find('#login')[0]);
-        assert.ok(stub.calledOnce);
-
-        // confirm Actions.login() received the values that weren't in the DOM
-        assert.equal(stub.args[0][0], username);
-        assert.equal(stub.args[0][1], password);
-      });
-
-    });
-
-    describe('ChangePasswordForm', function () {
-      var container, changePasswordForm;
-
-      beforeEach(function () {
-        container = document.createElement('div');
-        changePasswordForm = TestUtils.renderIntoDocument(<Components.ChangePasswordForm />, container);
-        utils.restore(Actions.changePassword);
-      });
-
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(container);
-      });
-
-      it('should call action to update password on field change', function () {
-        var spy = sinon.spy(Actions, 'updateChangePasswordField');
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(changePasswordForm)).find('#password')[0], { target: { value: 'bobsyouruncle' }});
-        assert.ok(spy.calledOnce);
-      });
-
-      it('should call action to update password confirm on field change', function () {
-        var spy = sinon.spy(Actions, 'updateChangePasswordConfirmField');
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(changePasswordForm)).find('#password-confirm')[0], { target: { value: 'hotdiggity' }});
-        assert.ok(spy.calledOnce);
-      });
-
-      it('should call action to submit form', function () {
-        var stub = sinon.stub(Actions, 'changePassword', function () {});
-        TestUtils.Simulate.submit($(ReactDOM.findDOMNode(changePasswordForm)).find('#change-password')[0]);
-        assert.ok(stub.calledOnce);
-      });
-    });
-
-    describe('CreateAdminForm', function () {
-      var container, createAdminForm;
-
-      beforeEach(function () {
-        container = document.createElement('div');
-        createAdminForm = TestUtils.renderIntoDocument(<Components.CreateAdminForm loginAfter={false} />, container);
-      });
-
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(container);
-      });
-
-      it('should call action to update username on field change', function () {
-        var spy = sinon.spy(Actions, 'updateCreateAdminUsername');
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(createAdminForm)).find('#username')[0], { target: { value: 'catsmeow' }});
-        assert.ok(spy.calledOnce);
-      });
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import utils from "../../../../test/mocha/testUtils";
+import Components from "../components.react";
+import Stores from "../stores";
+import Actions from "../actions";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+var assert = utils.assert;
+
+var createAdminSidebarStore = Stores.createAdminSidebarStore;
+
+describe('Auth -- Components', function () {
+
+  describe('LoginForm', function () {
+    var container, loginForm, stub;
+
+    beforeEach(function () {
+      stub = sinon.stub(Actions, 'login');
+      container = document.createElement('div');
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+      createAdminSidebarStore.reset();
+      Actions.login.restore();
+    });
+
+    it('should trigger login event when form submitted', function () {
+      loginForm = TestUtils.renderIntoDocument(<Components.LoginForm />, container);
+      TestUtils.Simulate.submit($(ReactDOM.findDOMNode(loginForm)).find('#login')[0]);
+      assert.ok(stub.calledOnce);
+    });
+
+    it('in case of nothing in state, should pass actual values to Actions.login()', function () {
+      var username = 'bob';
+      var password = 'smith';
+
+      loginForm = TestUtils.renderIntoDocument(
+        <Components.LoginForm
+          testBlankUsername={username}
+          testBlankPassword={password}
+        />, container);
+
+      TestUtils.Simulate.submit($(ReactDOM.findDOMNode(loginForm)).find('#login')[0]);
+      assert.ok(stub.calledOnce);
+
+      // confirm Actions.login() received the values that weren't in the DOM
+      assert.equal(stub.args[0][0], username);
+      assert.equal(stub.args[0][1], password);
+    });
+
+  });
+
+  describe('ChangePasswordForm', function () {
+    var container, changePasswordForm;
+
+    beforeEach(function () {
+      container = document.createElement('div');
+      changePasswordForm = TestUtils.renderIntoDocument(<Components.ChangePasswordForm />, container);
+      utils.restore(Actions.changePassword);
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
 
-      it('should call action to update password confirm on field change', function () {
-        var spy = sinon.spy(Actions, 'updateCreateAdminPassword');
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(createAdminForm)).find('#password')[0], { target: { value: 'topnotch' }});
-        assert.ok(spy.calledOnce);
-      });
+    it('should call action to update password on field change', function () {
+      var spy = sinon.spy(Actions, 'updateChangePasswordField');
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(changePasswordForm)).find('#password')[0], { target: { value: 'bobsyouruncle' }});
+      assert.ok(spy.calledOnce);
     });
 
-    describe('CreateAdminSidebar', function () {
-      var container, createAdminSidebar;
+    it('should call action to update password confirm on field change', function () {
+      var spy = sinon.spy(Actions, 'updateChangePasswordConfirmField');
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(changePasswordForm)).find('#password-confirm')[0], { target: { value: 'hotdiggity' }});
+      assert.ok(spy.calledOnce);
+    });
 
-      beforeEach(function () {
-        createAdminSidebarStore.reset();
-        container = document.createElement('div');
-        createAdminSidebar = TestUtils.renderIntoDocument(<Components.CreateAdminSidebar />, container);
-      });
+    it('should call action to submit form', function () {
+      var stub = sinon.stub(Actions, 'changePassword', function () {});
+      TestUtils.Simulate.submit($(ReactDOM.findDOMNode(changePasswordForm)).find('#change-password')[0]);
+      assert.ok(stub.calledOnce);
+    });
+  });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(container);
-      });
+  describe('CreateAdminForm', function () {
+    var container, createAdminForm;
 
-      it('confirm the default selected nav item is the change pwd page', function () {
-        assert.equal($(ReactDOM.findDOMNode(createAdminSidebar)).find('.active').find('a').attr('href'), '#changePassword');
-      });
+    beforeEach(function () {
+      container = document.createElement('div');
+      createAdminForm = TestUtils.renderIntoDocument(<Components.CreateAdminForm loginAfter={false} />, container);
+    });
 
-      it('confirm clicking a sidebar nav item selects it in the DOM', function () {
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(createAdminSidebar)).find('li[data-page="addAdmin"]').find('a')[0]);
-        assert.equal($(ReactDOM.findDOMNode(createAdminSidebar)).find('.active').find('a').attr('href'), '#addAdmin');
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
     });
 
+    it('should call action to update username on field change', function () {
+      var spy = sinon.spy(Actions, 'updateCreateAdminUsername');
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(createAdminForm)).find('#username')[0], { target: { value: 'catsmeow' }});
+      assert.ok(spy.calledOnce);
+    });
+
+    it('should call action to update password confirm on field change', function () {
+      var spy = sinon.spy(Actions, 'updateCreateAdminPassword');
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(createAdminForm)).find('#password')[0], { target: { value: 'topnotch' }});
+      assert.ok(spy.calledOnce);
+    });
+  });
+
+  describe('CreateAdminSidebar', function () {
+    var container, createAdminSidebar;
+
+    beforeEach(function () {
+      createAdminSidebarStore.reset();
+      container = document.createElement('div');
+      createAdminSidebar = TestUtils.renderIntoDocument(<Components.CreateAdminSidebar />, container);
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
+
+    it('confirm the default selected nav item is the change pwd page', function () {
+      assert.equal($(ReactDOM.findDOMNode(createAdminSidebar)).find('.active').find('a').attr('href'), '#changePassword');
+    });
+
+    it('confirm clicking a sidebar nav item selects it in the DOM', function () {
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(createAdminSidebar)).find('li[data-page="addAdmin"]').find('a')[0]);
+      assert.equal($(ReactDOM.findDOMNode(createAdminSidebar)).find('.active').find('a').attr('href'), '#addAdmin');
+    });
   });
 
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/actionsSpec.js b/app/addons/databases/tests/actionsSpec.js
index e656f8c..3dbe0c2 100644
--- a/app/addons/databases/tests/actionsSpec.js
+++ b/app/addons/databases/tests/actionsSpec.js
@@ -10,242 +10,238 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  '../../../../test/mocha/testUtils',
-  '../base',
-  '../stores',
-  '../actions',
-  '../actiontypes',
-  '../resources',
-  '../../documents/base'
-], function (app, FauxtonAPI, utils, Base, Stores, Actions, ActionTypes, Resources) {
-
-  var assert = utils.assert;
-
-  describe('Databases Actions', function () {
-
-    describe('Initialization', function () {
-
-      var oldDispatch, oldWhen, oldGetParams;
-      var dispatchEvents, thenCallback, alwaysCallback;
-      var databasesMock;
-
-      beforeEach(function () {
-        oldDispatch = FauxtonAPI.dispatch;
-        dispatchEvents = [];
-        FauxtonAPI.dispatch = function (what) {
-          dispatchEvents.push(what);
-        };
-        oldWhen = FauxtonAPI.when;
-        FauxtonAPI.when = function () {
-          return {
-            then: function (callback) {
-              thenCallback = callback;
-              callback();
-            },
-            always: function (callback) {
-              alwaysCallback = callback;
-              callback();
-            }
-          };
-        };
-        // (replace on demand)
-        oldGetParams = app.getParams;
-        databasesMock = {
-          fetch: function () {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import utils from "../../../../test/mocha/testUtils";
+import Base from "../base";
+import Stores from "../stores";
+import Actions from "../actions";
+import ActionTypes from "../actiontypes";
+import Resources from "../resources";
+import "../../documents/base";
+
+var assert = utils.assert;
+
+describe('Databases Actions', function () {
+
+  describe('Initialization', function () {
+
+    var oldDispatch, oldWhen, oldGetParams;
+    var dispatchEvents, thenCallback, alwaysCallback;
+    var databasesMock;
+
+    beforeEach(function () {
+      oldDispatch = FauxtonAPI.dispatch;
+      dispatchEvents = [];
+      FauxtonAPI.dispatch = function (what) {
+        dispatchEvents.push(what);
+      };
+      oldWhen = FauxtonAPI.when;
+      FauxtonAPI.when = function () {
+        return {
+          then: function (callback) {
+            thenCallback = callback;
+            callback();
           },
-          paginated: function () {
-            return [];
+          always: function (callback) {
+            alwaysCallback = callback;
+            callback();
           }
         };
-      });
-
-      afterEach(function () {
-        FauxtonAPI.dispatch = oldDispatch;
-        FauxtonAPI.when = oldWhen;
-        app.getParams = oldGetParams;
-      });
+      };
+      // (replace on demand)
+      oldGetParams = app.getParams;
+      databasesMock = {
+        fetch: function () {
+        },
+        paginated: function () {
+          return [];
+        }
+      };
+    });
 
-      it('Starts loading first', function () {
-        app.getParams = function () {
-          return {};
-        };
-        Actions.init(databasesMock);
-        assert(!!thenCallback || !!alwaysCallback);
-        // now we should have resolved it all
-        assert.equal(2, dispatchEvents.length);
-        assert.equal(ActionTypes.DATABASES_STARTLOADING, dispatchEvents[0].type);
-        assert.equal(ActionTypes.DATABASES_INIT, dispatchEvents[1].type);
-        assert.equal(1, dispatchEvents[1].options.page);
-      });
-
-      it('Accepts page params', function () {
-        app.getParams = function () {
-          return {
-            page: 33
-          };
-        };
-        Actions.init(databasesMock);
-        // now we should have resolved it all
-        assert.equal(2, dispatchEvents.length);
-        assert.equal(ActionTypes.DATABASES_INIT, dispatchEvents[1].type);
-        assert.equal(33, dispatchEvents[1].options.page);
-      });
+    afterEach(function () {
+      FauxtonAPI.dispatch = oldDispatch;
+      FauxtonAPI.when = oldWhen;
+      app.getParams = oldGetParams;
+    });
 
+    it('Starts loading first', function () {
+      app.getParams = function () {
+        return {};
+      };
+      Actions.init(databasesMock);
+      assert(!!thenCallback || !!alwaysCallback);
+      // now we should have resolved it all
+      assert.equal(2, dispatchEvents.length);
+      assert.equal(ActionTypes.DATABASES_STARTLOADING, dispatchEvents[0].type);
+      assert.equal(ActionTypes.DATABASES_INIT, dispatchEvents[1].type);
+      assert.equal(1, dispatchEvents[1].options.page);
     });
 
-    describe('Add database', function () {
-
-      var oldColl, oldBackbone, oldRouter, oldNotification, oldDispatch;
-      var passedId, doneCallback, errorCallback, navigationTarget, notificationText, dispatchEvents;
-
-      beforeEach(function () {
-        oldColl = Stores.databasesStore._collection;
-        oldBackbone = Stores.databasesStore._backboneCollection;
-        passedId = null;
-        Stores.databasesStore._backboneCollection = {};
-        Stores.databasesStore._backboneCollection.model = function (options) {
-          passedId = options.id;
-          return {
-            "save": function () {
-              var res = {
-                "done": function (callback) {
-                  doneCallback = callback;
-                  return res;
-                },
-                "error": function (callback) {
-                  errorCallback = callback;
-                  return res;
-                }
-              };
-              return res;
-            }
-          };
+    it('Accepts page params', function () {
+      app.getParams = function () {
+        return {
+          page: 33
         };
-        oldRouter = app.router;
-        navigationTarget = null;
-        app.router = {
-          navigate: function (target) {
-            navigationTarget = target;
+      };
+      Actions.init(databasesMock);
+      // now we should have resolved it all
+      assert.equal(2, dispatchEvents.length);
+      assert.equal(ActionTypes.DATABASES_INIT, dispatchEvents[1].type);
+      assert.equal(33, dispatchEvents[1].options.page);
+    });
+
+  });
+
+  describe('Add database', function () {
+
+    var oldColl, oldBackbone, oldRouter, oldNotification, oldDispatch;
+    var passedId, doneCallback, errorCallback, navigationTarget, notificationText, dispatchEvents;
+
+    beforeEach(function () {
+      oldColl = Stores.databasesStore._collection;
+      oldBackbone = Stores.databasesStore._backboneCollection;
+      passedId = null;
+      Stores.databasesStore._backboneCollection = {};
+      Stores.databasesStore._backboneCollection.model = function (options) {
+        passedId = options.id;
+        return {
+          "save": function () {
+            var res = {
+              "done": function (callback) {
+                doneCallback = callback;
+                return res;
+              },
+              "error": function (callback) {
+                errorCallback = callback;
+                return res;
+              }
+            };
+            return res;
           }
         };
-        oldNotification = FauxtonAPI.addNotification;
-        notificationText = [];
-        FauxtonAPI.addNotification = function (options) {
-          notificationText.push(options.msg);
-        };
-        oldDispatch = FauxtonAPI.dispatch;
-        dispatchEvents = [];
-        FauxtonAPI.dispatch = function (what) {
-          dispatchEvents.push(what);
-        };
-      });
-
-      afterEach(function () {
-        Stores.databasesStore._collection = oldColl;
-        Stores.databasesStore._backboneCollection = oldBackbone;
-        app.router = oldRouter;
-        FauxtonAPI.addNotification = oldNotification;
-        FauxtonAPI.dispatch = oldDispatch;
-      });
-
-      it("Creates database in backend", function () {
-        Actions.createNewDatabase("testdb");
-        doneCallback();
-        assert.equal("testdb", passedId);
-        assert.equal(1, _.map(dispatchEvents, function (item) {
-          if (item.type === ActionTypes.DATABASES_SET_PROMPT_VISIBLE) {
-            return item;
-          }
-        }).length);
-        assert.equal(2, notificationText.length);
-        assert(notificationText[0].indexOf("Creating") >= 0);
-        assert(notificationText[1].indexOf("success") >= 0);
-        assert.ok(navigationTarget.indexOf("testdb") >= 0);
-      });
-
-      it("Creates no database without name", function () {
-        Actions.createNewDatabase("   ");
-        assert(passedId === null);
-        assert.equal(0, _.map(dispatchEvents, function (item) {
-          if (item.type === ActionTypes.DATABASES_SET_PROMPT_VISIBLE) {
-            return item;
-          }
-        }).length);
-        assert.equal(1, notificationText.length);
-        assert(notificationText[0].indexOf("valid database name") >= 0);
-      });
-
-      it("Shows error message on create fail", function () {
-        Actions.createNewDatabase("testdb");
-        errorCallback({"responseText": JSON.stringify({"reason": "testerror"})});
-        assert.equal("testdb", passedId);
-        assert.equal(2, notificationText.length);
-        assert(notificationText[0].indexOf("Creating") >= 0);
-        assert(notificationText[1].indexOf("failed") >= 0);
-        assert(notificationText[1].indexOf("testerror") >= 0);
-        assert(navigationTarget === null);
-      });
+      };
+      oldRouter = app.router;
+      navigationTarget = null;
+      app.router = {
+        navigate: function (target) {
+          navigationTarget = target;
+        }
+      };
+      oldNotification = FauxtonAPI.addNotification;
+      notificationText = [];
+      FauxtonAPI.addNotification = function (options) {
+        notificationText.push(options.msg);
+      };
+      oldDispatch = FauxtonAPI.dispatch;
+      dispatchEvents = [];
+      FauxtonAPI.dispatch = function (what) {
+        dispatchEvents.push(what);
+      };
+    });
 
+    afterEach(function () {
+      Stores.databasesStore._collection = oldColl;
+      Stores.databasesStore._backboneCollection = oldBackbone;
+      app.router = oldRouter;
+      FauxtonAPI.addNotification = oldNotification;
+      FauxtonAPI.dispatch = oldDispatch;
     });
 
-    describe('Jump to database', function () {
+    it("Creates database in backend", function () {
+      Actions.createNewDatabase("testdb");
+      doneCallback();
+      assert.equal("testdb", passedId);
+      assert.equal(1, _.map(dispatchEvents, function (item) {
+        if (item.type === ActionTypes.DATABASES_SET_PROMPT_VISIBLE) {
+          return item;
+        }
+      }).length);
+      assert.equal(2, notificationText.length);
+      assert(notificationText[0].indexOf("Creating") >= 0);
+      assert(notificationText[1].indexOf("success") >= 0);
+      assert.ok(navigationTarget.indexOf("testdb") >= 0);
+    });
 
-      var container, jumpEl, oldNavigate, oldAddNotification, oldGetDatabaseNames, old$;
-      var navigationTarget, notificationText;
+    it("Creates no database without name", function () {
+      Actions.createNewDatabase("   ");
+      assert(passedId === null);
+      assert.equal(0, _.map(dispatchEvents, function (item) {
+        if (item.type === ActionTypes.DATABASES_SET_PROMPT_VISIBLE) {
+          return item;
+        }
+      }).length);
+      assert.equal(1, notificationText.length);
+      assert(notificationText[0].indexOf("valid database name") >= 0);
+    });
 
-      beforeEach(function () {
-        old$ = $;
-        // simulate typeahead
-        $ = function (selector) {
-          var res = old$(selector);
-          res.typeahead = function () {};
-          return res;
-        };
-        oldNavigate = FauxtonAPI.navigate;
-        navigationTarget = null;
-        FauxtonAPI.navigate = function (url) {
-          navigationTarget = url;
-        };
-        oldAddNotification = FauxtonAPI.addNotification;
-        notificationText = [];
-        FauxtonAPI.addNotification = function (options) {
-          notificationText.push(options.msg);
-        };
-        oldGetDatabaseNames = Stores.databasesStore.getDatabaseNames;
-        Stores.databasesStore.getDatabaseNames = function () {
-          return ["db1", "db2"];
-        };
-      });
-
-      afterEach(function () {
-        $ = old$;
-        FauxtonAPI.navigate = oldNavigate;
-        FauxtonAPI.addNotification = oldAddNotification;
-        Stores.databasesStore.getDatabaseNames = oldGetDatabaseNames;
-      });
-
-      it("jumps to an existing DB", function () {
-        Actions.jumpToDatabase("db1");
-        assert(navigationTarget.indexOf("db1") >= 0);
-        assert.equal(0, notificationText.length);
-      });
-
-      it("does nothing on empty name", function () {
-        Actions.jumpToDatabase("  ");
-        assert(navigationTarget === null);
-        assert.equal(0, notificationText.length);
-      });
-
-      it("shows a message on non-existent DB", function () {
-        Actions.jumpToDatabase("db3");
-        assert(navigationTarget === null);
-        assert.equal(1, notificationText.length);
-        assert(notificationText[0].indexOf("not exist") >= 0);
-      });
+    it("Shows error message on create fail", function () {
+      Actions.createNewDatabase("testdb");
+      errorCallback({"responseText": JSON.stringify({"reason": "testerror"})});
+      assert.equal("testdb", passedId);
+      assert.equal(2, notificationText.length);
+      assert(notificationText[0].indexOf("Creating") >= 0);
+      assert(notificationText[1].indexOf("failed") >= 0);
+      assert(notificationText[1].indexOf("testerror") >= 0);
+      assert(navigationTarget === null);
+    });
+
+  });
+
+  describe('Jump to database', function () {
+
+    var container, jumpEl, oldNavigate, oldAddNotification, oldGetDatabaseNames, old$;
+    var navigationTarget, notificationText;
+
+    beforeEach(function () {
+      old$ = $;
+      // simulate typeahead
+      $ = function (selector) {
+        var res = old$(selector);
+        res.typeahead = function () {};
+        return res;
+      };
+      oldNavigate = FauxtonAPI.navigate;
+      navigationTarget = null;
+      FauxtonAPI.navigate = function (url) {
+        navigationTarget = url;
+      };
+      oldAddNotification = FauxtonAPI.addNotification;
+      notificationText = [];
+      FauxtonAPI.addNotification = function (options) {
+        notificationText.push(options.msg);
+      };
+      oldGetDatabaseNames = Stores.databasesStore.getDatabaseNames;
+      Stores.databasesStore.getDatabaseNames = function () {
+        return ["db1", "db2"];
+      };
+    });
+
+    afterEach(function () {
+      $ = old$;
+      FauxtonAPI.navigate = oldNavigate;
+      FauxtonAPI.addNotification = oldAddNotification;
+      Stores.databasesStore.getDatabaseNames = oldGetDatabaseNames;
+    });
+
+    it("jumps to an existing DB", function () {
+      Actions.jumpToDatabase("db1");
+      assert(navigationTarget.indexOf("db1") >= 0);
+      assert.equal(0, notificationText.length);
+    });
+
+    it("does nothing on empty name", function () {
+      Actions.jumpToDatabase("  ");
+      assert(navigationTarget === null);
+      assert.equal(0, notificationText.length);
+    });
 
+    it("shows a message on non-existent DB", function () {
+      Actions.jumpToDatabase("db3");
+      assert(navigationTarget === null);
+      assert.equal(1, notificationText.length);
+      assert(notificationText[0].indexOf("not exist") >= 0);
     });
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/componentsSpec.react.jsx b/app/addons/databases/tests/componentsSpec.react.jsx
index a1a5442..f9a4eb0 100644
--- a/app/addons/databases/tests/componentsSpec.react.jsx
+++ b/app/addons/databases/tests/componentsSpec.react.jsx
@@ -9,335 +9,331 @@
 // 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',
-  '../components.react',
-  '../actions',
-  '../actiontypes',
-  '../stores',
-  '../../../../test/mocha/testUtils',
-  "react",
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, Actions, ActionTypes, Stores, utils, React, ReactDOM, TestUtils, sinon) {
-
-  var assert = utils.assert;
-
-  describe('DatabasesController', function () {
-
-    var container, dbEl, oldGetCollection;
-
-    beforeEach(function () {
-      // define our own collection
-      oldGetCollection = Stores.databasesStore.getCollection;
-      Stores.databasesStore.getCollection = function () {
-        return [
-          {
-            "get": function (what) {
-              if ("name" === what) {
-                return "db1";
-              } else {
-                throw "Unknown get('" + what + "')";
-              }
+import FauxtonAPI from "../../../core/api";
+import Views from "../components.react";
+import Actions from "../actions";
+import ActionTypes from "../actiontypes";
+import Stores from "../stores";
+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";
+
+var assert = utils.assert;
+
+describe('DatabasesController', function () {
+
+  var container, dbEl, oldGetCollection;
+
+  beforeEach(function () {
+    // define our own collection
+    oldGetCollection = Stores.databasesStore.getCollection;
+    Stores.databasesStore.getCollection = function () {
+      return [
+        {
+          "get": function (what) {
+            if ("name" === what) {
+              return "db1";
+            } else {
+              throw "Unknown get('" + what + "')";
+            }
+          },
+          "status": {
+            "loadSuccess": true,
+            "dataSize": function () {
+              return 2 * 1024 * 1024;
+            },
+            "numDocs": function () {
+              return 88;
+            },
+            "isGraveYard": function () {
+              return false;
             },
-            "status": {
-              "loadSuccess": true,
-              "dataSize": function () {
-                return 2 * 1024 * 1024;
-              },
-              "numDocs": function () {
-                return 88;
-              },
-              "isGraveYard": function () {
-                return false;
-              },
-              "updateSeq": function () {
-                return 99;
-              }
+            "updateSeq": function () {
+              return 99;
+            }
+          }
+        },
+        {
+          "get": function (what) {
+            if ("name" === what) {
+              return "db2";
+            } else {
+              throw "Unknown get('" + what + "')";
             }
           },
-          {
-            "get": function (what) {
-              if ("name" === what) {
-                return "db2";
-              } else {
-                throw "Unknown get('" + what + "')";
-              }
+          "status": {
+            "loadSuccess": true,
+            "dataSize": function () {
+              return 1024;
+            },
+            "numDocs": function () {
+              return 188;
             },
-            "status": {
-              "loadSuccess": true,
-              "dataSize": function () {
-                return 1024;
-              },
-              "numDocs": function () {
-                return 188;
-              },
-              "numDeletedDocs": function () {
-                return 222;
-              },
-              "isGraveYard": function () {
-                return true;
-              },
-              "updateSeq": function () {
-                return 399;
-              }
+            "numDeletedDocs": function () {
+              return 222;
+            },
+            "isGraveYard": function () {
+              return true;
+            },
+            "updateSeq": function () {
+              return 399;
             }
           }
-        ];
-      };
-      container = document.createElement('div');
-      dbEl = ReactDOM.render(React.createElement(Views.DatabasesController, {}), container);
-    });
+        }
+      ];
+    };
+    container = document.createElement('div');
+    dbEl = ReactDOM.render(React.createElement(Views.DatabasesController, {}), container);
+  });
 
-    afterEach(function () {
-      Stores.databasesStore.getCollection = oldGetCollection;
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    Stores.databasesStore.getCollection = oldGetCollection;
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('renders base data of DBs', function () {
+  it('renders base data of DBs', function () {
 
-      const el = ReactDOM.findDOMNode(dbEl);
+    const el = ReactDOM.findDOMNode(dbEl);
 
-      assert.equal(1 + 2, el.getElementsByTagName('tr').length);
-      assert.equal("db1", el.getElementsByTagName('tr')[1].getElementsByTagName('td')[0].innerText.trim());
-      assert.equal("2.0 MB", el.getElementsByTagName('tr')[1].getElementsByTagName('td')[1].innerText.trim());
-      assert.equal("88", el.getElementsByTagName('tr')[1].getElementsByTagName('td')[2].innerText.trim());
-      assert.equal(0, el.getElementsByTagName('tr')[1].getElementsByTagName('td')[2].getElementsByTagName("i").length);
-      assert.equal(3, el.getElementsByTagName('tr')[1].getElementsByTagName('td')[4].getElementsByTagName("a").length);
-      assert.equal("db2", el.getElementsByTagName('tr')[2].getElementsByTagName('td')[0].innerText.trim());
-      assert.equal(1, el.getElementsByTagName('tr')[2].getElementsByTagName('td')[2].getElementsByTagName("i").length);
-    });
+    assert.equal(1 + 2, el.getElementsByTagName('tr').length);
+    assert.equal("db1", el.getElementsByTagName('tr')[1].getElementsByTagName('td')[0].innerText.trim());
+    assert.equal("2.0 MB", el.getElementsByTagName('tr')[1].getElementsByTagName('td')[1].innerText.trim());
+    assert.equal("88", el.getElementsByTagName('tr')[1].getElementsByTagName('td')[2].innerText.trim());
+    assert.equal(0, el.getElementsByTagName('tr')[1].getElementsByTagName('td')[2].getElementsByTagName("i").length);
+    assert.equal(3, el.getElementsByTagName('tr')[1].getElementsByTagName('td')[4].getElementsByTagName("a").length);
+    assert.equal("db2", el.getElementsByTagName('tr')[2].getElementsByTagName('td')[0].innerText.trim());
+    assert.equal(1, el.getElementsByTagName('tr')[2].getElementsByTagName('td')[2].getElementsByTagName("i").length);
+  });
+
+});
 
+describe('AddDatabaseWidget', function () {
+
+  var container, addEl, oldCreateNewDatabase;
+  var createCalled, passedDbName;
+
+  beforeEach(function () {
+    oldCreateNewDatabase = Actions.createNewDatabase;
+    Actions.createNewDatabase = function (dbName) {
+      createCalled = true;
+      passedDbName = dbName;
+    };
+    container = document.createElement('div');
+    addEl = ReactDOM.render(React.createElement(Views.AddDatabaseWidget, {}), container);
   });
 
-  describe('AddDatabaseWidget', function () {
+  afterEach(function () {
+    Actions.createNewDatabase = oldCreateNewDatabase;
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    var container, addEl, oldCreateNewDatabase;
-    var createCalled, passedDbName;
+  it("Creates a database with given name", function () {
+    createCalled = false;
+    passedDbName = null;
+    const el = TestUtils.findRenderedDOMComponentWithTag(addEl, 'input');
+    ReactDOM.findDOMNode(el).value = "testdb";
+    addEl.onAddDatabase();
+    assert.equal(true, createCalled);
+    assert.equal("testdb", passedDbName);
+  });
 
-    beforeEach(function () {
-      oldCreateNewDatabase = Actions.createNewDatabase;
-      Actions.createNewDatabase = function (dbName) {
-        createCalled = true;
-        passedDbName = dbName;
-      };
-      container = document.createElement('div');
-      addEl = ReactDOM.render(React.createElement(Views.AddDatabaseWidget, {}), container);
-    });
+});
 
-    afterEach(function () {
-      Actions.createNewDatabase = oldCreateNewDatabase;
-      ReactDOM.unmountComponentAtNode(container);
-    });
+describe('JumpToDatabaseWidget', function () {
+
+  var container, jumpEl, oldJumpToDatabase, oldGetDatabaseNames, old$;
+  var jumpCalled, passedDbName;
+
+  beforeEach(function () {
+    old$ = $;
+    // simulate typeahead
+    $ = function (selector) {
+      var res = old$(selector);
+      res.typeahead = function () {};
+      return res;
+    };
+    oldJumpToDatabase = Actions.jumpToDatabase;
+    Actions.jumpToDatabase = function (dbName) {
+      jumpCalled = true;
+      passedDbName = dbName;
+    };
+    oldGetDatabaseNames = Stores.databasesStore.getDatabaseNames;
+    Stores.databasesStore.getDatabaseNames = function () {
+      return ["db1", "db2"];
+    };
+    container = document.createElement('div');
+    jumpEl = ReactDOM.render(React.createElement(Views.JumpToDatabaseWidget, {}), container);
+  });
 
-    it("Creates a database with given name", function () {
-      createCalled = false;
-      passedDbName = null;
-      const el = TestUtils.findRenderedDOMComponentWithTag(addEl, 'input');
-      ReactDOM.findDOMNode(el).value = "testdb";
-      addEl.onAddDatabase();
-      assert.equal(true, createCalled);
-      assert.equal("testdb", passedDbName);
-    });
+  afterEach(function () {
+    $ = old$;
+    Actions.jumpToDatabase = oldJumpToDatabase;
+    Stores.databasesStore.getDatabaseNames = oldGetDatabaseNames;
+    ReactDOM.unmountComponentAtNode(container);
+    // reset the store for future use
+    Stores.databasesStore.reset();
+  });
 
+  it("Jumps to a database with given name", function () {
+    jumpCalled = false;
+    passedDbName = null;
+    jumpEl.jumpToDb("db1");
+    assert.equal(true, jumpCalled);
+    assert.equal("db1", passedDbName);
   });
 
-  describe('JumpToDatabaseWidget', function () {
-
-    var container, jumpEl, oldJumpToDatabase, oldGetDatabaseNames, old$;
-    var jumpCalled, passedDbName;
-
-    beforeEach(function () {
-      old$ = $;
-      // simulate typeahead
-      $ = function (selector) {
-        var res = old$(selector);
-        res.typeahead = function () {};
-        return res;
-      };
-      oldJumpToDatabase = Actions.jumpToDatabase;
-      Actions.jumpToDatabase = function (dbName) {
-        jumpCalled = true;
-        passedDbName = dbName;
-      };
-      oldGetDatabaseNames = Stores.databasesStore.getDatabaseNames;
-      Stores.databasesStore.getDatabaseNames = function () {
-        return ["db1", "db2"];
-      };
-      container = document.createElement('div');
-      jumpEl = ReactDOM.render(React.createElement(Views.JumpToDatabaseWidget, {}), container);
-    });
+  it("jumps to an existing DB from input", function () {
+    jumpCalled = false;
+    passedDbName = null;
+    const input = TestUtils.findRenderedDOMComponentWithTag(jumpEl, 'input');
+    input.value = "db2";
+    jumpEl.jumpToDb();
+    assert.equal(true, jumpCalled);
+    assert.equal("db2", passedDbName);
+  });
 
-    afterEach(function () {
-      $ = old$;
-      Actions.jumpToDatabase = oldJumpToDatabase;
-      Stores.databasesStore.getDatabaseNames = oldGetDatabaseNames;
-      ReactDOM.unmountComponentAtNode(container);
-      // reset the store for future use
-      Stores.databasesStore.reset();
-    });
+  it('updates DB list if data is sent after initially mounted', function () {
+    var newCollection = new Backbone.Collection();
+    newCollection.add(new Backbone.Model({ name: 'new-db1' }));
+    newCollection.add(new Backbone.Model({ name: 'new-db2' }));
 
-    it("Jumps to a database with given name", function () {
-      jumpCalled = false;
-      passedDbName = null;
-      jumpEl.jumpToDb("db1");
-      assert.equal(true, jumpCalled);
-      assert.equal("db1", passedDbName);
-    });
+    var spy = sinon.spy(jumpEl, 'componentDidUpdate');
 
-    it("jumps to an existing DB from input", function () {
-      jumpCalled = false;
-      passedDbName = null;
-      const input = TestUtils.findRenderedDOMComponentWithTag(jumpEl, 'input');
-      input.value = "db2";
-      jumpEl.jumpToDb();
-      assert.equal(true, jumpCalled);
-      assert.equal("db2", passedDbName);
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DATABASES_INIT,
+      options: {
+        collection: newCollection.toJSON(),
+        backboneCollection: newCollection,
+        page: 1
+      }
     });
 
-    it('updates DB list if data is sent after initially mounted', function () {
-      var newCollection = new Backbone.Collection();
-      newCollection.add(new Backbone.Model({ name: 'new-db1' }));
-      newCollection.add(new Backbone.Model({ name: 'new-db2' }));
+    // because of the need to override typeahead, this just does a spy on the componentDidUpdate method to ensure
+    // it gets called
+    assert.ok(spy.calledOnce);
 
-      var spy = sinon.spy(jumpEl, 'componentDidUpdate');
+  });
+});
 
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DATABASES_INIT,
-        options: {
-          collection: newCollection.toJSON(),
-          backboneCollection: newCollection,
-          page: 1
-        }
-      });
 
-      // because of the need to override typeahead, this just does a spy on the componentDidUpdate method to ensure
-      // it gets called
-      assert.ok(spy.calledOnce);
+describe('DatabasePagination', function () {
+  it('uses custom URL prefix on the navigation if passed through props', function () {
+    var container = document.createElement('div');
+    var pagination = TestUtils.renderIntoDocument(<Views.DatabasePagination linkPath="_custom_path" />, container);
+    var links = $(ReactDOM.findDOMNode(pagination)).find('a');
 
+    assert.equal(links.length, 3, 'pagination contains links');
+    links.each(function () {
+      assert.include(this.href, '_custom_path', 'link contains custom path');
     });
-  });
-
 
-  describe('DatabasePagination', function () {
-    it('uses custom URL prefix on the navigation if passed through props', function () {
-      var container = document.createElement('div');
-      var pagination = TestUtils.renderIntoDocument(<Views.DatabasePagination linkPath="_custom_path" />, container);
-      var links = $(ReactDOM.findDOMNode(pagination)).find('a');
+    ReactDOM.unmountComponentAtNode(container);
+  });
+});
 
-      assert.equal(links.length, 3, 'pagination contains links');
-      links.each(function () {
-        assert.include(this.href, '_custom_path', 'link contains custom path');
-      });
+describe('DatabaseTable', function () {
+  var container;
 
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
   });
 
-  describe('DatabaseTable', function () {
-    var container;
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    beforeEach(function () {
-      container = document.createElement('div');
+  it('adds multiple extra columns if extended', function () {
+    var ColHeader1 = React.createClass({
+      render: function () { return <th>EXTRA COL 1</th>; }
     });
-
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
+    var ColHeader2 = React.createClass({
+      render: function () { return <th>EXTRA COL 2</th>; }
     });
-
-    it('adds multiple extra columns if extended', function () {
-      var ColHeader1 = React.createClass({
-        render: function () { return <th>EXTRA COL 1</th>; }
-      });
-      var ColHeader2 = React.createClass({
-        render: function () { return <th>EXTRA COL 2</th>; }
-      });
-      var ColHeader3 = React.createClass({
-        render: function () { return <th>EXTRA COL 3</th>; }
-      });
-
-      FauxtonAPI.registerExtension('DatabaseTable:head', ColHeader1);
-      FauxtonAPI.registerExtension('DatabaseTable:head', ColHeader2);
-      FauxtonAPI.registerExtension('DatabaseTable:head', ColHeader3);
-
-      var table = TestUtils.renderIntoDocument(
-        <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} loading={false} body={[]} />,
-        container
-      );
-      var cols = $(ReactDOM.findDOMNode(table)).find('th');
-
-      // (default # of rows is 5)
-      assert.equal(cols.length, 8, 'extra columns show up');
-
-      FauxtonAPI.unRegisterExtension('DatabaseTable:head');
+    var ColHeader3 = React.createClass({
+      render: function () { return <th>EXTRA COL 3</th>; }
     });
 
-    it('adds multiple extra column in DatabaseRow if extended', function () {
-      var Cell = React.createClass({
-        render: function () { return <td>EXTRA CELL</td>; }
-      });
+    FauxtonAPI.registerExtension('DatabaseTable:head', ColHeader1);
+    FauxtonAPI.registerExtension('DatabaseTable:head', ColHeader2);
+    FauxtonAPI.registerExtension('DatabaseTable:head', ColHeader3);
 
-      FauxtonAPI.registerExtension('DatabaseTable:databaseRow', Cell);
+    var table = TestUtils.renderIntoDocument(
+      <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} loading={false} body={[]} />,
+      container
+    );
+    var cols = $(ReactDOM.findDOMNode(table)).find('th');
 
-      var row = new Backbone.Model({ name: 'db name' });
-      row.status = {
-        loadSuccess: true,
-        dataSize: function () { return 0; },
-        numDocs: function () { return 0; },
-        updateSeq: function () { return 0; },
-        isGraveYard: function () { return false; }
-      };
+    // (default # of rows is 5)
+    assert.equal(cols.length, 8, 'extra columns show up');
 
-      var databaseRow = TestUtils.renderIntoDocument(
-        <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} body={[row]} />,
-        container
-      );
-      var links = $(ReactDOM.findDOMNode(databaseRow)).find('td');
+    FauxtonAPI.unRegisterExtension('DatabaseTable:head');
+  });
 
-      // (default # of rows is 5)
-      assert.equal(links.length, 6, 'extra column shows up');
+  it('adds multiple extra column in DatabaseRow if extended', function () {
+    var Cell = React.createClass({
+      render: function () { return <td>EXTRA CELL</td>; }
+    });
 
-      FauxtonAPI.unRegisterExtension('DatabaseTable:databaseRow');
+    FauxtonAPI.registerExtension('DatabaseTable:databaseRow', Cell);
 
-      Stores.databasesStore.reset();
-    });
+    var row = new Backbone.Model({ name: 'db name' });
+    row.status = {
+      loadSuccess: true,
+      dataSize: function () { return 0; },
+      numDocs: function () { return 0; },
+      updateSeq: function () { return 0; },
+      isGraveYard: function () { return false; }
+    };
 
-    it('shows error message if row marked as failed to load', function () {
-      var row = new Backbone.Model({ name: 'db name' });
-      row.status = {
-        loadSuccess: false,
-        dataSize: function () { return 0; },
-        numDocs: function () { return 0; },
-        updateSeq: function () { return 0; },
-        isGraveYard: function () { return false; }
-      };
-
-      var databaseRow = TestUtils.renderIntoDocument(
-        <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} body={[row]} />,
-        container
-      );
-      assert.equal($(ReactDOM.findDOMNode(databaseRow)).find('.database-load-fail').length, 1);
-    });
+    var databaseRow = TestUtils.renderIntoDocument(
+      <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} body={[row]} />,
+      container
+    );
+    var links = $(ReactDOM.findDOMNode(databaseRow)).find('td');
 
-    it('shows no error if row marked as loaded', function () {
-      var row = new Backbone.Model({ name: 'db name' });
-      row.status = {
-        loadSuccess: true,
-        dataSize: function () { return 0; },
-        numDocs: function () { return 0; },
-        updateSeq: function () { return 0; },
-        isGraveYard: function () { return false; }
-      };
-
-      var databaseRow = TestUtils.renderIntoDocument(
-        <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} body={[row]} />,
-        container
-      );
-
-      assert.equal($(ReactDOM.findDOMNode(databaseRow)).find('.database-load-fail').length, 0);
-    });
+    // (default # of rows is 5)
+    assert.equal(links.length, 6, 'extra column shows up');
+
+    FauxtonAPI.unRegisterExtension('DatabaseTable:databaseRow');
+
+    Stores.databasesStore.reset();
+  });
+
+  it('shows error message if row marked as failed to load', function () {
+    var row = new Backbone.Model({ name: 'db name' });
+    row.status = {
+      loadSuccess: false,
+      dataSize: function () { return 0; },
+      numDocs: function () { return 0; },
+      updateSeq: function () { return 0; },
+      isGraveYard: function () { return false; }
+    };
+
+    var databaseRow = TestUtils.renderIntoDocument(
+      <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} body={[row]} />,
+      container
+    );
+    assert.equal($(ReactDOM.findDOMNode(databaseRow)).find('.database-load-fail').length, 1);
+  });
 
+  it('shows no error if row marked as loaded', function () {
+    var row = new Backbone.Model({ name: 'db name' });
+    row.status = {
+      loadSuccess: true,
+      dataSize: function () { return 0; },
+      numDocs: function () { return 0; },
+      updateSeq: function () { return 0; },
+      isGraveYard: function () { return false; }
+    };
+
+    var databaseRow = TestUtils.renderIntoDocument(
+      <Views.DatabaseTable showDeleteDatabaseModal={{showModal: false}} body={[row]} />,
+      container
+    );
+
+    assert.equal($(ReactDOM.findDOMNode(databaseRow)).find('.database-load-fail').length, 0);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js b/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js
index ddb6b5f..00a9e96 100644
--- a/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js
+++ b/app/addons/databases/tests/nightwatch/checkDatabaseTooltip.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Check the tooltip icon for DB with deleted items appears': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/nightwatch/createsDatabase.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/nightwatch/createsDatabase.js b/app/addons/databases/tests/nightwatch/createsDatabase.js
index 4e7c99b..99d9e84 100644
--- a/app/addons/databases/tests/nightwatch/createsDatabase.js
+++ b/app/addons/databases/tests/nightwatch/createsDatabase.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 var newDatabaseName = 'fauxton-selenium-tests-db-create';
 var helpers = require('../../../../../test/nightwatch_tests/helpers/helpers.js');
 module.exports = {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/nightwatch/deletesDatabase.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/nightwatch/deletesDatabase.js b/app/addons/databases/tests/nightwatch/deletesDatabase.js
index 3109318..23d982c 100644
--- a/app/addons/databases/tests/nightwatch/deletesDatabase.js
+++ b/app/addons/databases/tests/nightwatch/deletesDatabase.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Deletes a database': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js b/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js
index 03150e4..007e842 100644
--- a/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js
+++ b/app/addons/databases/tests/nightwatch/deletesDatabaseSpecialChars.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Deletes a database with special chars': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/nightwatch/switchDatabase.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/nightwatch/switchDatabase.js b/app/addons/databases/tests/nightwatch/switchDatabase.js
index 94c0fe1..cdd2948 100644
--- a/app/addons/databases/tests/nightwatch/switchDatabase.js
+++ b/app/addons/databases/tests/nightwatch/switchDatabase.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Confirm selecting database via typeahead redirects properly': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/nightwatch/zeroclipboard.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/nightwatch/zeroclipboard.js b/app/addons/databases/tests/nightwatch/zeroclipboard.js
index cd83582..04a0361 100644
--- a/app/addons/databases/tests/nightwatch/zeroclipboard.js
+++ b/app/addons/databases/tests/nightwatch/zeroclipboard.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 var os = require('os');
 
 module.exports = {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/resourcesSpec.js b/app/addons/databases/tests/resourcesSpec.js
index 754d765..a434308 100644
--- a/app/addons/databases/tests/resourcesSpec.js
+++ b/app/addons/databases/tests/resourcesSpec.js
@@ -9,58 +9,55 @@
 // 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',
-  '../../../../test/mocha/testUtils',
-], function (FauxtonAPI, Resources, testUtils) {
-  var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox;
+import FauxtonAPI from "../../../core/api";
+import Resources from "../resources";
+import testUtils from "../../../../test/mocha/testUtils";
+var assert = testUtils.assert,
+    ViewSandbox = testUtils.ViewSandbox;
 
-  describe("Databases: List", function () {
+describe("Databases: List", function () {
 
-    describe("List items", function () {
+  describe("List items", function () {
 
-      it("detects graveyards", function () {
-        var modelWithGraveYard = new Resources.Status({
-          doc_count: 5,
-          doc_del_count: 6
-        });
-        var modelWithoutGraveYard = new Resources.Status({
-          doc_count: 6,
-          doc_del_count: 5
-        });
-        assert.ok(modelWithGraveYard.isGraveYard());
-        assert.ok(!modelWithoutGraveYard.isGraveYard());
+    it("detects graveyards", function () {
+      var modelWithGraveYard = new Resources.Status({
+        doc_count: 5,
+        doc_del_count: 6
       });
+      var modelWithoutGraveYard = new Resources.Status({
+        doc_count: 6,
+        doc_del_count: 5
+      });
+      assert.ok(modelWithGraveYard.isGraveYard());
+      assert.ok(!modelWithoutGraveYard.isGraveYard());
+    });
 
-      it("can tell whether the data size showing is accurate or not", function () {
-        var modelWithDataSize = new Resources.Status({
-          other: 6,
-          data_size: 5,
-          disk_size: 2
-        });
-        assert.ok(modelWithDataSize.hasDataSize());
-
-        var empty_probably_fetching_model = new Resources.Status({});
-        assert.notOk(empty_probably_fetching_model.hasDataSize());
+    it("can tell whether the data size showing is accurate or not", function () {
+      var modelWithDataSize = new Resources.Status({
+        other: 6,
+        data_size: 5,
+        disk_size: 2
       });
+      assert.ok(modelWithDataSize.hasDataSize());
 
+      var empty_probably_fetching_model = new Resources.Status({});
+      assert.notOk(empty_probably_fetching_model.hasDataSize());
     });
 
-    describe('List of Databases', function () {
-      it('returns the names of databases in a list in an array', function () {
-        var listCollection = new Resources.List([{
-          name: 'ente'
-        },
-        {
-          name: 'rocko'
-        }]);
-        var databaseNames = listCollection.getDatabaseNames();
+  });
 
-        assert.equal(databaseNames[0], 'ente');
-        assert.equal(databaseNames[1], 'rocko');
-      });
+  describe('List of Databases', function () {
+    it('returns the names of databases in a list in an array', function () {
+      var listCollection = new Resources.List([{
+        name: 'ente'
+      },
+      {
+        name: 'rocko'
+      }]);
+      var databaseNames = listCollection.getDatabaseNames();
+
+      assert.equal(databaseNames[0], 'ente');
+      assert.equal(databaseNames[1], 'rocko');
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/tests/storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/tests/storesSpec.js b/app/addons/databases/tests/storesSpec.js
index 45a8883..02ddbcf 100644
--- a/app/addons/databases/tests/storesSpec.js
+++ b/app/addons/databases/tests/storesSpec.js
@@ -10,63 +10,59 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  '../../../../test/mocha/testUtils',
-  '../stores',
-  '../actiontypes',
-  '../resources'
-], function (app, FauxtonAPI, utils, Stores, ActionTypes, Resources) {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import utils from "../../../../test/mocha/testUtils";
+import Stores from "../stores";
+import ActionTypes from "../actiontypes";
+import Resources from "../resources";
 
-  var assert = utils.assert;
+var assert = utils.assert;
 
-  describe('Databases Store', function () {
+describe('Databases Store', function () {
 
-    var oldColl, oldBackbone;
-    var passedId, doneCallback, errorCallback, navigationTarget;
+  var oldColl, oldBackbone;
+  var passedId, doneCallback, errorCallback, navigationTarget;
 
-    beforeEach(function () {
-      oldColl = Stores.databasesStore._collection;
-      oldBackbone = Stores.databasesStore._backboneCollection;
-      Stores.databasesStore._backboneCollection = {};
-    });
+  beforeEach(function () {
+    oldColl = Stores.databasesStore._collection;
+    oldBackbone = Stores.databasesStore._backboneCollection;
+    Stores.databasesStore._backboneCollection = {};
+  });
 
-    afterEach(function () {
-      Stores.databasesStore._collection = oldColl;
-      Stores.databasesStore._backboneCollection = oldBackbone;
-    });
+  afterEach(function () {
+    Stores.databasesStore._collection = oldColl;
+    Stores.databasesStore._backboneCollection = oldBackbone;
+  });
 
-    it("inits based on what we pass", function () {
-      Stores.databasesStore.init({"name": "col1"}, {"name": "col2"});
-      assert.equal("col1", Stores.databasesStore.getCollection().name);
-      assert.equal("col2", Stores.databasesStore._backboneCollection.name);
-    });
+  it("inits based on what we pass", function () {
+    Stores.databasesStore.init({"name": "col1"}, {"name": "col2"});
+    assert.equal("col1", Stores.databasesStore.getCollection().name);
+    assert.equal("col2", Stores.databasesStore._backboneCollection.name);
+  });
 
-    describe("database collection info", function () {
+  describe("database collection info", function () {
 
-      beforeEach(function () {
-        Stores.databasesStore._backboneCollection.toJSON = function () {
-          return {
-            "db1": {
-              "name": "db1"
-            },
-            "db2": {
-              "name": "db2"
-            }
-          };
+    beforeEach(function () {
+      Stores.databasesStore._backboneCollection.toJSON = function () {
+        return {
+          "db1": {
+            "name": "db1"
+          },
+          "db2": {
+            "name": "db2"
+          }
         };
-      });
-
-      it("determines database names", function () {
-        assert.ok(JSON.stringify(["db1", "db2"]) == JSON.stringify(Stores.databasesStore.getDatabaseNames().sort()));
-      });
+      };
+    });
 
-      it("determines database availability", function () {
-        assert(Stores.databasesStore.doesDatabaseExist("db1"));
-        assert(!Stores.databasesStore.doesDatabaseExist("db3"));
-      });
+    it("determines database names", function () {
+      assert.ok(JSON.stringify(["db1", "db2"]) == JSON.stringify(Stores.databasesStore.getDatabaseNames().sort()));
+    });
 
+    it("determines database availability", function () {
+      assert(Stores.databasesStore.doesDatabaseExist("db1"));
+      assert(!Stores.databasesStore.doesDatabaseExist("db3"));
     });
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documentation/base.js
----------------------------------------------------------------------
diff --git a/app/addons/documentation/base.js b/app/addons/documentation/base.js
index 7d94ef8..76a998b 100644
--- a/app/addons/documentation/base.js
+++ b/app/addons/documentation/base.js
@@ -10,25 +10,20 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './routes',
-  './assets/less/documentation.less'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Documentation from "./routes";
+import "./assets/less/documentation.less";
 
-function (app, FauxtonAPI, Documentation) {
+Documentation.initialize = function () {
+  FauxtonAPI.addHeaderLink({
+    id: 'Documentation',
+    title: 'Documentation',
+    icon: 'fonticon-bookmark',
+    href: '/documentation',
+    bottomNav: true,
+    top: true
+  });
+};
 
-  Documentation.initialize = function () {
-    FauxtonAPI.addHeaderLink({
-      id: 'Documentation',
-      title: 'Documentation',
-      icon: 'fonticon-bookmark',
-      href: '/documentation',
-      bottomNav: true,
-      top: true
-    });
-  };
-
-  return Documentation;
-});
+export default Documentation;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documentation/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documentation/components.react.jsx b/app/addons/documentation/components.react.jsx
index dacce94..01b0ddf 100644
--- a/app/addons/documentation/components.react.jsx
+++ b/app/addons/documentation/components.react.jsx
@@ -10,58 +10,54 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  './stores'
-], function (app, FauxtonAPI, React, Stores) {
-
-  var documentationStore = Stores.documentationStore;
-
-  var DocumentationController = React.createClass({
-    getStoreState: function () {
-      return {
-        links: documentationStore.getLinks()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    createLinkRows: function () {
-      return this.state.links.map(function (linkObject) {
-        return (
-          <tr key={linkObject.title}>
-            <td className="icons-container">
-              <div className={"icon " + linkObject.iconClassName}> </div>
-            </td>
-            <td>
-              <a href={linkObject.link} target="_blank" data-bypass="true">{linkObject.title}</a>
-            </td>
-          </tr>
-        );
-      });
-    },
-
-    render: function () {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import Stores from "./stores";
+
+var documentationStore = Stores.documentationStore;
+
+var DocumentationController = React.createClass({
+  getStoreState: function () {
+    return {
+      links: documentationStore.getLinks()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  createLinkRows: function () {
+    return this.state.links.map(function (linkObject) {
       return (
-        <div id="documentation-page" className="scrollable">
-          <div className="links">
-            <table>
-              <tbody>
-              {this.createLinkRows()}
-              </tbody>
-            </table>
-          </div>
-        </div>
+        <tr key={linkObject.title}>
+          <td className="icons-container">
+            <div className={"icon " + linkObject.iconClassName}> </div>
+          </td>
+          <td>
+            <a href={linkObject.link} target="_blank" data-bypass="true">{linkObject.title}</a>
+          </td>
+        </tr>
       );
-    }
-  });
-
-  return {
-    DocumentationController: DocumentationController
-  };
-
+    });
+  },
+
+  render: function () {
+    return (
+      <div id="documentation-page" className="scrollable">
+        <div className="links">
+          <table>
+            <tbody>
+            {this.createLinkRows()}
+            </tbody>
+          </table>
+        </div>
+      </div>
+    );
+  }
 });
+
+export default {
+  DocumentationController: DocumentationController
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documentation/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documentation/resources.js b/app/addons/documentation/resources.js
index d203e08..845d5fb 100644
--- a/app/addons/documentation/resources.js
+++ b/app/addons/documentation/resources.js
@@ -1,4 +1,3 @@
-
 // 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
@@ -11,8 +10,4 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([],
-function () {
-  // this is empty because the compiler looks for a resource.js file here
-  return null;
-});
+export default null;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documentation/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documentation/routes.js b/app/addons/documentation/routes.js
index 5e98fa4..f09ebe8 100644
--- a/app/addons/documentation/routes.js
+++ b/app/addons/documentation/routes.js
@@ -10,30 +10,25 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './components.react'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import DocumentationComponents from "./components.react";
 
-function (app, FauxtonAPI, DocumentationComponents) {
-
-  var DocumentationRouteObject = FauxtonAPI.RouteObject.extend({
-    selectedHeader: 'Documentation',
-    layout: 'one_pane',
-    disableLoader: false,
-    routes: {
-      'documentation': 'documentation'
-    },
-    crumbs: [
-      {'name': 'Documentation', 'link': '/documentation'}
-    ],
-    roles: ['fx_loggedIn'],
-    documentation: function () {
-      this.setComponent('#dashboard-content', DocumentationComponents.DocumentationController);
-    }
-  });
-  DocumentationRouteObject.RouteObjects = [DocumentationRouteObject];
-
-  return DocumentationRouteObject;
+var DocumentationRouteObject = FauxtonAPI.RouteObject.extend({
+  selectedHeader: 'Documentation',
+  layout: 'one_pane',
+  disableLoader: false,
+  routes: {
+    'documentation': 'documentation'
+  },
+  crumbs: [
+    {'name': 'Documentation', 'link': '/documentation'}
+  ],
+  roles: ['fx_loggedIn'],
+  documentation: function () {
+    this.setComponent('#dashboard-content', DocumentationComponents.DocumentationController);
+  }
 });
+DocumentationRouteObject.RouteObjects = [DocumentationRouteObject];
+
+export default DocumentationRouteObject;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documentation/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documentation/stores.js b/app/addons/documentation/stores.js
index 1f79c01..1f6542a 100644
--- a/app/addons/documentation/stores.js
+++ b/app/addons/documentation/stores.js
@@ -10,78 +10,74 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-], function (app, FauxtonAPI) {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
 
-  var DocumentationStore = FauxtonAPI.Store.extend({
-    getLinks: function () {
-      return [
-        {
-          title: 'CouchDB Official Documentation -- Online',
-          link: 'http://docs.couchdb.org/en/latest/',
-          iconClassName: 'couchdb-icon'
-        },
-        {
-          title: 'CouchDB Official Documentation -- Offline',
-          link: '/_utils/docs/contents.html',
-          iconClassName: 'couchdb-icon'
-        },
-        {
-          title: 'CouchDB Weekly News',
-          link: 'http://blog.couchdb.org/',
-          iconClassName: 'couchdb-icon'
-        },
-        {
-          title: 'CouchDB Homepage',
-          link: 'https://couchdb.apache.org/',
-          iconClassName: 'couchdb-icon'
-        },
-        {
-          title: 'CouchDB on Github',
-          link: 'https://github.com/apache/couchdb',
-          iconClassName: 'github-icon'
-        },
-        {
-          title: 'Fauxton on Github',
-          link: 'https://github.com/apache/couchdb-fauxton',
-          iconClassName: 'github-icon'
-        },
-        {
-          title: 'Fauxton Visual Guide',
-          link: 'https://couchdb.apache.org/fauxton-visual-guide/index.html',
-          iconClassName: 'couchdb-icon'
-        },
-        {
-          title: 'The Apache Software Foundation',
-          link: 'http://www.apache.org/',
-          iconClassName: 'asf-feather-icon'
-        },
-        {
-          title: 'Follow CouchDB on Twitter',
-          link: 'https://twitter.com/couchdb',
-          iconClassName: 'twitter-icon'
-        },
-        {
-          title: 'Follow CouchDB on Google Plus',
-          link: 'https://plus.google.com/+CouchDB',
-          iconClassName: 'google-plus-icon'
-        },
-        {
-          title: 'Follow CouchDB on LinkedIn',
-          link: 'https://www.linkedin.com/company/apache-couchdb',
-          iconClassName: 'linkedin-icon'
-        }
-      ];
+var DocumentationStore = FauxtonAPI.Store.extend({
+  getLinks: function () {
+    return [
+      {
+        title: 'CouchDB Official Documentation -- Online',
+        link: 'http://docs.couchdb.org/en/latest/',
+        iconClassName: 'couchdb-icon'
+      },
+      {
+        title: 'CouchDB Official Documentation -- Offline',
+        link: '/_utils/docs/contents.html',
+        iconClassName: 'couchdb-icon'
+      },
+      {
+        title: 'CouchDB Weekly News',
+        link: 'http://blog.couchdb.org/',
+        iconClassName: 'couchdb-icon'
+      },
+      {
+        title: 'CouchDB Homepage',
+        link: 'https://couchdb.apache.org/',
+        iconClassName: 'couchdb-icon'
+      },
+      {
+        title: 'CouchDB on Github',
+        link: 'https://github.com/apache/couchdb',
+        iconClassName: 'github-icon'
+      },
+      {
+        title: 'Fauxton on Github',
+        link: 'https://github.com/apache/couchdb-fauxton',
+        iconClassName: 'github-icon'
+      },
+      {
+        title: 'Fauxton Visual Guide',
+        link: 'https://couchdb.apache.org/fauxton-visual-guide/index.html',
+        iconClassName: 'couchdb-icon'
+      },
+      {
+        title: 'The Apache Software Foundation',
+        link: 'http://www.apache.org/',
+        iconClassName: 'asf-feather-icon'
+      },
+      {
+        title: 'Follow CouchDB on Twitter',
+        link: 'https://twitter.com/couchdb',
+        iconClassName: 'twitter-icon'
+      },
+      {
+        title: 'Follow CouchDB on Google Plus',
+        link: 'https://plus.google.com/+CouchDB',
+        iconClassName: 'google-plus-icon'
+      },
+      {
+        title: 'Follow CouchDB on LinkedIn',
+        link: 'https://www.linkedin.com/company/apache-couchdb',
+        iconClassName: 'linkedin-icon'
+      }
+    ];
 
-    }
-  });
-
-  var documentationStore = new DocumentationStore();
+  }
+});
 
-  return {
-    documentationStore: documentationStore
-  };
+var documentationStore = new DocumentationStore();
 
-});
+export default {
+  documentationStore: documentationStore
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documentation/tests/nightwatch/checksDocsPage.js
----------------------------------------------------------------------
diff --git a/app/addons/documentation/tests/nightwatch/checksDocsPage.js b/app/addons/documentation/tests/nightwatch/checksDocsPage.js
index 4a44e54..c421d7c 100644
--- a/app/addons/documentation/tests/nightwatch/checksDocsPage.js
+++ b/app/addons/documentation/tests/nightwatch/checksDocsPage.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Check the documentation page exists': function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/base.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/base.js b/app/addons/documents/base.js
index 3de66d0..f85c573 100644
--- a/app/addons/documents/base.js
+++ b/app/addons/documents/base.js
@@ -10,201 +10,194 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-
-  // Modules
-  "./routes",
-  "./assets/less/documents.less"
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Documents from "./routes";
+import "./assets/less/documents.less";
+
+function getQueryParam (query) {
+  if (!query) {
+    query = '';
+  }
+  return query;
+}
+
+FauxtonAPI.registerUrls( 'allDocs', {
+  server: function (id, query) {
+    return app.host + '/' + id + '/_all_docs' + getQueryParam(query);
+  },
+  app: function (id, query) {
+    return 'database/' + id + '/_all_docs' + getQueryParam(query);
+  },
+  apiurl: function (id, query) {
+    return window.location.origin + '/' + id + '/_all_docs' + getQueryParam(query);
+  }
+});
 
-function (app, FauxtonAPI, Documents) {
+FauxtonAPI.registerUrls('bulk_docs', {
+  server: function (id, query) {
+    return app.host + '/' + id + '/_bulk_docs' + getQueryParam(query);
+  },
+  app: function (id, query) {
+    return 'database/' + id + '/_bulk_docs' + getQueryParam(query);
+  },
+  apiurl: function (id, query) {
+    return window.location.origin + '/' + id + '/_bulk_docs' + getQueryParam(query);
+  }
+});
 
-  function getQueryParam (query) {
-    if (!query) {
-      query = '';
-    }
-    return query;
+FauxtonAPI.registerUrls('revision-browser', {
+  app: function (id, doc) {
+    return 'database/' + id + '/' + doc + '/conflicts';
   }
+});
 
-  FauxtonAPI.registerUrls( 'allDocs', {
-    server: function (id, query) {
-      return app.host + '/' + id + '/_all_docs' + getQueryParam(query);
-    },
-    app: function (id, query) {
-      return 'database/' + id + '/_all_docs' + getQueryParam(query);
-    },
-    apiurl: function (id, query) {
-      return window.location.origin + '/' + id + '/_all_docs' + getQueryParam(query);
-    }
-  });
-
-  FauxtonAPI.registerUrls('bulk_docs', {
-    server: function (id, query) {
-      return app.host + '/' + id + '/_bulk_docs' + getQueryParam(query);
-    },
-    app: function (id, query) {
-      return 'database/' + id + '/_bulk_docs' + getQueryParam(query);
-    },
-    apiurl: function (id, query) {
-      return window.location.origin + '/' + id + '/_bulk_docs' + getQueryParam(query);
-    }
-  });
+FauxtonAPI.registerUrls( 'designDocs', {
+  server: function (id, designDoc) {
+    return app.host + '/' + id + '/' + designDoc + '/_info';
+  },
 
-  FauxtonAPI.registerUrls('revision-browser', {
-    app: function (id, doc) {
-      return 'database/' + id + '/' + doc + '/conflicts';
-    }
-  });
+  app: function (id, designDoc) {
+    return 'database/' + id + '/_design/' + app.utils.safeURLName(designDoc) + '/_info';
+  },
 
-  FauxtonAPI.registerUrls( 'designDocs', {
-    server: function (id, designDoc) {
-      return app.host + '/' + id + '/' + designDoc + '/_info';
-    },
+  apiurl: function (id, designDoc) {
+    return window.location.origin + '/' + id + '/' + designDoc + '/_info';
+  }
+});
 
-    app: function (id, designDoc) {
-      return 'database/' + id + '/_design/' + app.utils.safeURLName(designDoc) + '/_info';
-    },
+FauxtonAPI.registerUrls( 'view', {
+  server: function (database, designDoc, viewName) {
+    return app.host + '/' + database + '/_design/' + designDoc + '/_view/' + viewName;
+  },
 
-    apiurl: function (id, designDoc) {
-      return window.location.origin + '/' + id + '/' + designDoc + '/_info';
-    }
-  });
+  app: function (database, designDoc) {
+    return 'database/' + database + '/_design/' + designDoc + '/_view/';
+  },
 
-  FauxtonAPI.registerUrls( 'view', {
-    server: function (database, designDoc, viewName) {
-      return app.host + '/' + database + '/_design/' + designDoc + '/_view/' + viewName;
-    },
+  apiurl: function (id, designDoc, viewName) {
+    return window.location.origin + '/' + id + '/_design/' + designDoc + '/_view/' + viewName;
+  },
 
-    app: function (database, designDoc) {
-      return 'database/' + database + '/_design/' + designDoc + '/_view/';
-    },
+  edit: function (database, designDoc, indexName) {
+    return 'database/' + database + '/_design/' + designDoc + '/_view/' + indexName + '/edit';
+  },
 
-    apiurl: function (id, designDoc, viewName) {
-      return window.location.origin + '/' + id + '/_design/' + designDoc + '/_view/' + viewName;
-    },
+  showView: function (database, designDoc, viewName) {
+    return '/database/' + database + '/' + designDoc + '/_view/' + viewName;
+  },
 
-    edit: function (database, designDoc, indexName) {
-      return 'database/' + database + '/_design/' + designDoc + '/_view/' + indexName + '/edit';
-    },
+  fragment: function (database, designDoc, viewName) {
+    return 'database/' + database + designDoc + '/_view/' + viewName;
+  }
+});
 
-    showView: function (database, designDoc, viewName) {
-      return '/database/' + database + '/' + designDoc + '/_view/' + viewName;
-    },
+FauxtonAPI.registerUrls('document', {
+  server: function (database, doc, query) {
+    if (_.isUndefined(query)) {
+      query = '';
+    }
+    return app.host + '/' + database + '/' + doc + query;
+  },
 
-    fragment: function (database, designDoc, viewName) {
-      return 'database/' + database + designDoc + '/_view/' + viewName;
+  attachment: function (database, doc, filename, query) {
+    if (_.isUndefined(query)) {
+      query = '';
     }
-  });
-
-  FauxtonAPI.registerUrls('document', {
-    server: function (database, doc, query) {
-      if (_.isUndefined(query)) {
-        query = '';
-      }
-      return app.host + '/' + database + '/' + doc + query;
-    },
-
-    attachment: function (database, doc, filename, query) {
-      if (_.isUndefined(query)) {
-        query = '';
-      }
-      return app.host + '/' + database + '/' + doc + '/' + filename + query;
-    },
-
-    app: function (database, doc) {
-      return '/database/' + database + '/' + doc;
-    },
-
-    apiurl: function (database, doc) {
-      if (!doc) {
-        // api url for creating a doc with POST
-        return window.location.origin + '/' + database;
-      }
-
-      return window.location.origin + '/' + database + '/' + doc;
-    },
-
-    'web-index': function (database, doc) {
-      return '/database/' + database + '/' + doc;
+    return app.host + '/' + database + '/' + doc + '/' + filename + query;
+  },
+
+  app: function (database, doc) {
+    return '/database/' + database + '/' + doc;
+  },
+
+  apiurl: function (database, doc) {
+    if (!doc) {
+      // api url for creating a doc with POST
+      return window.location.origin + '/' + database;
     }
-  });
 
-  FauxtonAPI.registerUrls( 'new', {
-    newDocument: function (database) {
-      return '/database/' + database + '/new';
-    },
+    return window.location.origin + '/' + database + '/' + doc;
+  },
 
-    newView: function (database) {
-      return '/database/' + database + '/new_view';
-    },
+  'web-index': function (database, doc) {
+    return '/database/' + database + '/' + doc;
+  }
+});
 
-    addView: function (database, ddoc) {
-      return '/database/' + database + '/new_view/' + ddoc;
-    }
-  });
+FauxtonAPI.registerUrls( 'new', {
+  newDocument: function (database) {
+    return '/database/' + database + '/new';
+  },
+
+  newView: function (database) {
+    return '/database/' + database + '/new_view';
+  },
 
-  FauxtonAPI.registerUrls( 'base', {
-    server: function (database) {
-      return app.host + '/' + database + '/';
-    },
+  addView: function (database, ddoc) {
+    return '/database/' + database + '/new_view/' + ddoc;
+  }
+});
 
-    app: function (database) {
-      return '/database/' + database + '/';
-    },
-  });
+FauxtonAPI.registerUrls( 'base', {
+  server: function (database) {
+    return app.host + '/' + database + '/';
+  },
 
-  FauxtonAPI.registerUrls('mango', {
+  app: function (database) {
+    return '/database/' + database + '/';
+  },
+});
 
-    'index-server': function (db, query) {
-      if (!query) {
-        query = '';
-      }
+FauxtonAPI.registerUrls('mango', {
 
-      return app.host + '/' + db + '/_index' + query;
-    },
+  'index-server': function (db, query) {
+    if (!query) {
+      query = '';
+    }
 
-    'index-apiurl': function (db, query) {
-      if (!query) {
-        query = '';
-      }
+    return app.host + '/' + db + '/_index' + query;
+  },
 
-      return window.location.origin + '/' + db + '/_index' + query;
-    },
+  'index-apiurl': function (db, query) {
+    if (!query) {
+      query = '';
+    }
 
-    'index-app': function (db, query) {
-      if (!query) {
-        query = '';
-      }
+    return window.location.origin + '/' + db + '/_index' + query;
+  },
 
-      return 'database/' + db + '/_index' + query;
-    },
+  'index-app': function (db, query) {
+    if (!query) {
+      query = '';
+    }
 
-    'query-server': function (db, query) {
-      if (!query) {
-        query = '';
-      }
+    return 'database/' + db + '/_index' + query;
+  },
 
-      return app.host + '/' + db + '/_find' + query;
-    },
+  'query-server': function (db, query) {
+    if (!query) {
+      query = '';
+    }
 
-    'query-apiurl': function (db, query) {
-      if (!query) {
-        query = '';
-      }
+    return app.host + '/' + db + '/_find' + query;
+  },
 
-      return window.location.origin + '/' + db + '/_find' + query;
-    },
+  'query-apiurl': function (db, query) {
+    if (!query) {
+      query = '';
+    }
 
-    'query-app': function (db, query) {
-      if (!query) {
-        query = '';
-      }
+    return window.location.origin + '/' + db + '/_find' + query;
+  },
 
-      return 'database/' + db + '/_find' + query;
+  'query-app': function (db, query) {
+    if (!query) {
+      query = '';
     }
-  });
 
-  return Documents;
+    return 'database/' + db + '/_find' + query;
+  }
 });
+
+export default Documents;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/changes/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/actions.js b/app/addons/documents/changes/actions.js
index 2fa4c6e..4fa9fd9 100644
--- a/app/addons/documents/changes/actions.js
+++ b/app/addons/documents/changes/actions.js
@@ -10,96 +10,91 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes',
-  './stores',
-  '../helpers'
-],
-function (app, FauxtonAPI, ActionTypes, Stores, Helpers) {
-
-  var changesStore = Stores.changesStore;
-  var pollingTimeout = 60000;
-  var currentRequest;
-
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+import Stores from "./stores";
+import Helpers from "../helpers";
+
+var changesStore = Stores.changesStore;
+var pollingTimeout = 60000;
+var currentRequest;
+
+
+export default {
+  toggleTabVisibility: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.TOGGLE_CHANGES_TAB_VISIBILITY
+    });
+  },
+
+  addFilter: function (filter) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.ADD_CHANGES_FILTER_ITEM,
+      filter: filter
+    });
+  },
+
+  removeFilter: function (filter) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.REMOVE_CHANGES_FILTER_ITEM,
+      filter: filter
+    });
+  },
+
+  initChanges: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.INIT_CHANGES,
+      options: options
+    });
+    currentRequest = null;
+    this.getLatestChanges();
+  },
+
+  getLatestChanges: function () {
+    var params = {
+      limit: 100
+    };
+
+    // after the first request for the changes list has been made, switch to longpoll
+    if (currentRequest) {
+      params.since = changesStore.getLastSeqNum();
+      params.timeout = pollingTimeout;
+      params.feed = 'longpoll';
+    }
 
-  return {
-    toggleTabVisibility: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.TOGGLE_CHANGES_TAB_VISIBILITY
-      });
-    },
+    var query = $.param(params);
+    var db = app.utils.safeURLName(changesStore.getDatabaseName());
 
-    addFilter: function (filter) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.ADD_CHANGES_FILTER_ITEM,
-        filter: filter
-      });
-    },
+    var endpoint = FauxtonAPI.urls('changes', 'server', db, '');
+    currentRequest = $.getJSON(endpoint);
+    currentRequest.then(_.bind(this.updateChanges, this));
+  },
 
-    removeFilter: function (filter) {
+  updateChanges: function (json) {
+    // only bother updating the list of changes if the seq num has changed
+    var latestSeqNum = Helpers.getSeqNum(json.last_seq);
+    if (latestSeqNum !== changesStore.getLastSeqNum()) {
       FauxtonAPI.dispatch({
-        type: ActionTypes.REMOVE_CHANGES_FILTER_ITEM,
-        filter: filter
+        type: ActionTypes.UPDATE_CHANGES,
+        changes: json.results,
+        seqNum: latestSeqNum
       });
-    },
+    }
 
-    initChanges: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.INIT_CHANGES,
-        options: options
-      });
-      currentRequest = null;
+    if (changesStore.pollingEnabled()) {
       this.getLatestChanges();
-    },
-
-    getLatestChanges: function () {
-      var params = {
-        limit: 100
-      };
-
-      // after the first request for the changes list has been made, switch to longpoll
-      if (currentRequest) {
-        params.since = changesStore.getLastSeqNum();
-        params.timeout = pollingTimeout;
-        params.feed = 'longpoll';
-      }
-
-      var query = $.param(params);
-      var db = app.utils.safeURLName(changesStore.getDatabaseName());
-
-      var endpoint = FauxtonAPI.urls('changes', 'server', db, '');
-      currentRequest = $.getJSON(endpoint);
-      currentRequest.then(_.bind(this.updateChanges, this));
-    },
-
-    updateChanges: function (json) {
-      // only bother updating the list of changes if the seq num has changed
-      var latestSeqNum = Helpers.getSeqNum(json.last_seq);
-      if (latestSeqNum !== changesStore.getLastSeqNum()) {
-        FauxtonAPI.dispatch({
-          type: ActionTypes.UPDATE_CHANGES,
-          changes: json.results,
-          seqNum: latestSeqNum
-        });
-      }
-
-      if (changesStore.pollingEnabled()) {
-        this.getLatestChanges();
-      }
-    },
+    }
+  },
 
-    togglePolling: function () {
-      FauxtonAPI.dispatch({ type: ActionTypes.TOGGLE_CHANGES_POLLING });
+  togglePolling: function () {
+    FauxtonAPI.dispatch({ type: ActionTypes.TOGGLE_CHANGES_POLLING });
 
-      // the user just enabled polling. Start 'er up
-      if (changesStore.pollingEnabled()) {
-        this.getLatestChanges();
-      } else {
-        currentRequest.abort();
-      }
+    // the user just enabled polling. Start 'er up
+    if (changesStore.pollingEnabled()) {
+      this.getLatestChanges();
+    } else {
+      currentRequest.abort();
     }
-  };
-
-});
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/changes/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/changes/actiontypes.js b/app/addons/documents/changes/actiontypes.js
index edca4b9..04d217d 100644
--- a/app/addons/documents/changes/actiontypes.js
+++ b/app/addons/documents/changes/actiontypes.js
@@ -10,15 +10,13 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    INIT_CHANGES: 'INIT_CHANGES',
-    UPDATE_CHANGES: 'UPDATE_CHANGES',
-    TOGGLE_CHANGES_TAB_VISIBILITY: 'TOGGLE_CHANGES_TAB_VISIBILITY',
-    ADD_CHANGES_FILTER_ITEM: 'ADD_CHANGES_FILTER_ITEM',
-    REMOVE_CHANGES_FILTER_ITEM: 'REMOVE_CHANGES_FILTER_ITEM',
-    UPDATE_CHANGES_FILTER: 'UPDATE_CHANGES_FILTER',
-    TOGGLE_CHANGES_CODE_VISIBILITY: 'TOGGLE_CHANGES_CODE_VISIBILITY',
-    TOGGLE_CHANGES_POLLING: 'TOGGLE_CHANGES_POLLING'
-  };
-});
+export default {
+  INIT_CHANGES: 'INIT_CHANGES',
+  UPDATE_CHANGES: 'UPDATE_CHANGES',
+  TOGGLE_CHANGES_TAB_VISIBILITY: 'TOGGLE_CHANGES_TAB_VISIBILITY',
+  ADD_CHANGES_FILTER_ITEM: 'ADD_CHANGES_FILTER_ITEM',
+  REMOVE_CHANGES_FILTER_ITEM: 'REMOVE_CHANGES_FILTER_ITEM',
+  UPDATE_CHANGES_FILTER: 'UPDATE_CHANGES_FILTER',
+  TOGGLE_CHANGES_CODE_VISIBILITY: 'TOGGLE_CHANGES_CODE_VISIBILITY',
+  TOGGLE_CHANGES_POLLING: 'TOGGLE_CHANGES_POLLING'
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/doc-editor/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/actions.js b/app/addons/documents/doc-editor/actions.js
index 0af33ba..ed00f94 100644
--- a/app/addons/documents/doc-editor/actions.js
+++ b/app/addons/documents/doc-editor/actions.js
@@ -12,239 +12,234 @@
 
 /* global FormData */
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes'
-],
-function (app, FauxtonAPI, ActionTypes) {
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
 
-  var xhr;
+var xhr;
 
-  function initDocEditor (params) {
-    var doc = params.doc;
+function initDocEditor (params) {
+  var doc = params.doc;
 
-    // ensure a clean slate
-    FauxtonAPI.dispatch({ type: ActionTypes.RESET_DOC });
+  // ensure a clean slate
+  FauxtonAPI.dispatch({ type: ActionTypes.RESET_DOC });
 
-    doc.fetch().then(function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
-
-      if (params.onLoaded) {
-        params.onLoaded();
+  doc.fetch().then(function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
       }
-    }, function (xhr, reason, msg) {
-      errorNotification('The document does not exist.');
-      FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', params.database.id, ''));
     });
-  }
 
-  function saveDoc (doc, isValidDoc, onSave) {
-    if (isValidDoc) {
+    if (params.onLoaded) {
+      params.onLoaded();
+    }
+  }, function (xhr, reason, msg) {
+    errorNotification('The document does not exist.');
+    FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', params.database.id, ''));
+  });
+}
+
+function saveDoc (doc, isValidDoc, onSave) {
+  if (isValidDoc) {
+    FauxtonAPI.addNotification({
+      msg: 'Saving document.',
+      clear: true
+    });
+
+    doc.save().then(function () {
+      onSave(doc.prettyJSON());
+      FauxtonAPI.navigate('#' + FauxtonAPI.urls('allDocs', 'app', doc.database.id), {trigger: true});
+    }).fail(function (xhr) {
       FauxtonAPI.addNotification({
-        msg: 'Saving document.',
+        msg: 'Save failed: ' + JSON.parse(xhr.responseText).reason,
+        type: 'error',
+        fade: false,
         clear: true
       });
+    });
 
-      doc.save().then(function () {
-        onSave(doc.prettyJSON());
-        FauxtonAPI.navigate('#' + FauxtonAPI.urls('allDocs', 'app', doc.database.id), {trigger: true});
-      }).fail(function (xhr) {
-        FauxtonAPI.addNotification({
-          msg: 'Save failed: ' + JSON.parse(xhr.responseText).reason,
-          type: 'error',
-          fade: false,
-          clear: true
-        });
+  } else if (doc.validationError && doc.validationError === 'Cannot change a documents id.') {
+    errorNotification('You cannot edit the _id of an existing document. Try this: Click \'Clone Document\', then change the _id on the clone before saving.');
+    delete doc.validationError;
+  } else {
+    errorNotification('Please fix the JSON errors and try saving again.');
+  }
+}
+
+function showDeleteDocModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.SHOW_DELETE_DOC_CONFIRMATION_MODAL });
+}
+
+function hideDeleteDocModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.HIDE_DELETE_DOC_CONFIRMATION_MODAL });
+}
+
+function deleteDoc (doc) {
+  var databaseName = doc.database.safeID();
+  var query = '?rev=' + doc.get('_rev');
+
+  $.ajax({
+    url: FauxtonAPI.urls('document', 'server', databaseName, doc.safeID(), query),
+    type: 'DELETE',
+    contentType: 'application/json; charset=UTF-8',
+    xhrFields: {
+      withCredentials: true
+    },
+    success: function () {
+      FauxtonAPI.addNotification({
+        msg: 'Your document has been successfully deleted.',
+        clear: true
+      });
+      FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', databaseName, ''));
+    },
+    error: function (resp) {
+      FauxtonAPI.addNotification({
+        msg: 'Failed to delete your document!',
+        type: 'error',
+        clear: true
       });
-
-    } else if (doc.validationError && doc.validationError === 'Cannot change a documents id.') {
-      errorNotification('You cannot edit the _id of an existing document. Try this: Click \'Clone Document\', then change the _id on the clone before saving.');
-      delete doc.validationError;
-    } else {
-      errorNotification('Please fix the JSON errors and try saving again.');
     }
-  }
-
-  function showDeleteDocModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.SHOW_DELETE_DOC_CONFIRMATION_MODAL });
-  }
-
-  function hideDeleteDocModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.HIDE_DELETE_DOC_CONFIRMATION_MODAL });
-  }
-
-  function deleteDoc (doc) {
-    var databaseName = doc.database.safeID();
-    var query = '?rev=' + doc.get('_rev');
-
-    $.ajax({
-      url: FauxtonAPI.urls('document', 'server', databaseName, doc.safeID(), query),
-      type: 'DELETE',
-      contentType: 'application/json; charset=UTF-8',
-      xhrFields: {
-        withCredentials: true
-      },
-      success: function () {
-        FauxtonAPI.addNotification({
-          msg: 'Your document has been successfully deleted.',
-          clear: true
-        });
-        FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', databaseName, ''));
-      },
-      error: function (resp) {
-        FauxtonAPI.addNotification({
-          msg: 'Failed to delete your document!',
-          type: 'error',
-          clear: true
-        });
+  });
+}
+
+function showCloneDocModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.SHOW_CLONE_DOC_MODAL });
+}
+
+function hideCloneDocModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.HIDE_CLONE_DOC_MODAL });
+}
+
+function cloneDoc (newId) {
+  var isDDoc = newId.match(/^_design\//),
+    removeDDocID = newId.replace(/^_design\//, ''),
+    encodedID = isDDoc ? '_design/' + app.utils.safeURLName(removeDDocID) : app.utils.safeURLName(newId);
+
+  this.hideCloneDocModal();
+  FauxtonAPI.triggerRouteEvent('duplicateDoc', encodedID);
+}
+
+function showUploadModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.SHOW_UPLOAD_MODAL });
+}
+
+function hideUploadModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.HIDE_UPLOAD_MODAL });
+}
+
+function uploadAttachment (params) {
+  if (params.files.length === 0) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.FILE_UPLOAD_ERROR,
+      options: {
+        error: 'Please select a file to be uploaded.'
       }
     });
+    return;
   }
 
-  function showCloneDocModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.SHOW_CLONE_DOC_MODAL });
-  }
-
-  function hideCloneDocModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.HIDE_CLONE_DOC_MODAL });
-  }
-
-  function cloneDoc (newId) {
-    var isDDoc = newId.match(/^_design\//),
-      removeDDocID = newId.replace(/^_design\//, ''),
-      encodedID = isDDoc ? '_design/' + app.utils.safeURLName(removeDDocID) : app.utils.safeURLName(newId);
-
-    this.hideCloneDocModal();
-    FauxtonAPI.triggerRouteEvent('duplicateDoc', encodedID);
-  }
-
-  function showUploadModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.SHOW_UPLOAD_MODAL });
-  }
-
-  function hideUploadModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.HIDE_UPLOAD_MODAL });
-  }
+  FauxtonAPI.dispatch({ type: ActionTypes.START_FILE_UPLOAD });
+
+  // store the xhr in parent scope to allow us to cancel any uploads if the user closes the modal
+  xhr = $.ajaxSettings.xhr();
+
+  var query = '?rev=' + params.rev;
+  var db = params.doc.getDatabase().safeID();
+  var docId = params.doc.safeID();
+  var file = params.files[0];
+
+  $.ajax({
+    url: FauxtonAPI.urls('document', 'attachment', db, docId, file.name, query),
+    type: 'PUT',
+    data: file,
+    contentType: file.type,
+    processData: false,
+    xhrFields: {
+      withCredentials: true
+    },
+    xhr: function () {
+      xhr.upload.onprogress = function (evt) {
+        var percentComplete = evt.loaded / evt.total * 100;
+        FauxtonAPI.dispatch({
+          type: ActionTypes.SET_FILE_UPLOAD_PERCENTAGE,
+          options: {
+            percent: percentComplete
+          }
+        });
+      };
+      return xhr;
+    },
+    success: function () {
+
+      // re-initialize the document editor. Only announce it's been updated when
+      initDocEditor({
+        doc: params.doc,
+        onLoaded: function () {
+          FauxtonAPI.dispatch({ type: ActionTypes.FILE_UPLOAD_SUCCESS });
+          FauxtonAPI.addNotification({
+            msg: 'Document saved successfully.',
+            type: 'success',
+            clear: true
+          });
+        }.bind(this)
+      });
 
-  function uploadAttachment (params) {
-    if (params.files.length === 0) {
+    },
+    error: function (resp) {
+      // cancelled uploads throw an ajax error but they don't contain a response. We don't want to publish an error
+      // event in those cases
+      if (_.isEmpty(resp.responseText)) {
+        return;
+      }
       FauxtonAPI.dispatch({
         type: ActionTypes.FILE_UPLOAD_ERROR,
         options: {
-          error: 'Please select a file to be uploaded.'
+          error: JSON.parse(resp.responseText).reason
         }
       });
-      return;
     }
-
-    FauxtonAPI.dispatch({ type: ActionTypes.START_FILE_UPLOAD });
-
-    // store the xhr in parent scope to allow us to cancel any uploads if the user closes the modal
-    xhr = $.ajaxSettings.xhr();
-
-    var query = '?rev=' + params.rev;
-    var db = params.doc.getDatabase().safeID();
-    var docId = params.doc.safeID();
-    var file = params.files[0];
-
-    $.ajax({
-      url: FauxtonAPI.urls('document', 'attachment', db, docId, file.name, query),
-      type: 'PUT',
-      data: file,
-      contentType: file.type,
-      processData: false,
-      xhrFields: {
-        withCredentials: true
-      },
-      xhr: function () {
-        xhr.upload.onprogress = function (evt) {
-          var percentComplete = evt.loaded / evt.total * 100;
-          FauxtonAPI.dispatch({
-            type: ActionTypes.SET_FILE_UPLOAD_PERCENTAGE,
-            options: {
-              percent: percentComplete
-            }
-          });
-        };
-        return xhr;
-      },
-      success: function () {
-
-        // re-initialize the document editor. Only announce it's been updated when
-        initDocEditor({
-          doc: params.doc,
-          onLoaded: function () {
-            FauxtonAPI.dispatch({ type: ActionTypes.FILE_UPLOAD_SUCCESS });
-            FauxtonAPI.addNotification({
-              msg: 'Document saved successfully.',
-              type: 'success',
-              clear: true
-            });
-          }.bind(this)
-        });
-
-      },
-      error: function (resp) {
-        // cancelled uploads throw an ajax error but they don't contain a response. We don't want to publish an error
-        // event in those cases
-        if (_.isEmpty(resp.responseText)) {
-          return;
-        }
-        FauxtonAPI.dispatch({
-          type: ActionTypes.FILE_UPLOAD_ERROR,
-          options: {
-            error: JSON.parse(resp.responseText).reason
-          }
-        });
-      }
-    });
-  }
-
-  function cancelUpload () {
-    xhr.abort();
-  }
-
-  function resetUploadModal () {
-    FauxtonAPI.dispatch({ type: ActionTypes.RESET_UPLOAD_MODAL });
-  }
-
-
-  // helpers
-
-  function errorNotification (msg) {
-    FauxtonAPI.addNotification({
-      msg: msg,
-      type: 'error',
-      clear: true
-    });
-  }
-
-  return {
-    initDocEditor: initDocEditor,
-    saveDoc: saveDoc,
-
-    // clone doc
-    showCloneDocModal: showCloneDocModal,
-    hideCloneDocModal: hideCloneDocModal,
-    cloneDoc: cloneDoc,
-
-    // delete doc
-    showDeleteDocModal: showDeleteDocModal,
-    hideDeleteDocModal: hideDeleteDocModal,
-    deleteDoc: deleteDoc,
-
-    // upload modal
-    showUploadModal: showUploadModal,
-    hideUploadModal: hideUploadModal,
-    uploadAttachment: uploadAttachment,
-    cancelUpload: cancelUpload,
-    resetUploadModal: resetUploadModal
-  };
-
-});
+  });
+}
+
+function cancelUpload () {
+  xhr.abort();
+}
+
+function resetUploadModal () {
+  FauxtonAPI.dispatch({ type: ActionTypes.RESET_UPLOAD_MODAL });
+}
+
+
+// helpers
+
+function errorNotification (msg) {
+  FauxtonAPI.addNotification({
+    msg: msg,
+    type: 'error',
+    clear: true
+  });
+}
+
+export default {
+  initDocEditor: initDocEditor,
+  saveDoc: saveDoc,
+
+  // clone doc
+  showCloneDocModal: showCloneDocModal,
+  hideCloneDocModal: hideCloneDocModal,
+  cloneDoc: cloneDoc,
+
+  // delete doc
+  showDeleteDocModal: showDeleteDocModal,
+  hideDeleteDocModal: hideDeleteDocModal,
+  deleteDoc: deleteDoc,
+
+  // upload modal
+  showUploadModal: showUploadModal,
+  hideUploadModal: hideUploadModal,
+  uploadAttachment: uploadAttachment,
+  cancelUpload: cancelUpload,
+  resetUploadModal: resetUploadModal
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/doc-editor/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/actiontypes.js b/app/addons/documents/doc-editor/actiontypes.js
index e669155..25df4b9 100644
--- a/app/addons/documents/doc-editor/actiontypes.js
+++ b/app/addons/documents/doc-editor/actiontypes.js
@@ -10,22 +10,20 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    RESET_DOC: 'RESET_DOC',
-    DOC_LOADED: 'DOC_LOADED',
-    SHOW_CLONE_DOC_MODAL: 'SHOW_CLONE_DOC_MODAL',
-    HIDE_CLONE_DOC_MODAL: 'HIDE_CLONE_DOC_MODAL',
-    SHOW_DELETE_DOC_CONFIRMATION_MODAL: 'SHOW_DELETE_DOC_CONFIRMATION_MODAL',
-    HIDE_DELETE_DOC_CONFIRMATION_MODAL: 'HIDE_DELETE_DOC_CONFIRMATION_MODAL',
-    SHOW_UPLOAD_MODAL: 'SHOW_UPLOAD_MODAL',
-    HIDE_UPLOAD_MODAL: 'HIDE_UPLOAD_MODAL',
-    RESET_UPLOAD_MODAL: 'RESET_UPLOAD_MODAL',
-    SHOW_STRING_EDIT_MODAL: 'SHOW_STRING_EDIT_MODAL',
-    HIDE_STRING_EDIT_MODAL: 'HIDE_STRING_EDIT_MODAL',
-    FILE_UPLOAD_SUCCESS: 'FILE_UPLOAD_SUCCESS',
-    FILE_UPLOAD_ERROR: 'FILE_UPLOAD_ERROR',
-    START_FILE_UPLOAD: 'START_FILE_UPLOAD',
-    SET_FILE_UPLOAD_PERCENTAGE: 'SET_FILE_UPLOAD_PERCENTAGE'
-  };
-});
+export default {
+  RESET_DOC: 'RESET_DOC',
+  DOC_LOADED: 'DOC_LOADED',
+  SHOW_CLONE_DOC_MODAL: 'SHOW_CLONE_DOC_MODAL',
+  HIDE_CLONE_DOC_MODAL: 'HIDE_CLONE_DOC_MODAL',
+  SHOW_DELETE_DOC_CONFIRMATION_MODAL: 'SHOW_DELETE_DOC_CONFIRMATION_MODAL',
+  HIDE_DELETE_DOC_CONFIRMATION_MODAL: 'HIDE_DELETE_DOC_CONFIRMATION_MODAL',
+  SHOW_UPLOAD_MODAL: 'SHOW_UPLOAD_MODAL',
+  HIDE_UPLOAD_MODAL: 'HIDE_UPLOAD_MODAL',
+  RESET_UPLOAD_MODAL: 'RESET_UPLOAD_MODAL',
+  SHOW_STRING_EDIT_MODAL: 'SHOW_STRING_EDIT_MODAL',
+  HIDE_STRING_EDIT_MODAL: 'HIDE_STRING_EDIT_MODAL',
+  FILE_UPLOAD_SUCCESS: 'FILE_UPLOAD_SUCCESS',
+  FILE_UPLOAD_ERROR: 'FILE_UPLOAD_ERROR',
+  START_FILE_UPLOAD: 'START_FILE_UPLOAD',
+  SET_FILE_UPLOAD_PERCENTAGE: 'SET_FILE_UPLOAD_PERCENTAGE'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/doc-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/components.react.jsx b/app/addons/documents/doc-editor/components.react.jsx
index 8062dd7..c2a7f15 100644
--- a/app/addons/documents/doc-editor/components.react.jsx
+++ b/app/addons/documents/doc-editor/components.react.jsx
@@ -11,442 +11,436 @@
 // the License.
 
 
-define([
-  '../../../core/api',
-  '../../../app',
-  'react',
-  'react-dom',
-  './actions',
-  './stores',
-  '../../fauxton/components.react',
-  '../../components/react-components.react',
-  'react-bootstrap',
-  '../../../helpers',
-], function (FauxtonAPI, app, React, ReactDOM, Actions, Stores, FauxtonComponents, GeneralComponents, ReactBootstrap, Helpers) {
-
-  var store = Stores.docEditorStore;
-  var Modal = ReactBootstrap.Modal;
-
-
-  var DocEditorController = React.createClass({
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        isLoading: store.isLoading(),
-        doc: store.getDoc(),
-        cloneDocModalVisible: store.isCloneDocModalVisible(),
-        uploadModalVisible: store.isUploadModalVisible(),
-        deleteDocModalVisible: store.isDeleteDocModalVisible(),
-        numFilesUploaded: store.getNumFilesUploaded(),
-        conflictCount: store.getDocConflictCount()
-      };
-    },
-
-    getDefaultProps: function () {
-      return {
-        database: {},
-        previousPage: '',
-        isNewDoc: false
-      };
-    },
-
-    getCodeEditor: function () {
-      if (this.state.isLoading) {
-        return (<GeneralComponents.LoadLines />);
-      }
-
-      var code = JSON.stringify(this.state.doc.attributes, null, '  ');
-      var editorCommands = [{
-        name: 'save',
-        bindKey: { win: 'Ctrl-S', mac: 'Ctrl-S' },
-        exec: this.saveDoc
-      }];
+import FauxtonAPI from "../../../core/api";
+import app from "../../../app";
+import React from "react";
+import ReactDOM from "react-dom";
+import Actions from "./actions";
+import Stores from "./stores";
+import FauxtonComponents from "../../fauxton/components.react";
+import GeneralComponents from "../../components/react-components.react";
+import { Modal } from "react-bootstrap";
+import Helpers from "../../../helpers";
+
+var store = Stores.docEditorStore;
+
+var DocEditorController = React.createClass({
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      isLoading: store.isLoading(),
+      doc: store.getDoc(),
+      cloneDocModalVisible: store.isCloneDocModalVisible(),
+      uploadModalVisible: store.isUploadModalVisible(),
+      deleteDocModalVisible: store.isDeleteDocModalVisible(),
+      numFilesUploaded: store.getNumFilesUploaded(),
+      conflictCount: store.getDocConflictCount()
+    };
+  },
+
+  getDefaultProps: function () {
+    return {
+      database: {},
+      previousPage: '',
+      isNewDoc: false
+    };
+  },
+
+  getCodeEditor: function () {
+    if (this.state.isLoading) {
+      return (<GeneralComponents.LoadLines />);
+    }
 
-      return (
-        <GeneralComponents.CodeEditor
-          id="doc-editor"
-          ref="docEditor"
-          defaultCode={code}
-          mode="json"
-          autoFocus={true}
-          editorCommands={editorCommands}
-          notifyUnsavedChanges={true}
-          stringEditModalEnabled={true} />
-      );
-    },
-
-    componentDidMount: function () {
-      store.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      store.off('change', this.onChange);
-    },
-
-    // whenever a file is uploaded, reset the editor
-    componentWillUpdate: function (nextProps, nextState) {
-      if (this.state.numFilesUploaded !== nextState.numFilesUploaded) {
-        this.getEditor().setValue(JSON.stringify(nextState.doc.attributes, null, '  '));
-      }
-    },
-
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
-
-    saveDoc: function () {
-      Actions.saveDoc(this.state.doc, this.checkDocIsValid(), this.onSaveComplete);
-    },
-
-    onSaveComplete: function (json) {
-      this.getEditor().clearChanges();
-    },
-
-    hideDeleteDocModal: function () {
-      Actions.hideDeleteDocModal();
-    },
-
-    deleteDoc: function () {
-      Actions.hideDeleteDocModal();
-      Actions.deleteDoc(this.state.doc);
-    },
-
-    getEditor: function () {
-      return (this.refs.docEditor) ? this.refs.docEditor.getEditor() : null;
-    },
-
-    checkDocIsValid: function () {
-      if (this.getEditor().hasErrors()) {
-        return false;
-      }
-      var json = JSON.parse(this.getEditor().getValue());
-      this.state.doc.clear().set(json, { validate: true });
-
-      return !this.state.doc.validationError;
-    },
-
-    clearChanges: function () {
-      this.refs.docEditor.clearChanges();
-    },
-
-    getExtensionIcons: function () {
-      var extensions = FauxtonAPI.getExtensions('DocEditor:icons');
-      return _.map(extensions, function (Extension, i) {
-        return (<Extension doc={this.state.doc} key={i} database={this.props.database} />);
-      }, this);
-    },
-
-    getButtonRow: function () {
-      if (this.props.isNewDoc) {
-        return false;
-      }
-      return (
-        <div>
-          <AttachmentsPanelButton doc={this.state.doc} isLoading={this.state.isLoading} />
-          <div className="doc-editor-extension-icons">{this.getExtensionIcons()}</div>
-
-          {this.state.conflictCount ? <PanelButton
-            title={`Conflicts (${this.state.conflictCount})`}
-            iconClass="icon-columns"
-            className="conflicts"
-            onClick={() => { FauxtonAPI.navigate(FauxtonAPI.urls('revision-browser', 'app', this.props.database.safeID(), this.state.doc.id));}}/> : null}
-
-          <PanelButton className="upload" title="Upload Attachment" iconClass="icon-circle-arrow-up" onClick={Actions.showUploadModal} />
-          <PanelButton title="Clone Document" iconClass="icon-repeat" onClick={Actions.showCloneDocModal} />
-          <PanelButton title="Delete" iconClass="icon-trash" onClick={Actions.showDeleteDocModal} />
-        </div>
-      );
-    },
+    var code = JSON.stringify(this.state.doc.attributes, null, '  ');
+    var editorCommands = [{
+      name: 'save',
+      bindKey: { win: 'Ctrl-S', mac: 'Ctrl-S' },
+      exec: this.saveDoc
+    }];
+
+    return (
+      <GeneralComponents.CodeEditor
+        id="doc-editor"
+        ref="docEditor"
+        defaultCode={code}
+        mode="json"
+        autoFocus={true}
+        editorCommands={editorCommands}
+        notifyUnsavedChanges={true}
+        stringEditModalEnabled={true} />
+    );
+  },
+
+  componentDidMount: function () {
+    store.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    store.off('change', this.onChange);
+  },
+
+  // whenever a file is uploaded, reset the editor
+  componentWillUpdate: function (nextProps, nextState) {
+    if (this.state.numFilesUploaded !== nextState.numFilesUploaded) {
+      this.getEditor().setValue(JSON.stringify(nextState.doc.attributes, null, '  '));
+    }
+  },
 
-    render: function () {
-      var saveButtonLabel = (this.props.isNewDoc) ? 'Create Document' : 'Save Changes';
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
+    }
+  },
 
-      return (
-        <div>
-          <div id="doc-editor-actions-panel">
-            <div className="doc-actions-left">
-              <button className="save-doc btn btn-success save" type="button" onClick={this.saveDoc}>
-                <i className="icon fonticon-ok-circled"></i> {saveButtonLabel}
-              </button>
-              <div>
-                <a href={this.props.previousPage} className="js-back cancel-button">Cancel</a>
-              </div>
-            </div>
-            <div className="alignRight">
-              {this.getButtonRow()}
-            </div>
-          </div>
+  saveDoc: function () {
+    Actions.saveDoc(this.state.doc, this.checkDocIsValid(), this.onSaveComplete);
+  },
+
+  onSaveComplete: function (json) {
+    this.getEditor().clearChanges();
+  },
+
+  hideDeleteDocModal: function () {
+    Actions.hideDeleteDocModal();
+  },
+
+  deleteDoc: function () {
+    Actions.hideDeleteDocModal();
+    Actions.deleteDoc(this.state.doc);
+  },
 
-          <div className="code-region">
-            <div className="bgEditorGutter"></div>
-            <div id="editor-container" className="doc-code">{this.getCodeEditor()}</div>
+  getEditor: function () {
+    return (this.refs.docEditor) ? this.refs.docEditor.getEditor() : null;
+  },
 
+  checkDocIsValid: function () {
+    if (this.getEditor().hasErrors()) {
+      return false;
+    }
+    var json = JSON.parse(this.getEditor().getValue());
+    this.state.doc.clear().set(json, { validate: true });
+
+    return !this.state.doc.validationError;
+  },
+
+  clearChanges: function () {
+    this.refs.docEditor.clearChanges();
+  },
+
+  getExtensionIcons: function () {
+    var extensions = FauxtonAPI.getExtensions('DocEditor:icons');
+    return _.map(extensions, function (Extension, i) {
+      return (<Extension doc={this.state.doc} key={i} database={this.props.database} />);
+    }, this);
+  },
+
+  getButtonRow: function () {
+    if (this.props.isNewDoc) {
+      return false;
+    }
+    return (
+      <div>
+        <AttachmentsPanelButton doc={this.state.doc} isLoading={this.state.isLoading} />
+        <div className="doc-editor-extension-icons">{this.getExtensionIcons()}</div>
+
+        {this.state.conflictCount ? <PanelButton
+          title={`Conflicts (${this.state.conflictCount})`}
+          iconClass="icon-columns"
+          className="conflicts"
+          onClick={() => { FauxtonAPI.navigate(FauxtonAPI.urls('revision-browser', 'app', this.props.database.safeID(), this.state.doc.id));}}/> : null}
+
+        <PanelButton className="upload" title="Upload Attachment" iconClass="icon-circle-arrow-up" onClick={Actions.showUploadModal} />
+        <PanelButton title="Clone Document" iconClass="icon-repeat" onClick={Actions.showCloneDocModal} />
+        <PanelButton title="Delete" iconClass="icon-trash" onClick={Actions.showDeleteDocModal} />
+      </div>
+    );
+  },
+
+  render: function () {
+    var saveButtonLabel = (this.props.isNewDoc) ? 'Create Document' : 'Save Changes';
+
+    return (
+      <div>
+        <div id="doc-editor-actions-panel">
+          <div className="doc-actions-left">
+            <button className="save-doc btn btn-success save" type="button" onClick={this.saveDoc}>
+              <i className="icon fonticon-ok-circled"></i> {saveButtonLabel}
+            </button>
+            <div>
+              <a href={this.props.previousPage} className="js-back cancel-button">Cancel</a>
+            </div>
+          </div>
+          <div className="alignRight">
+            {this.getButtonRow()}
           </div>
+        </div>
+
+        <div className="code-region">
+          <div className="bgEditorGutter"></div>
+          <div id="editor-container" className="doc-code">{this.getCodeEditor()}</div>
 
-          <UploadModal
-            ref="uploadModal"
-            visible={this.state.uploadModalVisible}
-            doc={this.state.doc} />
-          <CloneDocModal
-            visible={this.state.cloneDocModalVisible}
-            onSubmit={this.clearChanges} />
-          <FauxtonComponents.ConfirmationModal
-            title="Confirm Deletion"
-            visible={this.state.deleteDocModalVisible}
-            text="Are you sure you want to delete this document?"
-            onClose={this.hideDeleteDocModal}
-            onSubmit={this.deleteDoc}
-            successButtonLabel="Delete Document" />
         </div>
-      );
-    }
-  });
-
-  var AttachmentsPanelButton = React.createClass({
-
-    propTypes: {
-      isLoading: React.PropTypes.bool.isRequired,
-      doc: React.PropTypes.object
-    },
-
-    getDefaultProps: function () {
-      return {
-        isLoading: true,
-        doc: {}
-      };
-    },
-
-    getAttachmentList: function () {
-      var db = this.props.doc.database.get('id');
-      var doc = this.props.doc.get('_id');
-
-      return _.map(this.props.doc.get('_attachments'), function (item, filename) {
-        var url = FauxtonAPI.urls('document', 'attachment', db, doc, app.utils.safeURLName(filename));
-        return (
-          <li key={filename}>
-            <a href={url} target="_blank" data-bypass="true"> <strong>{filename}</strong>
-              <span className="attachment-delimiter">-</span>
-              <span>{item.content_type}, {Helpers.formatSize(item.length)}</span>
-            </a>
-          </li>
-        );
-      });
-    },
-
-    render: function () {
-      if (this.props.isLoading || !this.props.doc.get('_attachments')) {
-        return false;
-      }
 
+        <UploadModal
+          ref="uploadModal"
+          visible={this.state.uploadModalVisible}
+          doc={this.state.doc} />
+        <CloneDocModal
+          visible={this.state.cloneDocModalVisible}
+          onSubmit={this.clearChanges} />
+        <FauxtonComponents.ConfirmationModal
+          title="Confirm Deletion"
+          visible={this.state.deleteDocModalVisible}
+          text="Are you sure you want to delete this document?"
+          onClose={this.hideDeleteDocModal}
+          onSubmit={this.deleteDoc}
+          successButtonLabel="Delete Document" />
+      </div>
+    );
+  }
+});
+
+var AttachmentsPanelButton = React.createClass({
+
+  propTypes: {
+    isLoading: React.PropTypes.bool.isRequired,
+    doc: React.PropTypes.object
+  },
+
+  getDefaultProps: function () {
+    return {
+      isLoading: true,
+      doc: {}
+    };
+  },
+
+  getAttachmentList: function () {
+    var db = this.props.doc.database.get('id');
+    var doc = this.props.doc.get('_id');
+
+    return _.map(this.props.doc.get('_attachments'), function (item, filename) {
+      var url = FauxtonAPI.urls('document', 'attachment', db, doc, app.utils.safeURLName(filename));
       return (
-        <div className="panel-section view-attachments-section btn-group">
-          <button className="panel-button dropdown-toggle btn" data-bypass="true" data-toggle="dropdown" title="View Attachments"
-            id="view-attachments-menu">
-            <i className="icon icon-paper-clip"></i>
-            <span className="button-text">View Attachments</span>
-            <span className="caret"></span>
-          </button>
-          <ul className="dropdown-menu" role="menu" aria-labelledby="view-attachments-menu">
-            {this.getAttachmentList()}
-          </ul>
-        </div>
+        <li key={filename}>
+          <a href={url} target="_blank" data-bypass="true"> <strong>{filename}</strong>
+            <span className="attachment-delimiter">-</span>
+            <span>{item.content_type}, {Helpers.formatSize(item.length)}</span>
+          </a>
+        </li>
       );
+    });
+  },
+
+  render: function () {
+    if (this.props.isLoading || !this.props.doc.get('_attachments')) {
+      return false;
     }
-  });
-
-
-  var PanelButton = React.createClass({
-    propTypes: {
-      title: React.PropTypes.string.isRequired,
-      onClick: React.PropTypes.func.isRequired,
-      className: React.PropTypes.string
-    },
-
-    getDefaultProps: function () {
-      return {
-        title: '',
-        iconClass: '',
-        onClick: function () { },
-        className: ''
-      };
-    },
-
-    render: function () {
-      var iconClasses = 'icon ' + this.props.iconClass;
-      return (
-        <div className="panel-section">
-          <button className={`panel-button ${this.props.className}`} title={this.props.title} onClick={this.props.onClick}>
-            <i className={iconClasses}></i>
-            <span>{this.props.title}</span>
-          </button>
-        </div>
-      );
+
+    return (
+      <div className="panel-section view-attachments-section btn-group">
+        <button className="panel-button dropdown-toggle btn" data-bypass="true" data-toggle="dropdown" title="View Attachments"
+          id="view-attachments-menu">
+          <i className="icon icon-paper-clip"></i>
+          <span className="button-text">View Attachments</span>
+          <span className="caret"></span>
+        </button>
+        <ul className="dropdown-menu" role="menu" aria-labelledby="view-attachments-menu">
+          {this.getAttachmentList()}
+        </ul>
+      </div>
+    );
+  }
+});
+
+
+var PanelButton = React.createClass({
+  propTypes: {
+    title: React.PropTypes.string.isRequired,
+    onClick: React.PropTypes.func.isRequired,
+    className: React.PropTypes.string
+  },
+
+  getDefaultProps: function () {
+    return {
+      title: '',
+      iconClass: '',
+      onClick: function () { },
+      className: ''
+    };
+  },
+
+  render: function () {
+    var iconClasses = 'icon ' + this.props.iconClass;
+    return (
+      <div className="panel-section">
+        <button className={`panel-button ${this.props.className}`} title={this.props.title} onClick={this.props.onClick}>
+          <i className={iconClasses}></i>
+          <span>{this.props.title}</span>
+        </button>
+      </div>
+    );
+  }
+});
+
+
+var UploadModal = React.createClass({
+  propTypes: {
+    visible: React.PropTypes.bool.isRequired,
+    doc: React.PropTypes.object
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  getStoreState: function () {
+    return {
+      inProgress: store.isUploadInProgress(),
+      loadPercentage: store.getUploadLoadPercentage(),
+      errorMessage: store.getFileUploadErrorMsg()
+    };
+  },
+
+  closeModal: function (e) {
+    if (e) {
+      e.preventDefault();
     }
-  });
-
-
-  var UploadModal = React.createClass({
-    propTypes: {
-      visible: React.PropTypes.bool.isRequired,
-      doc: React.PropTypes.object
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    getStoreState: function () {
-      return {
-        inProgress: store.isUploadInProgress(),
-        loadPercentage: store.getUploadLoadPercentage(),
-        errorMessage: store.getFileUploadErrorMsg()
-      };
-    },
-
-    closeModal: function (e) {
-      if (e) {
-        e.preventDefault();
-      }
-
-      if (this.state.inProgress) {
-        Actions.cancelUpload();
-      }
-      Actions.hideUploadModal();
-      Actions.resetUploadModal();
-    },
-
-    upload: function () {
-      Actions.uploadAttachment({
-        doc: this.props.doc,
-        rev: this.props.doc.get('_rev'),
-        files: $(ReactDOM.findDOMNode(this.refs.attachments))[0].files
-      });
-    },
-
-    render: function () {
-      var errorClasses = 'alert alert-error';
-      if (this.state.errorMessage === '') {
-        errorClasses += ' hide';
-      }
-      var loadIndicatorClasses = 'progress progress-info';
-      if (!this.state.inProgress) {
-        loadIndicatorClasses += ' hide';
-      }
 
-      return (
-        <Modal dialogClassName="upload-file-modal" show={this.props.visible} onHide={this.closeModal}>
-          <Modal.Header closeButton={true}>
-            <Modal.Title>Upload Attachment</Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-            <div className={errorClasses}>{this.state.errorMessage}</div>
-            <div>
-              <form ref="uploadForm" className="form" method="post">
-                <p>
-                  Please select the file you want to upload as an attachment to this document. This creates a new
-                  revision of the document, so it's not necessary to save after uploading.
-                </p>
-                <input ref="attachments" type="file" name="_attachments" />
-                <br />
-              </form>
-
-              <div className={loadIndicatorClasses}>
-                <div className="bar" style={{ width: this.state.loadPercentage + '%'}}></div>
-              </div>
-            </div>
-          </Modal.Body>
-          <Modal.Footer>
-            <a href="#" data-bypass="true" className="cancel-link" onClick={this.closeModal}>Cancel</a>
-            <button href="#" id="upload-btn" data-bypass="true" className="btn btn-success save" onClick={this.upload}>
-              Upload Attachment
-            </button>
-          </Modal.Footer>
-        </Modal>
-      );
+    if (this.state.inProgress) {
+      Actions.cancelUpload();
+    }
+    Actions.hideUploadModal();
+    Actions.resetUploadModal();
+  },
+
+  upload: function () {
+    Actions.uploadAttachment({
+      doc: this.props.doc,
+      rev: this.props.doc.get('_rev'),
+      files: $(ReactDOM.findDOMNode(this.refs.attachments))[0].files
+    });
+  },
+
+  render: function () {
+    var errorClasses = 'alert alert-error';
+    if (this.state.errorMessage === '') {
+      errorClasses += ' hide';
+    }
+    var loadIndicatorClasses = 'progress progress-info';
+    if (!this.state.inProgress) {
+      loadIndicatorClasses += ' hide';
     }
-  });
-
-
-  var CloneDocModal = React.createClass({
-    propTypes: {
-      visible: React.PropTypes.bool.isRequired
-    },
-
-    getInitialState: function () {
-      return {
-        uuid: null
-      };
-    },
-
-    cloneDoc: function () {
-      if (this.props.onSubmit) {
-        this.props.onSubmit();
-      }
-      Actions.cloneDoc(this.state.uuid);
-    },
-
-    componentDidUpdate: function () {
-      if (this.state.uuid === null) {
-        var uuid = new FauxtonAPI.UUID();
-        uuid.fetch().then(function () {
-          this.setState({ uuid: uuid.next() });
-        }.bind(this));
-      }
-    },
-
-    closeModal: function (e) {
-      if (e) {
-        e.preventDefault();
-      }
-      Actions.hideCloneDocModal();
-    },
-
-    docIDChange: function (e) {
-      this.setState({ uuid: e.target.value });
-    },
-
-    render: function () {
-      if (this.state.uuid === null) {
-        return false;
-      }
 
-      return (
-        <Modal dialogClassName="clone-doc-modal" show={this.props.visible} onHide={this.closeModal}>
-          <Modal.Header closeButton={true}>
-            <Modal.Title>Clone Document</Modal.Title>
-          </Modal.Header>
-          <Modal.Body>
-            <form className="form" method="post">
+    return (
+      <Modal dialogClassName="upload-file-modal" show={this.props.visible} onHide={this.closeModal}>
+        <Modal.Header closeButton={true}>
+          <Modal.Title>Upload Attachment</Modal.Title>
+        </Modal.Header>
+        <Modal.Body>
+          <div className={errorClasses}>{this.state.errorMessage}</div>
+          <div>
+            <form ref="uploadForm" className="form" method="post">
               <p>
-                Set new document's ID:
+                Please select the file you want to upload as an attachment to this document. This creates a new
+                revision of the document, so it's not necessary to save after uploading.
               </p>
-              <input ref="newDocId" type="text" autoFocus={true} className="input-block-level"
-                onChange={this.docIDChange} value={this.state.uuid} />
+              <input ref="attachments" type="file" name="_attachments" />
+              <br />
             </form>
-          </Modal.Body>
-          <Modal.Footer>
-            <a href="#" data-bypass="true" className="cancel-link" onClick={this.closeModal}>Cancel</a>
-            <button className="btn btn-success save" onClick={this.cloneDoc}>
-              <i className="fonticon-ok-circled"></i> Clone Document
-            </button>
-          </Modal.Footer>
-        </Modal>
-      );
+
+            <div className={loadIndicatorClasses}>
+              <div className="bar" style={{ width: this.state.loadPercentage + '%'}}></div>
+            </div>
+          </div>
+        </Modal.Body>
+        <Modal.Footer>
+          <a href="#" data-bypass="true" className="cancel-link" onClick={this.closeModal}>Cancel</a>
+          <button href="#" id="upload-btn" data-bypass="true" className="btn btn-success save" onClick={this.upload}>
+            Upload Attachment
+          </button>
+        </Modal.Footer>
+      </Modal>
+    );
+  }
+});
+
+
+var CloneDocModal = React.createClass({
+  propTypes: {
+    visible: React.PropTypes.bool.isRequired
+  },
+
+  getInitialState: function () {
+    return {
+      uuid: null
+    };
+  },
+
+  cloneDoc: function () {
+    if (this.props.onSubmit) {
+      this.props.onSubmit();
+    }
+    Actions.cloneDoc(this.state.uuid);
+  },
+
+  componentDidUpdate: function () {
+    if (this.state.uuid === null) {
+      var uuid = new FauxtonAPI.UUID();
+      uuid.fetch().then(function () {
+        this.setState({ uuid: uuid.next() });
+      }.bind(this));
     }
-  });
+  },
 
+  closeModal: function (e) {
+    if (e) {
+      e.preventDefault();
+    }
+    Actions.hideCloneDocModal();
+  },
 
-  return {
-    DocEditorController: DocEditorController,
-    AttachmentsPanelButton: AttachmentsPanelButton,
-    UploadModal: UploadModal,
-    CloneDocModal: CloneDocModal
-  };
+  docIDChange: function (e) {
+    this.setState({ uuid: e.target.value });
+  },
 
+  render: function () {
+    if (this.state.uuid === null) {
+      return false;
+    }
+
+    return (
+      <Modal dialogClassName="clone-doc-modal" show={this.props.visible} onHide={this.closeModal}>
+        <Modal.Header closeButton={true}>
+          <Modal.Title>Clone Document</Modal.Title>
+        </Modal.Header>
+        <Modal.Body>
+          <form className="form" method="post">
+            <p>
+              Set new document's ID:
+            </p>
+            <input ref="newDocId" type="text" autoFocus={true} className="input-block-level"
+              onChange={this.docIDChange} value={this.state.uuid} />
+          </form>
+        </Modal.Body>
+        <Modal.Footer>
+          <a href="#" data-bypass="true" className="cancel-link" onClick={this.closeModal}>Cancel</a>
+          <button className="btn btn-success save" onClick={this.cloneDoc}>
+            <i className="fonticon-ok-circled"></i> Clone Document
+          </button>
+        </Modal.Footer>
+      </Modal>
+    );
+  }
 });
+
+
+export default {
+  DocEditorController: DocEditorController,
+  AttachmentsPanelButton: AttachmentsPanelButton,
+  UploadModal: UploadModal,
+  CloneDocModal: CloneDocModal
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/doc-editor/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/stores.js b/app/addons/documents/doc-editor/stores.js
index 2635ce5..a553de3 100644
--- a/app/addons/documents/doc-editor/stores.js
+++ b/app/addons/documents/doc-editor/stores.js
@@ -10,201 +10,196 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  './actiontypes'
-],
-
-function (FauxtonAPI, ActionTypes) {
-  var Stores = {};
-
-  Stores.DocEditorStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._doc = null;
-      this._isLoading = true;
-      this._cloneDocModalVisible = false;
-      this._deleteDocModalVisible = false;
-      this._uploadModalVisible = false;
-
-      // file upload-related fields
-      this._numFilesUploaded = 0;
-      this._fileUploadErrorMsg = '';
-      this._uploadInProgress = false;
-      this._fileUploadLoadPercentage = 0;
-
-      this._docConflictCount = null;
-    },
-
-    isLoading: function () {
-      return this._isLoading;
-    },
-
-    getDocConflictCount: function () {
-      return this._docConflictCount;
-    },
-
-    docLoaded: function (options) {
-      this._isLoading = false;
-      this._docConflictCount = options.doc.get('_conflicts') ? options.doc.get('_conflicts').length : 0;
-      options.doc.unset('_conflicts');
-      this._doc = options.doc;
-    },
-
-    getDoc: function () {
-      return this._doc;
-    },
-
-    isCloneDocModalVisible: function () {
-      return this._cloneDocModalVisible;
-    },
-
-    showCloneDocModal: function () {
-      this._cloneDocModalVisible = true;
-    },
-
-    hideCloneDocModal: function () {
-      this._cloneDocModalVisible = false;
-    },
-
-    isDeleteDocModalVisible: function () {
-      return this._deleteDocModalVisible;
-    },
-
-    showDeleteDocModal: function () {
-      this._deleteDocModalVisible = true;
-    },
-
-    hideDeleteDocModal: function () {
-      this._deleteDocModalVisible = false;
-    },
-
-    isUploadModalVisible: function () {
-      return this._uploadModalVisible;
-    },
-
-    showUploadModal: function () {
-      this._uploadModalVisible = true;
-    },
-
-    hideUploadModal: function () {
-      this._uploadModalVisible = false;
-    },
-
-    getNumFilesUploaded: function () {
-      return this._numFilesUploaded;
-    },
-
-    getFileUploadErrorMsg: function () {
-      return this._fileUploadErrorMsg;
-    },
-
-    setFileUploadErrorMsg: function (error) {
-      this._uploadInProgress = false;
-      this._fileUploadLoadPercentage = 0;
-      this._fileUploadErrorMsg = error;
-    },
-
-    isUploadInProgress: function () {
-      return this._uploadInProgress;
-    },
-
-    getUploadLoadPercentage: function () {
-      return this._fileUploadLoadPercentage;
-    },
-
-    resetUploadModal: function () {
-      this._uploadInProgress = false;
-      this._fileUploadLoadPercentage = 0;
-      this._fileUploadErrorMsg = '';
-    },
-
-    startFileUpload: function () {
-      this._uploadInProgress = true;
-      this._fileUploadLoadPercentage = 0;
-      this._fileUploadErrorMsg = '';
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.RESET_DOC:
-          this.reset();
-        break;
-
-        case ActionTypes.DOC_LOADED:
-          this.docLoaded(action.options);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.SHOW_CLONE_DOC_MODAL:
-          this.showCloneDocModal();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.HIDE_CLONE_DOC_MODAL:
-          this.hideCloneDocModal();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.SHOW_DELETE_DOC_CONFIRMATION_MODAL:
-          this.showDeleteDocModal();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.HIDE_DELETE_DOC_CONFIRMATION_MODAL:
-          this.hideDeleteDocModal();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.SHOW_UPLOAD_MODAL:
-          this.showUploadModal();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.HIDE_UPLOAD_MODAL:
-          this.hideUploadModal();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.FILE_UPLOAD_SUCCESS:
-          this._numFilesUploaded++;
-          this.triggerChange();
-        break;
-
-        case ActionTypes.FILE_UPLOAD_ERROR:
-          this.setFileUploadErrorMsg(action.options.error);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.RESET_UPLOAD_MODAL:
-          this.resetUploadModal();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.START_FILE_UPLOAD:
-          this.startFileUpload();
-          this.triggerChange();
-        break;
-
-        case ActionTypes.SET_FILE_UPLOAD_PERCENTAGE:
-          this._fileUploadLoadPercentage = action.options.percent;
-          this.triggerChange();
-        break;
-
-
-        default:
-        return;
-        // do nothing
-      }
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+var Stores = {};
+
+Stores.DocEditorStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._doc = null;
+    this._isLoading = true;
+    this._cloneDocModalVisible = false;
+    this._deleteDocModalVisible = false;
+    this._uploadModalVisible = false;
+
+    // file upload-related fields
+    this._numFilesUploaded = 0;
+    this._fileUploadErrorMsg = '';
+    this._uploadInProgress = false;
+    this._fileUploadLoadPercentage = 0;
+
+    this._docConflictCount = null;
+  },
+
+  isLoading: function () {
+    return this._isLoading;
+  },
+
+  getDocConflictCount: function () {
+    return this._docConflictCount;
+  },
+
+  docLoaded: function (options) {
+    this._isLoading = false;
+    this._docConflictCount = options.doc.get('_conflicts') ? options.doc.get('_conflicts').length : 0;
+    options.doc.unset('_conflicts');
+    this._doc = options.doc;
+  },
+
+  getDoc: function () {
+    return this._doc;
+  },
+
+  isCloneDocModalVisible: function () {
+    return this._cloneDocModalVisible;
+  },
+
+  showCloneDocModal: function () {
+    this._cloneDocModalVisible = true;
+  },
+
+  hideCloneDocModal: function () {
+    this._cloneDocModalVisible = false;
+  },
+
+  isDeleteDocModalVisible: function () {
+    return this._deleteDocModalVisible;
+  },
+
+  showDeleteDocModal: function () {
+    this._deleteDocModalVisible = true;
+  },
+
+  hideDeleteDocModal: function () {
+    this._deleteDocModalVisible = false;
+  },
+
+  isUploadModalVisible: function () {
+    return this._uploadModalVisible;
+  },
+
+  showUploadModal: function () {
+    this._uploadModalVisible = true;
+  },
+
+  hideUploadModal: function () {
+    this._uploadModalVisible = false;
+  },
+
+  getNumFilesUploaded: function () {
+    return this._numFilesUploaded;
+  },
+
+  getFileUploadErrorMsg: function () {
+    return this._fileUploadErrorMsg;
+  },
+
+  setFileUploadErrorMsg: function (error) {
+    this._uploadInProgress = false;
+    this._fileUploadLoadPercentage = 0;
+    this._fileUploadErrorMsg = error;
+  },
+
+  isUploadInProgress: function () {
+    return this._uploadInProgress;
+  },
+
+  getUploadLoadPercentage: function () {
+    return this._fileUploadLoadPercentage;
+  },
+
+  resetUploadModal: function () {
+    this._uploadInProgress = false;
+    this._fileUploadLoadPercentage = 0;
+    this._fileUploadErrorMsg = '';
+  },
+
+  startFileUpload: function () {
+    this._uploadInProgress = true;
+    this._fileUploadLoadPercentage = 0;
+    this._fileUploadErrorMsg = '';
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.RESET_DOC:
+        this.reset();
+      break;
+
+      case ActionTypes.DOC_LOADED:
+        this.docLoaded(action.options);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.SHOW_CLONE_DOC_MODAL:
+        this.showCloneDocModal();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.HIDE_CLONE_DOC_MODAL:
+        this.hideCloneDocModal();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.SHOW_DELETE_DOC_CONFIRMATION_MODAL:
+        this.showDeleteDocModal();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.HIDE_DELETE_DOC_CONFIRMATION_MODAL:
+        this.hideDeleteDocModal();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.SHOW_UPLOAD_MODAL:
+        this.showUploadModal();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.HIDE_UPLOAD_MODAL:
+        this.hideUploadModal();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.FILE_UPLOAD_SUCCESS:
+        this._numFilesUploaded++;
+        this.triggerChange();
+      break;
+
+      case ActionTypes.FILE_UPLOAD_ERROR:
+        this.setFileUploadErrorMsg(action.options.error);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.RESET_UPLOAD_MODAL:
+        this.resetUploadModal();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.START_FILE_UPLOAD:
+        this.startFileUpload();
+        this.triggerChange();
+      break;
+
+      case ActionTypes.SET_FILE_UPLOAD_PERCENTAGE:
+        this._fileUploadLoadPercentage = action.options.percent;
+        this.triggerChange();
+      break;
+
+
+      default:
+      return;
+      // do nothing
     }
+  }
 
-  });
+});
 
-  Stores.docEditorStore = new Stores.DocEditorStore();
-  Stores.docEditorStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.docEditorStore.dispatch);
+Stores.docEditorStore = new Stores.DocEditorStore();
+Stores.docEditorStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.docEditorStore.dispatch);
 
-  return Stores;
-});
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx b/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
index 8dfd2ec..2a9b374 100644
--- a/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
+++ b/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
@@ -10,233 +10,227 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../app',
-  '../../../../core/api',
-  'react',
-  'react-dom',
-  '../../resources',
-  '../components.react',
-  '../stores',
-  '../actions',
-  '../actiontypes',
-  '../../../databases/base',
-  '../../../../../test/mocha/testUtils',
-  'react-bootstrap',
-  'react-addons-test-utils',
-  'sinon'
-], function (app, FauxtonAPI, React, ReactDOM, Documents, Components, Stores, Actions, ActionTypes, Databases, utils,
-  ReactBoostrap, TestUtils, sinon) {
-
-  var assert = utils.assert;
-  var docJSON = {
-    _id: '_design/test-doc',
-    views: {
-      'test-view': {
-        map: 'function () {};'
-      }
+import app from "../../../../app";
+import FauxtonAPI from "../../../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Documents from "../../resources";
+import Components from "../components.react";
+import Stores from "../stores";
+import Actions from "../actions";
+import ActionTypes from "../actiontypes";
+import Databases from "../../../databases/base";
+import utils from "../../../../../test/mocha/testUtils";
+import TestUtils from "react-addons-test-utils";
+import sinon from "sinon";
+
+var assert = utils.assert;
+var docJSON = {
+  _id: '_design/test-doc',
+  views: {
+    'test-view': {
+      map: 'function () {};'
     }
-  };
-
-  var docWithAttachmentsJSON = {
-    _id: '_design/test-doc',
-    _rev: '12345',
-    blah: {
-      whatever: {
-        something: 1
-      }
+  }
+};
+
+var docWithAttachmentsJSON = {
+  _id: '_design/test-doc',
+  _rev: '12345',
+  blah: {
+    whatever: {
+      something: 1
+    }
+  },
+  _attachments: {
+    "one.png": {
+      "content-type": "images/png",
+      "length": 100
     },
-    _attachments: {
-      "one.png": {
-        "content-type": "images/png",
-        "length": 100
-      },
-      "one.zip": {
-        "content-type": "application/zip",
-        "length": 111100
-      }
+    "one.zip": {
+      "content-type": "application/zip",
+      "length": 111100
     }
-  };
+  }
+};
 
-  var database = new Databases.Model({ id: 'id' });
+var database = new Databases.Model({ id: 'id' });
 
 
-  describe('DocEditorController', function () {
-    var container;
+describe('DocEditorController', function () {
+  var container;
 
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('loading indicator appears on load', function () {
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController />, container);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.loading-lines').length, 1);
-    });
+  it('loading indicator appears on load', function () {
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController />, container);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.loading-lines').length, 1);
+  });
+
+  it('new docs do not show the button row', function () {
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController isNewDoc={true} database={database} />, container);
 
-    it('new docs do not show the button row', function () {
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController isNewDoc={true} database={database} />, container);
-
-      var doc = new Documents.Doc(docJSON, { database: database });
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
-
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.loading-lines').length, 0);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.icon-circle-arrow-up').length, 0);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.icon-repeat').length, 0);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.icon-trash').length, 0);
+    var doc = new Documents.Doc(docJSON, { database: database });
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
+      }
     });
 
-    it('view attachments button does not appear with no attachments', function () {
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
-
-      var doc = new Documents.Doc(docJSON, { database: database });
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.view-attachments-section').length, 0);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.loading-lines').length, 0);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.icon-circle-arrow-up').length, 0);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.icon-repeat').length, 0);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.icon-trash').length, 0);
+  });
+
+  it('view attachments button does not appear with no attachments', function () {
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
+
+    var doc = new Documents.Doc(docJSON, { database: database });
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
+      }
     });
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.view-attachments-section').length, 0);
+  });
 
-    it('view attachments button shows up when the doc has attachments', function () {
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
-
-      var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.view-attachments-section').length, 1);
+  it('view attachments button shows up when the doc has attachments', function () {
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
+
+    var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
+      }
     });
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.view-attachments-section').length, 1);
+  });
 
-    it('view attachments dropdown contains right number of docs', function () {
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
-
-      var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.view-attachments-section .dropdown-menu li').length, 2);
+  it('view attachments dropdown contains right number of docs', function () {
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
+
+    var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
+      }
     });
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.view-attachments-section .dropdown-menu li').length, 2);
+  });
 
-    //issues with this test running with all other tests. It passes on its own
-    it('view attachments dropdown contains correct urls', function () {
-      var el = TestUtils.renderIntoDocument(
-        <Components.DocEditorController database={database} />, container
-      );
+  //issues with this test running with all other tests. It passes on its own
+  it('view attachments dropdown contains correct urls', function () {
+    var el = TestUtils.renderIntoDocument(
+      <Components.DocEditorController database={database} />, container
+    );
+
+    var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
+      }
+    });
 
-      var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
+    var $attachmentNode = $(ReactDOM.findDOMNode(el)).find('.view-attachments-section .dropdown-menu li');
+    var attachmentURLactual = $attachmentNode.find('a').attr('href');
 
-      var $attachmentNode = $(ReactDOM.findDOMNode(el)).find('.view-attachments-section .dropdown-menu li');
-      var attachmentURLactual = $attachmentNode.find('a').attr('href');
+    assert.equal(attachmentURLactual, '../../id/_design/test-doc/one.png');
+  });
 
-      assert.equal(attachmentURLactual, '../../id/_design/test-doc/one.png');
+  it('setting deleteDocModal=true in store shows modal', function () {
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
+    var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
+      }
     });
 
-    it('setting deleteDocModal=true in store shows modal', function () {
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
-      var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
+    // uber-kludgy, but the delete doc modal is a generic dialog used multiple times, so this test first checks
+    // no modal is open, then confirms the open modal contains the delete dialog message
+    assert.equal($('body').find('.confirmation-modal').length, 0);
 
-      // uber-kludgy, but the delete doc modal is a generic dialog used multiple times, so this test first checks
-      // no modal is open, then confirms the open modal contains the delete dialog message
-      assert.equal($('body').find('.confirmation-modal').length, 0);
+    Actions.showDeleteDocModal();
 
-      Actions.showDeleteDocModal();
+    var modalContent = $('body').find('.confirmation-modal .modal-body p')[0];
+    assert.ok(/Are you sure you want to delete this document\?/.test(modalContent.innerHTML));
+  });
 
-      var modalContent = $('body').find('.confirmation-modal .modal-body p')[0];
-      assert.ok(/Are you sure you want to delete this document\?/.test(modalContent.innerHTML));
+  it('setting uploadDocModal=true in store shows modal', function () {
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
+    var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DOC_LOADED,
+      options: {
+        doc: doc
+      }
     });
 
-    it('setting uploadDocModal=true in store shows modal', function () {
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
-      var doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DOC_LOADED,
-        options: {
-          doc: doc
-        }
-      });
-
-      assert.equal($('body').find('.upload-file-modal').length, 0);
-      Actions.showUploadModal();
-      assert.notEqual($('body').find('.upload-file-modal').length, 0);
-    });
+    assert.equal($('body').find('.upload-file-modal').length, 0);
+    Actions.showUploadModal();
+    assert.notEqual($('body').find('.upload-file-modal').length, 0);
   });
+});
 
 
-  describe("AttachmentsPanelButton", function () {
-    var container, doc;
+describe("AttachmentsPanelButton", function () {
+  var container, doc;
 
-    beforeEach(function () {
-      doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
-      container = document.createElement('div');
-    });
+  beforeEach(function () {
+    doc = new Documents.Doc(docWithAttachmentsJSON, { database: database });
+    container = document.createElement('div');
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('does not show up when loading', function () {
-      var el = TestUtils.renderIntoDocument(<Components.AttachmentsPanelButton isLoading={true} doc={doc} />, container);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.panel-button').length, 0);
-    });
+  it('does not show up when loading', function () {
+    var el = TestUtils.renderIntoDocument(<Components.AttachmentsPanelButton isLoading={true} doc={doc} />, container);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.panel-button').length, 0);
+  });
 
-    it('shows up after loading', function () {
-      var el = TestUtils.renderIntoDocument(<Components.AttachmentsPanelButton isLoading={false} doc={doc} />, container);
-      assert.equal($(ReactDOM.findDOMNode(el)).find('.panel-button').length, 1);
-    });
+  it('shows up after loading', function () {
+    var el = TestUtils.renderIntoDocument(<Components.AttachmentsPanelButton isLoading={false} doc={doc} />, container);
+    assert.equal($(ReactDOM.findDOMNode(el)).find('.panel-button').length, 1);
   });
+});
 
 
-  describe("Custom Extension Buttons", function () {
-    it('supports buttons', function () {
-      var CustomButton = React.createClass({
-        render: function () {
-          return (
-            <div>
-              <button>Oh no she di'n't!</button>
-              <span id="testDatabaseName">{this.props.database.id}</span>
-            </div>
-          );
-        }
-      });
-      FauxtonAPI.registerExtension('DocEditor:icons', CustomButton);
-
-      var container = document.createElement('div');
-      var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
-      assert.isTrue(/Oh\sno\sshe\sdi'n't!/.test(ReactDOM.findDOMNode(el).outerHTML));
-
-      // confirm the database name was also included
-      assert.equal($(ReactDOM.findDOMNode(el)).find("#testDatabaseName").html(), database.id);
-
-      ReactDOM.unmountComponentAtNode(container);
+describe("Custom Extension Buttons", function () {
+  it('supports buttons', function () {
+    var CustomButton = React.createClass({
+      render: function () {
+        return (
+          <div>
+            <button>Oh no she di'n't!</button>
+            <span id="testDatabaseName">{this.props.database.id}</span>
+          </div>
+        );
+      }
     });
-  });
+    FauxtonAPI.registerExtension('DocEditor:icons', CustomButton);
+
+    var container = document.createElement('div');
+    var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
+    assert.isTrue(/Oh\sno\sshe\sdi'n't!/.test(ReactDOM.findDOMNode(el).outerHTML));
 
+    // confirm the database name was also included
+    assert.equal($(ReactDOM.findDOMNode(el)).find("#testDatabaseName").html(), database.id);
+
+    ReactDOM.unmountComponentAtNode(container);
+  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/doc-editor/tests/doc-editor.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/tests/doc-editor.storesSpec.js b/app/addons/documents/doc-editor/tests/doc-editor.storesSpec.js
index 69b790c..fb5480b 100644
--- a/app/addons/documents/doc-editor/tests/doc-editor.storesSpec.js
+++ b/app/addons/documents/doc-editor/tests/doc-editor.storesSpec.js
@@ -10,75 +10,70 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../app',
-  '../../../../core/api',
-  '../stores',
+import app from "../../../../app";
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../stores";
+import Documents from "../../resources";
+import utils from "../../../../../test/mocha/testUtils";
+FauxtonAPI.router = new FauxtonAPI.Router([]);
 
-  '../../resources',
-  '../../../../../test/mocha/testUtils',
-], function (app, FauxtonAPI, Stores, Documents, utils) {
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
+const assert = utils.assert;
+const store = Stores.docEditorStore;
 
-  const assert = utils.assert;
-  const store = Stores.docEditorStore;
+const doc = new Documents.Doc({id: 'foo'}, {database: 'bar'});
 
-  const doc = new Documents.Doc({id: 'foo'}, {database: 'bar'});
-
-  describe('DocEditorStore', function () {
-    afterEach(function () {
-      store.reset();
-    });
-
-    it('defines sensible defaults', function () {
-      assert.equal(store.isLoading(), true);
-      assert.equal(store.isCloneDocModalVisible(), false);
-      assert.equal(store.isDeleteDocModalVisible(), false);
-      assert.equal(store.isUploadModalVisible(), false);
-      assert.equal(store.getNumFilesUploaded(), 0);
-      assert.equal(store.isUploadInProgress(), false);
-      assert.equal(store.getUploadLoadPercentage(), 0);
-    });
+describe('DocEditorStore', function () {
+  afterEach(function () {
+    store.reset();
+  });
 
-    it('docLoaded() marks loading as complete', function () {
-      store.docLoaded({ doc: doc });
-      assert.equal(store.isLoading(), false);
-    });
+  it('defines sensible defaults', function () {
+    assert.equal(store.isLoading(), true);
+    assert.equal(store.isCloneDocModalVisible(), false);
+    assert.equal(store.isDeleteDocModalVisible(), false);
+    assert.equal(store.isUploadModalVisible(), false);
+    assert.equal(store.getNumFilesUploaded(), 0);
+    assert.equal(store.isUploadInProgress(), false);
+    assert.equal(store.getUploadLoadPercentage(), 0);
+  });
 
-    it('showCloneDocModal / hideCloneDocModal', function () {
-      store.showCloneDocModal();
-      assert.equal(store.isCloneDocModalVisible(), true);
-      store.hideCloneDocModal();
-      assert.equal(store.isCloneDocModalVisible(), false);
-    });
+  it('docLoaded() marks loading as complete', function () {
+    store.docLoaded({ doc: doc });
+    assert.equal(store.isLoading(), false);
+  });
 
-    it('showDeleteDocModal / hideCloneDocModal', function () {
-      store.showDeleteDocModal();
-      assert.equal(store.isDeleteDocModalVisible(), true);
-      store.hideDeleteDocModal();
-      assert.equal(store.isDeleteDocModalVisible(), false);
-    });
+  it('showCloneDocModal / hideCloneDocModal', function () {
+    store.showCloneDocModal();
+    assert.equal(store.isCloneDocModalVisible(), true);
+    store.hideCloneDocModal();
+    assert.equal(store.isCloneDocModalVisible(), false);
+  });
 
-    it('showCloneDocModal / hideCloneDocModal', function () {
-      store.showUploadModal();
-      assert.equal(store.isUploadModalVisible(), true);
-      store.hideUploadModal();
-      assert.equal(store.isUploadModalVisible(), false);
-    });
+  it('showDeleteDocModal / hideCloneDocModal', function () {
+    store.showDeleteDocModal();
+    assert.equal(store.isDeleteDocModalVisible(), true);
+    store.hideDeleteDocModal();
+    assert.equal(store.isDeleteDocModalVisible(), false);
+  });
 
-    it('reset() resets all values', function () {
-      store.docLoaded({ doc: doc });
-      store.showCloneDocModal();
-      store.showDeleteDocModal();
-      store.showUploadModal();
+  it('showCloneDocModal / hideCloneDocModal', function () {
+    store.showUploadModal();
+    assert.equal(store.isUploadModalVisible(), true);
+    store.hideUploadModal();
+    assert.equal(store.isUploadModalVisible(), false);
+  });
 
-      store.reset();
-      assert.equal(store.isLoading(), true);
-      assert.equal(store.isCloneDocModalVisible(), false);
-      assert.equal(store.isDeleteDocModalVisible(), false);
-      assert.equal(store.isUploadModalVisible(), false);
-    });
+  it('reset() resets all values', function () {
+    store.docLoaded({ doc: doc });
+    store.showCloneDocModal();
+    store.showDeleteDocModal();
+    store.showUploadModal();
 
+    store.reset();
+    assert.equal(store.isLoading(), true);
+    assert.equal(store.isCloneDocModalVisible(), false);
+    assert.equal(store.isDeleteDocModalVisible(), false);
+    assert.equal(store.isUploadModalVisible(), false);
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/header/header.actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/header/header.actions.js b/app/addons/documents/header/header.actions.js
index 282d20b..3dc26b3 100644
--- a/app/addons/documents/header/header.actions.js
+++ b/app/addons/documents/header/header.actions.js
@@ -10,41 +10,36 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './header.actiontypes',
-  '../queryoptions/actions',
-
-],
-function (app, FauxtonAPI, ActionTypes, ActionsQueryOptions) {
-
-  return {
-
-    toggleIncludeDocs: function (state, bulkDocsCollection) {
-      var params = app.getParams();
-
-      if (state) {
-        delete params.include_docs;
-        delete params.conflicts;
-      } else {
-        params.include_docs = true;
-        params.conflicts = true;
-      }
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./header.actiontypes";
+import ActionsQueryOptions from "../queryoptions/actions";
+
+export default {
+
+  toggleIncludeDocs: function (state, bulkDocsCollection) {
+    var params = app.getParams();
+
+    if (state) {
+      delete params.include_docs;
+      delete params.conflicts;
+    } else {
+      params.include_docs = true;
+      params.conflicts = true;
+    }
 
-      app.utils.localStorageSet('include_docs_bulkdocs', bulkDocsCollection.toJSON());
+    app.utils.localStorageSet('include_docs_bulkdocs', bulkDocsCollection.toJSON());
 
-      ActionsQueryOptions.runQuery(params);
-    },
+    ActionsQueryOptions.runQuery(params);
+  },
 
-    toggleTableView: function (state) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.TOGGLE_TABLEVIEW,
-        options: {
-          enable: state
-        }
-      });
-    }
+  toggleTableView: function (state) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.TOGGLE_TABLEVIEW,
+      options: {
+        enable: state
+      }
+    });
+  }
 
-  };
-});
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/header/header.actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/header/header.actiontypes.js b/app/addons/documents/header/header.actiontypes.js
index f4de5fc..b7fc6a6 100644
--- a/app/addons/documents/header/header.actiontypes.js
+++ b/app/addons/documents/header/header.actiontypes.js
@@ -10,8 +10,6 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], function () {
-  return {
-    TOGGLE_TABLEVIEW: 'TOGGLE_TABLEVIEW',
-  };
-});
+export default {
+  TOGGLE_TABLEVIEW: 'TOGGLE_TABLEVIEW',
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/header/header.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/header/header.react.jsx b/app/addons/documents/header/header.react.jsx
index abeed0b..165bc0d 100644
--- a/app/addons/documents/header/header.react.jsx
+++ b/app/addons/documents/header/header.react.jsx
@@ -10,105 +10,92 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  'react',
-  './header.actions',
-  '../../components/react-components.react',
-
-  '../index-results/stores',
-  '../index-results/actions',
-  'react-bootstrap',
-  '../queryoptions/stores',
-  'react-addons-css-transition-group'
-],
-
-function (app, FauxtonAPI, React, Actions, ReactComponents,
-  IndexResultsStore, IndexResultsActions, ReactBootstrap, QueryOptionsStore, ReactCSSTransitionGroup) {
-
-  var indexResultsStore = IndexResultsStore.indexResultsStore;
-  var queryOptionsStore = QueryOptionsStore.queryOptionsStore;
-
-
-  var ToggleHeaderButton = ReactComponents.ToggleHeaderButton;
-
-  var ButtonGroup = ReactBootstrap.ButtonGroup;
-  var Button = ReactBootstrap.Button;
-
-
-  var BulkDocumentHeaderController = React.createClass({
-    getStoreState: function () {
-      return {
-        selectedView: indexResultsStore.getCurrentViewType(),
-        isTableView: indexResultsStore.getIsTableView(),
-        includeDocs: queryOptionsStore.getIncludeDocsEnabled(),
-        bulkDocCollection: indexResultsStore.getBulkDocCollection()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      indexResultsStore.on('change', this.onChange, this);
-      queryOptionsStore.on('change', this.onChange, this);
-
-    },
-
-    componentWillUnmount: function () {
-      indexResultsStore.off('change', this.onChange);
-      queryOptionsStore.off('change', this.onChange);
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    render: function () {
-      var isTableViewSelected = this.state.isTableView;
-
-      return (
-        <div className="alternative-header">
-          <ButtonGroup className="two-sides-toggle-button">
-            <Button
-              className={isTableViewSelected ? '' : 'active'}
-              onClick={this.toggleTableView.bind(this, false)}
-            >
-              <i className="fonticon-json" /> JSON
-            </Button>
-            <Button
-              className={isTableViewSelected ? 'active' : ''}
-              onClick={this.toggleTableView.bind(this, true)}
-            >
-              <i className="fonticon-table" /> Table
-            </Button>
-          </ButtonGroup>
-          {this.props.showIncludeAllDocs ? <ToggleHeaderButton
-            toggleCallback={this.toggleIncludeDocs}
-            containerClasses="header-control-box control-toggle-include-docs"
-            title="Enable/Disable include_docs"
-            fonticon={this.state.includeDocs ? 'icon-check' : 'icon-check-empty'}
-            iconDefaultClass="icon fontawesome"
-            text="" /> : null}  { /* text is set via responsive css */}
-        </div>
-      );
-    },
-
-    toggleIncludeDocs: function () {
-      Actions.toggleIncludeDocs(this.state.includeDocs, this.state.bulkDocCollection);
-    },
-
-    toggleTableView: function (enable) {
-      Actions.toggleTableView(enable);
-    }
-  });
-
-  var Views = {
-    BulkDocumentHeaderController: BulkDocumentHeaderController
-  };
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import React from "react";
+import Actions from "./header.actions";
+import ReactComponents from "../../components/react-components.react";
+import IndexResultsStore from "../index-results/stores";
+import IndexResultsActions from "../index-results/actions";
+import { ButtonGroup, Button } from "react-bootstrap";
+import QueryOptionsStore from "../queryoptions/stores";
+import ReactCSSTransitionGroup from "react-addons-css-transition-group";
+
+var indexResultsStore = IndexResultsStore.indexResultsStore;
+var queryOptionsStore = QueryOptionsStore.queryOptionsStore;
+
+var ToggleHeaderButton = ReactComponents.ToggleHeaderButton;
+
+var BulkDocumentHeaderController = React.createClass({
+  getStoreState: function () {
+    return {
+      selectedView: indexResultsStore.getCurrentViewType(),
+      isTableView: indexResultsStore.getIsTableView(),
+      includeDocs: queryOptionsStore.getIncludeDocsEnabled(),
+      bulkDocCollection: indexResultsStore.getBulkDocCollection()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    indexResultsStore.on('change', this.onChange, this);
+    queryOptionsStore.on('change', this.onChange, this);
+
+  },
+
+  componentWillUnmount: function () {
+    indexResultsStore.off('change', this.onChange);
+    queryOptionsStore.off('change', this.onChange);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  render: function () {
+    var isTableViewSelected = this.state.isTableView;
+
+    return (
+      <div className="alternative-header">
+        <ButtonGroup className="two-sides-toggle-button">
+          <Button
+            className={isTableViewSelected ? '' : 'active'}
+            onClick={this.toggleTableView.bind(this, false)}
+          >
+            <i className="fonticon-json" /> JSON
+          </Button>
+          <Button
+            className={isTableViewSelected ? 'active' : ''}
+            onClick={this.toggleTableView.bind(this, true)}
+          >
+            <i className="fonticon-table" /> Table
+          </Button>
+        </ButtonGroup>
+        {this.props.showIncludeAllDocs ? <ToggleHeaderButton
+          toggleCallback={this.toggleIncludeDocs}
+          containerClasses="header-control-box control-toggle-include-docs"
+          title="Enable/Disable include_docs"
+          fonticon={this.state.includeDocs ? 'icon-check' : 'icon-check-empty'}
+          iconDefaultClass="icon fontawesome"
+          text="" /> : null}  { /* text is set via responsive css */}
+      </div>
+    );
+  },
+
+  toggleIncludeDocs: function () {
+    Actions.toggleIncludeDocs(this.state.includeDocs, this.state.bulkDocCollection);
+  },
+
+  toggleTableView: function (enable) {
+    Actions.toggleTableView(enable);
+  }
+});
 
-  return Views;
+var Views = {
+  BulkDocumentHeaderController: BulkDocumentHeaderController
+};
 
-});
+export default Views;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/helpers.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/helpers.js b/app/addons/documents/helpers.js
index 87e3f74..e3862f8 100644
--- a/app/addons/documents/helpers.js
+++ b/app/addons/documents/helpers.js
@@ -10,116 +10,113 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api'
-], function (app, FauxtonAPI) {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
 
 
-  function getPreviousPageForDoc (database, wasCloned) {
-    var previousPage = database.url('index'), // default to the current database's all_docs page
-        lastPages = FauxtonAPI.router.lastPages;
+function getPreviousPageForDoc (database, wasCloned) {
+  var previousPage = database.url('index'), // default to the current database's all_docs page
+      lastPages = FauxtonAPI.router.lastPages;
 
-    if (!wasCloned && lastPages.length >= 2) {
+  if (!wasCloned && lastPages.length >= 2) {
 
-      // if we came from "/new", we don't want to link the user there
-      if (/(new|new_view)$/.test(lastPages[1])) {
-        previousPage = lastPages[0];
-      } else {
-        previousPage = lastPages[1];
-      }
+    // if we came from "/new", we don't want to link the user there
+    if (/(new|new_view)$/.test(lastPages[1])) {
+      previousPage = lastPages[0];
+    } else {
+      previousPage = lastPages[1];
     }
-
-    return previousPage;
-  }
-
-  function getPreviousPage (database) {
-    return database.url('index');
   }
 
-  // sequence info is an array in couchdb2 with two indexes. On couch 1.x, it's just a string / number
-  function getSeqNum (val) {
-    return _.isArray(val) ? val[1] : val;
-  }
+  return previousPage;
+}
 
-  function getNewButtonLinks (databaseName) {
-    var addLinks = FauxtonAPI.getExtensions('sidebar:links');
-    var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', databaseName);
-
-    var addNewLinks = _.reduce(addLinks, function (menuLinks, link) {
-      menuLinks.push({
-        title: link.title,
-        url: newUrlPrefix + '/' + link.url,
-        icon: 'fonticon-plus-circled'
-      });
-
-      return menuLinks;
-    }, [{
-      title: 'New Doc',
-      url: newUrlPrefix + '/new',
-      icon: 'fonticon-plus-circled'
-    }, {
-      title: 'New View',
-      url: newUrlPrefix + '/new_view',
-      icon: 'fonticon-plus-circled'
-    }, getMangoLink(databaseName)]);
+function getPreviousPage (database) {
+  return database.url('index');
+}
 
-    return [{
-      title: 'Add New',
-      links: addNewLinks
-    }];
-  }
+// sequence info is an array in couchdb2 with two indexes. On couch 1.x, it's just a string / number
+function getSeqNum (val) {
+  return _.isArray(val) ? val[1] : val;
+}
 
-  function getMangoLink (databaseName) {
-    var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', databaseName);
+function getNewButtonLinks (databaseName) {
+  var addLinks = FauxtonAPI.getExtensions('sidebar:links');
+  var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', databaseName);
 
-    return {
-      title: app.i18n.en_US['new-mango-index'],
-      url: newUrlPrefix + '/_index',
+  var addNewLinks = _.reduce(addLinks, function (menuLinks, link) {
+    menuLinks.push({
+      title: link.title,
+      url: newUrlPrefix + '/' + link.url,
       icon: 'fonticon-plus-circled'
-    };
-  }
+    });
+
+    return menuLinks;
+  }, [{
+    title: 'New Doc',
+    url: newUrlPrefix + '/new',
+    icon: 'fonticon-plus-circled'
+  }, {
+    title: 'New View',
+    url: newUrlPrefix + '/new_view',
+    icon: 'fonticon-plus-circled'
+  }, getMangoLink(databaseName)]);
+
+  return [{
+    title: 'Add New',
+    links: addNewLinks
+  }];
+}
+
+function getMangoLink (databaseName) {
+  var newUrlPrefix = '#' + FauxtonAPI.urls('databaseBaseURL', 'app', databaseName);
 
-  function parseJSON (str) {
-    return JSON.parse('"' + str + '"');   // this ensures newlines are converted
-  }
-
-  function getModifyDatabaseLinks (databaseName, deleteCallback) {
-    return [{
-      title: 'Replicate Database',
-      icon: 'fonticon-replicate',
-      url: FauxtonAPI.urls('replication', 'app', databaseName)
-    }, {
-      title: 'Delete',
-      icon: 'fonticon-trash',
-      onClick: function () {
-        deleteCallback({showDeleteModal: true, dbId: databaseName});
-      }
-    }];
-  }
-
-  function truncateDoc (docString, maxRows) {
-    var lines = docString.split('\n');
-    var isTruncated = false;
-    if (lines.length > maxRows) {
-      isTruncated = true;
-      lines = lines.slice(0, maxRows);
-      docString = lines.join('\n');
+  return {
+    title: app.i18n.en_US['new-mango-index'],
+    url: newUrlPrefix + '/_index',
+    icon: 'fonticon-plus-circled'
+  };
+}
+
+function parseJSON (str) {
+  return JSON.parse('"' + str + '"');   // this ensures newlines are converted
+}
+
+function getModifyDatabaseLinks (databaseName, deleteCallback) {
+  return [{
+    title: 'Replicate Database',
+    icon: 'fonticon-replicate',
+    url: FauxtonAPI.urls('replication', 'app', databaseName)
+  }, {
+    title: 'Delete',
+    icon: 'fonticon-trash',
+    onClick: function () {
+      deleteCallback({showDeleteModal: true, dbId: databaseName});
     }
-    return {
-      isTruncated: isTruncated,
-      content: docString
-    };
+  }];
+}
+
+function truncateDoc (docString, maxRows) {
+  var lines = docString.split('\n');
+  var isTruncated = false;
+  if (lines.length > maxRows) {
+    isTruncated = true;
+    lines = lines.slice(0, maxRows);
+    docString = lines.join('\n');
   }
-
-
   return {
-    getPreviousPageForDoc: getPreviousPageForDoc,
-    getPreviousPage: getPreviousPage,
-    getSeqNum: getSeqNum,
-    getNewButtonLinks: getNewButtonLinks,
-    getModifyDatabaseLinks: getModifyDatabaseLinks,
-    parseJSON: parseJSON,
-    truncateDoc: truncateDoc
+    isTruncated: isTruncated,
+    content: docString
   };
-});
+}
+
+
+export default {
+  getPreviousPageForDoc: getPreviousPageForDoc,
+  getPreviousPage: getPreviousPage,
+  getSeqNum: getSeqNum,
+  getNewButtonLinks: getNewButtonLinks,
+  getModifyDatabaseLinks: getModifyDatabaseLinks,
+  parseJSON: parseJSON,
+  truncateDoc: truncateDoc
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/queryoptions/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/stores.js b/app/addons/documents/queryoptions/stores.js
index e45c64a..1516c7e 100644
--- a/app/addons/documents/queryoptions/stores.js
+++ b/app/addons/documents/queryoptions/stores.js
@@ -10,284 +10,278 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './actiontypes'
-],
-
-function (app, FauxtonAPI, ActionTypes) {
-  var Stores = {};
-
-  Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
-
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._loading = true;
-      this._showByKeys = false;
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./actiontypes";
+var Stores = {};
+
+Stores.QueryOptionsStore = FauxtonAPI.Store.extend({
+
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._loading = true;
+    this._showByKeys = false;
+    this._showBetweenKeys = false;
+    this._includeDocs = false;
+    this._betweenKeys = {
+      include: true,
+    };
+
+    this._trayVisible = false;
+
+    this._byKeys = '';
+    this._descending = false;
+    this._skip = '';
+    this._limit = "none";
+    this._reduce = false;
+    this._groupLevel = 'exact';
+
+    this._showReduce = false;
+  },
+
+  isLoading: function () {
+    return this._loading;
+  },
+
+  setTrayVisible: function (trayVisible) {
+    this._trayVisible = trayVisible;
+  },
+
+  getTrayVisible: function () {
+    return this._trayVisible;
+  },
+
+  showReduce: function () {
+    return this._showReduce;
+  },
+
+  reduce: function () {
+    return this._reduce;
+  },
+
+  betweenKeys: function () {
+    return this._betweenKeys;
+  },
+
+  updateBetweenKeys: function (newBetweenKeys) {
+    this._betweenKeys = newBetweenKeys;
+  },
+
+  updateSkip: function (skip) {
+    this._skip = skip;
+  },
+
+  skip: function () {
+    return this._skip;
+  },
+
+  limit: function () {
+    return this._limit;
+  },
+
+  updateLimit: function (limit) {
+    this._limit = limit;
+  },
+
+  byKeys: function () {
+    return this._byKeys;
+  },
+
+  updateByKeys: function (keys) {
+    this._byKeys = keys;
+  },
+
+  includeDocs: function () {
+    return this._includeDocs;
+  },
+
+  descending: function () {
+    return this._descending;
+  },
+
+  groupLevel: function () {
+    return this._groupLevel;
+  },
+
+  toggleByKeys: function () {
+    this._showByKeys = !this._showByKeys;
+
+    if (this._showByKeys) {
       this._showBetweenKeys = false;
-      this._includeDocs = false;
-      this._betweenKeys = {
-        include: true,
-      };
-
-      this._trayVisible = false;
-
-      this._byKeys = '';
-      this._descending = false;
-      this._skip = '';
-      this._limit = "none";
-      this._reduce = false;
-      this._groupLevel = 'exact';
-
-      this._showReduce = false;
-    },
-
-    isLoading: function () {
-      return this._loading;
-    },
-
-    setTrayVisible: function (trayVisible) {
-      this._trayVisible = trayVisible;
-    },
-
-    getTrayVisible: function () {
-      return this._trayVisible;
-    },
-
-    showReduce: function () {
-      return this._showReduce;
-    },
-
-    reduce: function () {
-      return this._reduce;
-    },
-
-    betweenKeys: function () {
-      return this._betweenKeys;
-    },
-
-    updateBetweenKeys: function (newBetweenKeys) {
-      this._betweenKeys = newBetweenKeys;
-    },
-
-    updateSkip: function (skip) {
-      this._skip = skip;
-    },
-
-    skip: function () {
-      return this._skip;
-    },
-
-    limit: function () {
-      return this._limit;
-    },
+    }
+  },
 
-    updateLimit: function (limit) {
-      this._limit = limit;
-    },
+  toggleBetweenKeys: function () {
+    this._showBetweenKeys = !this._showBetweenKeys;
 
-    byKeys: function () {
-      return this._byKeys;
-    },
+    if (this._showBetweenKeys) {
+      this._showByKeys = false;
+    }
+  },
 
-    updateByKeys: function (keys) {
-      this._byKeys = keys;
-    },
+  showByKeys: function () {
+    return this._showByKeys;
+  },
 
-    includeDocs: function () {
-      return this._includeDocs;
-    },
+  showBetweenKeys: function () {
+    return this._showBetweenKeys;
+  },
 
-    descending: function () {
-      return this._descending;
-    },
+  updateGroupLevel: function (groupLevel) {
+    this._groupLevel = groupLevel;
+  },
 
-    groupLevel: function () {
-      return this._groupLevel;
-    },
+  setQueryParams: function (params) {
+    this.reset();
+    if (params.include_docs) {
+      this._includeDocs = true;
+    }
 
-    toggleByKeys: function () {
-      this._showByKeys = !this._showByKeys;
+    if (params.start_key || params.end_key) {
+      var include = true;
 
-      if (this._showByKeys) {
-        this._showBetweenKeys = false;
+      if (params.inclusive_end) {
+        include = params.inclusive_end === 'true';
       }
-    },
-
-    toggleBetweenKeys: function () {
-      this._showBetweenKeys = !this._showBetweenKeys;
-
-      if (this._showBetweenKeys) {
-        this._showByKeys = false;
+      this._betweenKeys = { include: include };
+      if (params.start_key) {
+        this._betweenKeys.startkey = params.start_key;
       }
-    },
-
-    showByKeys: function () {
-      return this._showByKeys;
-    },
-
-    showBetweenKeys: function () {
-      return this._showBetweenKeys;
-    },
-
-    updateGroupLevel: function (groupLevel) {
-      this._groupLevel = groupLevel;
-    },
-
-    setQueryParams: function (params) {
-      this.reset();
-      if (params.include_docs) {
-        this._includeDocs = true;
+      if (params.end_key) {
+        this._betweenKeys.endkey = params.end_key;
       }
+      this._showBetweenKeys = true;
 
-      if (params.start_key || params.end_key) {
-        var include = true;
-
-        if (params.inclusive_end) {
-          include = params.inclusive_end === 'true';
-        }
-        this._betweenKeys = { include: include };
-        if (params.start_key) {
-          this._betweenKeys.startkey = params.start_key;
-        }
-        if (params.end_key) {
-          this._betweenKeys.endkey = params.end_key;
-        }
-        this._showBetweenKeys = true;
-
-      } else if (params.keys) {
-        this._byKeys = params.keys;
-        this._showByKeys = true;
-      }
+    } else if (params.keys) {
+      this._byKeys = params.keys;
+      this._showByKeys = true;
+    }
 
-      if (params.limit && params.limit !== 'none') {
-        this._limit = params.limit;
-      }
+    if (params.limit && params.limit !== 'none') {
+      this._limit = params.limit;
+    }
 
-      if (params.skip) {
-        this._skip = params.skip;
-      }
+    if (params.skip) {
+      this._skip = params.skip;
+    }
 
-      if (params.descending) {
-        this._descending = params.descending;
-      }
+    if (params.descending) {
+      this._descending = params.descending;
+    }
 
-      if (params.reduce) {
-        if (params.group) {
-          this._groupLevel = 'exact';
-        } else {
-          this._groupLevel = params.group_level;
-        }
-        this._reduce = true;
+    if (params.reduce) {
+      if (params.group) {
+        this._groupLevel = 'exact';
+      } else {
+        this._groupLevel = params.group_level;
       }
-    },
+      this._reduce = true;
+    }
+  },
 
-    getQueryParams: function () {
-      var params = {};
+  getQueryParams: function () {
+    var params = {};
 
-      if (this._includeDocs) {
-        params.include_docs = this._includeDocs;
-      }
+    if (this._includeDocs) {
+      params.include_docs = this._includeDocs;
+    }
 
-      if (this._showBetweenKeys) {
-        var betweenKeys = this._betweenKeys;
-        params.inclusive_end = betweenKeys.include;
-        if (betweenKeys.startkey && betweenKeys.startkey !== '') {
-          params.start_key = betweenKeys.startkey;
-        }
-        if (betweenKeys.endkey && betweenKeys.endkey !== '') {
-          params.end_key = betweenKeys.endkey;
-        }
-      } else if (this._showByKeys) {
-        params.keys = this._byKeys.replace(/\r?\n/g, '');
+    if (this._showBetweenKeys) {
+      var betweenKeys = this._betweenKeys;
+      params.inclusive_end = betweenKeys.include;
+      if (betweenKeys.startkey && betweenKeys.startkey !== '') {
+        params.start_key = betweenKeys.startkey;
       }
-
-      if (this._limit !== 'none') {
-        params.limit = parseInt(this._limit, 10);
+      if (betweenKeys.endkey && betweenKeys.endkey !== '') {
+        params.end_key = betweenKeys.endkey;
       }
+    } else if (this._showByKeys) {
+      params.keys = this._byKeys.replace(/\r?\n/g, '');
+    }
 
-      if (this._skip) {
-        params.skip = parseInt(this._skip, 10);
-      }
+    if (this._limit !== 'none') {
+      params.limit = parseInt(this._limit, 10);
+    }
 
-      if (this._descending) {
-        params.descending = this._descending;
-      }
+    if (this._skip) {
+      params.skip = parseInt(this._skip, 10);
+    }
 
-      if (this._reduce) {
-        params.reduce = true;
+    if (this._descending) {
+      params.descending = this._descending;
+    }
 
-        if (this._groupLevel === 'exact') {
-          params.group = true;
-        } else {
-          params.group_level = this._groupLevel;
-        }
-      }
+    if (this._reduce) {
+      params.reduce = true;
 
-      return params;
-    },
-
-    getIncludeDocsEnabled: function () {
-      return this._includeDocs;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.QUERY_RESET:
-          this.setQueryParams(action.params);
-        break;
-        case ActionTypes.QUERY_TOGGLE_INCLUDE_DOCS:
-          this._includeDocs = !this._includeDocs;
-        break;
-        case ActionTypes.QUERY_TOGGLE_DESCENDING:
-          this._descending = !this._descending;
-        break;
-        case ActionTypes.QUERY_TOGGLE_BY_KEYS:
-          this.toggleByKeys();
-        break;
-        case ActionTypes.QUERY_TOGGLE_BETWEEN_KEYS:
-          this.toggleBetweenKeys();
-        break;
-        case ActionTypes.QUERY_UPDATE_BETWEEN_KEYS:
-          this.updateBetweenKeys(action.betweenKeys);
-        break;
-        case ActionTypes.QUERY_UPDATE_BY_KEYS:
-          this.updateByKeys(action.byKeys);
-        break;
-        case ActionTypes.QUERY_UPDATE_SKIP:
-          this.updateSkip(action.skip);
-        break;
-        case ActionTypes.QUERY_UPDATE_LIMIT:
-          this.updateLimit(action.limit);
-        break;
-        case ActionTypes.QUERY_SHOW_REDUCE:
-          this._showReduce = true;
-        break;
-        case ActionTypes.QUERY_TOGGLE_REDUCE:
-          this._reduce = !this._reduce;
-        break;
-        case ActionTypes.QUERY_UPDATE_GROUP_LEVEL:
-          this.updateGroupLevel(action.groupLevel);
-        break;
-        case ActionTypes.QUERY_UPDATE_VISIBILITY:
-          this.setTrayVisible(action.options);
-        break;
-        default:
-        return;
-        // do nothing
+      if (this._groupLevel === 'exact') {
+        params.group = true;
+      } else {
+        params.group_level = this._groupLevel;
       }
-      this.triggerChange();
+    }
 
+    return params;
+  },
+
+  getIncludeDocsEnabled: function () {
+    return this._includeDocs;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.QUERY_RESET:
+        this.setQueryParams(action.params);
+      break;
+      case ActionTypes.QUERY_TOGGLE_INCLUDE_DOCS:
+        this._includeDocs = !this._includeDocs;
+      break;
+      case ActionTypes.QUERY_TOGGLE_DESCENDING:
+        this._descending = !this._descending;
+      break;
+      case ActionTypes.QUERY_TOGGLE_BY_KEYS:
+        this.toggleByKeys();
+      break;
+      case ActionTypes.QUERY_TOGGLE_BETWEEN_KEYS:
+        this.toggleBetweenKeys();
+      break;
+      case ActionTypes.QUERY_UPDATE_BETWEEN_KEYS:
+        this.updateBetweenKeys(action.betweenKeys);
+      break;
+      case ActionTypes.QUERY_UPDATE_BY_KEYS:
+        this.updateByKeys(action.byKeys);
+      break;
+      case ActionTypes.QUERY_UPDATE_SKIP:
+        this.updateSkip(action.skip);
+      break;
+      case ActionTypes.QUERY_UPDATE_LIMIT:
+        this.updateLimit(action.limit);
+      break;
+      case ActionTypes.QUERY_SHOW_REDUCE:
+        this._showReduce = true;
+      break;
+      case ActionTypes.QUERY_TOGGLE_REDUCE:
+        this._reduce = !this._reduce;
+      break;
+      case ActionTypes.QUERY_UPDATE_GROUP_LEVEL:
+        this.updateGroupLevel(action.groupLevel);
+      break;
+      case ActionTypes.QUERY_UPDATE_VISIBILITY:
+        this.setTrayVisible(action.options);
+      break;
+      default:
+      return;
+      // do nothing
     }
-  });
+    this.triggerChange();
 
-  Stores.queryOptionsStore = new Stores.QueryOptionsStore();
-  Stores.queryOptionsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.queryOptionsStore.dispatch);
+  }
+});
 
-  return Stores;
+Stores.queryOptionsStore = new Stores.QueryOptionsStore();
+Stores.queryOptionsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.queryOptionsStore.dispatch);
 
-});
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx b/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
index 651c042..8860fab 100644
--- a/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
+++ b/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
@@ -9,188 +9,185 @@
 // 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',
-  '../queryoptions.react',
-  '../stores',
-  '../actions',
-  '../../resources',
-  '../../../../../test/mocha/testUtils',
-  "react",
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, Stores, Actions, Documents, utils, React, ReactDOM, TestUtils, sinon) {
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
-
-  var assert = utils.assert;
-  var restore = utils.restore;
-
-  describe('Query Options', function () {
-    var container, El;
-
-    beforeEach(function () {
-      container = document.createElement('div');
+import FauxtonAPI from "../../../../core/api";
+import Views from "../queryoptions.react";
+import Stores from "../stores";
+import Actions from "../actions";
+import Documents from "../../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 restore = utils.restore;
+
+describe('Query Options', function () {
+  var container, El;
+
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
+
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
+
+  describe('MainFieldsView', function () {
+    var mainFieldsEl;
+
+    it('returns null no reduce', function () {
+      mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView reduce={false} includeDocs={false} showReduce={false}/>, container);
+      assert.ok(_.isNull(mainFieldsEl.reduce()));
     });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
+    it('shows reduce and group level', function () {
+      mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView reduce={true} includeDocs={false} showReduce={true}/>, container);
+      assert.ok(!_.isNull(mainFieldsEl.reduce()));
+      assert.ok(!_.isNull(mainFieldsEl.groupLevel()));
     });
 
-    describe('MainFieldsView', function () {
-      var mainFieldsEl;
-
-      it('returns null no reduce', function () {
-        mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView reduce={false} includeDocs={false} showReduce={false}/>, container);
-        assert.ok(_.isNull(mainFieldsEl.reduce()));
-      });
-
-      it('shows reduce and group level', function () {
-        mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView reduce={true} includeDocs={false} showReduce={true}/>, container);
-        assert.ok(!_.isNull(mainFieldsEl.reduce()));
-        assert.ok(!_.isNull(mainFieldsEl.groupLevel()));
-      });
-
-      it('updates group level', function () {
-        var spy = sinon.spy();
-        mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView updateGroupLevel={spy} reduce={true} includeDocs={false} showReduce={true}/>, container);
-        var el = $(ReactDOM.findDOMNode(mainFieldsEl)).find('#qoGroupLevel')[0];
-        TestUtils.Simulate.change(el, {target: {value: 'exact'}});
-
-        assert.ok(spy.calledOnce);
-      });
-
-      it('toggles include docs on change', function () {
-        var spy = sinon.spy();
-        mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView toggleIncludeDocs={spy} reduce={false} includeDocs={false} showReduce={false}/>, container);
-        var el = $(ReactDOM.findDOMNode(mainFieldsEl)).find('#qoIncludeDocs')[0];
-        TestUtils.Simulate.change(el);
-
-        assert.ok(spy.calledOnce);
-      });
-
-      it('uses overridden URL prop if defined', function () {
-        var customDocURL = 'http://whatever.com';
-        mainFieldsEl = TestUtils.renderIntoDocument(
-          <Views.MainFieldsView reduce={false} includeDocs={false} showReduce={false} docURL={customDocURL} />,
-          container);
-        assert.equal($(ReactDOM.findDOMNode(mainFieldsEl)).find('.help-link').attr('href'), customDocURL);
-      });
+    it('updates group level', function () {
+      var spy = sinon.spy();
+      mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView updateGroupLevel={spy} reduce={true} includeDocs={false} showReduce={true}/>, container);
+      var el = $(ReactDOM.findDOMNode(mainFieldsEl)).find('#qoGroupLevel')[0];
+      TestUtils.Simulate.change(el, {target: {value: 'exact'}});
 
+      assert.ok(spy.calledOnce);
     });
 
-    describe('KeySearchFields', function () {
-
-      it('toggles keys', function () {
-        var spy = sinon.spy();
-        var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
-          showByKeys={false}
-          showBetweenKeys={false}
-          betweenKeys={{}}
-          toggleByKeys={spy}
-          />, container);
-
-        var el = $(ReactDOM.findDOMNode(keysEl)).find('#byKeys')[0];
-        TestUtils.Simulate.click(el);
-        assert.ok(spy.calledOnce);
-      });
-
-      it('toggles between keys', function () {
-        var spy = sinon.spy();
-        var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
-          showByKeys={false}
-          showBetweenKeys={false}
-          toggleBetweenKeys={spy}
-          betweenKeys={{}}
-          />, container);
-
-        var el = $(ReactDOM.findDOMNode(keysEl)).find('#betweenKeys')[0];
-        TestUtils.Simulate.click(el);
-        assert.ok(spy.calledOnce);
-      });
-
-      it('updates byKeys', function () {
-        var spy = sinon.spy();
-        var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
-          showByKeys={false}
-          showBetweenKeys={false}
-          updateByKeys={spy}
-          betweenKeys={{}}
-          />, container);
-
-        var el = $(ReactDOM.findDOMNode(keysEl)).find('#keys-input')[0];
-        TestUtils.Simulate.change(el, {target: {value: 'boom'}});
-        assert.ok(spy.calledWith('boom'));
-      });
-
-      it('updates betweenKeys', function () {
-        var spy = sinon.spy();
-        var betweenKeys = {
-          startkey: '',
-          endkey: '',
-          inclusive_end: true
-        };
-        var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
-          showByKeys={false}
-          showBetweenKeys={false}
-          updateBetweenKeys={spy}
-          betweenKeys={betweenKeys}
-          />, container);
-
-        var el = $(ReactDOM.findDOMNode(keysEl)).find('#endkey')[0];
-        TestUtils.Simulate.change(el, {target: {value: 'boom'}});
-        assert.ok(spy.calledOnce);
-      });
+    it('toggles include docs on change', function () {
+      var spy = sinon.spy();
+      mainFieldsEl = TestUtils.renderIntoDocument(<Views.MainFieldsView toggleIncludeDocs={spy} reduce={false} includeDocs={false} showReduce={false}/>, container);
+      var el = $(ReactDOM.findDOMNode(mainFieldsEl)).find('#qoIncludeDocs')[0];
+      TestUtils.Simulate.change(el);
+
+      assert.ok(spy.calledOnce);
     });
 
-    describe('AdditionalParams', function () {
-      afterEach(function () {
-        restore(FauxtonAPI.addNotification);
-      });
-
-      it('only updates skip with numbers', function () {
-        var paramsEl = TestUtils.renderIntoDocument(<Views.AdditionalParams
-          updateSkip={function () {}}
-           />, container);
-
-        var spy = sinon.spy(FauxtonAPI, 'addNotification');
-        paramsEl.updateSkip({target: {value: 'b'}, preventDefault: function () {}});
-
-        assert.ok(spy.calledOnce);
-      });
-
-      it('updates skip if a number', function () {
-        var val = 0;
-        var paramsEl = TestUtils.renderIntoDocument(<Views.AdditionalParams
-          updateSkip={function (a) {
-            val = a;
-          }}
-           />, container);
-
-        paramsEl.updateSkip({target: {value: '3'}, preventDefault: function () {}});
-        assert.equal(val, '3');
-      });
+    it('uses overridden URL prop if defined', function () {
+      var customDocURL = 'http://whatever.com';
+      mainFieldsEl = TestUtils.renderIntoDocument(
+        <Views.MainFieldsView reduce={false} includeDocs={false} showReduce={false} docURL={customDocURL} />,
+        container);
+      assert.equal($(ReactDOM.findDOMNode(mainFieldsEl)).find('.help-link').attr('href'), customDocURL);
     });
 
   });
 
-  describe('QueryButtons', function () {
-    var container;
+  describe('KeySearchFields', function () {
 
-    beforeEach(function () {
-      container = document.createElement('div');
+    it('toggles keys', function () {
+      var spy = sinon.spy();
+      var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
+        showByKeys={false}
+        showBetweenKeys={false}
+        betweenKeys={{}}
+        toggleByKeys={spy}
+        />, container);
+
+      var el = $(ReactDOM.findDOMNode(keysEl)).find('#byKeys')[0];
+      TestUtils.Simulate.click(el);
+      assert.ok(spy.calledOnce);
     });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
+    it('toggles between keys', function () {
+      var spy = sinon.spy();
+      var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
+        showByKeys={false}
+        showBetweenKeys={false}
+        toggleBetweenKeys={spy}
+        betweenKeys={{}}
+        />, container);
+
+      var el = $(ReactDOM.findDOMNode(keysEl)).find('#betweenKeys')[0];
+      TestUtils.Simulate.click(el);
+      assert.ok(spy.calledOnce);
     });
 
-    describe('cancel event fires', function () {
+    it('updates byKeys', function () {
       var spy = sinon.spy();
-      var component = TestUtils.renderIntoDocument(<Views.QueryButtons onCancel={spy} />, container);
-      TestUtils.Simulate.click($(ReactDOM.findDOMNode(component)).find('a')[0]);
+      var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
+        showByKeys={false}
+        showBetweenKeys={false}
+        updateByKeys={spy}
+        betweenKeys={{}}
+        />, container);
+
+      var el = $(ReactDOM.findDOMNode(keysEl)).find('#keys-input')[0];
+      TestUtils.Simulate.change(el, {target: {value: 'boom'}});
+      assert.ok(spy.calledWith('boom'));
+    });
+
+    it('updates betweenKeys', function () {
+      var spy = sinon.spy();
+      var betweenKeys = {
+        startkey: '',
+        endkey: '',
+        inclusive_end: true
+      };
+      var keysEl = TestUtils.renderIntoDocument(<Views.KeySearchFields
+        showByKeys={false}
+        showBetweenKeys={false}
+        updateBetweenKeys={spy}
+        betweenKeys={betweenKeys}
+        />, container);
+
+      var el = $(ReactDOM.findDOMNode(keysEl)).find('#endkey')[0];
+      TestUtils.Simulate.change(el, {target: {value: 'boom'}});
+      assert.ok(spy.calledOnce);
+    });
+  });
+
+  describe('AdditionalParams', function () {
+    afterEach(function () {
+      restore(FauxtonAPI.addNotification);
+    });
+
+    it('only updates skip with numbers', function () {
+      var paramsEl = TestUtils.renderIntoDocument(<Views.AdditionalParams
+        updateSkip={function () {}}
+         />, container);
+
+      var spy = sinon.spy(FauxtonAPI, 'addNotification');
+      paramsEl.updateSkip({target: {value: 'b'}, preventDefault: function () {}});
+
       assert.ok(spy.calledOnce);
     });
 
+    it('updates skip if a number', function () {
+      var val = 0;
+      var paramsEl = TestUtils.renderIntoDocument(<Views.AdditionalParams
+        updateSkip={function (a) {
+          val = a;
+        }}
+         />, container);
+
+      paramsEl.updateSkip({target: {value: '3'}, preventDefault: function () {}});
+      assert.equal(val, '3');
+    });
+  });
+
+});
+
+describe('QueryButtons', function () {
+  var container;
+
+  beforeEach(function () {
+    container = document.createElement('div');
   });
+
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
+
+  describe('cancel event fires', function () {
+    var spy = sinon.spy();
+    var component = TestUtils.renderIntoDocument(<Views.QueryButtons onCancel={spy} />, container);
+    TestUtils.Simulate.click($(ReactDOM.findDOMNode(component)).find('a')[0]);
+    assert.ok(spy.calledOnce);
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js b/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js
index 25594c2..3966483 100644
--- a/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js
+++ b/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js
@@ -10,124 +10,121 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../../core/api',
-  '../stores',
-  '../actiontypes',
-  '../../../../../test/mocha/testUtils',
-], function (FauxtonAPI, Stores, ActionTypes, testUtils) {
-  var assert = testUtils.assert;
-  var dispatchToken;
-  var store;
-  var opts;
-
-  describe('QueryOptions Store', function () {
-    beforeEach(function () {
-      store = new Stores.QueryOptionsStore();
-      dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
-    });
+import FauxtonAPI from "../../../../core/api";
+import Stores from "../stores";
+import ActionTypes from "../actiontypes";
+import testUtils from "../../../../../test/mocha/testUtils";
+var assert = testUtils.assert;
+var dispatchToken;
+var store;
+var opts;
+
+describe('QueryOptions Store', function () {
+  beforeEach(function () {
+    store = new Stores.QueryOptionsStore();
+    dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch);
+  });
 
-    afterEach(function () {
-      FauxtonAPI.dispatcher.unregister(dispatchToken);
-    });
+  afterEach(function () {
+    FauxtonAPI.dispatcher.unregister(dispatchToken);
+  });
 
-    describe('Toggle By Keys and Between Keys', function () {
+  describe('Toggle By Keys and Between Keys', function () {
 
-      it('toggling by keys sets by keys to true', function () {
+    it('toggling by keys sets by keys to true', function () {
 
-        store.toggleByKeys();
+      store.toggleByKeys();
 
-        assert.ok(store.showByKeys());
-      });
+      assert.ok(store.showByKeys());
+    });
 
-      it('toggling between keys sets between keys to true', function () {
+    it('toggling between keys sets between keys to true', function () {
 
-        store.toggleBetweenKeys();
-        assert.ok(store.showBetweenKeys());
-      });
+      store.toggleBetweenKeys();
+      assert.ok(store.showBetweenKeys());
+    });
 
-      it('toggling between keys sets by keys to false', function () {
-        store._showByKeys = true;
-        store.toggleBetweenKeys();
-        assert.notOk(store.showByKeys());
-      });
+    it('toggling between keys sets by keys to false', function () {
+      store._showByKeys = true;
+      store.toggleBetweenKeys();
+      assert.notOk(store.showByKeys());
+    });
 
-      it('toggling by keys sets between keys to false', function () {
-        store._showBetweenKeys = true;
-        store.toggleByKeys();
-        assert.notOk(store.showBetweenKeys());
-      });
+    it('toggling by keys sets between keys to false', function () {
+      store._showBetweenKeys = true;
+      store.toggleByKeys();
+      assert.notOk(store.showBetweenKeys());
+    });
 
+  });
+
+  describe('getQueryParams', function () {
+    it('returns params for default', function () {
+      assert.deepEqual(store.getQueryParams(), {});
     });
 
-    describe('getQueryParams', function () {
-      it('returns params for default', function () {
-        assert.deepEqual(store.getQueryParams(), {});
+    it('with betweenKeys', function () {
+      store.toggleBetweenKeys();
+      store.updateBetweenKeys({
+        startkey:"a",
+        endkey: "z",
+        include: true
       });
 
-      it('with betweenKeys', function () {
-        store.toggleBetweenKeys();
-        store.updateBetweenKeys({
-          startkey:"a",
-          endkey: "z",
-          include: true
-        });
-
-        assert.deepEqual(store.getQueryParams(), {
-          inclusive_end: true,
-          start_key: 'a',
-          end_key: 'z'
-        });
+      assert.deepEqual(store.getQueryParams(), {
+        inclusive_end: true,
+        start_key: 'a',
+        end_key: 'z'
       });
+    });
 
-      it('with byKeys', function () {
-        store.toggleByKeys();
-        store.updateByKeys("[1,2,3]");
+    it('with byKeys', function () {
+      store.toggleByKeys();
+      store.updateByKeys("[1,2,3]");
 
-        assert.deepEqual(store.getQueryParams(), {
-          keys: "[1,2,3]"
-        });
+      assert.deepEqual(store.getQueryParams(), {
+        keys: "[1,2,3]"
       });
     });
+  });
 
-    describe('setQueryParams', function () {
-
-      it('sets all store values from given params', function () {
+  describe('setQueryParams', function () {
 
-        store.setQueryParams({
-          include_docs: true,
-          limit: 10,
-          skip: 5,
-          descending: true
-        });
+    it('sets all store values from given params', function () {
 
-        assert.ok(store.includeDocs());
-        assert.ok(store.descending());
-        assert.equal(store.limit(), 10);
-        assert.equal(store.skip(), 5);
+      store.setQueryParams({
+        include_docs: true,
+        limit: 10,
+        skip: 5,
+        descending: true
       });
 
-      it('sets between keys', function () {
-        store.setQueryParams({
-          start_key: 1,
-          end_key: 5
-        });
+      assert.ok(store.includeDocs());
+      assert.ok(store.descending());
+      assert.equal(store.limit(), 10);
+      assert.equal(store.skip(), 5);
+    });
 
-        assert.equal(store.betweenKeys().startkey, 1);
-        assert.equal(store.betweenKeys().endkey, 5);
-        assert.ok(store.betweenKeys().include);
-        assert.ok(store.showBetweenKeys());
+    it('sets between keys', function () {
+      store.setQueryParams({
+        start_key: 1,
+        end_key: 5
       });
 
-      it('sets by keys', function () {
-        store.setQueryParams({
-          keys: [1, 2, 3]
-        });
+      assert.equal(store.betweenKeys().startkey, 1);
+      assert.equal(store.betweenKeys().endkey, 5);
+      assert.ok(store.betweenKeys().include);
+      assert.ok(store.showBetweenKeys());
+    });
 
-        assert.deepEqual(store.byKeys(), [1, 2, 3]);
-        assert.ok(store.showByKeys());
+    it('sets by keys', function () {
+      store.setQueryParams({
+        keys: [1, 2, 3]
       });
 
+      assert.deepEqual(store.byKeys(), [1, 2, 3]);
+      assert.ok(store.showByKeys());
     });
+
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index 13610f5..b93dd3d 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -10,582 +10,577 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './shared-resources',
-  '../../../assets/js/plugins/cloudant.pagingcollection'
-],
-
-function (app, FauxtonAPI, Documents, PagingCollection) {
-  Documents.QueryParams = (function () {
-    var _eachParams = function (params, action) {
-      // clone to avoid in-place modification
-      var result = _.clone(params);
-
-      _.each(['startkey', 'endkey', 'key'], function (key) {
-        if (_.has(result, key)) {
-          result[key] = action(result[key]);
-        }
-      });
-
-      return result;
-    };
-
-    return {
-      parse: function (params) {
-        return _eachParams(params, JSON.parse);
-      },
-
-      stringify: function (params) {
-        return _eachParams(params, JSON.stringify);
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Documents from "./shared-resources";
+import PagingCollection from "../../../assets/js/plugins/cloudant.pagingcollection";
+Documents.QueryParams = (function () {
+  var _eachParams = function (params, action) {
+    // clone to avoid in-place modification
+    var result = _.clone(params);
+
+    _.each(['startkey', 'endkey', 'key'], function (key) {
+      if (_.has(result, key)) {
+        result[key] = action(result[key]);
       }
-    };
-  })();
+    });
 
+    return result;
+  };
 
-  Documents.DdocInfo = FauxtonAPI.Model.extend({
-    idAttribute: "_id",
-    documentation: function () {
-      return FauxtonAPI.constants.DOC_URLS.GENERAL;
-    },
-    initialize: function (_attrs, options) {
-      this.database = options.database;
+  return {
+    parse: function (params) {
+      return _eachParams(params, JSON.parse);
     },
 
-    url: function (context) {
-      if (!context) {
-        context = 'server';
-      }
-
-      return FauxtonAPI.urls('designDocs', context, this.database.safeID(), this.safeID());
-    },
-
-    // Need this to work around backbone router thinking _design/foo
-    // is a separate route. Alternatively, maybe these should be
-    // treated separately. For instance, we could default into the
-    // json editor for docs, or into a ddoc specific page.
-    safeID: function () {
-      var ddoc = this.id.replace(/^_design\//, "");
-      return "_design/" + app.utils.safeURLName(ddoc);
+    stringify: function (params) {
+      return _eachParams(params, JSON.stringify);
+    }
+  };
+})();
+
+
+Documents.DdocInfo = FauxtonAPI.Model.extend({
+  idAttribute: "_id",
+  documentation: function () {
+    return FauxtonAPI.constants.DOC_URLS.GENERAL;
+  },
+  initialize: function (_attrs, options) {
+    this.database = options.database;
+  },
+
+  url: function (context) {
+    if (!context) {
+      context = 'server';
     }
-  });
 
-  Documents.MangoIndex = Documents.Doc.extend({
-    idAttribute: 'ddoc',
+    return FauxtonAPI.urls('designDocs', context, this.database.safeID(), this.safeID());
+  },
+
+  // Need this to work around backbone router thinking _design/foo
+  // is a separate route. Alternatively, maybe these should be
+  // treated separately. For instance, we could default into the
+  // json editor for docs, or into a ddoc specific page.
+  safeID: function () {
+    var ddoc = this.id.replace(/^_design\//, "");
+    return "_design/" + app.utils.safeURLName(ddoc);
+  }
+});
 
-    getId: function () {
+Documents.MangoIndex = Documents.Doc.extend({
+  idAttribute: 'ddoc',
 
-      if (this.id) {
-        return this.id;
-      }
+  getId: function () {
 
+    if (this.id) {
+      return this.id;
+    }
 
-      return '_all_docs';
-    },
 
-    isNew: function () {
-      // never use put
-      return true;
-    },
+    return '_all_docs';
+  },
 
-    // @deprecated, see isJSONDocBulkDeletable
-    isDeletable: function () {
-      return this.get('type') !== 'special';
-    },
+  isNew: function () {
+    // never use put
+    return true;
+  },
 
-    // @deprecated, see isJSONDocBulkDeletable
-    isBulkDeletable: function () {
-      return this.isDeletable();
-    },
+  // @deprecated, see isJSONDocBulkDeletable
+  isDeletable: function () {
+    return this.get('type') !== 'special';
+  },
 
-    isFromView: function () {
-      return false;
-    },
+  // @deprecated, see isJSONDocBulkDeletable
+  isBulkDeletable: function () {
+    return this.isDeletable();
+  },
 
-    url: function () {
-      var database = this.database.safeID();
+  isFromView: function () {
+    return false;
+  },
 
-      return FauxtonAPI.urls('mango', 'index-server', database);
-    }
-  });
+  url: function () {
+    var database = this.database.safeID();
 
-  Documents.MangoIndexCollection = PagingCollection.extend({
-    model: Documents.MangoIndex,
-    initialize: function (_attr, options) {
-      var defaultLimit = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
+    return FauxtonAPI.urls('mango', 'index-server', database);
+  }
+});
 
-      this.database = options.database;
-      this.params = _.extend({limit: defaultLimit}, options.params);
-    },
+Documents.MangoIndexCollection = PagingCollection.extend({
+  model: Documents.MangoIndex,
+  initialize: function (_attr, options) {
+    var defaultLimit = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
 
-    collectionType: 'MangoIndex',
+    this.database = options.database;
+    this.params = _.extend({limit: defaultLimit}, options.params);
+  },
 
-    url: function () {
-      return this.urlRef.apply(this, arguments);
-    },
+  collectionType: 'MangoIndex',
 
-    updateSeq: function () {
-      return false;
-    },
+  url: function () {
+    return this.urlRef.apply(this, arguments);
+  },
 
-    //@deprecated, see isJSONDocEditable
-    isEditable: function () {
-      return false;
-    },
+  updateSeq: function () {
+    return false;
+  },
 
-    parse: function (res) {
-      return res.indexes;
-    },
+  //@deprecated, see isJSONDocEditable
+  isEditable: function () {
+    return false;
+  },
 
-    urlRef: function (context, params) {
-      var database = this.database.safeID(),
-          query = '';
+  parse: function (res) {
+    return res.indexes;
+  },
 
-      if (!context) {
-        context = 'index-server';
-      }
+  urlRef: function (context, params) {
+    var database = this.database.safeID(),
+        query = '';
 
-      return FauxtonAPI.urls('mango', context, database, query);
+    if (!context) {
+      context = 'index-server';
     }
-  });
 
-  // MANGO INDEX EDITOR
-  Documents.MangoDoc = Documents.Doc.extend({
-    isMangoDoc: function () {
-      return true;
-    }
-  });
+    return FauxtonAPI.urls('mango', context, database, query);
+  }
+});
 
-  Documents.MangoDocumentCollection = PagingCollection.extend({
-    model: Documents.MangoDoc,
+// MANGO INDEX EDITOR
+Documents.MangoDoc = Documents.Doc.extend({
+  isMangoDoc: function () {
+    return true;
+  }
+});
 
-    collectionType: 'MangoDocumentCollection',
+Documents.MangoDocumentCollection = PagingCollection.extend({
+  model: Documents.MangoDoc,
 
-    initialize: function (_attr, options) {
-      var defaultLimit = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
+  collectionType: 'MangoDocumentCollection',
 
-      this.database = options.database;
-      this.params = _.extend({limit: defaultLimit}, options.params);
+  initialize: function (_attr, options) {
+    var defaultLimit = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
 
-      this.paging = _.defaults((options.paging || {}), {
-        defaultParams: _.defaults({}, options.params),
-        hasNext: false,
-        hasPrevious: false,
-        params: {},
-        pageSize: FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE,
-        direction: undefined
-      });
+    this.database = options.database;
+    this.params = _.extend({limit: defaultLimit}, options.params);
 
-      this.paging.params = _.clone(this.paging.defaultParams);
-    },
+    this.paging = _.defaults((options.paging || {}), {
+      defaultParams: _.defaults({}, options.params),
+      hasNext: false,
+      hasPrevious: false,
+      params: {},
+      pageSize: FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE,
+      direction: undefined
+    });
 
-    url: function () {
-      return this.urlRef.apply(this, arguments);
-    },
+    this.paging.params = _.clone(this.paging.defaultParams);
+  },
 
-    updateSeq: function () {
-      return false;
-    },
-
-    isEditable: function () {
-      return true;
-    },
-
-    setQuery: function (query) {
-      this.query = query;
-      return this;
-    },
+  url: function () {
+    return this.urlRef.apply(this, arguments);
+  },
 
-    pageSizeReset: function (pageSize, opts) {
-      var options = _.defaults((opts || {}), {fetch: true});
-      this.paging.direction = undefined;
-      this.paging.pageSize = pageSize;
-      this.paging.params = this.paging.defaultParams;
-      this.paging.params.limit = pageSize;
+  updateSeq: function () {
+    return false;
+  },
 
-      if (options.fetch) {
-        return this.fetch();
-      }
-    },
+  isEditable: function () {
+    return true;
+  },
 
-    _iterate: function (offset, opts) {
-      var options = _.defaults((opts || {}), {fetch: true});
+  setQuery: function (query) {
+    this.query = query;
+    return this;
+  },
 
-      this.paging.params = this.calculateParams(this.paging.params, offset, this.paging.pageSize);
+  pageSizeReset: function (pageSize, opts) {
+    var options = _.defaults((opts || {}), {fetch: true});
+    this.paging.direction = undefined;
+    this.paging.pageSize = pageSize;
+    this.paging.params = this.paging.defaultParams;
+    this.paging.params.limit = pageSize;
 
+    if (options.fetch) {
       return this.fetch();
-    },
-
-    getPaginatedQuery: function () {
-      var paginatedQuery = JSON.parse(JSON.stringify(this.query));
-
-      if (!this.paging.direction && this.paging.params.limit > 0) {
-        this.paging.direction = 'fetch';
-        this.paging.params.limit = this.paging.params.limit + 1;
-      }
-
-      // just update if NOT provided by editor
-      if (!paginatedQuery.limit) {
-        paginatedQuery.limit = this.paging.params.limit;
-      }
-
-      if (!paginatedQuery.skip) {
-        paginatedQuery.skip = this.paging.params.skip;
-      }
-
-      return paginatedQuery;
-    },
-
-    fetch: function () {
-      var url = this.urlRef(),
-                promise = FauxtonAPI.Deferred(),
-                query = this.getPaginatedQuery();
-
-      $.ajax({
-        type: 'POST',
-        url: url,
-        contentType: 'application/json',
-        dataType: 'json',
-        data: JSON.stringify(query),
-      })
-      .then(function (res) {
-        this.handleResponse(res, promise);
-      }.bind(this))
-      .fail(function (res) {
-        promise.reject(res.responseJSON);
-      }.bind(this));
-
-      return promise;
-    },
-
-    parse: function (resp) {
-      var rows = resp.docs;
-
-      this.paging.hasNext = this.paging.hasPrevious = false;
-
-      this.viewMeta = {
-        total_rows: resp.total_rows,
-        offset: resp.offset,
-        update_seq: resp.update_seq
-      };
-
-      var skipLimit = this.paging.defaultParams.skip || 0;
-      if (this.paging.params.skip > skipLimit) {
-        this.paging.hasPrevious = true;
-      }
-
-      if (rows.length === this.paging.pageSize + 1) {
-        this.paging.hasNext = true;
+    }
+  },
 
-        // remove the next page marker result
-        rows.pop();
-        this.viewMeta.total_rows = this.viewMeta.total_rows - 1;
-      }
+  _iterate: function (offset, opts) {
+    var options = _.defaults((opts || {}), {fetch: true});
 
-      return rows;
-    },
+    this.paging.params = this.calculateParams(this.paging.params, offset, this.paging.pageSize);
 
-    handleResponse: function (res, promise) {
-      var models = this.parse(res);
+    return this.fetch();
+  },
 
-      this.reset(models);
-
-      promise.resolve();
-    },
+  getPaginatedQuery: function () {
+    var paginatedQuery = JSON.parse(JSON.stringify(this.query));
 
-    urlRef: function (context) {
-      var database = this.database.safeID(),
-          query = '';
-
-      if (!context) {
-        context = 'query-server';
-      }
+    if (!this.paging.direction && this.paging.params.limit > 0) {
+      this.paging.direction = 'fetch';
+      this.paging.params.limit = this.paging.params.limit + 1;
+    }
 
-      return FauxtonAPI.urls('mango', context, database, query);
+    // just update if NOT provided by editor
+    if (!paginatedQuery.limit) {
+      paginatedQuery.limit = this.paging.params.limit;
     }
-  });
 
-  Documents.NewDoc = Documents.Doc.extend({
-    fetch: function () {
-      var uuid = new FauxtonAPI.UUID();
-      var deferred = this.deferred = $.Deferred();
-      var that = this;
+    if (!paginatedQuery.skip) {
+      paginatedQuery.skip = this.paging.params.skip;
+    }
 
-      uuid.fetch().done(function () {
-        that.set("_id", uuid.next());
-        deferred.resolve();
-      });
+    return paginatedQuery;
+  },
+
+  fetch: function () {
+    var url = this.urlRef(),
+              promise = FauxtonAPI.Deferred(),
+              query = this.getPaginatedQuery();
+
+    $.ajax({
+      type: 'POST',
+      url: url,
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(query),
+    })
+    .then(function (res) {
+      this.handleResponse(res, promise);
+    }.bind(this))
+    .fail(function (res) {
+      promise.reject(res.responseJSON);
+    }.bind(this));
+
+    return promise;
+  },
+
+  parse: function (resp) {
+    var rows = resp.docs;
+
+    this.paging.hasNext = this.paging.hasPrevious = false;
+
+    this.viewMeta = {
+      total_rows: resp.total_rows,
+      offset: resp.offset,
+      update_seq: resp.update_seq
+    };
 
-      return deferred.promise();
+    var skipLimit = this.paging.defaultParams.skip || 0;
+    if (this.paging.params.skip > skipLimit) {
+      this.paging.hasPrevious = true;
     }
 
-  });
+    if (rows.length === this.paging.pageSize + 1) {
+      this.paging.hasNext = true;
 
-  Documents.BulkDeleteDoc = FauxtonAPI.Model.extend({
-    idAttribute: "_id"
-  });
+      // remove the next page marker result
+      rows.pop();
+      this.viewMeta.total_rows = this.viewMeta.total_rows - 1;
+    }
 
-  Documents.BulkDeleteDocCollection = FauxtonAPI.Collection.extend({
+    return rows;
+  },
 
-    model: Documents.BulkDeleteDoc,
+  handleResponse: function (res, promise) {
+    var models = this.parse(res);
 
-    sync: function ()�{
+    this.reset(models);
 
-    },
+    promise.resolve();
+  },
 
-    initialize: function (models, options) {
-      this.databaseId = options.databaseId;
-    },
+  urlRef: function (context) {
+    var database = this.database.safeID(),
+        query = '';
 
-    url: function () {
-      return app.host + '/' + this.databaseId + '/_bulk_docs';
-    },
+    if (!context) {
+      context = 'query-server';
+    }
 
-    bulkDelete: function () {
-      var payload = this.createPayload(this.toJSON()),
-          promise = FauxtonAPI.Deferred(),
-          that = this;
-
-      $.ajax({
-        type: 'POST',
-        url: this.url(),
-        contentType: 'application/json',
-        dataType: 'json',
-        data: JSON.stringify(payload),
-      })
-      .then(function (res) {
-        that.handleResponse(res, promise);
-      })
-      .fail(function () {
-        var ids = _.reduce(that.toArray(), function (acc, doc) {
-          acc.push(doc.id);
-          return acc;
-        }, []);
-        that.trigger('error', ids);
-        promise.reject(ids);
-      });
+    return FauxtonAPI.urls('mango', context, database, query);
+  }
+});
 
-      return promise;
-    },
+Documents.NewDoc = Documents.Doc.extend({
+  fetch: function () {
+    var uuid = new FauxtonAPI.UUID();
+    var deferred = this.deferred = $.Deferred();
+    var that = this;
 
-    handleResponse: function (res, promise) {
-      var ids = _.reduce(res, function (ids, doc) {
-        if (doc.error) {
-          ids.errorIds.push(doc.id);
-        }
+    uuid.fetch().done(function () {
+      that.set("_id", uuid.next());
+      deferred.resolve();
+    });
 
-        if (!doc.error) {
-          ids.successIds.push(doc.id);
-        }
+    return deferred.promise();
+  }
 
-        return ids;
-      }, {errorIds: [], successIds: []});
+});
 
-      this.removeDocuments(ids.successIds);
+Documents.BulkDeleteDoc = FauxtonAPI.Model.extend({
+  idAttribute: "_id"
+});
 
-      if (ids.errorIds.length) {
-        this.trigger('error', ids.errorIds);
+Documents.BulkDeleteDocCollection = FauxtonAPI.Collection.extend({
+
+  model: Documents.BulkDeleteDoc,
+
+  sync: function ()�{
+
+  },
+
+  initialize: function (models, options) {
+    this.databaseId = options.databaseId;
+  },
+
+  url: function () {
+    return app.host + '/' + this.databaseId + '/_bulk_docs';
+  },
+
+  bulkDelete: function () {
+    var payload = this.createPayload(this.toJSON()),
+        promise = FauxtonAPI.Deferred(),
+        that = this;
+
+    $.ajax({
+      type: 'POST',
+      url: this.url(),
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(payload),
+    })
+    .then(function (res) {
+      that.handleResponse(res, promise);
+    })
+    .fail(function () {
+      var ids = _.reduce(that.toArray(), function (acc, doc) {
+        acc.push(doc.id);
+        return acc;
+      }, []);
+      that.trigger('error', ids);
+      promise.reject(ids);
+    });
+
+    return promise;
+  },
+
+  handleResponse: function (res, promise) {
+    var ids = _.reduce(res, function (ids, doc) {
+      if (doc.error) {
+        ids.errorIds.push(doc.id);
       }
 
-      // This is kind of tricky. If there are no documents deleted then rejects
-      // otherwise resolve with list of successful and failed documents
-      if (!_.isEmpty(ids.successIds)) {
-        promise.resolve(ids);
-      } else {
-        promise.reject(ids.errorIds);
+      if (!doc.error) {
+        ids.successIds.push(doc.id);
       }
 
-      this.trigger('updated');
-    },
-
-    removeDocuments: function (ids) {
-      var reloadDesignDocs = false;
-      _.each(ids, function (id) {
-        if (/_design/.test(id)) {
-          reloadDesignDocs = true;
-        }
+      return ids;
+    }, {errorIds: [], successIds: []});
 
-        this.remove(this.get(id));
-      }, this);
-
-      if (reloadDesignDocs) {
-        FauxtonAPI.triggerRouteEvent('reloadDesignDocs');
-      }
+    this.removeDocuments(ids.successIds);
 
-      this.trigger('removed', ids);
-    },
-
-    createPayload: function (documents) {
-      var documentList = documents;
-
-      return {
-        docs: documentList
-      };
+    if (ids.errorIds.length) {
+      this.trigger('error', ids.errorIds);
     }
-  });
 
-  Documents.MangoBulkDeleteDocCollection = Documents.BulkDeleteDocCollection.extend({
-    url: function () {
-      return app.host + '/' + this.databaseId + '/_index/_bulk_delete';
-    },
-
-    createPayload: function (documents) {
-      var documentList = documents
-        .filter(function (doc) {
-          return doc._id !== '_all_docs';
-        })
-        .map(function (doc) {
-          return doc._id;
-        });
-
-      return {
-        docids: documentList
-      };
+    // This is kind of tricky. If there are no documents deleted then rejects
+    // otherwise resolve with list of successful and failed documents
+    if (!_.isEmpty(ids.successIds)) {
+      promise.resolve(ids);
+    } else {
+      promise.reject(ids.errorIds);
     }
 
-  });
+    this.trigger('updated');
+  },
 
-  Documents.IndexCollection = PagingCollection.extend({
-    model: Documents.Doc,
-    documentation: function () {
-      return FauxtonAPI.constants.DOC_URLS.GENERAL;
-    },
-    initialize: function (_models, options) {
-      this.database = options.database;
-      this.params = _.extend({limit: 20, reduce: false}, options.params);
+  removeDocuments: function (ids) {
+    var reloadDesignDocs = false;
+    _.each(ids, function (id) {
+      if (/_design/.test(id)) {
+        reloadDesignDocs = true;
+      }
 
-      this.idxType = "_view";
-      this.view = options.view;
-      this.design = options.design.replace('_design/', '');
-      this.perPageLimit = options.perPageLimit || 20;
+      this.remove(this.get(id));
+    }, this);
 
-      if (!this.params.limit) {
-        this.params.limit = this.perPageLimit;
-      }
-    },
+    if (reloadDesignDocs) {
+      FauxtonAPI.triggerRouteEvent('reloadDesignDocs');
+    }
 
-    isEditable: function () {
-      return !this.params.reduce;
-    },
+    this.trigger('removed', ids);
+  },
 
-    urlRef: function (context, params) {
-      var query = "";
-
-      if (params) {
-        if (!_.isEmpty(params)) {
-          query = "?" + $.param(params);
-        } else {
-          query = '';
-        }
-      } else if (this.params) {
-        var parsedParam = Documents.QueryParams.stringify(this.params);
-        query = "?" + $.param(parsedParam);
-      }
+  createPayload: function (documents) {
+    var documentList = documents;
 
-      if (!context) {
-        context = 'server';
-      }
+    return {
+      docs: documentList
+    };
+  }
+});
 
-      var database = this.database.safeID(),
-          design = app.utils.safeURLName(this.design),
-          view = app.utils.safeURLName(this.view),
-          url = FauxtonAPI.urls('view', context, database, design, view);
+Documents.MangoBulkDeleteDocCollection = Documents.BulkDeleteDocCollection.extend({
+  url: function () {
+    return app.host + '/' + this.databaseId + '/_index/_bulk_delete';
+  },
 
-      return url + query;
-    },
+  createPayload: function (documents) {
+    var documentList = documents
+      .filter(function (doc) {
+        return doc._id !== '_all_docs';
+      })
+      .map(function (doc) {
+        return doc._id;
+      });
 
-    url: function () {
-      return this.urlRef.apply(this, arguments);
-    },
+    return {
+      docids: documentList
+    };
+  }
 
-    totalRows: function () {
-      if (this.params.reduce) { return "unknown_reduce";}
+});
 
-      return this.viewMeta.total_rows || "unknown";
-    },
+Documents.IndexCollection = PagingCollection.extend({
+  model: Documents.Doc,
+  documentation: function () {
+    return FauxtonAPI.constants.DOC_URLS.GENERAL;
+  },
+  initialize: function (_models, options) {
+    this.database = options.database;
+    this.params = _.extend({limit: 20, reduce: false}, options.params);
+
+    this.idxType = "_view";
+    this.view = options.view;
+    this.design = options.design.replace('_design/', '');
+    this.perPageLimit = options.perPageLimit || 20;
+
+    if (!this.params.limit) {
+      this.params.limit = this.perPageLimit;
+    }
+  },
 
-    updateSeq: function () {
-      if (!this.viewMeta) {
-        return false;
-      }
+  isEditable: function () {
+    return !this.params.reduce;
+  },
 
-      return this.viewMeta.update_seq || false;
-    },
+  urlRef: function (context, params) {
+    var query = "";
 
-    simple: function () {
-      var docs = this.map(function (item) {
-        return {
-          _id: item.id,
-          key: item.get('key'),
-          value: item.get('value')
-        };
-      });
+    if (params) {
+      if (!_.isEmpty(params)) {
+        query = "?" + $.param(params);
+      } else {
+        query = '';
+      }
+    } else if (this.params) {
+      var parsedParam = Documents.QueryParams.stringify(this.params);
+      query = "?" + $.param(parsedParam);
+    }
 
-      return new Documents.IndexCollection(docs, {
-        database: this.database,
-        params: this.params,
-        view: this.view,
-        design: this.design
-      });
-    },
+    if (!context) {
+      context = 'server';
+    }
 
-    parse: function (resp) {
-      var rows = resp.rows;
-      this.endTime = new Date().getTime();
-      this.requestDuration = (this.endTime - this.startTime);
+    var database = this.database.safeID(),
+        design = app.utils.safeURLName(this.design),
+        view = app.utils.safeURLName(this.view),
+        url = FauxtonAPI.urls('view', context, database, design, view);
 
-      return PagingCollection.prototype.parse.apply(this, arguments);
-    },
+    return url + query;
+  },
 
-    buildAllDocs: function () {
-      this.fetch();
-    },
+  url: function () {
+    return this.urlRef.apply(this, arguments);
+  },
 
-    // We implement our own fetch to store the starttime so we that
-    // we can get the request duration
-    fetch: function () {
-      this.startTime = new Date().getTime();
-      return PagingCollection.prototype.fetch.call(this);
-    },
+  totalRows: function () {
+    if (this.params.reduce) { return "unknown_reduce";}
 
-    allDocs: function () {
-      return this.models;
-    },
+    return this.viewMeta.total_rows || "unknown";
+  },
 
-    // This is taken from futon.browse.js $.timeString
-    requestDurationInString: function () {
-      var ms, sec, min, h, timeString, milliseconds = this.requestDuration;
+  updateSeq: function () {
+    if (!this.viewMeta) {
+      return false;
+    }
 
-      sec = Math.floor(milliseconds / 1000.0);
-      min = Math.floor(sec / 60.0);
-      sec = (sec % 60.0).toString();
-      if (sec.length < 2) {
-        sec = "0" + sec;
-      }
+    return this.viewMeta.update_seq || false;
+  },
 
-      h = (Math.floor(min / 60.0)).toString();
-      if (h.length < 2) {
-        h = "0" + h;
-      }
+  simple: function () {
+    var docs = this.map(function (item) {
+      return {
+        _id: item.id,
+        key: item.get('key'),
+        value: item.get('value')
+      };
+    });
+
+    return new Documents.IndexCollection(docs, {
+      database: this.database,
+      params: this.params,
+      view: this.view,
+      design: this.design
+    });
+  },
+
+  parse: function (resp) {
+    var rows = resp.rows;
+    this.endTime = new Date().getTime();
+    this.requestDuration = (this.endTime - this.startTime);
+
+    return PagingCollection.prototype.parse.apply(this, arguments);
+  },
+
+  buildAllDocs: function () {
+    this.fetch();
+  },
+
+  // We implement our own fetch to store the starttime so we that
+  // we can get the request duration
+  fetch: function () {
+    this.startTime = new Date().getTime();
+    return PagingCollection.prototype.fetch.call(this);
+  },
+
+  allDocs: function () {
+    return this.models;
+  },
+
+  // This is taken from futon.browse.js $.timeString
+  requestDurationInString: function () {
+    var ms, sec, min, h, timeString, milliseconds = this.requestDuration;
+
+    sec = Math.floor(milliseconds / 1000.0);
+    min = Math.floor(sec / 60.0);
+    sec = (sec % 60.0).toString();
+    if (sec.length < 2) {
+      sec = "0" + sec;
+    }
 
-      min = (min % 60.0).toString();
-      if (min.length < 2) {
-        min = "0" + min;
-      }
+    h = (Math.floor(min / 60.0)).toString();
+    if (h.length < 2) {
+      h = "0" + h;
+    }
 
-      timeString = h + ":" + min + ":" + sec;
+    min = (min % 60.0).toString();
+    if (min.length < 2) {
+      min = "0" + min;
+    }
 
-      ms = (milliseconds % 1000.0).toString();
-      while (ms.length < 3) {
-        ms = "0" + ms;
-      }
-      timeString += "." + ms;
+    timeString = h + ":" + min + ":" + sec;
 
-      return timeString;
+    ms = (milliseconds % 1000.0).toString();
+    while (ms.length < 3) {
+      ms = "0" + ms;
     }
+    timeString += "." + ms;
 
-  });
+    return timeString;
+  }
 
-  return Documents;
 });
+
+export default Documents;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/rev-browser/rev-browser.actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/rev-browser/rev-browser.actions.js b/app/addons/documents/rev-browser/rev-browser.actions.js
index 29c9b2b..794fa7b 100644
--- a/app/addons/documents/rev-browser/rev-browser.actions.js
+++ b/app/addons/documents/rev-browser/rev-browser.actions.js
@@ -12,157 +12,152 @@
 
 /* global FormData */
 
-define([
-  '../../../app',
-  '../../../core/api',
-  './rev-browser.actiontypes',
-  'visualizeRevTree/lib/getTree',
-  'pouchdb'
-],
-(app, FauxtonAPI, ActionTypes, getTree, PouchDB) => {
-
-  let db;
-
-  function initDiffEditor (dbName, docId) {
-    const url = FauxtonAPI.urls('databaseBaseURL', 'server', dbName);
-    db = PouchDB(url);
-
-    // XXX: we need spec compliant promise support and get rid of jQ "deferreds"
-    const d1 = $.Deferred();
-    const d2 = $.Deferred();
-    $.when(d1, d2).done((tree, doc) => {
-      const conflictingRevs = getConflictingRevs(tree.paths, tree.winner, Object.keys(tree.deleted));
-      const initialRev = conflictingRevs[0];
-
-      if (!initialRev) {
-        return dispatchData(tree, doc, conflictingRevs, null, dbName);
-      }
-
-      db.get(doc._id, {rev: initialRev})
-        .then((conflictDoc) => {
-          dispatchData(tree, doc, conflictingRevs, conflictDoc, dbName);
-        });
-    });
-
-    db.get(docId)
-      .then(d2.resolve);
-
-    getTree(db, docId)
-      .then(d1.resolve);
-  }
-
-  function getConflictingRevs (paths, winner, deleted) {
-
-    return paths.reduce((acc, el) => {
-      if (el[0] !== winner) {
-        acc.push(el[0]);
-      }
-
-      return acc;
-    }, [])
-    .filter((el) => {
-      return deleted.indexOf(el) === -1;
-    });
-  }
-
-  function dispatchData (tree, doc, conflictingRevs, conflictDoc, databaseName) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.REV_BROWSER_REV_TREE_LOADED,
-      options: {
-        tree: tree,
-        doc: doc,
-        conflictDoc: conflictDoc,
-        conflictingRevs: conflictingRevs,
-        databaseName: databaseName
-      }
-    });
-  }
-
-  function toggleDiffView (enableDiff) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.REV_BROWSER_DIFF_ENABLE_DIFF_VIEW,
-      options: {
-        enableDiff: enableDiff
-      }
-    });
-  }
-
-  function chooseLeaves (doc, revTheirs) {
-    db.get(doc._id, {rev: revTheirs})
-      .then((res) => {
-        dispatchDocsToDiff(doc, res);
+import app from "../../../app";
+import FauxtonAPI from "../../../core/api";
+import ActionTypes from "./rev-browser.actiontypes";
+import getTree from "visualizeRevTree/lib/getTree";
+import PouchDB from "pouchdb";
+
+let db;
+
+function initDiffEditor (dbName, docId) {
+  const url = FauxtonAPI.urls('databaseBaseURL', 'server', dbName);
+  db = PouchDB(url);
+
+  // XXX: we need spec compliant promise support and get rid of jQ "deferreds"
+  const d1 = $.Deferred();
+  const d2 = $.Deferred();
+  $.when(d1, d2).done((tree, doc) => {
+    const conflictingRevs = getConflictingRevs(tree.paths, tree.winner, Object.keys(tree.deleted));
+    const initialRev = conflictingRevs[0];
+
+    if (!initialRev) {
+      return dispatchData(tree, doc, conflictingRevs, null, dbName);
+    }
+
+    db.get(doc._id, {rev: initialRev})
+      .then((conflictDoc) => {
+        dispatchData(tree, doc, conflictingRevs, conflictDoc, dbName);
       });
-  }
-
-  function dispatchDocsToDiff (doc, theirs) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.REV_BROWSER_DIFF_DOCS_READY,
-      options: {
-        theirs: theirs,
-        ours: doc
-      }
-    });
-  }
-
-  function showConfirmModal (show, docToWin) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.REV_BROWSER_SHOW_CONFIRM_MODAL,
-      options: {
-        show: show,
-        docToWin: docToWin
-      }
-    });
-  }
-
-  function selectRevAsWinner (databaseName, docId, paths, revToWin) {
-    const revsToDelete = getConflictingRevs(paths, revToWin, []);
-    const payload = buildBulkDeletePayload(docId, revsToDelete);
-
-    $.ajax({
-      url: FauxtonAPI.urls('bulk_docs', 'server', databaseName, ''),
-      type: 'POST',
-      contentType: 'application/json; charset=UTF-8',
-      data: JSON.stringify(payload),
-      success: () => {
-        FauxtonAPI.addNotification({
-          msg: 'Conflicts successfully solved.',
-          clear: true
-        });
-        showConfirmModal(false, null);
-        FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', databaseName, ''));
-      },
-      error: (resp) => {
-        FauxtonAPI.addNotification({
-          msg: 'Failed to delete clean up conflicts!',
-          type: 'error',
-          clear: true
-        });
-      }
+  });
+
+  db.get(docId)
+    .then(d2.resolve);
+
+  getTree(db, docId)
+    .then(d1.resolve);
+}
+
+function getConflictingRevs (paths, winner, deleted) {
+
+  return paths.reduce((acc, el) => {
+    if (el[0] !== winner) {
+      acc.push(el[0]);
+    }
+
+    return acc;
+  }, [])
+  .filter((el) => {
+    return deleted.indexOf(el) === -1;
+  });
+}
+
+function dispatchData (tree, doc, conflictingRevs, conflictDoc, databaseName) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.REV_BROWSER_REV_TREE_LOADED,
+    options: {
+      tree: tree,
+      doc: doc,
+      conflictDoc: conflictDoc,
+      conflictingRevs: conflictingRevs,
+      databaseName: databaseName
+    }
+  });
+}
+
+function toggleDiffView (enableDiff) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.REV_BROWSER_DIFF_ENABLE_DIFF_VIEW,
+    options: {
+      enableDiff: enableDiff
+    }
+  });
+}
+
+function chooseLeaves (doc, revTheirs) {
+  db.get(doc._id, {rev: revTheirs})
+    .then((res) => {
+      dispatchDocsToDiff(doc, res);
     });
-  }
-
-  function buildBulkDeletePayload (docId, revs) {
-    const list = revs.map((rev) => {
-      return {
-        "_id": docId,
-        "_rev": rev,
-        "_deleted": true
-      };
-    });
-
-    return { "docs": list };
-  }
-
-  return {
-    getConflictingRevs: getConflictingRevs,
-    selectRevAsWinner: selectRevAsWinner,
-    buildBulkDeletePayload: buildBulkDeletePayload,
-    chooseLeaves: chooseLeaves,
-    dispatchDocsToDiff: dispatchDocsToDiff,
-    initDiffEditor: initDiffEditor,
-    dispatchData: dispatchData,
-    toggleDiffView: toggleDiffView,
-    showConfirmModal: showConfirmModal
-  };
-
-});
+}
+
+function dispatchDocsToDiff (doc, theirs) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.REV_BROWSER_DIFF_DOCS_READY,
+    options: {
+      theirs: theirs,
+      ours: doc
+    }
+  });
+}
+
+function showConfirmModal (show, docToWin) {
+  FauxtonAPI.dispatch({
+    type: ActionTypes.REV_BROWSER_SHOW_CONFIRM_MODAL,
+    options: {
+      show: show,
+      docToWin: docToWin
+    }
+  });
+}
+
+function selectRevAsWinner (databaseName, docId, paths, revToWin) {
+  const revsToDelete = getConflictingRevs(paths, revToWin, []);
+  const payload = buildBulkDeletePayload(docId, revsToDelete);
+
+  $.ajax({
+    url: FauxtonAPI.urls('bulk_docs', 'server', databaseName, ''),
+    type: 'POST',
+    contentType: 'application/json; charset=UTF-8',
+    data: JSON.stringify(payload),
+    success: () => {
+      FauxtonAPI.addNotification({
+        msg: 'Conflicts successfully solved.',
+        clear: true
+      });
+      showConfirmModal(false, null);
+      FauxtonAPI.navigate(FauxtonAPI.urls('allDocs', 'app', databaseName, ''));
+    },
+    error: (resp) => {
+      FauxtonAPI.addNotification({
+        msg: 'Failed to delete clean up conflicts!',
+        type: 'error',
+        clear: true
+      });
+    }
+  });
+}
+
+function buildBulkDeletePayload (docId, revs) {
+  const list = revs.map((rev) => {
+    return {
+      "_id": docId,
+      "_rev": rev,
+      "_deleted": true
+    };
+  });
+
+  return { "docs": list };
+}
+
+export default {
+  getConflictingRevs: getConflictingRevs,
+  selectRevAsWinner: selectRevAsWinner,
+  buildBulkDeletePayload: buildBulkDeletePayload,
+  chooseLeaves: chooseLeaves,
+  dispatchDocsToDiff: dispatchDocsToDiff,
+  initDiffEditor: initDiffEditor,
+  dispatchData: dispatchData,
+  toggleDiffView: toggleDiffView,
+  showConfirmModal: showConfirmModal
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/rev-browser/rev-browser.actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/rev-browser/rev-browser.actiontypes.js b/app/addons/documents/rev-browser/rev-browser.actiontypes.js
index ddbba16..b54a609 100644
--- a/app/addons/documents/rev-browser/rev-browser.actiontypes.js
+++ b/app/addons/documents/rev-browser/rev-browser.actiontypes.js
@@ -10,11 +10,9 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([], () => {
-  return {
-    REV_BROWSER_REV_TREE_LOADED: 'REV_TREE_LOADED',
-    REV_BROWSER_DIFF_DOCS_READY: 'REV_BROWSER_DIFF_DOCS_READY',
-    REV_BROWSER_DIFF_ENABLE_DIFF_VIEW: 'REV_BROWSER_DIFF_ENABLE_DIFF_VIEW',
-    REV_BROWSER_SHOW_CONFIRM_MODAL: 'REV_BROWSER_SHOW_CONFIRM_MODAL'
-  };
-});
+export default {
+  REV_BROWSER_REV_TREE_LOADED: 'REV_TREE_LOADED',
+  REV_BROWSER_DIFF_DOCS_READY: 'REV_BROWSER_DIFF_DOCS_READY',
+  REV_BROWSER_DIFF_ENABLE_DIFF_VIEW: 'REV_BROWSER_DIFF_ENABLE_DIFF_VIEW',
+  REV_BROWSER_SHOW_CONFIRM_MODAL: 'REV_BROWSER_SHOW_CONFIRM_MODAL'
+};


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/componentsSpec.react.jsx b/app/addons/fauxton/tests/componentsSpec.react.jsx
index 74e0cf7..83eb514 100644
--- a/app/addons/fauxton/tests/componentsSpec.react.jsx
+++ b/app/addons/fauxton/tests/componentsSpec.react.jsx
@@ -9,271 +9,267 @@
 // 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',
-  '../components.react',
-  '../../../../test/mocha/testUtils',
-  'react',
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, utils, React, ReactDOM, TestUtils, sinon) {
-  var assert = utils.assert;
+import FauxtonAPI from "../../../core/api";
+import Views from "../components.react";
+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";
+var assert = utils.assert;
 
-  describe('Tray', function () {
+describe('Tray', function () {
 
-    var container, trayEl, oldToggleSpeed;
+  var container, trayEl, oldToggleSpeed;
 
-    beforeEach(function () {
-      container = document.createElement('div');
+  beforeEach(function () {
+    container = document.createElement('div');
 
-      // when we want to control the diff, we have to render directly
-      trayEl = TestUtils.renderIntoDocument(<Views.Tray className="traytest" />, container);
+    // when we want to control the diff, we have to render directly
+    trayEl = TestUtils.renderIntoDocument(<Views.Tray className="traytest" />, container);
 
-      oldToggleSpeed = FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED;
+    oldToggleSpeed = FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED;
 
-      // makes velocity toggle immediately
-      FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED = 0;
-    });
+    // makes velocity toggle immediately
+    FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED = 0;
+  });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-      FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED = oldToggleSpeed;
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+    FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED = oldToggleSpeed;
+  });
 
-    it('renders trayid and custom classes', function () {
-      assert(ReactDOM.findDOMNode(trayEl).getAttribute('class').indexOf('traytest') >= 0);
-    });
+  it('renders trayid and custom classes', function () {
+    assert(ReactDOM.findDOMNode(trayEl).getAttribute('class').indexOf('traytest') >= 0);
+  });
 
-    it('is initially closed', function () {
-      assert.equal('none', ReactDOM.findDOMNode(trayEl).style.display);
-    });
+  it('is initially closed', function () {
+    assert.equal('none', ReactDOM.findDOMNode(trayEl).style.display);
+  });
 
-    it('shows when requested', function () {
-      trayEl.setVisible(true, function () {
-        assert.equal('block', ReactDOM.findDOMNode(trayEl).style.display);
-      });
+  it('shows when requested', function () {
+    trayEl.setVisible(true, function () {
+      assert.equal('block', ReactDOM.findDOMNode(trayEl).style.display);
     });
+  });
 
-    it('hides when requested', function () {
-      trayEl.show(function () {
-        trayEl.setVisible(false, function () {
-          assert.equal('none', ReactDOM.findDOMNode(trayEl).style.display);
-        });
+  it('hides when requested', function () {
+    trayEl.show(function () {
+      trayEl.setVisible(false, function () {
+        assert.equal('none', ReactDOM.findDOMNode(trayEl).style.display);
       });
     });
+  });
 
-    it('does nothing when already hidden', function () {
-      trayEl.setVisible(false, function () {
-        throw new Error('should do nothing');
-      });
+  it('does nothing when already hidden', function () {
+    trayEl.setVisible(false, function () {
+      throw new Error('should do nothing');
     });
+  });
 
-    it('toggles open with callback', function () {
-      trayEl.toggle(function () {
-        assert.equal('block', ReactDOM.findDOMNode(trayEl).style.display);
-      });
+  it('toggles open with callback', function () {
+    trayEl.toggle(function () {
+      assert.equal('block', ReactDOM.findDOMNode(trayEl).style.display);
     });
+  });
 
-    it('toggles close again with callback', function () {
-      trayEl.show(function () {
-        trayEl.toggle(function () {
-          assert.equal('none', ReactDOM.findDOMNode(trayEl).style.display);
-        });
+  it('toggles close again with callback', function () {
+    trayEl.show(function () {
+      trayEl.toggle(function () {
+        assert.equal('none', ReactDOM.findDOMNode(trayEl).style.display);
       });
     });
+  });
 
-    it('calls props.onAutoHide when closing tray by clicking outside of it', function () {
-      var container = document.createElement('div');
-      var onClose = function () { };
-      var spy = sinon.spy();
-
-      var wrapper = React.createClass({
-
-        runTest: function () {
-          var trayEl = this.refs.tray;
-          var externalEl = this.refs.externalElement;
-          trayEl.show(function () {
-            TestUtils.Simulate.click(ReactDOM.findDOMNode(externalEl));
-            assert.ok(spy.calledOnce);
-          });
-        },
-
-        render: function () {
-          return (
-            <div>
-              <p ref="externalElement">Click me!</p>
-              <Views.Tray ref="tray" onAutoHide={onClose} />
-            </div>
-          );
-        }
-      });
+  it('calls props.onAutoHide when closing tray by clicking outside of it', function () {
+    var container = document.createElement('div');
+    var onClose = function () { };
+    var spy = sinon.spy();
 
-      var reactEl = TestUtils.renderIntoDocument(React.createElement(wrapper), container);
-      reactEl.runTest();
+    var wrapper = React.createClass({
 
-      ReactDOM.unmountComponentAtNode(container);
+      runTest: function () {
+        var trayEl = this.refs.tray;
+        var externalEl = this.refs.externalElement;
+        trayEl.show(function () {
+          TestUtils.Simulate.click(ReactDOM.findDOMNode(externalEl));
+          assert.ok(spy.calledOnce);
+        });
+      },
+
+      render: function () {
+        return (
+          <div>
+            <p ref="externalElement">Click me!</p>
+            <Views.Tray ref="tray" onAutoHide={onClose} />
+          </div>
+        );
+      }
     });
 
+    var reactEl = TestUtils.renderIntoDocument(React.createElement(wrapper), container);
+    reactEl.runTest();
+
+    ReactDOM.unmountComponentAtNode(container);
   });
 
-  describe('Pagination', function () {
+});
 
-    var nvl, container;
+describe('Pagination', function () {
 
-    beforeEach(function () {
-      // helper for empty strings
-      nvl = function (str) {
-        return str === null ? "" : str;
-      };
-      container = document.createElement('div');
-      // create element individually to parameterize
-    });
+  var nvl, container;
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+  beforeEach(function () {
+    // helper for empty strings
+    nvl = function (str) {
+      return str === null ? "" : str;
+    };
+    container = document.createElement('div');
+    // create element individually to parameterize
+  });
 
-    it('renders 20-wise pages per default', function () {
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination page={3} total={55} urlPrefix="?prefix=" urlSuffix="&suffix=88" />,
-        container
-      );
-
-      var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
-      assert.equal(1 + 3 + 1, lis.length);
-      assert(nvl(lis[0].getAttribute("class")).indexOf("disabled") < 0);
-      assert(nvl(lis[1].getAttribute("class")).indexOf("active") < 0);
-      assert(nvl(lis[2].getAttribute("class")).indexOf("active") < 0);
-      assert(nvl(lis[3].getAttribute("class")).indexOf("active") >= 0);
-      assert(nvl(lis[4].getAttribute("class")).indexOf("disabled") >= 0);
-      assert.equal("2", lis[2].innerText);
-      assert.equal("?prefix=2&suffix=88", lis[2].getElementsByTagName("a")[0].getAttribute("href"));
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it("can overwrite collection size", function () {
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination perPage={10} page={3} total={55} urlPrefix="?prefix=" urlSuffix="&suffix=88" />,
-        container
-      );
+  it('renders 20-wise pages per default', function () {
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination page={3} total={55} urlPrefix="?prefix=" urlSuffix="&suffix=88" />,
+      container
+    );
+
+    var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
+    assert.equal(1 + 3 + 1, lis.length);
+    assert(nvl(lis[0].getAttribute("class")).indexOf("disabled") < 0);
+    assert(nvl(lis[1].getAttribute("class")).indexOf("active") < 0);
+    assert(nvl(lis[2].getAttribute("class")).indexOf("active") < 0);
+    assert(nvl(lis[3].getAttribute("class")).indexOf("active") >= 0);
+    assert(nvl(lis[4].getAttribute("class")).indexOf("disabled") >= 0);
+    assert.equal("2", lis[2].innerText);
+    assert.equal("?prefix=2&suffix=88", lis[2].getElementsByTagName("a")[0].getAttribute("href"));
+  });
 
-      var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
-      assert.equal(1 + 6 + 1, lis.length);
-    });
+  it("can overwrite collection size", function () {
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination perPage={10} page={3} total={55} urlPrefix="?prefix=" urlSuffix="&suffix=88" />,
+      container
+    );
 
-    it("handles large collections properly - beginning", function () {
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination page={3} total={600} />,
-        container
-      );
-      var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
-      assert.equal(1 + 10 + 1, lis.length);
-      assert(nvl(lis[3].getAttribute("class")).indexOf("active") >= 0);
-      assert.equal("3", lis[3].innerText);
-      assert.equal("7", lis[7].innerText);
-      assert.equal("10", lis[10].innerText);
-    });
+    var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
+    assert.equal(1 + 6 + 1, lis.length);
+  });
 
-    it("handles large collections properly - middle", function () {
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination page={10} total={600} />,
-        container
-      );
-
-      var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
-      assert.equal(1 + 10 + 1, lis.length);
-      assert(nvl(lis[6].getAttribute("class")).indexOf("active") >= 0);
-      assert.equal("7", lis[3].innerText);
-      assert.equal("11", lis[7].innerText);
-      assert.equal("14", lis[10].innerText);
-    });
+  it("handles large collections properly - beginning", function () {
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination page={3} total={600} />,
+      container
+    );
+    var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
+    assert.equal(1 + 10 + 1, lis.length);
+    assert(nvl(lis[3].getAttribute("class")).indexOf("active") >= 0);
+    assert.equal("3", lis[3].innerText);
+    assert.equal("7", lis[7].innerText);
+    assert.equal("10", lis[10].innerText);
+  });
 
-    it("handles large collections properly - end", function () {
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination page={29} total={600} />,
-        container
-      );
-
-      var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
-      assert.equal(1 + 10 + 1, lis.length);
-      assert(nvl(lis[9].getAttribute("class")).indexOf("active") >= 0);
-      assert.equal("23", lis[3].innerText);
-      assert.equal("27", lis[7].innerText);
-      assert.equal("30", lis[10].innerText);
-    });
+  it("handles large collections properly - middle", function () {
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination page={10} total={600} />,
+      container
+    );
+
+    var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
+    assert.equal(1 + 10 + 1, lis.length);
+    assert(nvl(lis[6].getAttribute("class")).indexOf("active") >= 0);
+    assert.equal("7", lis[3].innerText);
+    assert.equal("11", lis[7].innerText);
+    assert.equal("14", lis[10].innerText);
+  });
 
-    it('limits the number of total pages when customized', function () {
-      var maxNavPages = 15;
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination page={1} total={1000} maxNavPages={maxNavPages} />,
-        container
-      );
-      var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
-      assert.equal(1 + maxNavPages + 1, lis.length);
-    });
+  it("handles large collections properly - end", function () {
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination page={29} total={600} />,
+      container
+    );
+
+    var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
+    assert.equal(1 + 10 + 1, lis.length);
+    assert(nvl(lis[9].getAttribute("class")).indexOf("active") >= 0);
+    assert.equal("23", lis[3].innerText);
+    assert.equal("27", lis[7].innerText);
+    assert.equal("30", lis[10].innerText);
+  });
 
-    it('calls callback method when supplied', function () {
-      var spy = sinon.spy();
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination page={1} total={100} onClick={spy} />,
-        container
-      );
-      var links = ReactDOM.findDOMNode(pageEl).getElementsByTagName("a");
+  it('limits the number of total pages when customized', function () {
+    var maxNavPages = 15;
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination page={1} total={1000} maxNavPages={maxNavPages} />,
+      container
+    );
+    var lis = ReactDOM.findDOMNode(pageEl).getElementsByTagName("li");
+    assert.equal(1 + maxNavPages + 1, lis.length);
+  });
 
-      TestUtils.Simulate.click(links[3]);
+  it('calls callback method when supplied', function () {
+    var spy = sinon.spy();
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination page={1} total={100} onClick={spy} />,
+      container
+    );
+    var links = ReactDOM.findDOMNode(pageEl).getElementsByTagName("a");
 
-      // confirm it gets called
-      assert.ok(spy.calledOnce);
+    TestUtils.Simulate.click(links[3]);
 
-      // confirm it's called with the pagination number (3)
-      assert.ok(spy.calledWith(3));
-    });
+    // confirm it gets called
+    assert.ok(spy.calledOnce);
 
-    it('calls callback method with correct values for prev and next', function () {
-      var spy = sinon.spy();
+    // confirm it's called with the pagination number (3)
+    assert.ok(spy.calledWith(3));
+  });
 
-      var currentPage = 5;
-      var pageEl = TestUtils.renderIntoDocument(
-        <Views.Pagination page={currentPage} total={200} onClick={spy} />,
-        container
-      );
-      var links = ReactDOM.findDOMNode(pageEl).getElementsByTagName("a");
+  it('calls callback method with correct values for prev and next', function () {
+    var spy = sinon.spy();
 
-      TestUtils.Simulate.click(links[0]);
-      assert.ok(spy.calledWith(currentPage - 1));
+    var currentPage = 5;
+    var pageEl = TestUtils.renderIntoDocument(
+      <Views.Pagination page={currentPage} total={200} onClick={spy} />,
+      container
+    );
+    var links = ReactDOM.findDOMNode(pageEl).getElementsByTagName("a");
 
-      TestUtils.Simulate.click(links[11]); // last index
-      assert.ok(spy.calledWith(currentPage + 1));
-    });
+    TestUtils.Simulate.click(links[0]);
+    assert.ok(spy.calledWith(currentPage - 1));
 
+    TestUtils.Simulate.click(links[11]); // last index
+    assert.ok(spy.calledWith(currentPage + 1));
   });
 
+});
 
-  describe('Clipboard', function () {
-    var container;
-    beforeEach(function () {
-      container = document.createElement('div');
-    });
 
-    afterEach(function () {
-      ReactDOM.unmountComponentAtNode(container);
-    });
+describe('Clipboard', function () {
+  var container;
+  beforeEach(function () {
+    container = document.createElement('div');
+  });
 
-    it('shows a clipboard icon by default', function () {
-      var clipboard = TestUtils.renderIntoDocument(<Views.Clipboard text="copy me" />, container);
-      assert.equal($(ReactDOM.findDOMNode(clipboard)).find('.icon-paste').length, 1);
-    });
+  afterEach(function () {
+    ReactDOM.unmountComponentAtNode(container);
+  });
 
-    it('shows text if specified', function () {
-      var clipboard = TestUtils.renderIntoDocument(<Views.Clipboard displayType="text" text="copy me" />, container);
-      assert.equal($(ReactDOM.findDOMNode(clipboard)).find('.icon-paste').length, 0);
-    });
+  it('shows a clipboard icon by default', function () {
+    var clipboard = TestUtils.renderIntoDocument(<Views.Clipboard text="copy me" />, container);
+    assert.equal($(ReactDOM.findDOMNode(clipboard)).find('.icon-paste').length, 1);
+  });
 
-    it('shows custom text if specified ', function () {
-      var clipboard = TestUtils.renderIntoDocument(<Views.Clipboard displayType="text" textDisplay='booyah!' text="copy me" />, container);
-      assert.ok(/booyah!/.test($(ReactDOM.findDOMNode(clipboard))[0].outerHTML));
-    });
+  it('shows text if specified', function () {
+    var clipboard = TestUtils.renderIntoDocument(<Views.Clipboard displayType="text" text="copy me" />, container);
+    assert.equal($(ReactDOM.findDOMNode(clipboard)).find('.icon-paste').length, 0);
+  });
 
+  it('shows custom text if specified ', function () {
+    var clipboard = TestUtils.renderIntoDocument(<Views.Clipboard displayType="text" textDisplay='booyah!' text="copy me" />, container);
+    assert.ok(/booyah!/.test($(ReactDOM.findDOMNode(clipboard))[0].outerHTML));
   });
 
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/nightwatch/highlightsidebar.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/nightwatch/highlightsidebar.js b/app/addons/fauxton/tests/nightwatch/highlightsidebar.js
index 315ae62..06d1e46 100644
--- a/app/addons/fauxton/tests/nightwatch/highlightsidebar.js
+++ b/app/addons/fauxton/tests/nightwatch/highlightsidebar.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Highlight Sidebar' : function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/nightwatch/notificationCenter.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/nightwatch/notificationCenter.js b/app/addons/fauxton/tests/nightwatch/notificationCenter.js
index ef3ffb8..a6956cc 100644
--- a/app/addons/fauxton/tests/nightwatch/notificationCenter.js
+++ b/app/addons/fauxton/tests/nightwatch/notificationCenter.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'Notification Center' : function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js b/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js
index 49bca39..ce9da24 100644
--- a/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js
+++ b/app/addons/fauxton/tests/nightwatch/updatesUrlsSameRouteobject.js
@@ -10,6 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
+// 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.
+
 module.exports = {
   'it updates the API url even for routes in the same routeobject' : function (client) {
     var waitTime = client.globals.maxWaitTime,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/actions.js b/app/addons/permissions/actions.js
index f912465..f11ff09 100644
--- a/app/addons/permissions/actions.js
+++ b/app/addons/permissions/actions.js
@@ -10,76 +10,72 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../core/api',
-  './actiontypes',
-  './stores'
-],
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+import Stores from "./stores";
+var permissionsStore = Stores.permissionsStore;
 
-function (FauxtonAPI, ActionTypes, Stores) {
-  var permissionsStore = Stores.permissionsStore;
-  return {
+export default {
 
-    fetchPermissions: function (database, security) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.PERMISSIONS_FETCHING,
-        database: database,
-        security: security
-      });
+  fetchPermissions: function (database, security) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.PERMISSIONS_FETCHING,
+      database: database,
+      security: security
+    });
+
+    FauxtonAPI.when([database.fetch(), security.fetch()]).then(function () {
+      this.editPermissions(database, security);
+    }.bind(this));
+  },
 
-      FauxtonAPI.when([database.fetch(), security.fetch()]).then(function () {
-        this.editPermissions(database, security);
-      }.bind(this));
-    },
+  editPermissions: function (database, security) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.PERMISSIONS_EDIT,
+      database: database,
+      security: security
+    });
+  },
+  addItem: function (options) {
+    var check = permissionsStore.getSecurity().canAddItem(options.value, options.type, options.section);
 
-    editPermissions: function (database, security) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.PERMISSIONS_EDIT,
-        database: database,
-        security: security
+    if (check.error) {
+      FauxtonAPI.addNotification({
+        msg: check.msg,
+        type: 'error'
       });
-    },
-    addItem: function (options) {
-      var check = permissionsStore.getSecurity().canAddItem(options.value, options.type, options.section);
 
-      if (check.error) {
-        FauxtonAPI.addNotification({
-          msg: check.msg,
-          type: 'error'
-        });
+      return;
+    }
 
-        return;
-      }
+    FauxtonAPI.dispatch({
+      type: ActionTypes.PERMISSIONS_ADD_ITEM,
+      options: options
+    });
 
-      FauxtonAPI.dispatch({
-        type: ActionTypes.PERMISSIONS_ADD_ITEM,
-        options: options
-      });
+    this.savePermissions();
 
-      this.savePermissions();
+  },
+  removeItem: function (options) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.PERMISSIONS_REMOVE_ITEM,
+      options: options
+    });
+    this.savePermissions();
+  },
 
-    },
-    removeItem: function (options) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.PERMISSIONS_REMOVE_ITEM,
-        options: options
+  savePermissions: function () {
+    permissionsStore.getSecurity().save().then(function () {
+      FauxtonAPI.addNotification({
+        msg: 'Database permissions has been updated.'
       });
-      this.savePermissions();
-    },
-
-    savePermissions: function () {
-      permissionsStore.getSecurity().save().then(function () {
-        FauxtonAPI.addNotification({
-          msg: 'Database permissions has been updated.'
-        });
-      }, function (xhr) {
-        if (!xhr && !xhr.responseJSON) { return;}
+    }, function (xhr) {
+      if (!xhr && !xhr.responseJSON) { return;}
 
-        FauxtonAPI.addNotification({
-          msg: 'Could not update permissions - reason: ' + xhr.responseJSON.reason,
-          type: 'error'
-        });
+      FauxtonAPI.addNotification({
+        msg: 'Could not update permissions - reason: ' + xhr.responseJSON.reason,
+        type: 'error'
       });
-    }
-  };
-});
+    });
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/actiontypes.js b/app/addons/permissions/actiontypes.js
index 2918ac6..132da81 100644
--- a/app/addons/permissions/actiontypes.js
+++ b/app/addons/permissions/actiontypes.js
@@ -10,14 +10,9 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-],
-
-function () {
-  return {
-    PERMISSIONS_EDIT: 'PERMISSIONS_EDIT',
-    PERMISSIONS_FETCHING: 'PERMISSIONS_FETCHING',
-    PERMISSIONS_ADD_ITEM: 'PERMISSIONS_ADD_ITEM',
-    PERMISSIONS_REMOVE_ITEM: 'PERMISSIONS_REMOVE_ITEM'
-  };
-});
+export default {
+  PERMISSIONS_EDIT: 'PERMISSIONS_EDIT',
+  PERMISSIONS_FETCHING: 'PERMISSIONS_FETCHING',
+  PERMISSIONS_ADD_ITEM: 'PERMISSIONS_ADD_ITEM',
+  PERMISSIONS_REMOVE_ITEM: 'PERMISSIONS_REMOVE_ITEM'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/base.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/base.js b/app/addons/permissions/base.js
index bf417c6..d6ddf5d 100644
--- a/app/addons/permissions/base.js
+++ b/app/addons/permissions/base.js
@@ -10,16 +10,11 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './routes',
-  './assets/less/permissions.less'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Permissions from "./routes";
+import "./assets/less/permissions.less";
 
-function (app, FauxtonAPI, Permissions) {
+Permissions.initialize = function () {};
 
-  Permissions.initialize = function () {};
-
-  return Permissions;
-});
+export default Permissions;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/permissions/components.react.jsx b/app/addons/permissions/components.react.jsx
index f93a806..cfd8f0f 100644
--- a/app/addons/permissions/components.react.jsx
+++ b/app/addons/permissions/components.react.jsx
@@ -10,230 +10,225 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  '../components/react-components.react',
-  './stores',
-  './actions'
-],
-
-function (app, FauxtonAPI, React, Components, Stores, Actions) {
-  var LoadLines = Components.LoadLines;
-  var permissionsStore = Stores.permissionsStore;
-  var getDocUrl = app.helpers.getDocUrl;
-
-  var PermissionsItem = React.createClass({
-
-    removeItem: function (e) {
-      this.props.removeItem({
-        value: this.props.item,
-        type: this.props.type,
-        section: this.props.section
-      });
-    },
-
-    render: function () {
-      return (
-        <li>
-          <span>{this.props.item}</span>
-          <button onClick={this.removeItem} type="button" className="pull-right close">�</button>
-        </li>
-      );
-    }
-
-  });
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import Components from "../components/react-components.react";
+import Stores from "./stores";
+import Actions from "./actions";
+var LoadLines = Components.LoadLines;
+var permissionsStore = Stores.permissionsStore;
+var getDocUrl = app.helpers.getDocUrl;
+
+var PermissionsItem = React.createClass({
+
+  removeItem: function (e) {
+    this.props.removeItem({
+      value: this.props.item,
+      type: this.props.type,
+      section: this.props.section
+    });
+  },
+
+  render: function () {
+    return (
+      <li>
+        <span>{this.props.item}</span>
+        <button onClick={this.removeItem} type="button" className="pull-right close">�</button>
+      </li>
+    );
+  }
 
-  var PermissionsSection = React.createClass({
-    getInitialState: function () {
-      return {
-        newRole: '',
-        newName: ''
-      };
-    },
+});
 
-    getHelp: function () {
-      if (this.props.section === 'admins') {
-        return 'Database members can access the database. If no members are defined, the database is public. ';
-      }
+var PermissionsSection = React.createClass({
+  getInitialState: function () {
+    return {
+      newRole: '',
+      newName: ''
+    };
+  },
 
+  getHelp: function () {
+    if (this.props.section === 'admins') {
       return 'Database members can access the database. If no members are defined, the database is public. ';
-    },
-
-    isEmptyValue: function (value, type) {
-      if (!_.isEmpty(value)) {
-        return false;
-      }
-      FauxtonAPI.addNotification({
-        msg: 'Cannot add an empty value for ' + type + '.',
-        type: 'warning'
-      });
-
-      return true;
-    },
-
-    addNames: function (e) {
-      e.preventDefault();
-      if (this.isEmptyValue(this.state.newName, 'names')) {
-        return;
-      }
-      this.props.addItem({
-        type: 'names',
-        section: this.props.section,
-        value: this.state.newName
-      });
-
-      this.setState({newName: ''});
-    },
-
-    addRoles: function (e) {
-      e.preventDefault();
-      if (this.isEmptyValue(this.state.newRole, 'roles')) {
-        return;
-      }
-      this.props.addItem({
-        type: 'roles',
-        section: this.props.section,
-        value: this.state.newRole
-      });
-
-      this.setState({newRole: ''});
-    },
-
-    getItems: function (items, type) {
-      return _.map(items, function (item, i) {
-        return <PermissionsItem key={i} item={item} section={this.props.section} type={type} removeItem={this.props.removeItem} />;
-      }, this);
-    },
-
-    getNames: function () {
-      return this.getItems(this.props.names, 'names');
-    },
-
-    getRoles: function () {
-      return this.getItems(this.props.roles, 'roles');
-    },
-
-    nameChange: function (e) {
-      this.setState({newName: e.target.value});
-    },
-
-    roleChange: function (e) {
-      this.setState({newRole: e.target.value});
-    },
-
-    render: function () {
-      return (
-      <div>
-        <header className="page-header">
-          <h3>{this.props.section}</h3>
-          <p className="help">
-            {this.getHelp()}
-            <a className="help-link" data-bypass="true" href={getDocUrl('DB_PERMISSION')} target="_blank">
-              <i className="icon-question-sign"></i>
-            </a>
-          </p>
-        </header>
-        <div className="row-fluid">
-          <div className="span6">
-            <header>
-              <h4>Users</h4>
-              <p>Specify users who will have {this.props.section} access to this database.</p>
-            </header>
-            <form onSubmit={this.addNames} className="permission-item-form form-inline">
-              <input onChange={this.nameChange} value={this.state.newName} type="text" className="item input-small" placeholder="Add User" />
-              <button type="submit" className="btn btn-success"><i className="icon fonticon-plus-circled" /> Add User</button>
-            </form>
-            <ul className="clearfix unstyled permission-items span10">
-              {this.getNames()}
-            </ul>
-          </div>
-          <div className="span6">
-            <header>
-              <h4>Roles</h4>
-              <p>Users with any of the following role(s) will have {this.props.section} access.</p>
-            </header>
-            <form onSubmit={this.addRoles} className="permission-item-form form-inline">
-              <input onChange={this.roleChange} value={this.state.newRole} type="text" className="item input-small" placeholder="Add Role" />
-              <button type="submit" className="btn btn-success"><i className="icon fonticon-plus-circled" /> Add Role</button>
-            </form>
-            <ul className="unstyled permission-items span10">
-              {this.getRoles()}
-            </ul>
-          </div>
-        </div>
-      </div>
-      );
     }
 
-  });
-
-  var PermissionsController = React.createClass({
-
-    getStoreState: function () {
-      return {
-        isLoading: permissionsStore.isLoading(),
-        adminRoles: permissionsStore.getAdminRoles(),
-        adminNames: permissionsStore.getAdminNames(),
-        memberRoles: permissionsStore.getMemberRoles(),
-        memberNames: permissionsStore.getMemberNames(),
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      permissionsStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      permissionsStore.off('change', this.onChange);
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
-
-    addItem: function (options) {
-      Actions.addItem(options);
-    },
-
-    removeItem: function (options) {
-      Actions.removeItem(options);
-    },
-
-    render: function () {
-      if (this.state.isLoading) {
-        return <LoadLines />;
-      }
-
-      return (
-        <div className="permissions-page flex-body">
-          <div id="sections">
-            <PermissionsSection roles={this.state.adminRoles}
-              names={this.state.adminNames}
-              addItem={this.addItem}
-              removeItem={this.removeItem}
-              section={'admins'} />
-            <PermissionsSection
-              roles={this.state.memberRoles}
-              names={this.state.memberNames}
-              addItem={this.addItem}
-              removeItem={this.removeItem}
-              section={'members'} />
-          </div>
+    return 'Database members can access the database. If no members are defined, the database is public. ';
+  },
+
+  isEmptyValue: function (value, type) {
+    if (!_.isEmpty(value)) {
+      return false;
+    }
+    FauxtonAPI.addNotification({
+      msg: 'Cannot add an empty value for ' + type + '.',
+      type: 'warning'
+    });
+
+    return true;
+  },
+
+  addNames: function (e) {
+    e.preventDefault();
+    if (this.isEmptyValue(this.state.newName, 'names')) {
+      return;
+    }
+    this.props.addItem({
+      type: 'names',
+      section: this.props.section,
+      value: this.state.newName
+    });
+
+    this.setState({newName: ''});
+  },
+
+  addRoles: function (e) {
+    e.preventDefault();
+    if (this.isEmptyValue(this.state.newRole, 'roles')) {
+      return;
+    }
+    this.props.addItem({
+      type: 'roles',
+      section: this.props.section,
+      value: this.state.newRole
+    });
+
+    this.setState({newRole: ''});
+  },
+
+  getItems: function (items, type) {
+    return _.map(items, function (item, i) {
+      return <PermissionsItem key={i} item={item} section={this.props.section} type={type} removeItem={this.props.removeItem} />;
+    }, this);
+  },
+
+  getNames: function () {
+    return this.getItems(this.props.names, 'names');
+  },
+
+  getRoles: function () {
+    return this.getItems(this.props.roles, 'roles');
+  },
+
+  nameChange: function (e) {
+    this.setState({newName: e.target.value});
+  },
+
+  roleChange: function (e) {
+    this.setState({newRole: e.target.value});
+  },
+
+  render: function () {
+    return (
+    <div>
+      <header className="page-header">
+        <h3>{this.props.section}</h3>
+        <p className="help">
+          {this.getHelp()}
+          <a className="help-link" data-bypass="true" href={getDocUrl('DB_PERMISSION')} target="_blank">
+            <i className="icon-question-sign"></i>
+          </a>
+        </p>
+      </header>
+      <div className="row-fluid">
+        <div className="span6">
+          <header>
+            <h4>Users</h4>
+            <p>Specify users who will have {this.props.section} access to this database.</p>
+          </header>
+          <form onSubmit={this.addNames} className="permission-item-form form-inline">
+            <input onChange={this.nameChange} value={this.state.newName} type="text" className="item input-small" placeholder="Add User" />
+            <button type="submit" className="btn btn-success"><i className="icon fonticon-plus-circled" /> Add User</button>
+          </form>
+          <ul className="clearfix unstyled permission-items span10">
+            {this.getNames()}
+          </ul>
         </div>
-      );
+        <div className="span6">
+          <header>
+            <h4>Roles</h4>
+            <p>Users with any of the following role(s) will have {this.props.section} access.</p>
+          </header>
+          <form onSubmit={this.addRoles} className="permission-item-form form-inline">
+            <input onChange={this.roleChange} value={this.state.newRole} type="text" className="item input-small" placeholder="Add Role" />
+            <button type="submit" className="btn btn-success"><i className="icon fonticon-plus-circled" /> Add Role</button>
+          </form>
+          <ul className="unstyled permission-items span10">
+            {this.getRoles()}
+          </ul>
+        </div>
+      </div>
+    </div>
+    );
+  }
+
+});
+
+var PermissionsController = React.createClass({
+
+  getStoreState: function () {
+    return {
+      isLoading: permissionsStore.isLoading(),
+      adminRoles: permissionsStore.getAdminRoles(),
+      adminNames: permissionsStore.getAdminNames(),
+      memberRoles: permissionsStore.getMemberRoles(),
+      memberNames: permissionsStore.getMemberNames(),
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    permissionsStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    permissionsStore.off('change', this.onChange);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  addItem: function (options) {
+    Actions.addItem(options);
+  },
+
+  removeItem: function (options) {
+    Actions.removeItem(options);
+  },
+
+  render: function () {
+    if (this.state.isLoading) {
+      return <LoadLines />;
     }
 
-  });
+    return (
+      <div className="permissions-page flex-body">
+        <div id="sections">
+          <PermissionsSection roles={this.state.adminRoles}
+            names={this.state.adminNames}
+            addItem={this.addItem}
+            removeItem={this.removeItem}
+            section={'admins'} />
+          <PermissionsSection
+            roles={this.state.memberRoles}
+            names={this.state.memberNames}
+            addItem={this.addItem}
+            removeItem={this.removeItem}
+            section={'members'} />
+        </div>
+      </div>
+    );
+  }
 
-  return {
-    PermissionsController: PermissionsController,
-    PermissionsSection: PermissionsSection,
-    PermissionsItem: PermissionsItem
-  };
 });
+
+export default {
+  PermissionsController: PermissionsController,
+  PermissionsSection: PermissionsSection,
+  PermissionsItem: PermissionsItem
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/resources.js b/app/addons/permissions/resources.js
index 30d7626..d4a4b58 100644
--- a/app/addons/permissions/resources.js
+++ b/app/addons/permissions/resources.js
@@ -10,78 +10,74 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api'
-],
-function (app, FauxtonAPI) {
-  var Permissions = FauxtonAPI.addon();
-
-  Permissions.Security = Backbone.Model.extend({
-    defaults: {
-      admins:  { names: [], roles: [] },
-      members: { names: [], roles: [] }
-    },
-
-    isNew: function () {
-      return false;
-    },
-
-    initialize: function (attrs, options) {
-      this.database = options.database;
-    },
-
-    url: function () {
-      return window.location.origin + '/' + this.database.safeID() + '/_security';
-    },
-
-    documentation: FauxtonAPI.constants.DOC_URLS.DB_PERMISSION,
-
-    addItem: function (value, type, section) {
-      var sectionValues = this.get(section);
-
-      var check = this.canAddItem(value, type, section);
-      if (check.error) { return check;}
-
-      sectionValues[type].push(value);
-      return this.set(section, sectionValues);
-    },
-
-    canAddItem: function (value, type, section) {
-      var sectionValues = this.get(section);
-
-      if (!sectionValues || !sectionValues[type]) {
-        return {
-          error: true,
-          msg: 'Section ' + section + ' does not exist'
-        };
-      }
-
-      if (sectionValues[type].indexOf(value) > -1) {
-        return {
-          error: true,
-          msg: 'Role/Name has already been added'
-        };
-      }
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+var Permissions = FauxtonAPI.addon();
 
+Permissions.Security = Backbone.Model.extend({
+  defaults: {
+    admins:  { names: [], roles: [] },
+    members: { names: [], roles: [] }
+  },
+
+  isNew: function () {
+    return false;
+  },
+
+  initialize: function (attrs, options) {
+    this.database = options.database;
+  },
+
+  url: function () {
+    return window.location.origin + '/' + this.database.safeID() + '/_security';
+  },
+
+  documentation: FauxtonAPI.constants.DOC_URLS.DB_PERMISSION,
+
+  addItem: function (value, type, section) {
+    var sectionValues = this.get(section);
+
+    var check = this.canAddItem(value, type, section);
+    if (check.error) { return check;}
+
+    sectionValues[type].push(value);
+    return this.set(section, sectionValues);
+  },
+
+  canAddItem: function (value, type, section) {
+    var sectionValues = this.get(section);
+
+    if (!sectionValues || !sectionValues[type]) {
+      return {
+        error: true,
+        msg: 'Section ' + section + ' does not exist'
+      };
+    }
+
+    if (sectionValues[type].indexOf(value) > -1) {
       return {
-        error: false
+        error: true,
+        msg: 'Role/Name has already been added'
       };
-    },
+    }
 
-    removeItem: function (value, type, section) {
-      var sectionValues = this.get(section);
-      var types = sectionValues[type];
-      var indexOf = _.indexOf(types, value);
+    return {
+      error: false
+    };
+  },
 
-      if (indexOf  === -1) { return;}
+  removeItem: function (value, type, section) {
+    var sectionValues = this.get(section);
+    var types = sectionValues[type];
+    var indexOf = _.indexOf(types, value);
 
-      types.splice(indexOf, 1);
-      sectionValues[type] = types;
-      return this.set(section, sectionValues);
-    }
+    if (indexOf  === -1) { return;}
 
-  });
+    types.splice(indexOf, 1);
+    sectionValues[type] = types;
+    return this.set(section, sectionValues);
+  }
 
-  return Permissions;
 });
+
+export default Permissions;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/routes.js b/app/addons/permissions/routes.js
index bc52a15..044a09d 100644
--- a/app/addons/permissions/routes.js
+++ b/app/addons/permissions/routes.js
@@ -10,90 +10,86 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  '../databases/base',
-  './resources',
-  './actions',
-  './components.react',
-  '../documents/shared-routes'
-],
-function (app, FauxtonAPI, Databases, Resources, Actions, Permissions, BaseRoute) {
-
-  var PermissionsRouteObject = BaseRoute.extend({
-    roles: ['fx_loggedIn'],
-    routes: {
-      'database/:database/permissions': 'permissions'
-    },
-
-    initialize: function (route, masterLayout, options) {
-      var docOptions = app.getParams();
-      docOptions.include_docs = true;
-
-      this.initViews(options[0]);
-      this.listenToLookaheadTray();
-    },
-
-    initViews: function (databaseName) {
-      this.database = new Databases.Model({ id: databaseName });
-      this.security = new Resources.Security(null, {
-        database: this.database
-      });
-      this.allDatabases = new Databases.List();
-
-      this.createDesignDocsCollection();
-      this.addLeftHeader();
-      this.addSidebar('permissions');
-    },
-
-    apiUrl: function () {
-      return [this.security.url('apiurl'), this.security.documentation];
-    },
-
-    establish: function () {
-      return [
-        this.designDocs.fetch({reset: true}),
-        this.allDatabases.fetchOnce()
-      ];
-    },
-
-    listenToLookaheadTray: function () {
-      this.listenTo(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
-    },
-
-    onSelectDatabase: function (dbName) {
-      this.cleanup();
-      this.initViews(dbName);
-
-      FauxtonAPI.navigate('/database/' + app.utils.safeURLName(dbName) + '/permissions', {
-        trigger: true
-      });
-      this.listenToLookaheadTray();
-    },
-
-    permissions: function () {
-      Actions.fetchPermissions(this.database, this.security);
-      this.setComponent('#dashboard-content', Permissions.PermissionsController);
-    },
-
-    crumbs: function () {
-      return [
-        { name: this.database.id, link: Databases.databaseUrl(this.database)},
-        { name: 'Permissions', link: '/permissions' }
-      ];
-    },
-
-    cleanup: function () {
-      if (this.leftheader) {
-        this.removeView('#breadcrumbs');
-      }
-      this.removeComponent('#sidebar-content');
-      this.stopListening(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Databases from "../databases/base";
+import Resources from "./resources";
+import Actions from "./actions";
+import Permissions from "./components.react";
+import BaseRoute from "../documents/shared-routes";
+
+var PermissionsRouteObject = BaseRoute.extend({
+  roles: ['fx_loggedIn'],
+  routes: {
+    'database/:database/permissions': 'permissions'
+  },
+
+  initialize: function (route, masterLayout, options) {
+    var docOptions = app.getParams();
+    docOptions.include_docs = true;
+
+    this.initViews(options[0]);
+    this.listenToLookaheadTray();
+  },
+
+  initViews: function (databaseName) {
+    this.database = new Databases.Model({ id: databaseName });
+    this.security = new Resources.Security(null, {
+      database: this.database
+    });
+    this.allDatabases = new Databases.List();
+
+    this.createDesignDocsCollection();
+    this.addLeftHeader();
+    this.addSidebar('permissions');
+  },
+
+  apiUrl: function () {
+    return [this.security.url('apiurl'), this.security.documentation];
+  },
+
+  establish: function () {
+    return [
+      this.designDocs.fetch({reset: true}),
+      this.allDatabases.fetchOnce()
+    ];
+  },
+
+  listenToLookaheadTray: function () {
+    this.listenTo(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
+  },
+
+  onSelectDatabase: function (dbName) {
+    this.cleanup();
+    this.initViews(dbName);
+
+    FauxtonAPI.navigate('/database/' + app.utils.safeURLName(dbName) + '/permissions', {
+      trigger: true
+    });
+    this.listenToLookaheadTray();
+  },
+
+  permissions: function () {
+    Actions.fetchPermissions(this.database, this.security);
+    this.setComponent('#dashboard-content', Permissions.PermissionsController);
+  },
+
+  crumbs: function () {
+    return [
+      { name: this.database.id, link: Databases.databaseUrl(this.database)},
+      { name: 'Permissions', link: '/permissions' }
+    ];
+  },
+
+  cleanup: function () {
+    if (this.leftheader) {
+      this.removeView('#breadcrumbs');
     }
-  });
+    this.removeComponent('#sidebar-content');
+    this.stopListening(FauxtonAPI.Events, 'lookaheadTray:update', this.onSelectDatabase);
+  }
+});
 
-  Permissions.RouteObjects = [PermissionsRouteObject];
+Permissions.RouteObjects = [PermissionsRouteObject];
 
-  return Permissions;
-});
+export default Permissions;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/stores.js b/app/addons/permissions/stores.js
index f306fcd..9737cd0 100644
--- a/app/addons/permissions/stores.js
+++ b/app/addons/permissions/stores.js
@@ -10,100 +10,95 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../core/api',
-  './actiontypes'
-],
-
-function (FauxtonAPI, ActionTypes) {
-  var Stores = {};
-
-  Stores.PermissionsStore = FauxtonAPI.Store.extend({
-    initialize: function () {
-      this._isLoading = true;
-    },
-
-    isLoading: function () {
-      return this._isLoading;
-    },
-
-    editPermissions: function (database, security) {
-      this._database = database;
-      this._security = security;
-      this._isLoading = false;
-    },
-
-    getItem: function (section, type) {
-      if (this._isLoading) {return [];}
-
-      return this._security.get(section)[type];
-    },
-
-    getDatabase: function () {
-      return this._database;
-    },
-
-    getSecurity: function () {
-      return this._security;
-    },
-
-    getAdminRoles: function () {
-      return this.getItem('admins', 'roles');
-    },
-
-    getAdminNames: function () {
-      return this.getItem('admins', 'names');
-    },
-
-    getMemberNames: function () {
-      return this.getItem('members', 'names');
-    },
-
-    getMemberRoles: function () {
-      return this.getItem('members', 'roles');
-    },
-
-    addItem: function (options) {
-      this._security.addItem(options.value, options.type, options.section);
-    },
-
-    removeItem: function (options) {
-      this._security.removeItem(options.value, options.type, options.section);
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.PERMISSIONS_FETCHING:
-          this._isLoading = true;
-          this.triggerChange();
-        break;
-
-        case ActionTypes.PERMISSIONS_EDIT:
-          this.editPermissions(action.database, action.security);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.PERMISSIONS_ADD_ITEM:
-          this.addItem(action.options);
-          this.triggerChange();
-        break;
-
-        case ActionTypes.PERMISSIONS_REMOVE_ITEM:
-          this.removeItem(action.options);
-          this.triggerChange();
-        break;
-
-        default:
-        return;
-        // do nothing
-      }
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+var Stores = {};
+
+Stores.PermissionsStore = FauxtonAPI.Store.extend({
+  initialize: function () {
+    this._isLoading = true;
+  },
+
+  isLoading: function () {
+    return this._isLoading;
+  },
+
+  editPermissions: function (database, security) {
+    this._database = database;
+    this._security = security;
+    this._isLoading = false;
+  },
+
+  getItem: function (section, type) {
+    if (this._isLoading) {return [];}
+
+    return this._security.get(section)[type];
+  },
+
+  getDatabase: function () {
+    return this._database;
+  },
+
+  getSecurity: function () {
+    return this._security;
+  },
+
+  getAdminRoles: function () {
+    return this.getItem('admins', 'roles');
+  },
+
+  getAdminNames: function () {
+    return this.getItem('admins', 'names');
+  },
+
+  getMemberNames: function () {
+    return this.getItem('members', 'names');
+  },
+
+  getMemberRoles: function () {
+    return this.getItem('members', 'roles');
+  },
+
+  addItem: function (options) {
+    this._security.addItem(options.value, options.type, options.section);
+  },
+
+  removeItem: function (options) {
+    this._security.removeItem(options.value, options.type, options.section);
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.PERMISSIONS_FETCHING:
+        this._isLoading = true;
+        this.triggerChange();
+      break;
+
+      case ActionTypes.PERMISSIONS_EDIT:
+        this.editPermissions(action.database, action.security);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.PERMISSIONS_ADD_ITEM:
+        this.addItem(action.options);
+        this.triggerChange();
+      break;
+
+      case ActionTypes.PERMISSIONS_REMOVE_ITEM:
+        this.removeItem(action.options);
+        this.triggerChange();
+      break;
+
+      default:
+      return;
+      // do nothing
     }
+  }
 
-  });
+});
 
-  Stores.permissionsStore = new Stores.PermissionsStore();
+Stores.permissionsStore = new Stores.PermissionsStore();
 
-  Stores.permissionsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.permissionsStore.dispatch);
+Stores.permissionsStore.dispatchToken = FauxtonAPI.dispatcher.register(Stores.permissionsStore.dispatch);
 
-  return Stores;
-});
+export default Stores;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/tests/actionsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/tests/actionsSpec.js b/app/addons/permissions/tests/actionsSpec.js
index 6f51272..4424e04 100644
--- a/app/addons/permissions/tests/actionsSpec.js
+++ b/app/addons/permissions/tests/actionsSpec.js
@@ -10,116 +10,113 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  '../../databases/base',
-  '../stores',
-  '../resources',
-  '../actions',
-  '../../../../test/mocha/testUtils',
-  'sinon'
-], function (FauxtonAPI, Databases, Stores, Permissions, Actions, testUtils, sinon) {
-  var assert = testUtils.assert;
-  var restore = testUtils.restore;
-  var store = Stores.permissionsStore;
-
-  describe('Permissions Actions', function () {
-    var getSecuritystub;
-
-    beforeEach(function () {
-      var databaseName = 'permissions-test';
-      var database = new Databases.Model({ id: databaseName });
-      Actions.editPermissions(
-        database,
-        new Permissions.Security(null, {
-          database: database
-        })
-      );
+import FauxtonAPI from "../../../core/api";
+import Databases from "../../databases/base";
+import Stores from "../stores";
+import Permissions from "../resources";
+import Actions from "../actions";
+import testUtils from "../../../../test/mocha/testUtils";
+import sinon from "sinon";
+var assert = testUtils.assert;
+var restore = testUtils.restore;
+var store = Stores.permissionsStore;
+
+describe('Permissions Actions', function () {
+  var getSecuritystub;
+
+  beforeEach(function () {
+    var databaseName = 'permissions-test';
+    var database = new Databases.Model({ id: databaseName });
+    Actions.editPermissions(
+      database,
+      new Permissions.Security(null, {
+        database: database
+      })
+    );
+
+
+    var promise = FauxtonAPI.Deferred();
+    getSecuritystub = sinon.stub(store, 'getSecurity');
+    getSecuritystub.returns({
+      canAddItem: function () { return {error: true};},
+      save: function () {
+        return promise;
+      }
+    });
+  });
 
+  afterEach(function () {
+    restore(store.getSecurity);
+  });
 
-      var promise = FauxtonAPI.Deferred();
-      getSecuritystub = sinon.stub(store, 'getSecurity');
-      getSecuritystub.returns({
-        canAddItem: function () { return {error: true};},
-        save: function () {
-          return promise;
-        }
-      });
-    });
+  describe('add Item', function () {
 
     afterEach(function () {
+      restore(FauxtonAPI.addNotification);
+      restore(Actions.savePermissions);
       restore(store.getSecurity);
     });
 
-    describe('add Item', function () {
+    it('does not save item if cannot add it', function () {
+      var spy = sinon.spy(FauxtonAPI, 'addNotification');
+      var spy2 = sinon.spy(Actions, 'savePermissions');
 
-      afterEach(function () {
-        restore(FauxtonAPI.addNotification);
-        restore(Actions.savePermissions);
-        restore(store.getSecurity);
+      Actions.addItem({
+        value: 'boom',
+        type: 'names',
+        section: 'members'
       });
 
-      it('does not save item if cannot add it', function () {
-        var spy = sinon.spy(FauxtonAPI, 'addNotification');
-        var spy2 = sinon.spy(Actions, 'savePermissions');
+      assert.ok(spy.calledOnce);
+      assert.notOk(spy2.calledOnce);
+    });
 
-        Actions.addItem({
-          value: 'boom',
-          type: 'names',
-          section: 'members'
-        });
+    it('save items', function () {
+      var spy = sinon.spy(FauxtonAPI, 'addNotification');
+      var spy2 = sinon.spy(Actions, 'savePermissions');
 
-        assert.ok(spy.calledOnce);
-        assert.notOk(spy2.calledOnce);
+      var promise = FauxtonAPI.Deferred();
+      getSecuritystub.returns({
+        canAddItem: function () { return {error: false};},
+        save: function () {
+          return promise;
+        }
       });
 
-      it('save items', function () {
-        var spy = sinon.spy(FauxtonAPI, 'addNotification');
-        var spy2 = sinon.spy(Actions, 'savePermissions');
-
-        var promise = FauxtonAPI.Deferred();
-        getSecuritystub.returns({
-          canAddItem: function () { return {error: false};},
-          save: function () {
-            return promise;
-          }
-        });
-
-        Actions.addItem({
-          value: 'boom',
-          type: 'names',
-          section: 'members'
-        });
-
-        assert.ok(spy2.calledOnce);
-        assert.notOk(spy.calledOnce);
+      Actions.addItem({
+        value: 'boom',
+        type: 'names',
+        section: 'members'
       });
-    });
 
-    describe('remove item', function () {
+      assert.ok(spy2.calledOnce);
+      assert.notOk(spy.calledOnce);
+    });
+  });
 
-      afterEach(function () {
-        restore(Actions.savePermissions);
-      });
+  describe('remove item', function () {
 
-      it('saves item', function () {
-        Actions.addItem({
-          value: 'boom',
-          type: 'names',
-          section: 'members'
-        });
+    afterEach(function () {
+      restore(Actions.savePermissions);
+    });
 
-        var spy = sinon.spy(Actions, 'savePermissions');
+    it('saves item', function () {
+      Actions.addItem({
+        value: 'boom',
+        type: 'names',
+        section: 'members'
+      });
 
-        Actions.removeItem({
-          value: 'boom',
-          type: 'names',
-          section: 'members'
-        });
+      var spy = sinon.spy(Actions, 'savePermissions');
 
-        assert.ok(spy.calledOnce);
+      Actions.removeItem({
+        value: 'boom',
+        type: 'names',
+        section: 'members'
       });
 
+      assert.ok(spy.calledOnce);
     });
+
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/tests/componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/permissions/tests/componentsSpec.react.jsx b/app/addons/permissions/tests/componentsSpec.react.jsx
index 8fc3309..6992de4 100644
--- a/app/addons/permissions/tests/componentsSpec.react.jsx
+++ b/app/addons/permissions/tests/componentsSpec.react.jsx
@@ -9,163 +9,160 @@
 // 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',
-  '../../databases/base',
-  '../resources',
-  '../components.react',
-  '../actions',
-  '../../../../test/mocha/testUtils',
-  "react",
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Databases, Permissions, Views, Actions, utils, React, ReactDOM, TestUtils, sinon) {
-    var assert = utils.assert;
-    var restore = utils.restore;
-
-    describe('Permissions Components', function () {
-
-      beforeEach(function () {
-        var databaseName = 'permissions-test';
-        var database = new Databases.Model({ id: databaseName });
-        Actions.editPermissions(
-          database,
-          new Permissions.Security(null, {
-            database: database
-          })
-        );
-
-        var savePermissionsStub = sinon.stub(Actions, 'savePermissions');
+import FauxtonAPI from "../../../core/api";
+import Databases from "../../databases/base";
+import Permissions from "../resources";
+import Views from "../components.react";
+import Actions from "../actions";
+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";
+var assert = utils.assert;
+var restore = utils.restore;
+
+describe('Permissions Components', function () {
+
+  beforeEach(function () {
+    var databaseName = 'permissions-test';
+    var database = new Databases.Model({ id: databaseName });
+    Actions.editPermissions(
+      database,
+      new Permissions.Security(null, {
+        database: database
+      })
+    );
+
+    var savePermissionsStub = sinon.stub(Actions, 'savePermissions');
+  });
+
+  afterEach(function () {
+    restore(Actions.savePermissions);
+  });
+
+  describe('Permissions Controller', function () {
+    var el, container;
+
+    beforeEach(function () {
+      container = document.createElement('div');
+      el = TestUtils.renderIntoDocument(<Views.PermissionsController />, container);
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
+
+    it('on Add triggers add action', function () {
+      var spy = sinon.spy(Actions, 'addItem');
+      el.addItem({});
+      assert.ok(spy.calledOnce);
+    });
+
+    it('on Remove triggers remove action', function () {
+      var spy = sinon.spy(Actions, 'removeItem');
+      el.removeItem({
+        value: 'boom',
+        type: 'names',
+        section: 'members'
+      });
+      assert.ok(spy.calledOnce);
+    });
+
+  });
+
+  describe('PermissionsSection', function () {
+    var el, container, addSpy;
+
+    beforeEach(function () {
+      addSpy = sinon.spy();
+      container = document.createElement('div');
+      el = TestUtils.renderIntoDocument(<Views.PermissionsSection section={'members'} roles={[]} names={[]} addItem={addSpy} />, container);
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
+
+    it('adds user on submit', function () {
+      var input = $(ReactDOM.findDOMNode(el)).find('input')[0];
+      TestUtils.Simulate.change(input, {
+        target: {
+          value: 'newusername'
+        }
       });
+      var form = $(ReactDOM.findDOMNode(el)).find('.permission-item-form')[0];
+      TestUtils.Simulate.submit(form);
 
-      afterEach(function () {
-        restore(Actions.savePermissions);
+      var options = addSpy.args[0][0];
+      assert.ok(addSpy.calledOnce);
+      assert.equal(options.type, "names");
+      assert.equal(options.section, "members");
+    });
+
+    it('adds role on submit', function () {
+      var input = $(ReactDOM.findDOMNode(el)).find('input')[1];
+      TestUtils.Simulate.change(input, {
+        target: {
+          value: 'newrole'
+        }
       });
+      var form = $(ReactDOM.findDOMNode(el)).find('.permission-item-form')[1];
+      TestUtils.Simulate.submit(form);
+
+      var options = addSpy.args[0][0];
+      assert.ok(addSpy.calledOnce);
+      assert.equal(options.type, "roles");
+      assert.equal(options.section, "members");
+    });
 
-      describe('Permissions Controller', function () {
-        var el, container;
-
-        beforeEach(function () {
-          container = document.createElement('div');
-          el = TestUtils.renderIntoDocument(<Views.PermissionsController />, container);
-        });
-
-        afterEach(function () {
-          ReactDOM.unmountComponentAtNode(container);
-        });
-
-        it('on Add triggers add action', function () {
-          var spy = sinon.spy(Actions, 'addItem');
-          el.addItem({});
-          assert.ok(spy.calledOnce);
-        });
-
-        it('on Remove triggers remove action', function () {
-          var spy = sinon.spy(Actions, 'removeItem');
-          el.removeItem({
-            value: 'boom',
-            type: 'names',
-            section: 'members'
-          });
-          assert.ok(spy.calledOnce);
-        });
+    it('stores new name on change', function () {
+      var newName = 'newName';
+      var dom = $(ReactDOM.findDOMNode(el)).find('.item')[0];
 
+      TestUtils.Simulate.change(dom, {
+        target: {
+          value: newName
+        }
       });
 
-      describe('PermissionsSection', function () {
-        var el, container, addSpy;
-
-        beforeEach(function () {
-          addSpy = sinon.spy();
-          container = document.createElement('div');
-          el = TestUtils.renderIntoDocument(<Views.PermissionsSection section={'members'} roles={[]} names={[]} addItem={addSpy} />, container);
-        });
-
-        afterEach(function () {
-          ReactDOM.unmountComponentAtNode(container);
-        });
-
-        it('adds user on submit', function () {
-          var input = $(ReactDOM.findDOMNode(el)).find('input')[0];
-          TestUtils.Simulate.change(input, {
-            target: {
-              value: 'newusername'
-            }
-          });
-          var form = $(ReactDOM.findDOMNode(el)).find('.permission-item-form')[0];
-          TestUtils.Simulate.submit(form);
-
-          var options = addSpy.args[0][0];
-          assert.ok(addSpy.calledOnce);
-          assert.equal(options.type, "names");
-          assert.equal(options.section, "members");
-        });
-
-        it('adds role on submit', function () {
-          var input = $(ReactDOM.findDOMNode(el)).find('input')[1];
-          TestUtils.Simulate.change(input, {
-            target: {
-              value: 'newrole'
-            }
-          });
-          var form = $(ReactDOM.findDOMNode(el)).find('.permission-item-form')[1];
-          TestUtils.Simulate.submit(form);
-
-          var options = addSpy.args[0][0];
-          assert.ok(addSpy.calledOnce);
-          assert.equal(options.type, "roles");
-          assert.equal(options.section, "members");
-        });
-
-        it('stores new name on change', function () {
-          var newName = 'newName';
-          var dom = $(ReactDOM.findDOMNode(el)).find('.item')[0];
-
-          TestUtils.Simulate.change(dom, {
-            target: {
-              value: newName
-            }
-          });
-
-          assert.equal(el.state.newName, newName);
-        });
-
-        it('stores new role on change', function () {
-          var newRole = 'newRole';
-          var dom = $(ReactDOM.findDOMNode(el)).find('.item')[1];
-
-          TestUtils.Simulate.change(dom, {
-            target: {
-              value: newRole
-            }
-          });
-
-          assert.equal(el.state.newRole, newRole);
-        });
+      assert.equal(el.state.newName, newName);
+    });
+
+    it('stores new role on change', function () {
+      var newRole = 'newRole';
+      var dom = $(ReactDOM.findDOMNode(el)).find('.item')[1];
+
+      TestUtils.Simulate.change(dom, {
+        target: {
+          value: newRole
+        }
       });
 
-      describe('PermissionsItem', function () {
-        var el, container, removeSpy;
+      assert.equal(el.state.newRole, newRole);
+    });
+  });
 
-        beforeEach(function () {
-          removeSpy = sinon.spy();
-          container = document.createElement('div');
-          el = TestUtils.renderIntoDocument(<Views.PermissionsItem section={'members'} item={'test-item'} removeItem={removeSpy} />, container);
-        });
+  describe('PermissionsItem', function () {
+    var el, container, removeSpy;
 
-        afterEach(function () {
-          ReactDOM.unmountComponentAtNode(container);
-        });
+    beforeEach(function () {
+      removeSpy = sinon.spy();
+      container = document.createElement('div');
+      el = TestUtils.renderIntoDocument(<Views.PermissionsItem section={'members'} item={'test-item'} removeItem={removeSpy} />, container);
+    });
 
-        it('triggers remove on click', function () {
-          var dom = $(ReactDOM.findDOMNode(el)).find('.close')[0];
-          TestUtils.Simulate.click(dom);
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
 
-          assert.ok(removeSpy.calledOnce);
+    it('triggers remove on click', function () {
+      var dom = $(ReactDOM.findDOMNode(el)).find('.close')[0];
+      TestUtils.Simulate.click(dom);
 
-        });
+      assert.ok(removeSpy.calledOnce);
 
-      });
     });
+
   });
+});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/permissions/tests/resourceSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/permissions/tests/resourceSpec.js b/app/addons/permissions/tests/resourceSpec.js
index dad9122..7a77710 100644
--- a/app/addons/permissions/tests/resourceSpec.js
+++ b/app/addons/permissions/tests/resourceSpec.js
@@ -9,63 +9,59 @@
 // 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',
-  '../../../../test/mocha/testUtils'
-], function (FauxtonAPI, Models, testUtils) {
-  var assert = testUtils.assert;
+import FauxtonAPI from "../../../core/api";
+import Models from "../resources";
+import testUtils from "../../../../test/mocha/testUtils";
+var assert = testUtils.assert;
 
-  describe('Permissions', function () {
+describe('Permissions', function () {
 
-    describe('#addItem', function () {
-      var security;
+  describe('#addItem', function () {
+    var security;
 
-      beforeEach(function () {
-        security = new Models.Security(null, {database: 'fakedb'});
-      });
-
-      it('Should add value to section', function () {
+    beforeEach(function () {
+      security = new Models.Security(null, {database: 'fakedb'});
+    });
 
-        security.addItem('_user', 'names', 'admins');
-        assert.equal(security.get('admins').names[0], '_user');
-      });
+    it('Should add value to section', function () {
 
-      it('Should handle incorrect type', function () {
-        security.addItem('_user', 'asdasd', 'admins');
-      });
+      security.addItem('_user', 'names', 'admins');
+      assert.equal(security.get('admins').names[0], '_user');
+    });
 
-      it('Should handle incorrect section', function () {
-        security.addItem('_user', 'names', 'Asdasd');
-      });
+    it('Should handle incorrect type', function () {
+      security.addItem('_user', 'asdasd', 'admins');
+    });
 
-      it('Should reject duplicates', function () {
-        security.addItem('_user', 'names', 'admins');
-        security.addItem('_user', 'names', 'admins');
-        assert.equal(security.get('admins').names.length, 1);
-      });
+    it('Should handle incorrect section', function () {
+      security.addItem('_user', 'names', 'Asdasd');
     });
 
-    describe('#removeItem', function () {
-      var security;
+    it('Should reject duplicates', function () {
+      security.addItem('_user', 'names', 'admins');
+      security.addItem('_user', 'names', 'admins');
+      assert.equal(security.get('admins').names.length, 1);
+    });
+  });
 
-      beforeEach(function () {
-        security = new Models.Security(null, {database: 'fakedb'});
-      });
+  describe('#removeItem', function () {
+    var security;
 
-      it('removes value from section', function () {
-        security.addItem('_user', 'names', 'admins');
-        security.removeItem('_user', 'names', 'admins');
+    beforeEach(function () {
+      security = new Models.Security(null, {database: 'fakedb'});
+    });
 
-        assert.equal(security.get('admins').names.length, 0);
-      });
+    it('removes value from section', function () {
+      security.addItem('_user', 'names', 'admins');
+      security.removeItem('_user', 'names', 'admins');
 
-      it('ignores non-existing value', function () {
-        security.addItem('_user', 'names', 'admins');
-        security.removeItem('wrong_user', 'names', 'admins');
-        assert.equal(security.get('admins').names.length, 1);
-      });
+      assert.equal(security.get('admins').names.length, 0);
+    });
 
+    it('ignores non-existing value', function () {
+      security.addItem('_user', 'names', 'admins');
+      security.removeItem('wrong_user', 'names', 'admins');
+      assert.equal(security.get('admins').names.length, 1);
     });
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/replication/base.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/base.js b/app/addons/replication/base.js
index 13bf2e6..cf8dc69 100644
--- a/app/addons/replication/base.js
+++ b/app/addons/replication/base.js
@@ -10,23 +10,18 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './route',
-  './assets/less/replication.less'
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import replication from "./route";
+import "./assets/less/replication.less";
+replication.initialize = function () {
+  FauxtonAPI.addHeaderLink({ title: 'Replication', href: '#/replication', icon: 'fonticon-replicate' });
+};
 
-function (app, FauxtonAPI, replication) {
-  replication.initialize = function () {
-    FauxtonAPI.addHeaderLink({ title: 'Replication', href: '#/replication', icon: 'fonticon-replicate' });
-  };
-
-  FauxtonAPI.registerUrls( 'replication', {
-    app: function (db) {
-      return '#/replication/' + db;
-    }
-  });
-
-  return replication;
+FauxtonAPI.registerUrls( 'replication', {
+  app: function (db) {
+    return '#/replication/' + db;
+  }
 });
+
+export default replication;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/replication/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/resources.js b/app/addons/replication/resources.js
index 7b28aa1..7402435 100644
--- a/app/addons/replication/resources.js
+++ b/app/addons/replication/resources.js
@@ -10,59 +10,54 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api"
-],
-
-function (app, FauxtonAPI) {
-  var Replication = {};
-
-  // these are probably dupes from the database modules. I'm going to keep them separate for now
-  Replication.DBModel = Backbone.Model.extend({
-    label: function () {
-      // for autocomplete
-      return this.get('name');
-    }
-  });
-
-  Replication.DBList = Backbone.Collection.extend({
-    model: Replication.DBModel,
-    url: function () {
-      return app.host + '/_all_dbs';
-    },
-    parse: function (resp) {
-      // TODO: pagination!
-      return _.map(resp, function (database) {
-        return {
-          id: database,
-          name: database
-        };
-      });
-    }
-  });
-
-  Replication.Task = Backbone.Model.extend({});
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+var Replication = {};
+
+// these are probably dupes from the database modules. I'm going to keep them separate for now
+Replication.DBModel = Backbone.Model.extend({
+  label: function () {
+    // for autocomplete
+    return this.get('name');
+  }
+});
 
-  Replication.Tasks = Backbone.Collection.extend({
-    model: Replication.Task,
-    url: function () {
-      return app.host + '/_active_tasks';
-    },
-    parse: function (resp) {
-      //only want replication tasks to return
-      return _.filter(resp, function (task) {
-        return task.type === 'replication';
-      });
-    }
-  });
+Replication.DBList = Backbone.Collection.extend({
+  model: Replication.DBModel,
+  url: function () {
+    return app.host + '/_all_dbs';
+  },
+  parse: function (resp) {
+    // TODO: pagination!
+    return _.map(resp, function (database) {
+      return {
+        id: database,
+        name: database
+      };
+    });
+  }
+});
 
-  Replication.Replicate = Backbone.Model.extend({
-    documentation: FauxtonAPI.constants.DOC_URLS.REPLICATION,
-    url: function () {
-      return window.location.origin + '/_replicate';
-    }
-  });
+Replication.Task = Backbone.Model.extend({});
+
+Replication.Tasks = Backbone.Collection.extend({
+  model: Replication.Task,
+  url: function () {
+    return app.host + '/_active_tasks';
+  },
+  parse: function (resp) {
+    //only want replication tasks to return
+    return _.filter(resp, function (task) {
+      return task.type === 'replication';
+    });
+  }
+});
 
-  return Replication;
+Replication.Replicate = Backbone.Model.extend({
+  documentation: FauxtonAPI.constants.DOC_URLS.REPLICATION,
+  url: function () {
+    return window.location.origin + '/_replicate';
+  }
 });
+
+export default Replication;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/replication/route.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/route.js b/app/addons/replication/route.js
index b3e8c33..7d4aa60 100644
--- a/app/addons/replication/route.js
+++ b/app/addons/replication/route.js
@@ -10,52 +10,48 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './resources',
-  './views'
-],
-function (app, FauxtonAPI, Replication, Views) {
-  var RepRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'one_pane',
-    routes: {
-      "replication": 'defaultView',
-      "replication/:dbname": 'defaultView'
-    },
-    selectedHeader: 'Replication',
-    apiUrl: function () {
-      return [this.replication.url(), this.replication.documentation];
-    },
-    crumbs: [
-      { "name": 'Replicate changes from: ', 'link': 'replication' }
-    ],
-    defaultView: function (dbname) {
-      var isAdmin = FauxtonAPI.session.isAdmin();
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Replication from "./resources";
+import Views from "./views";
+var RepRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'one_pane',
+  routes: {
+    "replication": 'defaultView',
+    "replication/:dbname": 'defaultView'
+  },
+  selectedHeader: 'Replication',
+  apiUrl: function () {
+    return [this.replication.url(), this.replication.documentation];
+  },
+  crumbs: [
+    { "name": 'Replicate changes from: ', 'link': 'replication' }
+  ],
+  defaultView: function (dbname) {
+    var isAdmin = FauxtonAPI.session.isAdmin();
 
-      this.tasks = [];
-      this.databases = new Replication.DBList({});
-      this.replication = new Replication.Replicate({});
+    this.tasks = [];
+    this.databases = new Replication.DBList({});
+    this.replication = new Replication.Replicate({});
 
-      if (isAdmin) {
-        this.tasks = new Replication.Tasks({ id: 'ReplicationTasks' });
-        this.setView('#dashboard-content', new Views.ReplicationFormForAdmins({
-          selectedDB: dbname || '',
-          collection: this.databases,
-          status: this.tasks
-        }));
-        return;
-      }
-      this.setView('#dashboard-content', new Views.ReplicationForm({
+    if (isAdmin) {
+      this.tasks = new Replication.Tasks({ id: 'ReplicationTasks' });
+      this.setView('#dashboard-content', new Views.ReplicationFormForAdmins({
         selectedDB: dbname || '',
         collection: this.databases,
         status: this.tasks
       }));
+      return;
     }
-  });
+    this.setView('#dashboard-content', new Views.ReplicationForm({
+      selectedDB: dbname || '',
+      collection: this.databases,
+      status: this.tasks
+    }));
+  }
+});
 
 
-  Replication.RouteObjects = [RepRouteObject];
+Replication.RouteObjects = [RepRouteObject];
 
-  return Replication;
-});
+export default Replication;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/replication/tests/replicationSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/replication/tests/replicationSpec.js b/app/addons/replication/tests/replicationSpec.js
index 7b64a04..bae87c1 100644
--- a/app/addons/replication/tests/replicationSpec.js
+++ b/app/addons/replication/tests/replicationSpec.js
@@ -9,33 +9,30 @@
 // 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([
-  '../base',
-  '../views',
-  '../resources',
-  '../../../../test/mocha/testUtils',
-], function (Replication, Views, Resources, testUtils) {
-  var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox,
-      viewSandbox;
+import Replication from "../base";
+import Views from "../views";
+import Resources from "../resources";
+import testUtils from "../../../../test/mocha/testUtils";
+var assert = testUtils.assert,
+    ViewSandbox = testUtils.ViewSandbox,
+    viewSandbox;
 
-  describe('Replication Addon', function () {
-    describe('Replication View', function () {
-      var view = new Views.ReplicationForm({
-        collection: new Replication.DBList()
-      });
-      beforeEach(function (done) {
-        viewSandbox = new ViewSandbox();
-        viewSandbox.renderView(view, done);
-      });
+describe('Replication Addon', function () {
+  describe('Replication View', function () {
+    var view = new Views.ReplicationForm({
+      collection: new Replication.DBList()
+    });
+    beforeEach(function (done) {
+      viewSandbox = new ViewSandbox();
+      viewSandbox.renderView(view, done);
+    });
 
-      afterEach(function () {
-        viewSandbox.remove();
-      });
+    afterEach(function () {
+      viewSandbox.remove();
+    });
 
-      it("should render", function () {
-        assert.ok(view.$el.length > 0);
-      });
+    it("should render", function () {
+      assert.ok(view.$el.length > 0);
     });
   });
 });


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/resourcesSpec.js b/app/addons/documents/tests/resourcesSpec.js
index 176d726..661209b 100644
--- a/app/addons/documents/tests/resourcesSpec.js
+++ b/app/addons/documents/tests/resourcesSpec.js
@@ -9,459 +9,456 @@
 // 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',
-  '../../../../test/mocha/testUtils',
-  '../base'
-], function (FauxtonAPI, Models, testUtils) {
-  var assert = testUtils.assert;
-
-  describe('IndexCollection', function () {
-    var collection;
-    beforeEach(function () {
-      collection = new Models.IndexCollection([{
-        id:'myId1',
-        doc: 'num1'
-      },
-      {
-        id:'myId2',
-        doc: 'num2'
-      }], {
-        database: {id: 'databaseId', safeID: function () { return this.id; }},
-        design: '_design/myDoc'
-      });
+import FauxtonAPI from "../../../core/api";
+import Models from "../resources";
+import testUtils from "../../../../test/mocha/testUtils";
+import "../base";
+var assert = testUtils.assert;
+
+describe('IndexCollection', function () {
+  var collection;
+  beforeEach(function () {
+    collection = new Models.IndexCollection([{
+      id:'myId1',
+      doc: 'num1'
+    },
+    {
+      id:'myId2',
+      doc: 'num2'
+    }], {
+      database: {id: 'databaseId', safeID: function () { return this.id; }},
+      design: '_design/myDoc'
     });
+  });
 
-    it('creates the right api-url with an absolute url', function () {
-      assert.ok(/file:/.test(collection.urlRef('apiurl')));
-    });
+  it('creates the right api-url with an absolute url', function () {
+    assert.ok(/file:/.test(collection.urlRef('apiurl')));
+  });
+
+});
 
+describe('Document', function () {
+  var doc;
+  beforeEach(function () {
+    doc = new Models.Doc({}, {});
   });
 
-  describe('Document', function () {
-    var doc;
-    beforeEach(function () {
-      doc = new Models.Doc({}, {});
+  it('does not remove an id attribute', function () {
+    var res = doc.parse({
+      _id: 'be31e531fe131bdf416b479ac1000484',
+      _rev: '4-3a1b9f4b988b413e9245cd250769da72',
+      id: 'foo'
     });
+    assert.equal(res.id, 'foo');
+  });
 
-    it('does not remove an id attribute', function () {
-      var res = doc.parse({
-        _id: 'be31e531fe131bdf416b479ac1000484',
-        _rev: '4-3a1b9f4b988b413e9245cd250769da72',
-        id: 'foo'
-      });
-      assert.equal(res.id, 'foo');
+  it('removes the id, if we create a document and get back an "id" instead of "_id"', function () {
+    // if we take the document {"_id": "mycustomid", "_rev": "18-9cdeb1b121137233e3466b06a1780c29", id: "foo"}
+    // and do a PUT request for an update, CouchDB will return:
+    // {"ok":true,"id":"mycustomid","rev":"18-9cdeb1b121137233e3466b06a1780c29"}
+    // and our Model will think it has the id "mycustomid" instead of "foo"
+    var res = doc.parse({
+      id: 'be31e531fe131bdf416b479ac1000484',
+      _rev: '4-3a1b9f4b988b413e9245cd250769da72',
+      ok: true
     });
+    assert.notOk(res.id);
+  });
 
-    it('removes the id, if we create a document and get back an "id" instead of "_id"', function () {
-      // if we take the document {"_id": "mycustomid", "_rev": "18-9cdeb1b121137233e3466b06a1780c29", id: "foo"}
-      // and do a PUT request for an update, CouchDB will return:
-      // {"ok":true,"id":"mycustomid","rev":"18-9cdeb1b121137233e3466b06a1780c29"}
-      // and our Model will think it has the id "mycustomid" instead of "foo"
-      var res = doc.parse({
-        id: 'be31e531fe131bdf416b479ac1000484',
-        _rev: '4-3a1b9f4b988b413e9245cd250769da72',
-        ok: true
-      });
-      assert.notOk(res.id);
+  it('can return the doc url, if id given', function () {
+    doc = new Models.Doc({_id: 'scholle'}, {
+      database: {id: 'blerg', safeID: function () { return this.id; }}
     });
 
-    it('can return the doc url, if id given', function () {
-      doc = new Models.Doc({_id: 'scholle'}, {
-        database: {id: 'blerg', safeID: function () { return this.id; }}
-      });
+    assert.ok(/\/blerg/.test(doc.url('apiurl')));
+  });
 
-      assert.ok(/\/blerg/.test(doc.url('apiurl')));
+  it('will return the API url to create a new doc, if no doc exists yet', function () {
+    doc = new Models.Doc({}, {
+      database: {id: 'blerg', safeID: function () { return this.id; }}
     });
 
-    it('will return the API url to create a new doc, if no doc exists yet', function () {
-      doc = new Models.Doc({}, {
-        database: {id: 'blerg', safeID: function () { return this.id; }}
-      });
-
-      assert.ok(/\/blerg/.test(doc.url('apiurl')));
-    });
+    assert.ok(/\/blerg/.test(doc.url('apiurl')));
   });
+});
 
-  describe('MangoIndex', function () {
-    var doc;
+describe('MangoIndex', function () {
+  var doc;
 
-    it('is deleteable', function () {
-      var index = {
-        ddoc: null,
-        name: '_all_docs',
-        type: 'json',
-        def: {fields: [{_id: 'asc'}]}
-      };
-      doc = new Models.MangoIndex(index, {});
+  it('is deleteable', function () {
+    var index = {
+      ddoc: null,
+      name: '_all_docs',
+      type: 'json',
+      def: {fields: [{_id: 'asc'}]}
+    };
+    doc = new Models.MangoIndex(index, {});
 
-      assert.ok(doc.isDeletable());
-    });
+    assert.ok(doc.isDeletable());
+  });
 
-    it('special docs are not deleteable', function () {
-      var index = {
-        ddoc: null,
-        name: '_all_docs',
-        type: 'special',
-        def: {fields: [{_id: 'asc'}]}
-      };
-      doc = new Models.MangoIndex(index, {});
+  it('special docs are not deleteable', function () {
+    var index = {
+      ddoc: null,
+      name: '_all_docs',
+      type: 'special',
+      def: {fields: [{_id: 'asc'}]}
+    };
+    doc = new Models.MangoIndex(index, {});
 
-      assert.notOk(doc.isDeletable());
-    });
+    assert.notOk(doc.isDeletable());
   });
+});
 
-  describe('MangoDocumentCollection', function () {
-    var collection;
-
-    it('gets 1 doc more to know if there are more than 20', function () {
-      collection = new Models.MangoDocumentCollection([{
-        name: 'myId1',
-        doc: 'num1'
-      },
-      {
-        name: 'myId2',
-        doc: 'num2'
-      }], {
-        database: {id: 'databaseId', safeID: function () { return this.id; }},
-        params: {limit: 20}
-      });
-      collection.setQuery({
-        selector: '$foo',
-        fields: 'bla'
-      });
+describe('MangoDocumentCollection', function () {
+  var collection;
 
-      assert.deepEqual({
-        selector: '$foo',
-        fields: 'bla',
-        limit: 21,
-        skip: undefined
-      }, collection.getPaginatedQuery());
+  it('gets 1 doc more to know if there are more than 20', function () {
+    collection = new Models.MangoDocumentCollection([{
+      name: 'myId1',
+      doc: 'num1'
+    },
+    {
+      name: 'myId2',
+      doc: 'num2'
+    }], {
+      database: {id: 'databaseId', safeID: function () { return this.id; }},
+      params: {limit: 20}
     });
-
-    it('on next page, skips first 20', function () {
-      collection = new Models.MangoDocumentCollection([{
-        name: 'myId1',
-        doc: 'num1'
-      },
-      {
-        name: 'myId2',
-        doc: 'num2'
-      }], {
-        database: {id: 'databaseId', safeID: function () { return this.id; }},
-        params: {limit: 20}
-      });
-      collection.setQuery({
-        selector: '$foo',
-        fields: 'bla'
-      });
-      collection.next();
-      assert.deepEqual({
-        selector: '$foo',
-        fields: 'bla',
-        limit: 21,
-        skip: 20
-      }, collection.getPaginatedQuery());
+    collection.setQuery({
+      selector: '$foo',
+      fields: 'bla'
     });
 
+    assert.deepEqual({
+      selector: '$foo',
+      fields: 'bla',
+      limit: 21,
+      skip: undefined
+    }, collection.getPaginatedQuery());
   });
 
-  describe('MangoDocumentCollection', function () {
-    var collection;
-
-    it('is not editable', function () {
-      collection = new Models.MangoIndexCollection([{
-        name: 'myId1',
-        doc: 'num1'
-      },
-      {
-        name: 'myId2',
-        doc: 'num2'
-      }], {
-        database: {id: 'databaseId', safeID: function () { return this.id; }},
-        params: {limit: 20}
-      });
+  it('on next page, skips first 20', function () {
+    collection = new Models.MangoDocumentCollection([{
+      name: 'myId1',
+      doc: 'num1'
+    },
+    {
+      name: 'myId2',
+      doc: 'num2'
+    }], {
+      database: {id: 'databaseId', safeID: function () { return this.id; }},
+      params: {limit: 20}
+    });
+    collection.setQuery({
+      selector: '$foo',
+      fields: 'bla'
+    });
+    collection.next();
+    assert.deepEqual({
+      selector: '$foo',
+      fields: 'bla',
+      limit: 21,
+      skip: 20
+    }, collection.getPaginatedQuery());
+  });
 
-      assert.notOk(collection.isEditable());
+});
+
+describe('MangoDocumentCollection', function () {
+  var collection;
+
+  it('is not editable', function () {
+    collection = new Models.MangoIndexCollection([{
+      name: 'myId1',
+      doc: 'num1'
+    },
+    {
+      name: 'myId2',
+      doc: 'num2'
+    }], {
+      database: {id: 'databaseId', safeID: function () { return this.id; }},
+      params: {limit: 20}
     });
+
+    assert.notOk(collection.isEditable());
   });
+});
 
-  describe('IndexCollection', function () {
-    var collection;
-
-    it('design docs are editable', function () {
-      collection = new Models.IndexCollection([{
-        _id: 'myId1',
-        doc: 'num1'
-      },
-      {
-        _id: 'myId2',
-        doc: 'num2'
-      }], {
-        database: {id: 'databaseId', safeID: function () { return this.id; }},
-        params: {limit: 20},
-        design: '_design/foobar'
-      });
+describe('IndexCollection', function () {
+  var collection;
 
-      assert.ok(collection.isEditable());
+  it('design docs are editable', function () {
+    collection = new Models.IndexCollection([{
+      _id: 'myId1',
+      doc: 'num1'
+    },
+    {
+      _id: 'myId2',
+      doc: 'num2'
+    }], {
+      database: {id: 'databaseId', safeID: function () { return this.id; }},
+      params: {limit: 20},
+      design: '_design/foobar'
     });
 
-    it('reduced design docs are NOT editable', function () {
-      collection = new Models.IndexCollection([{
-        _id: 'myId1',
-        doc: 'num1'
-      },
-      {
-        _id: 'myId2',
-        doc: 'num2'
-      }], {
-        database: {id: 'databaseId', safeID: function () { return this.id; }},
-        params: {limit: 20, reduce: true},
-        design: '_design/foobar'
-      });
+    assert.ok(collection.isEditable());
+  });
 
-      assert.notOk(collection.isEditable());
+  it('reduced design docs are NOT editable', function () {
+    collection = new Models.IndexCollection([{
+      _id: 'myId1',
+      doc: 'num1'
+    },
+    {
+      _id: 'myId2',
+      doc: 'num2'
+    }], {
+      database: {id: 'databaseId', safeID: function () { return this.id; }},
+      params: {limit: 20, reduce: true},
+      design: '_design/foobar'
     });
+
+    assert.notOk(collection.isEditable());
   });
+});
 
-  describe('AllDocs', function () {
-    var collection;
-
-    it('all-docs-list documents are always editable', function () {
-      collection = new Models.AllDocs([{
-        _id: 'myId1',
-        doc: 'num1'
-      },
-      {
-        _id: 'myId2',
-        doc: 'num2'
-      }], {
-        database: {id: 'databaseId', safeID: function () { return this.id; }},
-        params: {limit: 20}
-      });
+describe('AllDocs', function () {
+  var collection;
 
-      assert.ok(collection.isEditable());
+  it('all-docs-list documents are always editable', function () {
+    collection = new Models.AllDocs([{
+      _id: 'myId1',
+      doc: 'num1'
+    },
+    {
+      _id: 'myId2',
+      doc: 'num2'
+    }], {
+      database: {id: 'databaseId', safeID: function () { return this.id; }},
+      params: {limit: 20}
     });
+
+    assert.ok(collection.isEditable());
   });
+});
 
-  describe('QueryParams', function () {
-    describe('parse', function () {
-      it('should not parse arbitrary parameters', function () {
-        var params = {'foo': '[1]]'};
-        var result = Models.QueryParams.parse(params);
+describe('QueryParams', function () {
+  describe('parse', function () {
+    it('should not parse arbitrary parameters', function () {
+      var params = {'foo': '[1]]'};
+      var result = Models.QueryParams.parse(params);
 
-        assert.deepEqual(result, params);
-      });
+      assert.deepEqual(result, params);
+    });
+
+    it('parses startkey, endkey', function () {
+      var params = {
+        'startkey':'[\"a\",\"b\"]',
+        'endkey':'[\"c\",\"d\"]'
+      };
+      var result = Models.QueryParams.parse(params);
 
-      it('parses startkey, endkey', function () {
-        var params = {
-          'startkey':'[\"a\",\"b\"]',
-          'endkey':'[\"c\",\"d\"]'
-        };
-        var result = Models.QueryParams.parse(params);
-
-        assert.deepEqual(result, {
-          'startkey': ['a', 'b'],
-          'endkey': ['c', 'd']
-        });
+      assert.deepEqual(result, {
+        'startkey': ['a', 'b'],
+        'endkey': ['c', 'd']
       });
+    });
 
-      it('parses key', function () {
-        var params = {
-          key:'[1,2]'
-        };
-        var result = Models.QueryParams.parse(params);
+    it('parses key', function () {
+      var params = {
+        key:'[1,2]'
+      };
+      var result = Models.QueryParams.parse(params);
 
-        assert.deepEqual(result, {'key': [1, 2]});
-      });
+      assert.deepEqual(result, {'key': [1, 2]});
+    });
 
-      it('does not modify input', function () {
-        var params = {
-          key:'[\"a\",\"b\"]'
-        };
-        var clone = _.clone(params);
-        var result = Models.QueryParams.parse(params);
+    it('does not modify input', function () {
+      var params = {
+        key:'[\"a\",\"b\"]'
+      };
+      var clone = _.clone(params);
+      var result = Models.QueryParams.parse(params);
 
-        assert.deepEqual(params, clone);
-      });
+      assert.deepEqual(params, clone);
     });
+  });
 
-    describe('stringify', function () {
-      it('should not stringify arbitrary parameters', function () {
-        var params = {'foo': [1, 2, 3]};
-        var result = Models.QueryParams.stringify(params);
+  describe('stringify', function () {
+    it('should not stringify arbitrary parameters', function () {
+      var params = {'foo': [1, 2, 3]};
+      var result = Models.QueryParams.stringify(params);
 
-        assert.deepEqual(result, params);
-      });
+      assert.deepEqual(result, params);
+    });
 
-      it('stringifies startkey, endkey', function () {
-        var params = {
-          'startkey': ['a', 'b'],
-          'endkey': ['c', 'd']
-        };
+    it('stringifies startkey, endkey', function () {
+      var params = {
+        'startkey': ['a', 'b'],
+        'endkey': ['c', 'd']
+      };
 
-        var result = Models.QueryParams.stringify(params);
+      var result = Models.QueryParams.stringify(params);
 
-        assert.deepEqual(result, {
-          'startkey':'[\"a\",\"b\"]',
-          'endkey':'[\"c\",\"d\"]'
-        });
+      assert.deepEqual(result, {
+        'startkey':'[\"a\",\"b\"]',
+        'endkey':'[\"c\",\"d\"]'
       });
+    });
 
-      it('stringifies key', function () {
-        var params = {'key':['a', 'b']};
-        var result = Models.QueryParams.stringify(params);
+    it('stringifies key', function () {
+      var params = {'key':['a', 'b']};
+      var result = Models.QueryParams.stringify(params);
 
-        assert.deepEqual(result, { 'key': '[\"a\",\"b\"]' });
-      });
+      assert.deepEqual(result, { 'key': '[\"a\",\"b\"]' });
+    });
 
-      it('does not modify input', function () {
-        var params = {'key': ['a', 'b']};
-        var clone = _.clone(params);
-        var result = Models.QueryParams.stringify(params);
+    it('does not modify input', function () {
+      var params = {'key': ['a', 'b']};
+      var clone = _.clone(params);
+      var result = Models.QueryParams.stringify(params);
 
-        assert.deepEqual(params, clone);
-      });
+      assert.deepEqual(params, clone);
+    });
 
-      it('is symmetrical with parse', function () {
-        var params = {
-          'startkey': ['a', 'b'],
-          'endkey': ['c', 'd'],
-          'foo': '[1,2]',
-          'bar': 'abc'
-        };
+    it('is symmetrical with parse', function () {
+      var params = {
+        'startkey': ['a', 'b'],
+        'endkey': ['c', 'd'],
+        'foo': '[1,2]',
+        'bar': 'abc'
+      };
 
-        var clone = _.clone(params);
-        var json = Models.QueryParams.stringify(params);
-        var result = Models.QueryParams.parse(json);
+      var clone = _.clone(params);
+      var json = Models.QueryParams.stringify(params);
+      var result = Models.QueryParams.parse(json);
 
-        assert.deepEqual(result, clone);
-      });
+      assert.deepEqual(result, clone);
     });
   });
+});
 
-  describe('Bulk Delete', function () {
-    var databaseId = 'ente',
-        collection,
-        promise,
-        values;
-
-    values = [{
-      _id: '1',
-      _rev: '1234561',
-      _deleted: true
-    },
-    {
-      _id: '2',
-      _rev: '1234562',
-      _deleted: true
-    },
-    {
-      _id: '3',
-      _rev: '1234563',
-      _deleted: true
-    }];
-
-    beforeEach(function () {
-      collection = new Models.BulkDeleteDocCollection(values, {
-        databaseId: databaseId
-      });
-
-      promise = FauxtonAPI.Deferred();
+describe('Bulk Delete', function () {
+  var databaseId = 'ente',
+      collection,
+      promise,
+      values;
+
+  values = [{
+    _id: '1',
+    _rev: '1234561',
+    _deleted: true
+  },
+  {
+    _id: '2',
+    _rev: '1234562',
+    _deleted: true
+  },
+  {
+    _id: '3',
+    _rev: '1234563',
+    _deleted: true
+  }];
+
+  beforeEach(function () {
+    collection = new Models.BulkDeleteDocCollection(values, {
+      databaseId: databaseId
     });
 
-    it('contains the models', function () {
-      collection = new Models.BulkDeleteDocCollection(values, {
-        databaseId: databaseId
-      });
+    promise = FauxtonAPI.Deferred();
+  });
 
-      assert.equal(collection.length, 3);
+  it('contains the models', function () {
+    collection = new Models.BulkDeleteDocCollection(values, {
+      databaseId: databaseId
     });
 
-    it('clears the memory if no errors happened', function () {
-      collection.handleResponse([
-        {'ok': true, 'id': '1', 'rev': '10-72cd2edbcc0d197ce96188a229a7af01'},
-        {'ok': true, 'id': '2', 'rev': '6-da537822b9672a4b2f42adb1be04a5b1'}
-      ], promise);
+    assert.equal(collection.length, 3);
+  });
 
-      assert.equal(collection.length, 1);
-    });
+  it('clears the memory if no errors happened', function () {
+    collection.handleResponse([
+      {'ok': true, 'id': '1', 'rev': '10-72cd2edbcc0d197ce96188a229a7af01'},
+      {'ok': true, 'id': '2', 'rev': '6-da537822b9672a4b2f42adb1be04a5b1'}
+    ], promise);
 
-    it('triggers a removed event with all ids', function () {
-      collection.listenToOnce(collection, 'removed', function (ids) {
-        assert.deepEqual(ids, ['Deferred', 'DeskSet']);
-      });
+    assert.equal(collection.length, 1);
+  });
 
-      collection.handleResponse([
-        {'ok': true, 'id': 'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
-        {'ok': true, 'id': 'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
-      ], promise);
+  it('triggers a removed event with all ids', function () {
+    collection.listenToOnce(collection, 'removed', function (ids) {
+      assert.deepEqual(ids, ['Deferred', 'DeskSet']);
     });
 
-    it('triggers a error event with all errored ids', function () {
-      collection.listenToOnce(collection, 'error', function (ids) {
-        assert.deepEqual(ids, ['Deferred']);
-      });
-      collection.handleResponse([
-        {'error':'conflict', 'id':'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
-        {'ok':true, 'id':'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
-      ], promise);
-    });
+    collection.handleResponse([
+      {'ok': true, 'id': 'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
+      {'ok': true, 'id': 'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
+    ], promise);
+  });
 
-    it('removes successfull deleted from the collection but keeps one with errors', function () {
-      collection.handleResponse([
-        {'error':'conflict', 'id':'1', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
-        {'ok':true, 'id':'2', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'},
-        {'error':'conflict', 'id':'3', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
-      ], promise);
-      assert.ok(collection.get('1'));
-      assert.ok(collection.get('3'));
-      assert.notOk(collection.get('2'));
+  it('triggers a error event with all errored ids', function () {
+    collection.listenToOnce(collection, 'error', function (ids) {
+      assert.deepEqual(ids, ['Deferred']);
     });
+    collection.handleResponse([
+      {'error':'conflict', 'id':'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
+      {'ok':true, 'id':'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
+    ], promise);
+  });
 
-    it('triggers resolve for successful delete', function () {
-      var spy = sinon.spy();
-      promise.then(spy);
-
-      collection.handleResponse([
-        {'ok':true, 'id':'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
-        {'ok':true, 'id':'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
-      ], promise);
+  it('removes successfull deleted from the collection but keeps one with errors', function () {
+    collection.handleResponse([
+      {'error':'conflict', 'id':'1', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
+      {'ok':true, 'id':'2', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'},
+      {'error':'conflict', 'id':'3', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
+    ], promise);
+    assert.ok(collection.get('1'));
+    assert.ok(collection.get('3'));
+    assert.notOk(collection.get('2'));
+  });
 
-      assert.ok(spy.calledOnce);
+  it('triggers resolve for successful delete', function () {
+    var spy = sinon.spy();
+    promise.then(spy);
 
-    });
+    collection.handleResponse([
+      {'ok':true, 'id':'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
+      {'ok':true, 'id':'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'}
+    ], promise);
 
-    it('triggers resolve for successful delete with errors as well', function () {
-      var spy = sinon.spy();
-      promise.then(spy);
-      var ids = {
-        errorIds: ['1'],
-        successIds: ['Deferred', 'DeskSet']
-      };
+    assert.ok(spy.calledOnce);
 
-      collection.handleResponse([
-        {'ok':true, 'id':'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
-        {'ok':true, 'id':'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'},
-        {'error':'conflict', 'id':'1', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
-      ], promise);
+  });
 
-      assert.ok(spy.calledWith(ids));
-    });
+  it('triggers resolve for successful delete with errors as well', function () {
+    var spy = sinon.spy();
+    promise.then(spy);
+    var ids = {
+      errorIds: ['1'],
+      successIds: ['Deferred', 'DeskSet']
+    };
+
+    collection.handleResponse([
+      {'ok':true, 'id':'Deferred', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
+      {'ok':true, 'id':'DeskSet', 'rev':'6-da537822b9672a4b2f42adb1be04a5b1'},
+      {'error':'conflict', 'id':'1', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'},
+    ], promise);
+
+    assert.ok(spy.calledWith(ids));
+  });
 
-    it('triggers reject for failed delete', function () {
-      var spy = sinon.spy();
-      promise.fail(spy);
+  it('triggers reject for failed delete', function () {
+    var spy = sinon.spy();
+    promise.fail(spy);
 
-      collection.handleResponse([
-        {'error':'conflict', 'id':'1', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'}
-      ], promise);
+    collection.handleResponse([
+      {'error':'conflict', 'id':'1', 'rev':'10-72cd2edbcc0d197ce96188a229a7af01'}
+    ], promise);
 
-      assert.ok(spy.calledWith(['1']));
+    assert.ok(spy.calledWith(['1']));
 
-    });
+  });
 
 
-  });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/tests/routeSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/routeSpec.js b/app/addons/documents/tests/routeSpec.js
index 5807b02..57bf9aa 100644
--- a/app/addons/documents/tests/routeSpec.js
+++ b/app/addons/documents/tests/routeSpec.js
@@ -10,39 +10,36 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../../core/api',
-  '../base',
-  '../routes',
-  '../header/header.actions',
-  '../index-results/actions',
-  '../../../../test/mocha/testUtils',
-], function (FauxtonAPI, Base, Documents, HeaderActions, IndexResultsActions, testUtils) {
-  var assert = testUtils.assert;
-  var DocumentRoute = Documents.RouteObjects[2];
-
-  //commenting out for now. This test adds little value and is breaking the routeObjectSpecs
-  describe('Documents Route', function () {
-
-    /*it('the all-documents-list has a right header', function () {
-       var routeObj = new DocumentRoute(null, null, ['test']);
-
-       routeObj.allDocs('newdatabase', null);
-      assert.equal(typeof routeObj.rightHeader, 'object');
-
-    });*/
-
-  });
-
-  //    until there is consensus on how to encode json responses
-  //    https://issues.apache.org/jira/browse/COUCHDB-2748
-  //    taking out this test for https://github.com/apache/couchdb-fauxton/pull/489
-
-  //describe('Fauxton Urls', function () {
-    // it('document app encodes document id', function () {
-    //   var id = "\foo";
-    //   var url = FauxtonAPI.urls('document', 'app', 'fake-db', id);
-    //   assert.deepEqual("/database/fake-db/%0Coo", url);
-    // });
-  //});
+import FauxtonAPI from "../../../core/api";
+import Base from "../base";
+import Documents from "../routes";
+import HeaderActions from "../header/header.actions";
+import IndexResultsActions from "../index-results/actions";
+import testUtils from "../../../../test/mocha/testUtils";
+var assert = testUtils.assert;
+var DocumentRoute = Documents.RouteObjects[2];
+
+//commenting out for now. This test adds little value and is breaking the routeObjectSpecs
+describe('Documents Route', function () {
+
+  /*it('the all-documents-list has a right header', function () {
+     var routeObj = new DocumentRoute(null, null, ['test']);
+
+     routeObj.allDocs('newdatabase', null);
+    assert.equal(typeof routeObj.rightHeader, 'object');
+
+  });*/
+
 });
+
+//    until there is consensus on how to encode json responses
+//    https://issues.apache.org/jira/browse/COUCHDB-2748
+//    taking out this test for https://github.com/apache/couchdb-fauxton/pull/489
+
+//describe('Fauxton Urls', function () {
+// it('document app encodes document id', function () {
+//   var id = "\foo";
+//   var url = FauxtonAPI.urls('document', 'app', 'fake-db', id);
+//   assert.deepEqual("/database/fake-db/%0Coo", url);
+// });
+//});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 6c46076..3b1ff67 100644
--- a/app/addons/documents/views.js
+++ b/app/addons/documents/views.js
@@ -10,95 +10,86 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  "../fauxton/components",
-  "./resources",
-  "../databases/resources",
-
-  // Views
-  "./queryoptions/queryoptions.react",
-  "./queryoptions/actions",
-  './jumptodoc.react',
-
-  //plugins
-  "../../../assets/js/plugins/prettify"
-],
-
-function (app, FauxtonAPI, Components, Documents, Databases, QueryOptions, QueryActions, JumpToDoc) {
-
-  var Views = {};
-
-  function showError (msg) {
-    FauxtonAPI.addNotification({
-      msg: msg,
-      type: 'error',
-      clear:  true
-    });
-  }
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Components from "../fauxton/components";
+import Documents from "./resources";
+import Databases from "../databases/resources";
+import QueryOptions from "./queryoptions/queryoptions.react";
+import QueryActions from "./queryoptions/actions";
+import JumpToDoc from "./jumptodoc.react";
+import "../../../assets/js/plugins/prettify";
+
+var Views = {};
+
+function showError (msg) {
+  FauxtonAPI.addNotification({
+    msg: msg,
+    type: 'error',
+    clear:  true
+  });
+}
+
+Views.RightAllDocsHeader = FauxtonAPI.View.extend({
+  className: "header-right right-db-header flex-layout flex-row",
+  template: "addons/documents/templates/all_docs_header",
+  events: {
+    'click .toggle-select-menu': 'selectAllMenu'
+  },
+
+  initialize: function (options) {
+    this.database = options.database;
+    this.params = options.params;
+
+    _.bindAll(this);
+    this.selectVisible = false;
+    FauxtonAPI.Events.on('success:bulkDelete', this.selectAllMenu);
+  },
+
+  afterRender: function () {
+    QueryOptions.render('#query-options');
+    JumpToDoc.render('#header-search', this.database, this.database.allDocs);
+    this.toggleQueryOptionsHeader(this.isHidden);
+  },
+
+  cleanup: function () {
+    FauxtonAPI.Events.unbind('success:bulkDelete');
+  },
+
+  selectAllMenu: function (e) {
+    FauxtonAPI.triggerRouteEvent("toggleSelectHeader");
+    FauxtonAPI.Events.trigger("documents:showSelectAll", this.selectVisible);
+  },
+
+  resetQueryOptions: function (options) {
+    QueryActions.reset(options);
+  },
+
+  hideQueryOptions: function () {
+    this.isHidden = true;
+    if (this.hasRendered) {
+      this.toggleQueryOptionsHeader(this.isHidden);
+    }
+  },
 
-  Views.RightAllDocsHeader = FauxtonAPI.View.extend({
-    className: "header-right right-db-header flex-layout flex-row",
-    template: "addons/documents/templates/all_docs_header",
-    events: {
-      'click .toggle-select-menu': 'selectAllMenu'
-    },
-
-    initialize: function (options) {
-      this.database = options.database;
-      this.params = options.params;
-
-      _.bindAll(this);
-      this.selectVisible = false;
-      FauxtonAPI.Events.on('success:bulkDelete', this.selectAllMenu);
-    },
-
-    afterRender: function () {
-      QueryOptions.render('#query-options');
-      JumpToDoc.render('#header-search', this.database, this.database.allDocs);
+  showQueryOptions: function () {
+    this.isHidden = false;
+    if (this.hasRendered) {
       this.toggleQueryOptionsHeader(this.isHidden);
-    },
-
-    cleanup: function () {
-      FauxtonAPI.Events.unbind('success:bulkDelete');
-    },
-
-    selectAllMenu: function (e) {
-      FauxtonAPI.triggerRouteEvent("toggleSelectHeader");
-      FauxtonAPI.Events.trigger("documents:showSelectAll", this.selectVisible);
-    },
-
-    resetQueryOptions: function (options) {
-      QueryActions.reset(options);
-    },
-
-    hideQueryOptions: function () {
-      this.isHidden = true;
-      if (this.hasRendered) {
-        this.toggleQueryOptionsHeader(this.isHidden);
-      }
-    },
-
-    showQueryOptions: function () {
-      this.isHidden = false;
-      if (this.hasRendered) {
-        this.toggleQueryOptionsHeader(this.isHidden);
-      }
-    },
-
-    toggleQueryOptionsHeader: function (hide) {
-      $("#header-query-options").toggleClass("hide", hide);
-    },
-
-    serialize: function () {
-      return {
-        database: this.database.get('id')
-      };
     }
-  });
+  },
 
-  Documents.Views = Views;
+  toggleQueryOptionsHeader: function (hide) {
+    $("#header-query-options").toggleClass("hide", hide);
+  },
 
-  return Documents;
+  serialize: function () {
+    return {
+      database: this.database.get('id')
+    };
+  }
 });
+
+Documents.Views = Views;
+
+export default Documents;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/base.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/base.js b/app/addons/fauxton/base.js
index 7d22bb1..a907c03 100644
--- a/app/addons/fauxton/base.js
+++ b/app/addons/fauxton/base.js
@@ -10,112 +10,106 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  "./components",
-  './notifications/notifications.react',
-  './notifications/actions',
-  "./navigation/components.react",
-  "./navigation/actions",
-  '../components/react-components.react',
-  '../components/actions',
-  './assets/less/fauxton.less'
-],
-
-function (app, FauxtonAPI, Components, NotificationComponents, Actions, NavbarReactComponents, NavigationActions,
-          ReactComponents, ComponentActions) {
-
-  var Fauxton = FauxtonAPI.addon();
-  FauxtonAPI.addNotification = function (options) {
-    options = _.extend({
-      msg: 'Notification Event Triggered!',
-      type: 'info',
-      escape: true,
-      clear: false
-    }, options);
-
-    // log all notifications in a store
-    Actions.addNotification(options);
-  };
-
-  FauxtonAPI.UUID = FauxtonAPI.Model.extend({
-    initialize: function (options) {
-      options = _.extend({count: 1}, options);
-      this.count = options.count;
-    },
-
-    url: function () {
-      return app.host + "/_uuids?count=" + this.count;
-    },
-
-    next: function () {
-      return this.get("uuids").pop();
-    }
-  });
-
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Components from "./components";
+import NotificationComponents from "./notifications/notifications.react";
+import Actions from "./notifications/actions";
+import NavbarReactComponents from "./navigation/components.react";
+import NavigationActions from "./navigation/actions";
+import ReactComponents from "../components/react-components.react";
+import ComponentActions from "../components/actions";
+import "./assets/less/fauxton.less";
+
+var Fauxton = FauxtonAPI.addon();
+FauxtonAPI.addNotification = function (options) {
+  options = _.extend({
+    msg: 'Notification Event Triggered!',
+    type: 'info',
+    escape: true,
+    clear: false
+  }, options);
+
+  // log all notifications in a store
+  Actions.addNotification(options);
+};
+
+FauxtonAPI.UUID = FauxtonAPI.Model.extend({
+  initialize: function (options) {
+    options = _.extend({count: 1}, options);
+    this.count = options.count;
+  },
+
+  url: function () {
+    return app.host + "/_uuids?count=" + this.count;
+  },
+
+  next: function () {
+    return this.get("uuids").pop();
+  }
+});
 
-  Fauxton.initialize = function () {
 
-    FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) {
-      NavigationActions.setNavbarActiveLink(_.result(routeObject, 'selectedHeader'));
+Fauxton.initialize = function () {
 
-      // always attempt to render the API Bar. Even if it's hidden on initial load, it may be enabled later
-      routeObject.setComponent('#api-navbar', ReactComponents.ApiBarController, {
-        buttonVisible: true,
-        contentVisible: false
-      });
+  FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) {
+    NavigationActions.setNavbarActiveLink(_.result(routeObject, 'selectedHeader'));
 
-      if (routeObject.get('apiUrl')) {
-        var apiAndDocs = routeObject.get('apiUrl');
-
-        ComponentActions.updateAPIBar({
-          buttonVisible: true,
-          contentVisible: false,
-          endpoint: apiAndDocs[0],
-          docURL: apiAndDocs[1]
-        });
-      } else {
-        ComponentActions.hideAPIBarButton();
-      }
-
-      if (!routeObject.get('hideNotificationCenter')) {
-        routeObject.setComponent('#notification-center-btn', NotificationComponents.NotificationCenterButton);
-      }
-
-      if (routeObject.overrideBreadcrumbs) { return; }
-
-      FauxtonAPI.masterLayout.removeView('#breadcrumbs');
-      var crumbs = routeObject.get('crumbs');
-
-      if (crumbs.length) {
-        FauxtonAPI.masterLayout.setView('#breadcrumbs', new Components.Breadcrumbs({
-          crumbs: crumbs
-        }), true).render();
-      }
+    // always attempt to render the API Bar. Even if it's hidden on initial load, it may be enabled later
+    routeObject.setComponent('#api-navbar', ReactComponents.ApiBarController, {
+      buttonVisible: true,
+      contentVisible: false
     });
 
-    var primaryNavBarEl = $('#primary-navbar')[0];
-    if (primaryNavBarEl) {
-      NavbarReactComponents.renderNavBar(primaryNavBarEl);
+    if (routeObject.get('apiUrl')) {
+      var apiAndDocs = routeObject.get('apiUrl');
+
+      ComponentActions.updateAPIBar({
+        buttonVisible: true,
+        contentVisible: false,
+        endpoint: apiAndDocs[0],
+        docURL: apiAndDocs[1]
+      });
+    } else {
+      ComponentActions.hideAPIBarButton();
     }
 
-    var notificationEl = $('#notifications')[0];
-    if (notificationEl) {
-      NotificationComponents.renderNotificationController(notificationEl);
+    if (!routeObject.get('hideNotificationCenter')) {
+      routeObject.setComponent('#notification-center-btn', NotificationComponents.NotificationCenterButton);
     }
-    var versionInfo = new Fauxton.VersionInfo();
 
-    versionInfo.fetch().then(function () {
-      NavigationActions.setNavbarVersionInfo(versionInfo.get("version"));
-    });
-  };
+    if (routeObject.overrideBreadcrumbs) { return; }
 
-  Fauxton.VersionInfo = Backbone.Model.extend({
-    url: function () {
-      return app.host;
+    FauxtonAPI.masterLayout.removeView('#breadcrumbs');
+    var crumbs = routeObject.get('crumbs');
+
+    if (crumbs.length) {
+      FauxtonAPI.masterLayout.setView('#breadcrumbs', new Components.Breadcrumbs({
+        crumbs: crumbs
+      }), true).render();
     }
   });
 
-  return Fauxton;
+  var primaryNavBarEl = $('#primary-navbar')[0];
+  if (primaryNavBarEl) {
+    NavbarReactComponents.renderNavBar(primaryNavBarEl);
+  }
+
+  var notificationEl = $('#notifications')[0];
+  if (notificationEl) {
+    NotificationComponents.renderNotificationController(notificationEl);
+  }
+  var versionInfo = new Fauxton.VersionInfo();
+
+  versionInfo.fetch().then(function () {
+    NavigationActions.setNavbarVersionInfo(versionInfo.get("version"));
+  });
+};
+
+Fauxton.VersionInfo = Backbone.Model.extend({
+  url: function () {
+    return app.host;
+  }
 });
+
+export default Fauxton;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 73402be..97db63a 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -10,580 +10,573 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  // Libs
-  "../../core/api",
-  "../../../assets/js/libs/spin.min",
-  '../components/react-components.react',
-  '../components/actions',
-  '../documents/helpers',
-
-  "velocity-animate/velocity.ui"
-],
-
-function (app, FauxtonAPI, spin, ReactComponents, ComponentsActions, Helpers) {
-  var Components = FauxtonAPI.addon();
-
-  // XXX: move to /addons/documents - component is tightly coupled to documents/alldocs
-  Components.LeftHeader = FauxtonAPI.View.extend({
-    className: "header-left",
-    template: "addons/fauxton/templates/header_left",
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import spin from "../../../assets/js/libs/spin.min";
+import ReactComponents from "../components/react-components.react";
+import ComponentsActions from "../components/actions";
+import Helpers from "../documents/helpers";
+import "velocity-animate/velocity.ui";
+var Components = FauxtonAPI.addon();
+
+// XXX: move to /addons/documents - component is tightly coupled to documents/alldocs
+Components.LeftHeader = FauxtonAPI.View.extend({
+  className: "header-left",
+  template: "addons/fauxton/templates/header_left",
+
+  initialize: function (options) {
+    this.lookaheadTrayOptions = options.lookaheadTrayOptions || null;
+    this.crumbs = options.crumbs || [];
+
+    this.dbName = options.databaseName;
+
+    // listen for breadcrumb clicks
+    this.listenTo(FauxtonAPI.Events, 'breadcrumb:click', this.toggleTray);
+    this.listenTo(FauxtonAPI.Events, 'lookaheadTray:close', this.unselectLastBreadcrumb);
+  },
+
+  updateCrumbs: function (crumbs) {
+
+    // if the breadcrumbs haven't changed, don't bother re-rendering the component
+    if (_.isEqual(this.crumbs, crumbs)) {
+      return;
+    }
 
-    initialize: function (options) {
-      this.lookaheadTrayOptions = options.lookaheadTrayOptions || null;
-      this.crumbs = options.crumbs || [];
+    this.crumbs = crumbs;
+    this.breadcrumbs && this.breadcrumbs.update(crumbs);
+  },
 
-      this.dbName = options.databaseName;
+  unselectLastBreadcrumb: function () {
+    this.breadcrumbs.unselectLastBreadcrumb();
+  },
 
-      // listen for breadcrumb clicks
-      this.listenTo(FauxtonAPI.Events, 'breadcrumb:click', this.toggleTray);
-      this.listenTo(FauxtonAPI.Events, 'lookaheadTray:close', this.unselectLastBreadcrumb);
-    },
+  toggleTray: function () {
+    if (this.lookaheadTray !== null) {
+      this.lookaheadTray.toggleTray();
+    }
+  },
 
-    updateCrumbs: function (crumbs) {
+  beforeRender: function () {
+    this.setUpCrumbs();
+    this.setUpDropDownMenu();
 
-      // if the breadcrumbs haven't changed, don't bother re-rendering the component
-      if (_.isEqual(this.crumbs, crumbs)) {
-        return;
-      }
+    if (this.lookaheadTray !== null) {
+      this.setUpLookaheadTray();
+    }
+  },
+
+  setUpCrumbs: function () {
+    this.breadcrumbs = this.insertView("#header-breadcrumbs", new Components.Breadcrumbs({
+      crumbs: this.crumbs
+    }));
+  },
+
+  getModififyDbLinks: function () {
+    var onClickDelete = ComponentsActions.showDeleteDatabaseModal;
+    return Helpers.getModifyDatabaseLinks(this.dbName, onClickDelete);
+  },
+
+  setUpDropDownMenu: function () {
+    var dropdownMenuLinks = Helpers.getNewButtonLinks(this.dbName);
+
+    dropdownMenuLinks = this.getModififyDbLinks().concat(dropdownMenuLinks);
+
+    this.dropdown = this.insertView("#header-dropdown-menu", new Components.MenuDropDownReact({
+      links: dropdownMenuLinks,
+    }));
+  },
+
+  setUpLookaheadTray: function () {
+    var options = this.lookaheadTrayOptions,
+        dbNames = options.databaseCollection.getDatabaseNames(),
+        currentDBName = this.crumbs[1].name;
+
+    // remove the current database name from the list
+    dbNames = _.without(dbNames, currentDBName);
+
+    this.lookaheadTray = this.insertView("#header-lookahead", new Components.LookaheadTray({
+      data: dbNames,
+      toggleEventName: options.toggleEventName,
+      onUpdateEventName: options.onUpdateEventName,
+      placeholder: options.placeholder
+    }));
+  }
+});
 
-      this.crumbs = crumbs;
-      this.breadcrumbs && this.breadcrumbs.update(crumbs);
-    },
+Components.MenuDropDownReact = FauxtonAPI.View.extend({
+  initialize: function (options) {
+    this.options = options;
+  },
 
-    unselectLastBreadcrumb: function () {
-      this.breadcrumbs.unselectLastBreadcrumb();
-    },
+  afterRender: function () {
+    ReactComponents.renderMenuDropDown(this.el, this.options);
+  },
 
-    toggleTray: function () {
-      if (this.lookaheadTray !== null) {
-        this.lookaheadTray.toggleTray();
-      }
-    },
+  cleanup: function () {
+    ReactComponents.removeMenuDropDown(this.el);
+  }
+});
+Components.Breadcrumbs = FauxtonAPI.View.extend({
+  className: "breadcrumb pull-left",
+  tagName: "ul",
+  template: "addons/fauxton/templates/breadcrumbs",
+
+  events:  {
+    "click .js-lastelement": "toggleLastElement"
+  },
+
+  serialize: function () {
+    var crumbs = _.clone(this.crumbs);
+
+    // helper template function to determine when to insert a delimiter char
+    var nextCrumbHasLabel = function (crumb, index) {
+      var nextHasLabel = crumbs[index + 1].name !== "";
+      return index < crumbs.length && crumb.name && nextHasLabel;
+    };
+
+    return {
+      toggleDisabled: this.toggleDisabled,
+      crumbs: crumbs,
+      nextCrumbHasLabel: nextCrumbHasLabel
+    };
+  },
+
+  toggleLastElement: function (event) {
+    if (this.toggleDisabled) {
+      return;
+    }
+    this.$(event.currentTarget).toggleClass('js-enabled');
+    FauxtonAPI.Events.trigger('breadcrumb:click');
+  },
 
-    beforeRender: function () {
-      this.setUpCrumbs();
-      this.setUpDropDownMenu();
+  unselectLastBreadcrumb: function () {
+    if (this.toggleDisabled) {
+      return;
+    }
+    this.$('.js-enabled').removeClass('js-enabled');
+  },
+
+  update: function (crumbs) {
+    this.crumbs = crumbs;
+    this.render();
+  },
+
+  initialize: function (options) {
+    this.crumbs = options.crumbs;
+    this.toggleDisabled = options.toggleDisabled || false;
+  }
+});
 
-      if (this.lookaheadTray !== null) {
-        this.setUpLookaheadTray();
-      }
-    },
-
-    setUpCrumbs: function () {
-      this.breadcrumbs = this.insertView("#header-breadcrumbs", new Components.Breadcrumbs({
-        crumbs: this.crumbs
-      }));
-    },
-
-    getModififyDbLinks: function () {
-      var onClickDelete = ComponentsActions.showDeleteDatabaseModal;
-      return Helpers.getModifyDatabaseLinks(this.dbName, onClickDelete);
-    },
-
-    setUpDropDownMenu: function () {
-      var dropdownMenuLinks = Helpers.getNewButtonLinks(this.dbName);
-
-      dropdownMenuLinks = this.getModififyDbLinks().concat(dropdownMenuLinks);
-
-      this.dropdown = this.insertView("#header-dropdown-menu", new Components.MenuDropDownReact({
-        links: dropdownMenuLinks,
-      }));
-    },
-
-    setUpLookaheadTray: function () {
-      var options = this.lookaheadTrayOptions,
-          dbNames = options.databaseCollection.getDatabaseNames(),
-          currentDBName = this.crumbs[1].name;
-
-      // remove the current database name from the list
-      dbNames = _.without(dbNames, currentDBName);
-
-      this.lookaheadTray = this.insertView("#header-lookahead", new Components.LookaheadTray({
-        data: dbNames,
-        toggleEventName: options.toggleEventName,
-        onUpdateEventName: options.onUpdateEventName,
-        placeholder: options.placeholder
-      }));
+/**
+ * Our generic Tray component. All trays should extend this guy - it offers some convenient boilerplate code for
+ * hiding/showing, event publishing and so on. The important functions that can be called on the child Views are:
+ * - hideTray
+ * - showTray
+ * - toggleTray
+ */
+Components.Tray = FauxtonAPI.View.extend({
+
+  // populated dynamically
+  events: {},
+
+  initTray: function (opts) {
+    this.toggleTrayBtnSelector = (_.has(opts, 'toggleTrayBtnSelector')) ? opts.toggleTrayBtnSelector : null;
+    this.onShowTray = (_.has(opts, 'onShowTray')) ? opts.onShowTray : null;
+
+    // if the component extending this one passed along the selector of the element that toggles the tray,
+    // add the appropriate events
+    if (!_.isNull(this.toggleTrayBtnSelector)) {
+      this.events['click ' + this.toggleTrayBtnSelector] = 'toggleTray';
     }
-  });
 
-  Components.MenuDropDownReact = FauxtonAPI.View.extend({
-    initialize: function (options) {
-      this.options = options;
-    },
+    _.bind(this.toggleTray, this);
+    _.bind(this.trayVisible, this);
+    _.bind(this.hideTray, this);
+    _.bind(this.showTray, this);
 
-    afterRender: function () {
-      ReactComponents.renderMenuDropDown(this.el, this.options);
-    },
+    // a unique identifier for this tray
+    this.trayId = 'tray-' + this.cid;
 
-    cleanup: function () {
-      ReactComponents.removeMenuDropDown(this.el);
-    }
-  });
-  Components.Breadcrumbs = FauxtonAPI.View.extend({
-    className: "breadcrumb pull-left",
-    tagName: "ul",
-    template: "addons/fauxton/templates/breadcrumbs",
-
-    events:  {
-      "click .js-lastelement": "toggleLastElement"
-    },
-
-    serialize: function () {
-      var crumbs = _.clone(this.crumbs);
-
-      // helper template function to determine when to insert a delimiter char
-      var nextCrumbHasLabel = function (crumb, index) {
-        var nextHasLabel = crumbs[index + 1].name !== "";
-        return index < crumbs.length && crumb.name && nextHasLabel;
-      };
-
-      return {
-        toggleDisabled: this.toggleDisabled,
-        crumbs: crumbs,
-        nextCrumbHasLabel: nextCrumbHasLabel
-      };
-    },
-
-    toggleLastElement: function (event) {
-      if (this.toggleDisabled) {
+    var that = this;
+    $('body').on('click.' + this.trayId, function (e) {
+      var $clickEl = $(e.target);
+
+      if (!that.trayVisible()) {
         return;
       }
-      this.$(event.currentTarget).toggleClass('js-enabled');
-      FauxtonAPI.Events.trigger('breadcrumb:click');
-    },
-
-    unselectLastBreadcrumb: function () {
-      if (this.toggleDisabled) {
+      if (!_.isNull(that.toggleTrayBtnSelector) && $clickEl.closest(that.toggleTrayBtnSelector).length) {
         return;
       }
-      this.$('.js-enabled').removeClass('js-enabled');
-    },
+      if (!$clickEl.closest('.tray').length) {
+        that.hideTray();
+      }
+    });
+
+    FauxtonAPI.Events.on(FauxtonAPI.constants.EVENTS.TRAY_OPENED, this.onTrayOpenEvent, this);
+  },
 
-    update: function (crumbs) {
-      this.crumbs = crumbs;
-      this.render();
-    },
+  cleanup: function () {
+    $('body').off('click.' + this.trayId);
+  },
 
-    initialize: function (options) {
-      this.crumbs = options.crumbs;
-      this.toggleDisabled = options.toggleDisabled || false;
+  // all trays publish a EVENTS.TRAY_OPENED event containing their unique ID. This listens for those events and
+  // closes the current tray if it's already open
+  onTrayOpenEvent: function (msg) {
+    if (!_.has(msg, 'trayId')) {
+      return;
     }
-  });
-
-  /**
-   * Our generic Tray component. All trays should extend this guy - it offers some convenient boilerplate code for
-   * hiding/showing, event publishing and so on. The important functions that can be called on the child Views are:
-   * - hideTray
-   * - showTray
-   * - toggleTray
-   */
-  Components.Tray = FauxtonAPI.View.extend({
-
-    // populated dynamically
-    events: {},
-
-    initTray: function (opts) {
-      this.toggleTrayBtnSelector = (_.has(opts, 'toggleTrayBtnSelector')) ? opts.toggleTrayBtnSelector : null;
-      this.onShowTray = (_.has(opts, 'onShowTray')) ? opts.onShowTray : null;
-
-      // if the component extending this one passed along the selector of the element that toggles the tray,
-      // add the appropriate events
-      if (!_.isNull(this.toggleTrayBtnSelector)) {
-        this.events['click ' + this.toggleTrayBtnSelector] = 'toggleTray';
-      }
+    if (msg.trayId !== this.trayId && this.trayVisible()) {
+      this.hideTray();
+    }
+  },
 
-      _.bind(this.toggleTray, this);
-      _.bind(this.trayVisible, this);
-      _.bind(this.hideTray, this);
-      _.bind(this.showTray, this);
+  toggleTray: function (e) {
+    e.preventDefault();
 
-      // a unique identifier for this tray
-      this.trayId = 'tray-' + this.cid;
+    if (this.trayVisible()) {
+      this.hideTray();
+    } else {
+      this.showTray();
+    }
+  },
 
-      var that = this;
-      $('body').on('click.' + this.trayId, function (e) {
-        var $clickEl = $(e.target);
+  hideTray: function () {
+    var $tray = this.$('.tray');
+    $tray.velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
+      $tray.hide();
+    });
 
-        if (!that.trayVisible()) {
-          return;
-        }
-        if (!_.isNull(that.toggleTrayBtnSelector) && $clickEl.closest(that.toggleTrayBtnSelector).length) {
-          return;
-        }
-        if (!$clickEl.closest('.tray').length) {
-          that.hideTray();
-        }
-      });
+    if (!_.isNull(this.toggleTrayBtnSelector)) {
+      this.$(this.toggleTrayBtnSelector).removeClass('enabled');
+    }
+  },
 
-      FauxtonAPI.Events.on(FauxtonAPI.constants.EVENTS.TRAY_OPENED, this.onTrayOpenEvent, this);
-    },
+  showTray: function () {
+    this.$('.tray').velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED);
+    if (!_.isNull(this.toggleTrayBtnSelector)) {
+      this.$(this.toggleTrayBtnSelector).addClass('enabled');
+    }
 
-    cleanup: function () {
-      $('body').off('click.' + this.trayId);
-    },
+    if (!_.isNull(this.onShowTray)) {
+      this.onShowTray();
+    }
 
-    // all trays publish a EVENTS.TRAY_OPENED event containing their unique ID. This listens for those events and
-    // closes the current tray if it's already open
-    onTrayOpenEvent: function (msg) {
-      if (!_.has(msg, 'trayId')) {
-        return;
-      }
-      if (msg.trayId !== this.trayId && this.trayVisible()) {
-        this.hideTray();
-      }
-    },
+    FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENTS.TRAY_OPENED, { trayId: this.trayId });
+  },
 
-    toggleTray: function (e) {
-      e.preventDefault();
+  trayVisible: function () {
+    return this.$('.tray').is(':visible');
+  }
+});
 
-      if (this.trayVisible()) {
-        this.hideTray();
-      } else {
-        this.showTray();
-      }
-    },
 
-    hideTray: function () {
-      var $tray = this.$('.tray');
-      $tray.velocity('reverse', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
-        $tray.hide();
-      });
+Components.ModalView = FauxtonAPI.View.extend({
+  disableLoader: true,
 
-      if (!_.isNull(this.toggleTrayBtnSelector)) {
-        this.$(this.toggleTrayBtnSelector).removeClass('enabled');
-      }
-    },
+  initialize: function (options) {
+    _.bindAll(this);
+  },
 
-    showTray: function () {
-      this.$('.tray').velocity('transition.slideDownIn', FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED);
-      if (!_.isNull(this.toggleTrayBtnSelector)) {
-        this.$(this.toggleTrayBtnSelector).addClass('enabled');
-      }
+  afterRender: function () {
+    var that = this;
+    this.$('.modal').on('shown', function () {
+      that.$('input:text:visible:first').focus();
+    });
+  },
 
-      if (!_.isNull(this.onShowTray)) {
-        this.onShowTray();
-      }
+  showModal: function () {
+    if (this._showModal) { this._showModal();}
+    this.clear_error_msg();
+    this.$('.modal').modal();
 
-      FauxtonAPI.Events.trigger(FauxtonAPI.constants.EVENTS.TRAY_OPENED, { trayId: this.trayId });
-    },
+    // hack to get modal visible
+    $('.modal-backdrop').css('z-index', FauxtonAPI.constants.MISC.MODAL_BACKDROP_Z_INDEX);
+  },
 
-    trayVisible: function () {
-      return this.$('.tray').is(':visible');
+  hideModal: function () {
+    this.$('.modal').modal('hide');
+  },
+
+  set_error_msg: function (msg) {
+    var text;
+    if (typeof(msg) == 'string') {
+      text = msg;
+    } else {
+      text = JSON.parse(msg.responseText).reason;
     }
-  });
-
-
-  Components.ModalView = FauxtonAPI.View.extend({
-    disableLoader: true,
-
-    initialize: function (options) {
-      _.bindAll(this);
-    },
-
-    afterRender: function () {
-      var that = this;
-      this.$('.modal').on('shown', function () {
-        that.$('input:text:visible:first').focus();
-      });
-    },
-
-    showModal: function () {
-      if (this._showModal) { this._showModal();}
-      this.clear_error_msg();
-      this.$('.modal').modal();
-
-      // hack to get modal visible
-      $('.modal-backdrop').css('z-index', FauxtonAPI.constants.MISC.MODAL_BACKDROP_Z_INDEX);
-    },
-
-    hideModal: function () {
-      this.$('.modal').modal('hide');
-    },
-
-    set_error_msg: function (msg) {
-      var text;
-      if (typeof(msg) == 'string') {
-        text = msg;
-      } else {
-        text = JSON.parse(msg.responseText).reason;
-      }
-      this.$('#modal-error').text(text).removeClass('hide');
-    },
+    this.$('#modal-error').text(text).removeClass('hide');
+  },
 
-    clear_error_msg: function () {
-      this.$('#modal-error').text(' ').addClass('hide');
-    },
+  clear_error_msg: function () {
+    this.$('#modal-error').text(' ').addClass('hide');
+  },
 
-    serialize: function () {
-      if (this.model) {
-        return this.model.toJSON();
-      }
-      return {};
+  serialize: function () {
+    if (this.model) {
+      return this.model.toJSON();
     }
-  });
+    return {};
+  }
+});
 
-  Components.Typeahead = FauxtonAPI.View.extend({
+Components.Typeahead = FauxtonAPI.View.extend({
 
-    initialize: function (options) {
-      this.source = options.source;
-      this.onUpdateEventName = options.onUpdateEventName;
-    },
+  initialize: function (options) {
+    this.source = options.source;
+    this.onUpdateEventName = options.onUpdateEventName;
+  },
 
-    afterRender: function () {
-      var onUpdateEventName = this.onUpdateEventName;
+  afterRender: function () {
+    var onUpdateEventName = this.onUpdateEventName;
 
-      this.$el.typeahead({
-        source: this.source,
-        updater: function (item) {
-          FauxtonAPI.Events.trigger(onUpdateEventName, item);
-          return item;
-        }
-      });
-    }
-  });
-
-  Components.DbSearchTypeahead = Components.Typeahead.extend({
-    initialize: function (options) {
-      this.dbLimit = options.dbLimit || 30;
-      if (options.filter) {
-        this.resultFilter = options.resultFilter;
+    this.$el.typeahead({
+      source: this.source,
+      updater: function (item) {
+        FauxtonAPI.Events.trigger(onUpdateEventName, item);
+        return item;
       }
-      _.bindAll(this);
-    },
-
-    getURL: function (query, dbLimit) {
-      query = encodeURIComponent(query);
-      return [
-        app.host,
-        "/_all_dbs?startkey=%22",
-        query,
-        "%22&endkey=%22",
-        query,
-        encodeURIComponent("\u9999"),
-        "%22&limit=",
-        dbLimit
-      ].join('');
-    },
-
-    source: function (query, process) {
-      var url = this.getURL(query, this.dbLimit);
-      var resultFilter = this.resultFilter;
-
-      if (this.ajaxReq) { this.ajaxReq.abort(); }
-
-      this.ajaxReq = $.ajax({
-        cache: false,
-        url: url,
-        dataType: 'json',
-        success: function (data) {
-          if (resultFilter) {
-            data = resultFilter(data);
-          }
-          process(data);
-        }
-      });
-    }
-  });
-
-  Components.DocSearchTypeahead = Components.Typeahead.extend({
-    initialize: function (options) {
-      this.docLimit = options.docLimit || 30;
-      this.database = options.database;
-      _.bindAll(this);
-    },
-    source: function (id, process) {
-      var query = '?' + $.param({
-        startkey: JSON.stringify(id),
-        endkey: JSON.stringify(id + "\u9999"),
-        limit: this.docLimit
-      });
-
-      var url = FauxtonAPI.urls('allDocs', 'server', this.database.safeID(), query);
-
-      if (this.ajaxReq) { this.ajaxReq.abort(); }
-
-      this.ajaxReq = $.ajax({
-        cache: false,
-        url: url,
-        dataType: 'json',
-        success: function (data) {
-          var ids = _.map(data.rows, function (row) {
-            return row.id;
-          });
-          process(ids);
-        }
-      });
+    });
+  }
+});
+
+Components.DbSearchTypeahead = Components.Typeahead.extend({
+  initialize: function (options) {
+    this.dbLimit = options.dbLimit || 30;
+    if (options.filter) {
+      this.resultFilter = options.resultFilter;
     }
-  });
-
-  Components.LookaheadTray = FauxtonAPI.View.extend({
-    className: "lookahead-tray tray",
-    template: "addons/fauxton/templates/lookahead_tray",
-    placeholder: "Enter to search",
-
-    events: {
-      'click #js-close-tray': 'closeTray',
-      'keyup': 'onKeyup'
-    },
-
-    serialize: function () {
-      return {
-        placeholder: this.placeholder
-      };
-    },
-
-    initialize: function (opts) {
-      this.data = opts.data;
-      this.toggleEventName = opts.toggleEventName;
-      this.onUpdateEventName = opts.onUpdateEventName;
-
-      var trayIsVisible = _.bind(this.trayIsVisible, this);
-      var closeTray = _.bind(this.closeTray, this);
-      $("body").on("click.lookaheadTray", function (e) {
-        if (!trayIsVisible()) { return; }
-        if ($(e.target).closest(".lookahead-tray").length === 0 &&
-            $(e.target).closest('.lookahead-tray-link').length === 0) {
-          closeTray();
+    _.bindAll(this);
+  },
+
+  getURL: function (query, dbLimit) {
+    query = encodeURIComponent(query);
+    return [
+      app.host,
+      "/_all_dbs?startkey=%22",
+      query,
+      "%22&endkey=%22",
+      query,
+      encodeURIComponent("\u9999"),
+      "%22&limit=",
+      dbLimit
+    ].join('');
+  },
+
+  source: function (query, process) {
+    var url = this.getURL(query, this.dbLimit);
+    var resultFilter = this.resultFilter;
+
+    if (this.ajaxReq) { this.ajaxReq.abort(); }
+
+    this.ajaxReq = $.ajax({
+      cache: false,
+      url: url,
+      dataType: 'json',
+      success: function (data) {
+        if (resultFilter) {
+          data = resultFilter(data);
         }
-      });
-    },
-
-    afterRender: function () {
-      var that = this;
-      this.dbSearchTypeahead = new Components.Typeahead({
-        el: 'input.search-autocomplete',
-        source: that.data,
-        onUpdateEventName: that.onUpdateEventName
-      });
-      this.dbSearchTypeahead.render();
-    },
-
-    clearValue: function () {
-      this.$('.search-autocomplete').val('');
-    },
-
-    cleanup: function () {
-      $("body").off("click.lookaheadTray");
-    },
-
-    trayIsVisible: function () {
-      return this.$el.is(":visible");
-    },
-
-    toggleTray: function () {
-      if (this.trayIsVisible()) {
-        this.closeTray();
-      } else {
-        this.openTray();
+        process(data);
       }
-    },
-
-    openTray: function () {
-      var speed = FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED;
-      this.$el.velocity('transition.slideDownIn', speed, function () {
-        this.$el.find('input').focus();
-      }.bind(this));
-    },
-
-    closeTray: function () {
-      var $tray = this.$el;
-      $tray.velocity("reverse", FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
-        $tray.hide();
-      });
-      FauxtonAPI.Events.trigger('lookaheadTray:close');
-    },
-
-    onKeyup: function (e) {
-      if (e.which === 27) {
-        this.closeTray();
-      }
-    }
-  });
-
-
-  //need to make this into a backbone view...
-  var routeObjectSpinner;
-
-  FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) {
-    if (!routeObject.disableLoader) {
-      var opts = {
-        lines: 16, // The number of lines to draw
-        length: 8, // The length of each line
-        width: 4, // The line thickness
-        radius: 12, // The radius of the inner circle
-        color: '#333', // #rbg or #rrggbb
-        speed: 1, // Rounds per second
-        trail: 10, // Afterglow percentage
-        shadow: false // Whether to render a shadow
-      };
-
-      if (routeObjectSpinner) { return; }
-
-      if (!$('.spinner').length) {
-        $('<div class="spinner"></div>')
-          .appendTo('#app-container');
+    });
+  }
+});
+
+Components.DocSearchTypeahead = Components.Typeahead.extend({
+  initialize: function (options) {
+    this.docLimit = options.docLimit || 30;
+    this.database = options.database;
+    _.bindAll(this);
+  },
+  source: function (id, process) {
+    var query = '?' + $.param({
+      startkey: JSON.stringify(id),
+      endkey: JSON.stringify(id + "\u9999"),
+      limit: this.docLimit
+    });
+
+    var url = FauxtonAPI.urls('allDocs', 'server', this.database.safeID(), query);
+
+    if (this.ajaxReq) { this.ajaxReq.abort(); }
+
+    this.ajaxReq = $.ajax({
+      cache: false,
+      url: url,
+      dataType: 'json',
+      success: function (data) {
+        var ids = _.map(data.rows, function (row) {
+          return row.id;
+        });
+        process(ids);
       }
+    });
+  }
+});
 
-      routeObjectSpinner = new Spinner(opts).spin();
-      $('.spinner').append(routeObjectSpinner.el);
+Components.LookaheadTray = FauxtonAPI.View.extend({
+  className: "lookahead-tray tray",
+  template: "addons/fauxton/templates/lookahead_tray",
+  placeholder: "Enter to search",
+
+  events: {
+    'click #js-close-tray': 'closeTray',
+    'keyup': 'onKeyup'
+  },
+
+  serialize: function () {
+    return {
+      placeholder: this.placeholder
+    };
+  },
+
+  initialize: function (opts) {
+    this.data = opts.data;
+    this.toggleEventName = opts.toggleEventName;
+    this.onUpdateEventName = opts.onUpdateEventName;
+
+    var trayIsVisible = _.bind(this.trayIsVisible, this);
+    var closeTray = _.bind(this.closeTray, this);
+    $("body").on("click.lookaheadTray", function (e) {
+      if (!trayIsVisible()) { return; }
+      if ($(e.target).closest(".lookahead-tray").length === 0 &&
+          $(e.target).closest('.lookahead-tray-link').length === 0) {
+        closeTray();
+      }
+    });
+  },
+
+  afterRender: function () {
+    var that = this;
+    this.dbSearchTypeahead = new Components.Typeahead({
+      el: 'input.search-autocomplete',
+      source: that.data,
+      onUpdateEventName: that.onUpdateEventName
+    });
+    this.dbSearchTypeahead.render();
+  },
+
+  clearValue: function () {
+    this.$('.search-autocomplete').val('');
+  },
+
+  cleanup: function () {
+    $("body").off("click.lookaheadTray");
+  },
+
+  trayIsVisible: function () {
+    return this.$el.is(":visible");
+  },
+
+  toggleTray: function () {
+    if (this.trayIsVisible()) {
+      this.closeTray();
+    } else {
+      this.openTray();
     }
-  });
-
-  var removeRouteObjectSpinner = function () {
-    if (routeObjectSpinner) {
-      routeObjectSpinner.stop();
-      routeObjectSpinner = null;
-      $('.spinner').remove();
+  },
+
+  openTray: function () {
+    var speed = FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED;
+    this.$el.velocity('transition.slideDownIn', speed, function () {
+      this.$el.find('input').focus();
+    }.bind(this));
+  },
+
+  closeTray: function () {
+    var $tray = this.$el;
+    $tray.velocity("reverse", FauxtonAPI.constants.MISC.TRAY_TOGGLE_SPEED, function () {
+      $tray.hide();
+    });
+    FauxtonAPI.Events.trigger('lookaheadTray:close');
+  },
+
+  onKeyup: function (e) {
+    if (e.which === 27) {
+      this.closeTray();
     }
-  };
+  }
+});
 
-  var removeViewSpinner = function (selector) {
-    var viewSpinner = viewSpinners[selector];
 
-    if (viewSpinner) {
-      viewSpinner.stop();
-      $(selector).find('.spinner').remove();
-      delete viewSpinners[selector];
-    }
-  };
-
-  var viewSpinners = {};
-  FauxtonAPI.RouteObject.on('beforeRender', function (routeObject, view, selector) {
-    removeRouteObjectSpinner();
-
-    if (!view.disableLoader) {
-      var opts = _.extend({
-        lines: 16, // The number of lines to draw
-        length: 8, // The length of each line
-        width: 4, // The line thickness
-        radius: 12, // The radius of the inner circle
-        color: '#333', // #rbg or #rrggbb
-        speed: 1, // Rounds per second
-        trail: 10, // Afterglow percentage
-        shadow: false // Whether to render a shadow
-      }, view.loaderStyles);
-
-      var viewSpinner = new Spinner(opts).spin();
-      $('<div class="spinner"></div>')
-        .appendTo(selector)
-        .append(viewSpinner.el);
+//need to make this into a backbone view...
+var routeObjectSpinner;
 
-      viewSpinners[selector] = viewSpinner;
+FauxtonAPI.RouteObject.on('beforeEstablish', function (routeObject) {
+  if (!routeObject.disableLoader) {
+    var opts = {
+      lines: 16, // The number of lines to draw
+      length: 8, // The length of each line
+      width: 4, // The line thickness
+      radius: 12, // The radius of the inner circle
+      color: '#333', // #rbg or #rrggbb
+      speed: 1, // Rounds per second
+      trail: 10, // Afterglow percentage
+      shadow: false // Whether to render a shadow
+    };
+
+    if (routeObjectSpinner) { return; }
+
+    if (!$('.spinner').length) {
+      $('<div class="spinner"></div>')
+        .appendTo('#app-container');
     }
-  });
 
-  FauxtonAPI.RouteObject.on('afterRender', function (routeObject, view, selector) {
-    removeViewSpinner(selector);
-  });
+    routeObjectSpinner = new Spinner(opts).spin();
+    $('.spinner').append(routeObjectSpinner.el);
+  }
+});
 
-  FauxtonAPI.RouteObject.on('viewHasRendered', function (view, selector) {
-    removeViewSpinner(selector);
-    removeRouteObjectSpinner();
-  });
+var removeRouteObjectSpinner = function () {
+  if (routeObjectSpinner) {
+    routeObjectSpinner.stop();
+    routeObjectSpinner = null;
+    $('.spinner').remove();
+  }
+};
+
+var removeViewSpinner = function (selector) {
+  var viewSpinner = viewSpinners[selector];
+
+  if (viewSpinner) {
+    viewSpinner.stop();
+    $(selector).find('.spinner').remove();
+    delete viewSpinners[selector];
+  }
+};
+
+var viewSpinners = {};
+FauxtonAPI.RouteObject.on('beforeRender', function (routeObject, view, selector) {
+  removeRouteObjectSpinner();
+
+  if (!view.disableLoader) {
+    var opts = _.extend({
+      lines: 16, // The number of lines to draw
+      length: 8, // The length of each line
+      width: 4, // The line thickness
+      radius: 12, // The radius of the inner circle
+      color: '#333', // #rbg or #rrggbb
+      speed: 1, // Rounds per second
+      trail: 10, // Afterglow percentage
+      shadow: false // Whether to render a shadow
+    }, view.loaderStyles);
+
+    var viewSpinner = new Spinner(opts).spin();
+    $('<div class="spinner"></div>')
+      .appendTo(selector)
+      .append(viewSpinner.el);
+
+    viewSpinners[selector] = viewSpinner;
+  }
+});
 
+FauxtonAPI.RouteObject.on('afterRender', function (routeObject, view, selector) {
+  removeViewSpinner(selector);
+});
 
-  return Components;
+FauxtonAPI.RouteObject.on('viewHasRendered', function (view, selector) {
+  removeViewSpinner(selector);
+  removeRouteObjectSpinner();
 });
+
+
+export default Components;


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

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/tests/componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/cors/tests/componentsSpec.react.jsx b/app/addons/cors/tests/componentsSpec.react.jsx
index 6446eef..0ab9b1b 100644
--- a/app/addons/cors/tests/componentsSpec.react.jsx
+++ b/app/addons/cors/tests/componentsSpec.react.jsx
@@ -9,233 +9,229 @@
 // 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',
-  '../components.react',
-  '../actions',
-  '../resources',
-  '../stores',
-  '../../../../test/mocha/testUtils',
-  "react",
-  'react-dom',
-  'react-addons-test-utils',
-  'sinon'
-], function (FauxtonAPI, Views, Actions, Resources, Stores, utils, React, ReactDOM, TestUtils, sinon) {
-
-  FauxtonAPI.router = new FauxtonAPI.Router([]);
-  var assert = utils.assert;
-  var corsStore = Stores.corsStore;
-
-  describe('CORS Components', function () {
-
-
-    describe('CorsController', function () {
-      var container, corsEl, saveStub;
-
-      beforeEach(function () {
-        container = document.createElement('div');
-        corsStore._origins = ['http://hello.com'];
-        corsStore._node = 'node2@127.0.0.1';
-        corsStore._isEnabled = true;
-        corsStore._configChanged = true;
-        corsEl = TestUtils.renderIntoDocument(<Views.CORSController />, container);
-        //stub this out so it doesn't keep trying to save cors and crash phantomjs
-        saveStub = sinon.stub(corsEl, 'save');
-      });
+import FauxtonAPI from "../../../core/api";
+import Views from "../components.react";
+import Actions from "../actions";
+import Resources from "../resources";
+import Stores from "../stores";
+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 corsStore = Stores.corsStore;
+
+describe('CORS Components', function () {
+
+
+  describe('CorsController', function () {
+    var container, corsEl, saveStub;
+
+    beforeEach(function () {
+      container = document.createElement('div');
+      corsStore._origins = ['http://hello.com'];
+      corsStore._node = 'node2@127.0.0.1';
+      corsStore._isEnabled = true;
+      corsStore._configChanged = true;
+      corsEl = TestUtils.renderIntoDocument(<Views.CORSController />, container);
+      //stub this out so it doesn't keep trying to save cors and crash phantomjs
+      saveStub = sinon.stub(corsEl, 'save');
+    });
 
-      afterEach(function () {
-        utils.restore(Actions.toggleLoadingBarsToEnabled);
-        utils.restore(corsEl.save);
+    afterEach(function () {
+      utils.restore(Actions.toggleLoadingBarsToEnabled);
+      utils.restore(corsEl.save);
 
-        ReactDOM.unmountComponentAtNode(container);
-        window.confirm.restore && window.confirm.restore();
-      });
+      ReactDOM.unmountComponentAtNode(container);
+      window.confirm.restore && window.confirm.restore();
+    });
 
-      it('confirms user change from restricted origin to disabled cors', function () {
-        var spy = sinon.stub(window, 'confirm');
-        spy.returns(false);
-        corsEl.state.isAllOrigins = false;
-        corsEl.state.corsEnabled = true;
-        corsEl.enableCorsChange();
-        assert.ok(spy.calledOnce);
-      });
+    it('confirms user change from restricted origin to disabled cors', function () {
+      var spy = sinon.stub(window, 'confirm');
+      spy.returns(false);
+      corsEl.state.isAllOrigins = false;
+      corsEl.state.corsEnabled = true;
+      corsEl.enableCorsChange();
+      assert.ok(spy.calledOnce);
+    });
 
-      it('does not confirm for selected origins are emtpy for disabled cors change', function () {
-        var spy = sinon.stub(window, 'confirm');
-        sinon.stub(Actions, 'toggleLoadingBarsToEnabled');
-        spy.returns(false);
-        corsEl.state.corsEnabled = true;
-        corsEl.state.isAllOrigins = false;
-        corsEl.state.origins = [];
-        corsEl.enableCorsChange();
-        assert.notOk(spy.calledOnce);
-      });
+    it('does not confirm for selected origins are emtpy for disabled cors change', function () {
+      var spy = sinon.stub(window, 'confirm');
+      sinon.stub(Actions, 'toggleLoadingBarsToEnabled');
+      spy.returns(false);
+      corsEl.state.corsEnabled = true;
+      corsEl.state.isAllOrigins = false;
+      corsEl.state.origins = [];
+      corsEl.enableCorsChange();
+      assert.notOk(spy.calledOnce);
+    });
 
-      it('confirms user change when moving from selected origins to all origins', function () {
-        var spy = sinon.stub(window, 'confirm');
-        spy.returns(false);
-        corsEl.state.corsEnabled = true;
-        corsEl.state.isAllOrigins = false;
-        corsEl.originChange(true);
-        assert.ok(spy.calledOnce);
-      });
+    it('confirms user change when moving from selected origins to all origins', function () {
+      var spy = sinon.stub(window, 'confirm');
+      spy.returns(false);
+      corsEl.state.corsEnabled = true;
+      corsEl.state.isAllOrigins = false;
+      corsEl.originChange(true);
+      assert.ok(spy.calledOnce);
+    });
 
-      it('does not confirm all origins change if selected origins are emtpy', function () {
-        var spy = sinon.stub(window, 'confirm');
-        sinon.stub(Actions, 'toggleLoadingBarsToEnabled');
-        spy.returns(false);
-        corsEl.state.corsEnabled = true;
-        corsEl.state.isAllOrigins = false;
-        corsEl.state.origins = [];
-        corsEl.originChange(true);
+    it('does not confirm all origins change if selected origins are emtpy', function () {
+      var spy = sinon.stub(window, 'confirm');
+      sinon.stub(Actions, 'toggleLoadingBarsToEnabled');
+      spy.returns(false);
+      corsEl.state.corsEnabled = true;
+      corsEl.state.isAllOrigins = false;
+      corsEl.state.origins = [];
+      corsEl.originChange(true);
 
-        assert.notOk(spy.calledOnce);
-      });
+      assert.notOk(spy.calledOnce);
+    });
 
-      it('shows loading bars', function () {
-        Actions.toggleLoadingBarsToEnabled(true);
-        assert.equal($(ReactDOM.findDOMNode(corsEl)).find('.loading-lines').length, 1);
-      });
+    it('shows loading bars', function () {
+      Actions.toggleLoadingBarsToEnabled(true);
+      assert.equal($(ReactDOM.findDOMNode(corsEl)).find('.loading-lines').length, 1);
+    });
 
-      it('hides loading bars', function () {
-        Actions.toggleLoadingBarsToEnabled(false);
+    it('hides loading bars', function () {
+      Actions.toggleLoadingBarsToEnabled(false);
 
-        assert.equal($(ReactDOM.findDOMNode(corsEl)).find('.loading-lines').length, 0);
-      });
+      assert.equal($(ReactDOM.findDOMNode(corsEl)).find('.loading-lines').length, 0);
     });
+  });
 
-    describe('OriginInput', function () {
-      var container, inputEl, addOrigin;
-      var newOrigin = 'http://new-site.com';
+  describe('OriginInput', function () {
+    var container, inputEl, addOrigin;
+    var newOrigin = 'http://new-site.com';
 
-      beforeEach(function () {
-        addOrigin = sinon.spy();
-        container = document.createElement('div');
-        inputEl = TestUtils.renderIntoDocument(<Views.OriginInput isVisible={true} addOrigin={addOrigin}/>, container);
-      });
+    beforeEach(function () {
+      addOrigin = sinon.spy();
+      container = document.createElement('div');
+      inputEl = TestUtils.renderIntoDocument(<Views.OriginInput isVisible={true} addOrigin={addOrigin}/>, container);
+    });
 
-      afterEach(function () {
-        utils.restore(Resources.validateCORSDomain);
-        utils.restore(FauxtonAPI.addNotification);
-        ReactDOM.unmountComponentAtNode(container);
-      });
+    afterEach(function () {
+      utils.restore(Resources.validateCORSDomain);
+      utils.restore(FauxtonAPI.addNotification);
+      ReactDOM.unmountComponentAtNode(container);
+    });
 
-      it('calls validates each domain', function () {
-        var spy = sinon.spy(Resources, 'validateCORSDomain');
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(inputEl)).find('input')[0], {target: {value: newOrigin}});
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(inputEl)).find('.btn')[0]);
-        assert.ok(spy.calledWith(newOrigin));
-      });
+    it('calls validates each domain', function () {
+      var spy = sinon.spy(Resources, 'validateCORSDomain');
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(inputEl)).find('input')[0], {target: {value: newOrigin}});
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(inputEl)).find('.btn')[0]);
+      assert.ok(spy.calledWith(newOrigin));
+    });
 
-      it('calls addOrigin on add click with valid domain', function () {
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(inputEl)).find('input')[0], {target: {value: newOrigin}});
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(inputEl)).find('.btn')[0]);
-        assert.ok(addOrigin.calledWith(newOrigin));
-      });
+    it('calls addOrigin on add click with valid domain', function () {
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(inputEl)).find('input')[0], {target: {value: newOrigin}});
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(inputEl)).find('.btn')[0]);
+      assert.ok(addOrigin.calledWith(newOrigin));
+    });
 
-      it('shows notification if origin is not valid', function () {
-        var spy = sinon.spy(FauxtonAPI, 'addNotification');
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(inputEl)).find('input')[0], {target: {value: 'badOrigin'}});
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(inputEl)).find('.btn')[0]);
-        assert.ok(spy.calledOnce);
-      });
+    it('shows notification if origin is not valid', function () {
+      var spy = sinon.spy(FauxtonAPI, 'addNotification');
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(inputEl)).find('input')[0], {target: {value: 'badOrigin'}});
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(inputEl)).find('.btn')[0]);
+      assert.ok(spy.calledOnce);
     });
+  });
 
-    describe('Origins', function () {
-      var container, originEl, changeOrigin;
+  describe('Origins', function () {
+    var container, originEl, changeOrigin;
 
-      beforeEach(function () {
-        changeOrigin = sinon.spy();
-        container = document.createElement('div');
-        originEl = TestUtils.renderIntoDocument(<Views.Origins corsEnabled={true} isAllOrigins={false} originChange={changeOrigin}/>, container);
-      });
+    beforeEach(function () {
+      changeOrigin = sinon.spy();
+      container = document.createElement('div');
+      originEl = TestUtils.renderIntoDocument(<Views.Origins corsEnabled={true} isAllOrigins={false} originChange={changeOrigin}/>, container);
+    });
 
-      afterEach(function () {
-        ReactDOM.unmountComponentAtNode(container);
-      });
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
 
-      it('calls change Origin on all origins selected', function () {
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(originEl)).find('input[value="all"]')[0]);
-        assert.ok(changeOrigin.calledWith(true));
-      });
+    it('calls change Origin on all origins selected', function () {
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(originEl)).find('input[value="all"]')[0]);
+      assert.ok(changeOrigin.calledWith(true));
+    });
 
-      it('calls changeOrigin() when you switch from "Allow All Origins" to "Select List of Origins"', function () {
-        //changeOrigin(true) = sets origins to ['*']
-        //changeOrigin(false) = sets origins to [] (an empty array which user can populate with URLs)
+    it('calls changeOrigin() when you switch from "Allow All Origins" to "Select List of Origins"', function () {
+      //changeOrigin(true) = sets origins to ['*']
+      //changeOrigin(false) = sets origins to [] (an empty array which user can populate with URLs)
 
-        //this test begins with 'select origins' checked,
-        //1. render radio buttons with 'all origins'
-        originEl = TestUtils.renderIntoDocument(<Views.Origins corsEnabled={true} isAllOrigins={true} originChange={changeOrigin}/>, container);
-        //2. switch back to 'select origins'
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(originEl)).find('input[value="selected"]')[0]);
-        assert.ok(changeOrigin.calledWith(false));
-      });
+      //this test begins with 'select origins' checked,
+      //1. render radio buttons with 'all origins'
+      originEl = TestUtils.renderIntoDocument(<Views.Origins corsEnabled={true} isAllOrigins={true} originChange={changeOrigin}/>, container);
+      //2. switch back to 'select origins'
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(originEl)).find('input[value="selected"]')[0]);
+      assert.ok(changeOrigin.calledWith(false));
     });
+  });
 
-    describe('OriginRow', function () {
-      var container, originTableEl, origin, deleteOrigin, updateOrigin;
+  describe('OriginRow', function () {
+    var container, originTableEl, origin, deleteOrigin, updateOrigin;
 
-      beforeEach(function () {
-        deleteOrigin = sinon.spy();
-        updateOrigin = sinon.spy();
-        container = document.createElement('div');
-        origin = 'https://hello.com';
-        //because OriginRow is inside a table have to render the whole table to test
-        originTableEl = TestUtils.renderIntoDocument(<Views.OriginTable updateOrigin={updateOrigin} deleteOrigin={deleteOrigin} isVisible={true} origins={[origin]}/>, container);
-      });
+    beforeEach(function () {
+      deleteOrigin = sinon.spy();
+      updateOrigin = sinon.spy();
+      container = document.createElement('div');
+      origin = 'https://hello.com';
+      //because OriginRow is inside a table have to render the whole table to test
+      originTableEl = TestUtils.renderIntoDocument(<Views.OriginTable updateOrigin={updateOrigin} deleteOrigin={deleteOrigin} isVisible={true} origins={[origin]}/>, container);
+    });
 
-      afterEach(function () {
-        window.confirm.restore && window.confirm.restore();
-        Actions.deleteOrigin.restore && Actions.deleteOrigin.restore();
-        ReactDOM.unmountComponentAtNode(container);
-        Actions.hideDeleteDomainModal();
-      });
+    afterEach(function () {
+      window.confirm.restore && window.confirm.restore();
+      Actions.deleteOrigin.restore && Actions.deleteOrigin.restore();
+      ReactDOM.unmountComponentAtNode(container);
+      Actions.hideDeleteDomainModal();
+    });
 
-      it('should show confirm modal on delete', function () {
-        assert.equal($('body').find('.confirmation-modal').length, 0);
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-trash')[0]);
-        assert.notEqual($('body').find('.confirmation-modal').length, 1); // a little sneaky.
-      });
+    it('should show confirm modal on delete', function () {
+      assert.equal($('body').find('.confirmation-modal').length, 0);
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-trash')[0]);
+      assert.notEqual($('body').find('.confirmation-modal').length, 1); // a little sneaky.
+    });
 
-      it('does not throw on origins being undefined', function () {
-        TestUtils.renderIntoDocument(
-          <Views.OriginTable
-            updateOrigin={updateOrigin}
-            isVisible={true}
-            origins={false} />,
-          container
-        );
-      });
+    it('does not throw on origins being undefined', function () {
+      TestUtils.renderIntoDocument(
+        <Views.OriginTable
+          updateOrigin={updateOrigin}
+          isVisible={true}
+          origins={false} />,
+        container
+      );
+    });
 
-      it('should change origin to input on edit click', function () {
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-pencil')[0]);
-        assert.ok($(ReactDOM.findDOMNode(originTableEl)).find('input').length === 1);
-      });
+    it('should change origin to input on edit click', function () {
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-pencil')[0]);
+      assert.ok($(ReactDOM.findDOMNode(originTableEl)).find('input').length === 1);
+    });
 
-      it('should update origin on update clicked', function () {
-        var updatedOrigin = 'https://updated-origin.com';
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-pencil')[0]);
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(originTableEl)).find('input')[0], {
-          target: {
-            value: updatedOrigin
-          }
-        });
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.btn')[0]);
-        assert.ok(updateOrigin.calledWith(updatedOrigin));
+    it('should update origin on update clicked', function () {
+      var updatedOrigin = 'https://updated-origin.com';
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-pencil')[0]);
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(originTableEl)).find('input')[0], {
+        target: {
+          value: updatedOrigin
+        }
       });
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.btn')[0]);
+      assert.ok(updateOrigin.calledWith(updatedOrigin));
+    });
 
-      it('should not update origin on update clicked with bad origin', function () {
-        var updatedOrigin = 'updated-origin';
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-pencil')[0]);
-        TestUtils.Simulate.change($(ReactDOM.findDOMNode(originTableEl)).find('input')[0], {
-          target: {
-            value: updatedOrigin
-          }
-        });
-        TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.btn')[0]);
-        assert.notOk(updateOrigin.calledOnce);
+    it('should not update origin on update clicked with bad origin', function () {
+      var updatedOrigin = 'updated-origin';
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.fonticon-pencil')[0]);
+      TestUtils.Simulate.change($(ReactDOM.findDOMNode(originTableEl)).find('input')[0], {
+        target: {
+          value: updatedOrigin
+        }
       });
-
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(originTableEl)).find('.btn')[0]);
+      assert.notOk(updateOrigin.calledOnce);
     });
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/tests/resourcesSpec.js b/app/addons/cors/tests/resourcesSpec.js
index e271386..9c02a7e 100644
--- a/app/addons/cors/tests/resourcesSpec.js
+++ b/app/addons/cors/tests/resourcesSpec.js
@@ -9,70 +9,67 @@
 // 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',
-  '../../../../test/mocha/testUtils',
-  '../resources',
-], function (app, testUtils, CORS) {
-  var assert = testUtils.assert;
+import app from "../../../app";
+import testUtils from "../../../../test/mocha/testUtils";
+import CORS from "../resources";
+var assert = testUtils.assert;
 
-  describe('Cors Config Model', function () {
-    var cors;
+describe('Cors Config Model', function () {
+  var cors;
 
-    beforeEach(function () {
-      cors = new CORS.Config(null, {node: 'node2@127.0.0.1'});
-    });
-
-    it('Splits up origins into array', function () {
-      var origins = ['http://hello.com', 'http://another.co.a'];
-      cors.set(cors.parse({origins: origins.join(',')}));
-      assert.deepEqual(cors.get('origins'), origins);
-    });
+  beforeEach(function () {
+    cors = new CORS.Config(null, {node: 'node2@127.0.0.1'});
+  });
 
-    it('returns empty array for undefined', function () {
-      var origins = { origins : undefined };
-      cors.set(cors.parse(origins));
-      assert.deepEqual(cors.get('origins'), []);
-    });
+  it('Splits up origins into array', function () {
+    var origins = ['http://hello.com', 'http://another.co.a'];
+    cors.set(cors.parse({origins: origins.join(',')}));
+    assert.deepEqual(cors.get('origins'), origins);
+  });
 
-    it('does not return an empty string (empty origin), when "specific origins" is set, but there are no domains on that list', function () {
-        var emptyOrigins = {origins: ''};
-        cors.set(cors.parse(emptyOrigins));
-        assert.deepEqual(cors.get('origins'), []);
-      });
+  it('returns empty array for undefined', function () {
+    var origins = { origins : undefined };
+    cors.set(cors.parse(origins));
+    assert.deepEqual(cors.get('origins'), []);
+  });
 
-    it('allows valid domains', function () {
-      var urls = [
-        'http://something.com',
-        'https://a.ca',
-        'https://something.com:8000',
-        'https://www.some-valid-domain.com:80',
-        'http://localhost',
-        'https://localhost',
-        'http://192.168.1.113',
-        'http://192.168.1.113:1337'
-      ];
-      _.each(urls, function (url) {
-        assert.isTrue(CORS.validateCORSDomain(url));
-      });
+  it('does not return an empty string (empty origin), when "specific origins" is set, but there are no domains on that list', function () {
+      var emptyOrigins = {origins: ''};
+      cors.set(cors.parse(emptyOrigins));
+      assert.deepEqual(cors.get('origins'), []);
     });
 
-    it('fails on non http/https domains', function () {
-      var urls = [
-        'whoahnellythisaintright',
-        'ftp://site.com'
-      ];
-      _.each(urls, function (url) {
-        assert.isFalse(CORS.validateCORSDomain(url));
-      });
+  it('allows valid domains', function () {
+    var urls = [
+      'http://something.com',
+      'https://a.ca',
+      'https://something.com:8000',
+      'https://www.some-valid-domain.com:80',
+      'http://localhost',
+      'https://localhost',
+      'http://192.168.1.113',
+      'http://192.168.1.113:1337'
+    ];
+    _.each(urls, function (url) {
+      assert.isTrue(CORS.validateCORSDomain(url));
     });
+  });
 
-    it('normalizes common cases, like accidentally added subfolders', function () {
-      assert.equal('https://foo.com', CORS.normalizeUrls('https://foo.com/blerg'));
-      assert.equal('https://192.168.1.113', CORS.normalizeUrls('https://192.168.1.113/blerg'));
-      assert.equal('https://foo.com:1337', CORS.normalizeUrls('https://foo.com:1337/blerg'));
-      assert.equal('https://foo.com', CORS.normalizeUrls('https://foo.com'));
+  it('fails on non http/https domains', function () {
+    var urls = [
+      'whoahnellythisaintright',
+      'ftp://site.com'
+    ];
+    _.each(urls, function (url) {
+      assert.isFalse(CORS.validateCORSDomain(url));
     });
+  });
 
+  it('normalizes common cases, like accidentally added subfolders', function () {
+    assert.equal('https://foo.com', CORS.normalizeUrls('https://foo.com/blerg'));
+    assert.equal('https://192.168.1.113', CORS.normalizeUrls('https://192.168.1.113/blerg'));
+    assert.equal('https://foo.com:1337', CORS.normalizeUrls('https://foo.com:1337/blerg'));
+    assert.equal('https://foo.com', CORS.normalizeUrls('https://foo.com'));
   });
+
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/cors/tests/storesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/cors/tests/storesSpec.js b/app/addons/cors/tests/storesSpec.js
index a603e0d..556e8f0 100644
--- a/app/addons/cors/tests/storesSpec.js
+++ b/app/addons/cors/tests/storesSpec.js
@@ -9,93 +9,89 @@
 // 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',
-  '../../../../test/mocha/testUtils',
-  '../../../core/api',
-  '../stores',
-], function (app, testUtils, FauxtonAPI, Stores) {
-  var assert = testUtils.assert;
-  var store = Stores.corsStore;
-
-  describe('CORS store', function () {
-
-    describe('isAllOrigins', function () {
-
-      it('returns true for all origins', function () {
-        store._origins = ['*'];
-
-        assert.ok(store.isAllOrigins());
-      });
-
-      it('returns false for specific origins', function () {
-        store._origins = ['https://hello.com', 'http://another.com'];
-        assert.notOk(store.isAllOrigins());
-      });
-
-      it('returns false for empty array', function () {
-        store._origins = [];
-        assert.notOk(store.isAllOrigins());
-      });
+import app from "../../../app";
+import testUtils from "../../../../test/mocha/testUtils";
+import FauxtonAPI from "../../../core/api";
+import Stores from "../stores";
+var assert = testUtils.assert;
+var store = Stores.corsStore;
+
+describe('CORS store', function () {
+
+  describe('isAllOrigins', function () {
+
+    it('returns true for all origins', function () {
+      store._origins = ['*'];
+
+      assert.ok(store.isAllOrigins());
     });
 
-    describe('addOrigin', function () {
+    it('returns false for specific origins', function () {
+      store._origins = ['https://hello.com', 'http://another.com'];
+      assert.notOk(store.isAllOrigins());
+    });
 
-      it('adds Origin to list', function () {
-        var origin = 'http://hello.com';
-        store._origins = [];
-        store.addOrigin(origin);
+    it('returns false for empty array', function () {
+      store._origins = [];
+      assert.notOk(store.isAllOrigins());
+    });
+  });
 
-        assert.ok(_.include(store.getOrigins(), origin));
-      });
+  describe('addOrigin', function () {
 
+    it('adds Origin to list', function () {
+      var origin = 'http://hello.com';
+      store._origins = [];
+      store.addOrigin(origin);
+
+      assert.ok(_.include(store.getOrigins(), origin));
     });
 
-    describe('originChange', function () {
+  });
 
-      it('sets origins to * for true', function () {
-        store.originChange(true);
+  describe('originChange', function () {
 
-        assert.deepEqual(store.getOrigins(), ['*']);
-      });
+    it('sets origins to * for true', function () {
+      store.originChange(true);
 
-      it('sets origins to [] for true', function () {
-        store.originChange(false);
+      assert.deepEqual(store.getOrigins(), ['*']);
+    });
 
-        assert.deepEqual(store.getOrigins(), []);
-      });
+    it('sets origins to [] for true', function () {
+      store.originChange(false);
 
+      assert.deepEqual(store.getOrigins(), []);
     });
 
-    describe('deleteOrigin', function () {
+  });
 
-      it('removes origin', function () {
-        store._origins = ['http://first.com', 'http://hello.com', 'http://second.com'];
-        store.deleteOrigin('http://hello.com');
+  describe('deleteOrigin', function () {
 
-        assert.deepEqual(store.getOrigins(), ['http://first.com', 'http://second.com']);
+    it('removes origin', function () {
+      store._origins = ['http://first.com', 'http://hello.com', 'http://second.com'];
+      store.deleteOrigin('http://hello.com');
 
-      });
+      assert.deepEqual(store.getOrigins(), ['http://first.com', 'http://second.com']);
 
     });
 
-    describe('update origin', function () {
+  });
 
-      it('removes old origin', function () {
-        store._origins = ['http://first.com', 'http://hello.com', 'http://second.com'];
-        store.updateOrigin('http://hello123.com', 'http://hello.com');
+  describe('update origin', function () {
 
-        assert.notOk(_.include(store.getOrigins(), 'http://hello.com'));
+    it('removes old origin', function () {
+      store._origins = ['http://first.com', 'http://hello.com', 'http://second.com'];
+      store.updateOrigin('http://hello123.com', 'http://hello.com');
 
-      });
+      assert.notOk(_.include(store.getOrigins(), 'http://hello.com'));
 
-      it('adds new origin', function () {
-        store._origins = ['http://first.com', 'http://hello.com', 'http://second.com'];
-        store.updateOrigin('http://hello123.com', 'http://hello.com');
+    });
 
-        assert.ok(_.include(store.getOrigins(), 'http://hello123.com'));
+    it('adds new origin', function () {
+      store._origins = ['http://first.com', 'http://hello.com', 'http://second.com'];
+      store.updateOrigin('http://hello123.com', 'http://hello.com');
 
-      });
+      assert.ok(_.include(store.getOrigins(), 'http://hello123.com'));
 
     });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/actions.js b/app/addons/databases/actions.js
index 86d3279..06af7d4 100644
--- a/app/addons/databases/actions.js
+++ b/app/addons/databases/actions.js
@@ -9,131 +9,128 @@
 // 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',
-  '../../core/api',
-  './stores',
-  './actiontypes',
-  './resources'
-],
-function (app, FauxtonAPI, Stores, ActionTypes, Resources) {
-  return {
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Stores from "./stores";
+import ActionTypes from "./actiontypes";
+import Resources from "./resources";
 
-    init: function (databases) {
-      var params = app.getParams();
-      var page = params.page ? parseInt(params.page, 10) : 1;
-      var perPage = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
+export default {
 
-      this.setStartLoading();
-      FauxtonAPI.when(databases.fetch({ cache: false })).then(function () {
+  init: function (databases) {
+    var params = app.getParams();
+    var page = params.page ? parseInt(params.page, 10) : 1;
+    var perPage = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
 
-        // if there are no databases, publish the init message anyway
-        if (!databases.paginated(page, perPage).length) {
+    this.setStartLoading();
+    FauxtonAPI.when(databases.fetch({ cache: false })).then(function () {
+
+      // if there are no databases, publish the init message anyway
+      if (!databases.paginated(page, perPage).length) {
+        FauxtonAPI.dispatch({
+          type: ActionTypes.DATABASES_INIT,
+          options: {
+            collection: [],
+            backboneCollection: databases,
+            page: page
+          }
+        });
+      }
+
+      var numComplete = 0;
+      _.each(databases.paginated(page, perPage), function (db) {
+        db.status.fetchOnce().always(function () {
+          numComplete++;
+          if (numComplete < databases.paginated(page, perPage).length) {
+            return;
+          }
           FauxtonAPI.dispatch({
             type: ActionTypes.DATABASES_INIT,
             options: {
-              collection: [],
+              collection: databases.paginated(page, perPage),
               backboneCollection: databases,
               page: page
             }
           });
-        }
-
-        var numComplete = 0;
-        _.each(databases.paginated(page, perPage), function (db) {
-          db.status.fetchOnce().always(function () {
-            numComplete++;
-            if (numComplete < databases.paginated(page, perPage).length) {
-              return;
-            }
-            FauxtonAPI.dispatch({
-              type: ActionTypes.DATABASES_INIT,
-              options: {
-                collection: databases.paginated(page, perPage),
-                backboneCollection: databases,
-                page: page
-              }
-            });
-          });
         });
-      }.bind(this));
-    },
-
-    setPage: function (page) {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DATABASES_SETPAGE,
-        options: {
-          page: page
-        }
       });
-    },
+    }.bind(this));
+  },
 
-    setStartLoading: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DATABASES_STARTLOADING
-      });
-    },
+  setPage: function (page) {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DATABASES_SETPAGE,
+      options: {
+        page: page
+      }
+    });
+  },
 
-    setLoadComplete: function () {
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DATABASES_LOADCOMPLETE
+  setStartLoading: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DATABASES_STARTLOADING
+    });
+  },
+
+  setLoadComplete: function () {
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DATABASES_LOADCOMPLETE
+    });
+  },
+
+  createNewDatabase: function (databaseName) {
+    if (_.isNull(databaseName) || databaseName.trim().length === 0) {
+      FauxtonAPI.addNotification({
+        msg: 'Please enter a valid database name',
+        type: 'error',
+        clear: true
       });
-    },
+      return;
+    }
+    databaseName = databaseName.trim();
+    // name accepted, make sure prompt can be removed
+    FauxtonAPI.dispatch({
+      type: ActionTypes.DATABASES_SET_PROMPT_VISIBLE,
+      options: {
+        visible: false
+      }
+    });
 
-    createNewDatabase: function (databaseName) {
-      if (_.isNull(databaseName) || databaseName.trim().length === 0) {
+    var db = Stores.databasesStore.obtainNewDatabaseModel(databaseName);
+    FauxtonAPI.addNotification({ msg: 'Creating database.' });
+    db.save().done(function () {
         FauxtonAPI.addNotification({
-          msg: 'Please enter a valid database name',
-          type: 'error',
+          msg: 'Database created successfully',
+          type: 'success',
           clear: true
         });
-        return;
+        var route = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(databaseName), '?limit=' + Resources.DocLimit);
+        app.router.navigate(route, { trigger: true });
       }
-      databaseName = databaseName.trim();
-      // name accepted, make sure prompt can be removed
-      FauxtonAPI.dispatch({
-        type: ActionTypes.DATABASES_SET_PROMPT_VISIBLE,
-        options: {
-          visible: false
-        }
-      });
-
-      var db = Stores.databasesStore.obtainNewDatabaseModel(databaseName);
-      FauxtonAPI.addNotification({ msg: 'Creating database.' });
-      db.save().done(function () {
-          FauxtonAPI.addNotification({
-            msg: 'Database created successfully',
-            type: 'success',
-            clear: true
-          });
-          var route = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(databaseName), '?limit=' + Resources.DocLimit);
-          app.router.navigate(route, { trigger: true });
-        }
-      ).error(function (xhr) {
-          var responseText = JSON.parse(xhr.responseText).reason;
-          FauxtonAPI.addNotification({
-            msg: 'Create database failed: ' + responseText,
-            type: 'error',
-            clear: true
-          });
-        }
-      );
-    },
-
-    jumpToDatabase: function (databaseName) {
-      if (_.isNull(databaseName) || databaseName.trim().length === 0) {
-        return;
-      }
-      databaseName = databaseName.trim();
-      if (Stores.databasesStore.doesDatabaseExist(databaseName)) {
-        var url = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(databaseName), "");
-        FauxtonAPI.navigate(url);
-      } else {
+    ).error(function (xhr) {
+        var responseText = JSON.parse(xhr.responseText).reason;
         FauxtonAPI.addNotification({
-          msg: 'Database does not exist.',
-          type: 'error'
+          msg: 'Create database failed: ' + responseText,
+          type: 'error',
+          clear: true
         });
       }
+    );
+  },
+
+  jumpToDatabase: function (databaseName) {
+    if (_.isNull(databaseName) || databaseName.trim().length === 0) {
+      return;
+    }
+    databaseName = databaseName.trim();
+    if (Stores.databasesStore.doesDatabaseExist(databaseName)) {
+      var url = FauxtonAPI.urls('allDocs', 'app', app.utils.safeURLName(databaseName), "");
+      FauxtonAPI.navigate(url);
+    } else {
+      FauxtonAPI.addNotification({
+        msg: 'Database does not exist.',
+        type: 'error'
+      });
     }
-  };
-});
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/actiontypes.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/actiontypes.js b/app/addons/databases/actiontypes.js
index 7be561e..9305684 100644
--- a/app/addons/databases/actiontypes.js
+++ b/app/addons/databases/actiontypes.js
@@ -9,12 +9,10 @@
 // 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([], function () {
-  return {
-    DATABASES_INIT: 'DATABASES_INIT',
-    DATABASES_SETPAGE: 'DATABASES_SETPAGE',
-    DATABASES_SET_PROMPT_VISIBLE: 'DATABASES_SET_PROMPT_VISIBLE',
-    DATABASES_STARTLOADING: 'DATABASES_STARTLOADING',
-    DATABASES_LOADCOMPLETE: 'DATABASES_LOADCOMPLETE'
-  };
-});
+export default {
+  DATABASES_INIT: 'DATABASES_INIT',
+  DATABASES_SETPAGE: 'DATABASES_SETPAGE',
+  DATABASES_SET_PROMPT_VISIBLE: 'DATABASES_SET_PROMPT_VISIBLE',
+  DATABASES_STARTLOADING: 'DATABASES_STARTLOADING',
+  DATABASES_LOADCOMPLETE: 'DATABASES_LOADCOMPLETE'
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/base.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/base.js b/app/addons/databases/base.js
index d0a56b9..b31fcc7 100644
--- a/app/addons/databases/base.js
+++ b/app/addons/databases/base.js
@@ -10,74 +10,69 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  "./routes",
-  "./assets/less/databases.less"
-],
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Databases from "./routes";
+import "./assets/less/databases.less";
 
-function (app, FauxtonAPI, Databases) {
-
-  Databases.initialize = function () {
-    FauxtonAPI.addHeaderLink({
-      href:"#/_all_dbs",
-      title:"Databases",
-      icon: "fonticon-database",
-      className: 'databases'
-    });
-  };
-
-  // Utility functions
-  Databases.databaseUrl = function (database) {
-    var name = _.isObject(database) ? database.id : database,
-        dbname = app.utils.safeURLName(name);
+Databases.initialize = function () {
+  FauxtonAPI.addHeaderLink({
+    href:"#/_all_dbs",
+    title:"Databases",
+    icon: "fonticon-database",
+    className: 'databases'
+  });
+};
 
-    return ['/database/', dbname, '/_all_docs?limit=' + Databases.DocLimit].join('');
-  };
+// Utility functions
+Databases.databaseUrl = function (database) {
+  var name = _.isObject(database) ? database.id : database,
+      dbname = app.utils.safeURLName(name);
 
-  FauxtonAPI.registerUrls('changes', {
-    server: function (id, query) {
-      return app.host + '/' + id + '/_changes' + query;
+  return ['/database/', dbname, '/_all_docs?limit=' + Databases.DocLimit].join('');
+};
 
-    },
-    app: function (id, query) {
-      return '/database/' + id + '/_changes' + query;
-    },
+FauxtonAPI.registerUrls('changes', {
+  server: function (id, query) {
+    return app.host + '/' + id + '/_changes' + query;
 
-    apiurl: function (id, query) {
-      return window.location.origin + '/' + id + '/_changes' + query;
-    }
-  });
+  },
+  app: function (id, query) {
+    return '/database/' + id + '/_changes' + query;
+  },
 
-  FauxtonAPI.registerUrls('allDBs', {
-    app: function () {
-      return '_all_dbs';
-    }
-  });
+  apiurl: function (id, query) {
+    return window.location.origin + '/' + id + '/_changes' + query;
+  }
+});
 
-  FauxtonAPI.registerUrls('databaseBaseURL', {
-    server: function (database) {
-      return window.location.origin + '/' + database;
-    },
-    app: function (database) {
-      return '/database/' + database;
-    }
-  });
+FauxtonAPI.registerUrls('allDBs', {
+  app: function () {
+    return '_all_dbs';
+  }
+});
 
-  FauxtonAPI.registerUrls('permissions', {
-    server: function (db) {
-      return app.host + '/' + db + '/_security';
-    },
+FauxtonAPI.registerUrls('databaseBaseURL', {
+  server: function (database) {
+    return window.location.origin + '/' + database;
+  },
+  app: function (database) {
+    return '/database/' + database;
+  }
+});
 
-    app: function (db) {
-      return '/database/' + db + '/permissions';
-    },
+FauxtonAPI.registerUrls('permissions', {
+  server: function (db) {
+    return app.host + '/' + db + '/_security';
+  },
 
-    apiurl: function (db) {
-      return window.location.origin + '/' + db + '/_security';
-    }
-  });
+  app: function (db) {
+    return '/database/' + db + '/permissions';
+  },
 
-  return Databases;
+  apiurl: function (db) {
+    return window.location.origin + '/' + db + '/_security';
+  }
 });
+
+export default Databases;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/databases/components.react.jsx b/app/addons/databases/components.react.jsx
index 395130c..e4a11c5 100644
--- a/app/addons/databases/components.react.jsx
+++ b/app/addons/databases/components.react.jsx
@@ -10,401 +10,395 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  'react',
-  'react-dom',
-  '../components/react-components.react',
-  '../components/stores',
-  '../components/actions',
-  '..//fauxton/components.react',
-
-  './stores',
-  './resources',
-  './actions',
-  '../../helpers'
-], function (app, FauxtonAPI, React, ReactDOM,
-  Components, ComponentsStore, ComponentsActions, FauxtonComponentsReact,
-  Stores, Resources, Actions, Helpers) {
-
-  var ToggleHeaderButton = Components.ToggleHeaderButton;
-  var databasesStore = Stores.databasesStore;
-  var deleteDbModalStore = ComponentsStore.deleteDbModalStore;
-  var DeleteDatabaseModal = Components.DeleteDatabaseModal;
-
-
-  var DatabasesController = React.createClass({
-
-    getStoreState: function () {
-      return {
-        collection: databasesStore.getCollection(),
-        loading: databasesStore.isLoading(),
-        showDeleteDatabaseModal: deleteDbModalStore.getShowDeleteDatabaseModal()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      databasesStore.on('change', this.onChange, this);
-      deleteDbModalStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      databasesStore.off('change', this.onChange, this);
-      deleteDbModalStore.off('change', this.onChange, this);
-    },
-
-    onChange: function () {
-      if (this.isMounted()) {
-        this.setState(this.getStoreState());
-      }
-    },
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import React from "react";
+import ReactDOM from "react-dom";
+import Components from "../components/react-components.react";
+import ComponentsStore from "../components/stores";
+import ComponentsActions from "../components/actions";
+import FauxtonComponentsReact from "..//fauxton/components.react";
+import Stores from "./stores";
+import Resources from "./resources";
+import Actions from "./actions";
+import Helpers from "../../helpers";
+
+var ToggleHeaderButton = Components.ToggleHeaderButton;
+var databasesStore = Stores.databasesStore;
+var deleteDbModalStore = ComponentsStore.deleteDbModalStore;
+var DeleteDatabaseModal = Components.DeleteDatabaseModal;
+
+
+var DatabasesController = React.createClass({
+
+  getStoreState: function () {
+    return {
+      collection: databasesStore.getCollection(),
+      loading: databasesStore.isLoading(),
+      showDeleteDatabaseModal: deleteDbModalStore.getShowDeleteDatabaseModal()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    databasesStore.on('change', this.onChange, this);
+    deleteDbModalStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    databasesStore.off('change', this.onChange, this);
+    deleteDbModalStore.off('change', this.onChange, this);
+  },
+
+  onChange: function () {
+    if (this.isMounted()) {
+      this.setState(this.getStoreState());
+    }
+  },
+
+  render: function () {
+    var collection = this.state.collection;
+    var loading = this.state.loading;
+    return (
+      <DatabaseTable
+        showDeleteDatabaseModal={this.state.showDeleteDatabaseModal}
+        body={collection}
+        loading={loading} />
+    );
+  }
+});
 
-    render: function () {
-      var collection = this.state.collection;
-      var loading = this.state.loading;
+var DatabaseTable = React.createClass({
+
+  createRows: function () {
+    return _.map(this.props.body, function (item, iteration) {
       return (
-        <DatabaseTable
-          showDeleteDatabaseModal={this.state.showDeleteDatabaseModal}
-          body={collection}
-          loading={loading} />
+        <DatabaseRow
+          row={item}
+          key={iteration} />
       );
-    }
-  });
-
-  var DatabaseTable = React.createClass({
-
-    createRows: function () {
-      return _.map(this.props.body, function (item, iteration) {
-        return (
-          <DatabaseRow
-            row={item}
-            key={iteration} />
-        );
-      });
-    },
-
-    getExtensionColumns: function () {
-      var cols = FauxtonAPI.getExtensions('DatabaseTable:head');
-      return _.map(cols, function (Item, index) {
-        return <Item key={index} />;
-      });
-    },
-
-    showDeleteDatabaseModal: function (name) {
-      ComponentsActions.showDeleteDatabaseModal({
-        showDeleteModal: !this.props.showDeleteDatabaseModal.showDeleteModal
-      });
-    },
-
-    render: function () {
-      if (this.props.loading) {
-        return (
-          <div className="view">
-            <Components.LoadLines />
-          </div>
-        );
-      }
-
-      var rows = this.createRows();
+    });
+  },
+
+  getExtensionColumns: function () {
+    var cols = FauxtonAPI.getExtensions('DatabaseTable:head');
+    return _.map(cols, function (Item, index) {
+      return <Item key={index} />;
+    });
+  },
+
+  showDeleteDatabaseModal: function (name) {
+    ComponentsActions.showDeleteDatabaseModal({
+      showDeleteModal: !this.props.showDeleteDatabaseModal.showDeleteModal
+    });
+  },
+
+  render: function () {
+    if (this.props.loading) {
       return (
         <div className="view">
-          <DeleteDatabaseModal
-            showHide={this.showDeleteDatabaseModal}
-            modalProps={this.props.showDeleteDatabaseModal} />
-          <table className="databases table table-striped">
-            <thead>
-              <tr>
-                <th>Name</th>
-                <th>Size</th>
-                <th># of Docs</th>
-                <th>Update Seq</th>
-                {this.getExtensionColumns()}
-                <th>Actions</th>
-              </tr>
-            </thead>
-            <tbody>
-            {rows}
-            </tbody>
-          </table>
+          <Components.LoadLines />
         </div>
       );
     }
-  });
 
-  var DatabaseRow = React.createClass({
+    var rows = this.createRows();
+    return (
+      <div className="view">
+        <DeleteDatabaseModal
+          showHide={this.showDeleteDatabaseModal}
+          modalProps={this.props.showDeleteDatabaseModal} />
+        <table className="databases table table-striped">
+          <thead>
+            <tr>
+              <th>Name</th>
+              <th>Size</th>
+              <th># of Docs</th>
+              <th>Update Seq</th>
+              {this.getExtensionColumns()}
+              <th>Actions</th>
+            </tr>
+          </thead>
+          <tbody>
+          {rows}
+          </tbody>
+        </table>
+      </div>
+    );
+  }
+});
 
-    propTypes: {
-      row: React.PropTypes.object
-    },
+var DatabaseRow = React.createClass({
 
-    renderGraveyard: function (row) {
-      if (row.status.isGraveYard()) {
-        return (
-          <GraveyardInfo row={row} />
-        );
-      } else {
-        return null;
-      }
-    },
-
-    getExtensionColumns: function (row) {
-      var cols = FauxtonAPI.getExtensions('DatabaseTable:databaseRow');
-      return _.map(cols, function (Item, index) {
-        return <Item row={row} key={index} />;
-      });
-    },
-
-    showDeleteDatabaseModal: function (name) {
-      ComponentsActions.showDeleteDatabaseModal({showDeleteModal: true, dbId: name});
-    },
-
-    render: function () {
-      var row = this.props.row;
-      //Adding this row check in as it seems our unit tests need them to pass
-      if (!row || !row.get) {return (<span></span>);};
-
-      var name = row.get("name");
-
-      // if the row status failed to load, inform the user
-      if (!row.status.loadSuccess) {
-        return (
-          <tr>
-            <td>{name}</td>
-            <td colSpan="4" className="database-load-fail">This database failed to load.</td>
-          </tr>
-        );
-      }
-      var encoded = app.utils.safeURLName(name);
-      var size = Helpers.formatSize(row.status.dataSize());
+  propTypes: {
+    row: React.PropTypes.object
+  },
 
+  renderGraveyard: function (row) {
+    if (row.status.isGraveYard()) {
       return (
-        <tr>
-          <td>
-            <a href={"#/database/" + encoded + "/_all_docs"}>{name}</a>
-          </td>
-          <td>{size}</td>
-          <td>{row.status.numDocs()} {this.renderGraveyard(row)}</td>
-          <td>{row.status.updateSeq()}</td>
-          {this.getExtensionColumns(row)}
-          <td className="database-actions">
-            <a className="db-actions btn fonticon-replicate set-replication-start"
-              title={"Replicate " + name}
-              href={"#/replication/" + encoded} />
-            <a
-              className="db-actions btn icon-lock set-permissions"
-              title={"Set permissions for " + name} href={"#/database/" + encoded + "/permissions"} />
-            <a
-              className="db-actions btn icon-trash"
-              onClick={this.showDeleteDatabaseModal.bind(this, name)}
-              title={'Delete ' + name} data-bypass="true" />
-          </td>
-        </tr>
+        <GraveyardInfo row={row} />
       );
+    } else {
+      return null;
     }
-  });
+  },
 
-  var GraveyardInfo = React.createClass({
+  getExtensionColumns: function (row) {
+    var cols = FauxtonAPI.getExtensions('DatabaseTable:databaseRow');
+    return _.map(cols, function (Item, index) {
+      return <Item row={row} key={index} />;
+    });
+  },
 
-    componentDidMount: function () {
-      $(ReactDOM.findDOMNode(this.refs.myself)).tooltip();
-    },
+  showDeleteDatabaseModal: function (name) {
+    ComponentsActions.showDeleteDatabaseModal({showDeleteModal: true, dbId: name});
+  },
 
-    render: function () {
-      var row = this.props.row;
-      var graveyardTitle = "This database has just " + row.status.numDocs() +
-        " docs and " + row.status.numDeletedDocs() + " deleted docs";
-      return (
-        <i className="js-db-graveyard icon icon-exclamation-sign" ref="myself" title={graveyardTitle}></i>
-      );
-    }
-  });
+  render: function () {
+    var row = this.props.row;
+    //Adding this row check in as it seems our unit tests need them to pass
+    if (!row || !row.get) {return (<span></span>);};
 
-  var RightDatabasesHeader = React.createClass({
+    var name = row.get("name");
 
-    render: function () {
+    // if the row status failed to load, inform the user
+    if (!row.status.loadSuccess) {
       return (
-        <div className="header-right right-db-header flex-layout flex-row">
-          <JumpToDatabaseWidget />
-          <AddDatabaseWidget />
-        </div>
+        <tr>
+          <td>{name}</td>
+          <td colSpan="4" className="database-load-fail">This database failed to load.</td>
+        </tr>
       );
     }
-  });
-
-  var AddDatabaseWidget = React.createClass({
-
-    onTrayToggle: function (e) {
-      e.preventDefault();
+    var encoded = app.utils.safeURLName(name);
+    var size = Helpers.formatSize(row.status.dataSize());
+
+    return (
+      <tr>
+        <td>
+          <a href={"#/database/" + encoded + "/_all_docs"}>{name}</a>
+        </td>
+        <td>{size}</td>
+        <td>{row.status.numDocs()} {this.renderGraveyard(row)}</td>
+        <td>{row.status.updateSeq()}</td>
+        {this.getExtensionColumns(row)}
+        <td className="database-actions">
+          <a className="db-actions btn fonticon-replicate set-replication-start"
+            title={"Replicate " + name}
+            href={"#/replication/" + encoded} />
+          <a
+            className="db-actions btn icon-lock set-permissions"
+            title={"Set permissions for " + name} href={"#/database/" + encoded + "/permissions"} />
+          <a
+            className="db-actions btn icon-trash"
+            onClick={this.showDeleteDatabaseModal.bind(this, name)}
+            title={'Delete ' + name} data-bypass="true" />
+        </td>
+      </tr>
+    );
+  }
+});
 
-      this.setState({isPromptVisible: !this.state.isPromptVisible});
+var GraveyardInfo = React.createClass({
 
-      this.refs.newDbTray.toggle(function (shown) {
-        if (shown) {
-          ReactDOM.findDOMNode(this.refs.newDbName).focus();
-        }
-      }.bind(this));
-    },
+  componentDidMount: function () {
+    $(ReactDOM.findDOMNode(this.refs.myself)).tooltip();
+  },
 
-    onKeyUpInInput: function (e) {
-      if (e.which === 13) {
-        this.onAddDatabase();
-      }
-    },
+  render: function () {
+    var row = this.props.row;
+    var graveyardTitle = "This database has just " + row.status.numDocs() +
+      " docs and " + row.status.numDeletedDocs() + " deleted docs";
+    return (
+      <i className="js-db-graveyard icon icon-exclamation-sign" ref="myself" title={graveyardTitle}></i>
+    );
+  }
+});
 
-    getInitialState: function () {
-      return {
-        isPromptVisible: false
-      };
-    },
+var RightDatabasesHeader = React.createClass({
 
-    onAddDatabase: function () {
-      var databaseName = ReactDOM.findDOMNode(this.refs.newDbName).value;
-      Actions.createNewDatabase(databaseName);
-    },
+  render: function () {
+    return (
+      <div className="header-right right-db-header flex-layout flex-row">
+        <JumpToDatabaseWidget />
+        <AddDatabaseWidget />
+      </div>
+    );
+  }
+});
 
-    render: function () {
-      var headerButtonContainerClasses = 'header-control-box add-new-database-btn';
+var AddDatabaseWidget = React.createClass({
 
-      return (
-        <div>
-          <ToggleHeaderButton
-            selected={this.state.isPromptVisible}
-            toggleCallback={this.onTrayToggle}
-            containerClasses={headerButtonContainerClasses}
-            title="Create Database"
-            fonticon="fonticon-new-database"
-            text="Create Database" />
-          <FauxtonComponentsReact.Tray ref="newDbTray" className="new-database-tray">
-            <span className="add-on">Create Database</span>
-            <input id="js-new-database-name" type="text" onKeyUp={this.onKeyUpInInput} ref="newDbName" className="input-xxlarge" placeholder="Name of database" />
-            <a className="btn" id="js-create-database" onClick={this.onAddDatabase}>Create</a>
-          </FauxtonComponentsReact.Tray>
-        </div>
-      );
-    }
-  });
-
-  var JumpToDatabaseWidget = React.createClass({
-
-    getStoreState: function () {
-      return {
-        databaseNames: databasesStore.getDatabaseNames()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      databasesStore.on('change', this.onChange, this);
-    },
-
-    componentDidUpdate: function () {
-      $(ReactDOM.findDOMNode(this.refs.searchDbName)).typeahead({
-        source: this.state.databaseNames,
-        updater: function (item) {
-          this.jumpToDb(item);
-        }.bind(this)
-      });
-    },
-
-    componentWillUnmount: function () {
-      databasesStore.off('change', this.onChange, this);
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
+  onTrayToggle: function (e) {
+    e.preventDefault();
 
-    jumpToDb: function (databaseName) {
-      databaseName = databaseName || ReactDOM.findDOMNode(this.refs.searchDbName).value;
-      Actions.jumpToDatabase(databaseName);
-    },
+    this.setState({isPromptVisible: !this.state.isPromptVisible});
 
-    jumpToDbHandler: function (e) {
-      e.preventDefault();
-      this.jumpToDb();
-    },
+    this.refs.newDbTray.toggle(function (shown) {
+      if (shown) {
+        ReactDOM.findDOMNode(this.refs.newDbName).focus();
+      }
+    }.bind(this));
+  },
 
-    render: function () {
-      return (
-        <div className="searchbox-wrapper">
-          <div id="header-search" className="js-search searchbox-container">
-            <form onSubmit={this.jumpToDbHandler} id="jump-to-db" className="navbar-form pull-right database-search">
-              <div className="input-append">
-                <input type="text" className="search-autocomplete" ref="searchDbName" name="search-query" placeholder="Database name" autoComplete="off" />
-                <span><button className="btn btn-primary" type="submit"><i className="icon icon-search"></i></button></span>
-              </div>
-            </form>
-          </div>
-        </div>
-      );
+  onKeyUpInInput: function (e) {
+    if (e.which === 13) {
+      this.onAddDatabase();
     }
-  });
-
-  var DatabasePagination = React.createClass({
-
-    getDefaultProps: function () {
-      return {
-        linkPath: '_all_dbs'
-      };
-    },
-
-    getStoreState: function () {
-      return {
-        databaseNames: databasesStore.getDatabaseNames(),
-        page: databasesStore.getPage()
-      };
-    },
-
-    getInitialState: function () {
-      return this.getStoreState();
-    },
-
-    componentDidMount: function () {
-      databasesStore.on('change', this.onChange, this);
-    },
-
-    componentWillUnmount: function () {
-      databasesStore.off('change', this.onChange, this);
-    },
-
-    onChange: function () {
-      this.setState(this.getStoreState());
-    },
+  },
+
+  getInitialState: function () {
+    return {
+      isPromptVisible: false
+    };
+  },
+
+  onAddDatabase: function () {
+    var databaseName = ReactDOM.findDOMNode(this.refs.newDbName).value;
+    Actions.createNewDatabase(databaseName);
+  },
+
+  render: function () {
+    var headerButtonContainerClasses = 'header-control-box add-new-database-btn';
+
+    return (
+      <div>
+        <ToggleHeaderButton
+          selected={this.state.isPromptVisible}
+          toggleCallback={this.onTrayToggle}
+          containerClasses={headerButtonContainerClasses}
+          title="Create Database"
+          fonticon="fonticon-new-database"
+          text="Create Database" />
+        <FauxtonComponentsReact.Tray ref="newDbTray" className="new-database-tray">
+          <span className="add-on">Create Database</span>
+          <input id="js-new-database-name" type="text" onKeyUp={this.onKeyUpInInput} ref="newDbName" className="input-xxlarge" placeholder="Name of database" />
+          <a className="btn" id="js-create-database" onClick={this.onAddDatabase}>Create</a>
+        </FauxtonComponentsReact.Tray>
+      </div>
+    );
+  }
+});
 
-    render: function () {
-      var page = this.state.page;
-      var total = this.props.total || this.state.databaseNames.length;
-      var urlPrefix = '#/' + this.props.linkPath + '?page=';
-      var start = 1 + (page - 1) * FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
-      var end = Math.min(total, page * FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE);
+var JumpToDatabaseWidget = React.createClass({
+
+  getStoreState: function () {
+    return {
+      databaseNames: databasesStore.getDatabaseNames()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    databasesStore.on('change', this.onChange, this);
+  },
+
+  componentDidUpdate: function () {
+    $(ReactDOM.findDOMNode(this.refs.searchDbName)).typeahead({
+      source: this.state.databaseNames,
+      updater: function (item) {
+        this.jumpToDb(item);
+      }.bind(this)
+    });
+  },
+
+  componentWillUnmount: function () {
+    databasesStore.off('change', this.onChange, this);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  jumpToDb: function (databaseName) {
+    databaseName = databaseName || ReactDOM.findDOMNode(this.refs.searchDbName).value;
+    Actions.jumpToDatabase(databaseName);
+  },
+
+  jumpToDbHandler: function (e) {
+    e.preventDefault();
+    this.jumpToDb();
+  },
+
+  render: function () {
+    return (
+      <div className="searchbox-wrapper">
+        <div id="header-search" className="js-search searchbox-container">
+          <form onSubmit={this.jumpToDbHandler} id="jump-to-db" className="navbar-form pull-right database-search">
+            <div className="input-append">
+              <input type="text" className="search-autocomplete" ref="searchDbName" name="search-query" placeholder="Database name" autoComplete="off" />
+              <span><button className="btn btn-primary" type="submit"><i className="icon icon-search"></i></button></span>
+            </div>
+          </form>
+        </div>
+      </div>
+    );
+  }
+});
 
-      return (
-        <footer className="all-db-footer pagination-footer">
-          <div id="database-pagination">
-            <FauxtonComponentsReact.Pagination page={page} total={total} urlPrefix={urlPrefix} />
-          </div>
-          <div className="current-databases">Showing {start}&ndash;{end} of {total} databases.</div>
-        </footer>
-      );
-    }
-  });
-
-  return {
-    DatabasesController: DatabasesController,
-    DatabaseTable: DatabaseTable,
-    DatabaseRow: DatabaseRow,
-    RightDatabasesHeader: RightDatabasesHeader,
-    GraveyardInfo: GraveyardInfo,
-    AddDatabaseWidget: AddDatabaseWidget,
-    JumpToDatabaseWidget: JumpToDatabaseWidget,
-    DatabasePagination: DatabasePagination
-  };
+var DatabasePagination = React.createClass({
+
+  getDefaultProps: function () {
+    return {
+      linkPath: '_all_dbs'
+    };
+  },
+
+  getStoreState: function () {
+    return {
+      databaseNames: databasesStore.getDatabaseNames(),
+      page: databasesStore.getPage()
+    };
+  },
+
+  getInitialState: function () {
+    return this.getStoreState();
+  },
+
+  componentDidMount: function () {
+    databasesStore.on('change', this.onChange, this);
+  },
+
+  componentWillUnmount: function () {
+    databasesStore.off('change', this.onChange, this);
+  },
+
+  onChange: function () {
+    this.setState(this.getStoreState());
+  },
+
+  render: function () {
+    var page = this.state.page;
+    var total = this.props.total || this.state.databaseNames.length;
+    var urlPrefix = '#/' + this.props.linkPath + '?page=';
+    var start = 1 + (page - 1) * FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE;
+    var end = Math.min(total, page * FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE);
+
+    return (
+      <footer className="all-db-footer pagination-footer">
+        <div id="database-pagination">
+          <FauxtonComponentsReact.Pagination page={page} total={total} urlPrefix={urlPrefix} />
+        </div>
+        <div className="current-databases">Showing {start}&ndash;{end} of {total} databases.</div>
+      </footer>
+    );
+  }
 });
+
+export default {
+  DatabasesController: DatabasesController,
+  DatabaseTable: DatabaseTable,
+  DatabaseRow: DatabaseRow,
+  RightDatabasesHeader: RightDatabasesHeader,
+  GraveyardInfo: GraveyardInfo,
+  AddDatabaseWidget: AddDatabaseWidget,
+  JumpToDatabaseWidget: JumpToDatabaseWidget,
+  DatabasePagination: DatabasePagination
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/resources.js b/app/addons/databases/resources.js
index 5d0471e..73c76d7 100644
--- a/app/addons/databases/resources.js
+++ b/app/addons/databases/resources.js
@@ -10,208 +10,202 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  // Modules
-  "../documents/resources"
-],
-
-function (app, FauxtonAPI, Documents) {
-  var Databases = FauxtonAPI.addon();
-
-  Databases.DocLimit = 100;
-
-  Databases.Model = FauxtonAPI.Model.extend({
-    initialize: function (options) {
-      this.status = new Databases.Status({
-        database: this
-      });
-    },
-
-    documentation: function () {
-      return FauxtonAPI.constants.DOC_URLS.ALL_DBS;
-    },
-
-    buildAllDocs: function (params) {
-      this.allDocs = new Documents.AllDocs(null, {
-        database: this,
-        params: params
-      });
-
-      return this.allDocs;
-    },
-
-    isNew: function () {
-      // Databases are never new, to make Backbone do a PUT
-      return false;
-    },
-
-    isSystemDatabase: function () {
-      return app.utils.isSystemDatabase(this.id);
-    },
-
-    url: function (context) {
-      if (context === "index") {
-        return "/database/" + this.safeID() + "/_all_docs";
-      } else if (context === "web-index") {
-        return "#/database/" + this.safeID() + "/_all_docs?limit=" + Databases.DocLimit;
-      } else if (context === "apiurl") {
-        return window.location.origin + "/database/" + this.safeID() + "/_all_docs";
-      } else if (context === "changes") {
-        return FauxtonAPI.urls('changes', 'app', this.safeID(), '?descending=true&limit=100&include_docs=true');
-      } else if (context === "changes-apiurl") {
-        return FauxtonAPI.urls('changes', 'apiurl', this.safeID(), '?descending=true&limit=100&include_docs=true');
-      } else if (context === "app") {
-        return "/database/" + this.safeID();
-      } else {
-        return app.host + "/" + this.safeID();
-      }
-    },
-    safeName: function () {
-      return app.utils.safeURLName(this.get("name"));
-    },
-    safeID: function () {
-      return app.utils.safeURLName(this.id);
-    },
-    buildChanges: function (params) {
-      if (!params.limit) {
-        params.limit = 100;
-      }
-
-      this.changes = new Databases.Changes({
-        database: this,
-        params: params
-      });
-
-      return this.changes;
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Documents from "../documents/resources";
+var Databases = FauxtonAPI.addon();
+
+Databases.DocLimit = 100;
+
+Databases.Model = FauxtonAPI.Model.extend({
+  initialize: function (options) {
+    this.status = new Databases.Status({
+      database: this
+    });
+  },
+
+  documentation: function () {
+    return FauxtonAPI.constants.DOC_URLS.ALL_DBS;
+  },
+
+  buildAllDocs: function (params) {
+    this.allDocs = new Documents.AllDocs(null, {
+      database: this,
+      params: params
+    });
+
+    return this.allDocs;
+  },
+
+  isNew: function () {
+    // Databases are never new, to make Backbone do a PUT
+    return false;
+  },
+
+  isSystemDatabase: function () {
+    return app.utils.isSystemDatabase(this.id);
+  },
+
+  url: function (context) {
+    if (context === "index") {
+      return "/database/" + this.safeID() + "/_all_docs";
+    } else if (context === "web-index") {
+      return "#/database/" + this.safeID() + "/_all_docs?limit=" + Databases.DocLimit;
+    } else if (context === "apiurl") {
+      return window.location.origin + "/database/" + this.safeID() + "/_all_docs";
+    } else if (context === "changes") {
+      return FauxtonAPI.urls('changes', 'app', this.safeID(), '?descending=true&limit=100&include_docs=true');
+    } else if (context === "changes-apiurl") {
+      return FauxtonAPI.urls('changes', 'apiurl', this.safeID(), '?descending=true&limit=100&include_docs=true');
+    } else if (context === "app") {
+      return "/database/" + this.safeID();
+    } else {
+      return app.host + "/" + this.safeID();
     }
-  });
-
-  Databases.Changes = FauxtonAPI.Collection.extend({
-
-    initialize: function (options) {
-      this.database = options.database;
-      this.params = options.params;
-    },
-    documentation: function () {
-      return FauxtonAPI.constants.DOC_URLS.CHANGES;
-    },
-    url: function (context) {
-      var query = "";
-      if (this.params) {
-        query = "?" + $.param(this.params);
-      }
-
-      if (!context) { context = 'server';}
-
-      return FauxtonAPI.urls('changes', context, this.database.safeID(), query);
-    },
-
-    parse: function (resp) {
-      this.last_seq = resp.last_seq;
-      return resp.results;
+  },
+  safeName: function () {
+    return app.utils.safeURLName(this.get("name"));
+  },
+  safeID: function () {
+    return app.utils.safeURLName(this.id);
+  },
+  buildChanges: function (params) {
+    if (!params.limit) {
+      params.limit = 100;
     }
-  });
-
-  Databases.Status = FauxtonAPI.Model.extend({
-    url: function () {
-      return app.host + "/" + this.database.safeID();
-    },
-
-    initialize: function (options) {
-      this.database = options.database;
-      this.loadSuccess = false;
-    },
-
-    numDocs: function () {
-      return this.get("doc_count");
-    },
-
-    numDeletedDocs: function () {
-      return this.get("doc_del_count");
-    },
-
-    isGraveYard: function () {
-      return this.numDeletedDocs() > this.numDocs();
-    },
-
-    updateSeq: function (full) {
-      var updateSeq = this.get("update_seq");
-      if (full || (typeof(updateSeq) === 'number')) {
-        return updateSeq;
-      } else if (updateSeq) {
-        return updateSeq[0];
-      } else {
-        return 0;
-      }
-    },
-
-    dataSize: function () {
-      if (this.get("other")) {
-        return this.get("other").data_size;
-      } else if (this.get('data_size')) {
-        return this.get('data_size');
-      } else if (this.get('disk_size')) {
-        return this.get('disk_size');
-      } else {
-        return 0;
-      }
-    },
-
-    parse: function (resp) {
-      this.loadSuccess = true;
-      return resp;
-    },
-
-    // a sure-fire way to know when the DB size info is actually available; dataSize() may return 0 before or after
-    // the data has been loaded
-    hasDataSize: function () {
-      return this.get('other') || this.get('data_size') || this.get('disk_size');
+
+    this.changes = new Databases.Changes({
+      database: this,
+      params: params
+    });
+
+    return this.changes;
+  }
+});
+
+Databases.Changes = FauxtonAPI.Collection.extend({
+
+  initialize: function (options) {
+    this.database = options.database;
+    this.params = options.params;
+  },
+  documentation: function () {
+    return FauxtonAPI.constants.DOC_URLS.CHANGES;
+  },
+  url: function (context) {
+    var query = "";
+    if (this.params) {
+      query = "?" + $.param(this.params);
     }
-  });
-
-  // TODO: shared databases - read from the user doc
-  Databases.List = FauxtonAPI.Collection.extend({
-    model: Databases.Model,
-    documentation: function () {
-      return FauxtonAPI.constants.DOC_URLS.ALL_DBS;
-    },
-
-    getDatabaseNames: function () {
-      return _.map(this.toArray(), function (model) {
-        return model.get('name');
-      });
-    },
-
-    cache: {
-      expires: 60
-    },
-
-    url: function (context) {
-      if (context === "apiurl") {
-        return window.location.origin + "/_all_dbs";
-      } else {
-        return app.host + "/_all_dbs";
-      }
-    },
-
-    parse: function (resp) {
-      // TODO: pagination!
-      return _.map(resp, function (database) {
-        return {
-          id: app.utils.safeURLName(database),
-          name: database
-        };
-      });
-    },
-
-    paginated: function (page, perPage) {
-      var start = (page - 1) * perPage;
-      var end = page * perPage;
-      return this.slice(start, end);
+
+    if (!context) { context = 'server';}
+
+    return FauxtonAPI.urls('changes', context, this.database.safeID(), query);
+  },
+
+  parse: function (resp) {
+    this.last_seq = resp.last_seq;
+    return resp.results;
+  }
+});
+
+Databases.Status = FauxtonAPI.Model.extend({
+  url: function () {
+    return app.host + "/" + this.database.safeID();
+  },
+
+  initialize: function (options) {
+    this.database = options.database;
+    this.loadSuccess = false;
+  },
+
+  numDocs: function () {
+    return this.get("doc_count");
+  },
+
+  numDeletedDocs: function () {
+    return this.get("doc_del_count");
+  },
+
+  isGraveYard: function () {
+    return this.numDeletedDocs() > this.numDocs();
+  },
+
+  updateSeq: function (full) {
+    var updateSeq = this.get("update_seq");
+    if (full || (typeof(updateSeq) === 'number')) {
+      return updateSeq;
+    } else if (updateSeq) {
+      return updateSeq[0];
+    } else {
+      return 0;
+    }
+  },
+
+  dataSize: function () {
+    if (this.get("other")) {
+      return this.get("other").data_size;
+    } else if (this.get('data_size')) {
+      return this.get('data_size');
+    } else if (this.get('disk_size')) {
+      return this.get('disk_size');
+    } else {
+      return 0;
     }
-  });
+  },
+
+  parse: function (resp) {
+    this.loadSuccess = true;
+    return resp;
+  },
+
+  // a sure-fire way to know when the DB size info is actually available; dataSize() may return 0 before or after
+  // the data has been loaded
+  hasDataSize: function () {
+    return this.get('other') || this.get('data_size') || this.get('disk_size');
+  }
+});
 
-  return Databases;
+// TODO: shared databases - read from the user doc
+Databases.List = FauxtonAPI.Collection.extend({
+  model: Databases.Model,
+  documentation: function () {
+    return FauxtonAPI.constants.DOC_URLS.ALL_DBS;
+  },
+
+  getDatabaseNames: function () {
+    return _.map(this.toArray(), function (model) {
+      return model.get('name');
+    });
+  },
+
+  cache: {
+    expires: 60
+  },
+
+  url: function (context) {
+    if (context === "apiurl") {
+      return window.location.origin + "/_all_dbs";
+    } else {
+      return app.host + "/_all_dbs";
+    }
+  },
+
+  parse: function (resp) {
+    // TODO: pagination!
+    return _.map(resp, function (database) {
+      return {
+        id: app.utils.safeURLName(database),
+        name: database
+      };
+    });
+  },
+
+  paginated: function (page, perPage) {
+    var start = (page - 1) * perPage;
+    var end = page * perPage;
+    return this.slice(start, end);
+  }
 });
+
+export default Databases;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/routes.js b/app/addons/databases/routes.js
index fd38b34..c872692 100644
--- a/app/addons/databases/routes.js
+++ b/app/addons/databases/routes.js
@@ -10,50 +10,45 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  "../../app",
-  "../../core/api",
-  "./resources",
-  "./actions",
-  './components.react'
-],
-
-function (app, FauxtonAPI, Databases, Actions, Components) {
-
-  var AllDbsRouteObject = FauxtonAPI.RouteObject.extend({
-    layout: 'one_pane',
-
-    crumbs: [
-      {"name": "Databases", "link": "/_all_dbs"}
-    ],
-
-    routes: {
-      "": "allDatabases",
-      "index.html": "allDatabases",
-      "_all_dbs(:params)": "allDatabases"
-    },
-
-    roles: ['fx_loggedIn'],
-
-    selectedHeader: "Databases",
-    disableLoader: true,
-
-    initialize: function () {
-      this.databases = new Databases.List();
-    },
-
-    allDatabases: function () {
-      Actions.init(this.databases);
-      this.setComponent("#right-header", Components.RightDatabasesHeader);
-      this.setComponent("#dashboard-content", Components.DatabasesController);
-      this.setComponent("#footer", Components.DatabasePagination);
-    },
-
-    apiUrl: function () {
-      return [this.databases.url("apiurl"), this.databases.documentation()];
-    }
-  });
-  Databases.RouteObjects = [AllDbsRouteObject];
-
-  return Databases;
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import Databases from "./resources";
+import Actions from "./actions";
+import Components from "./components.react";
+
+var AllDbsRouteObject = FauxtonAPI.RouteObject.extend({
+  layout: 'one_pane',
+
+  crumbs: [
+    {"name": "Databases", "link": "/_all_dbs"}
+  ],
+
+  routes: {
+    "": "allDatabases",
+    "index.html": "allDatabases",
+    "_all_dbs(:params)": "allDatabases"
+  },
+
+  roles: ['fx_loggedIn'],
+
+  selectedHeader: "Databases",
+  disableLoader: true,
+
+  initialize: function () {
+    this.databases = new Databases.List();
+  },
+
+  allDatabases: function () {
+    Actions.init(this.databases);
+    this.setComponent("#right-header", Components.RightDatabasesHeader);
+    this.setComponent("#dashboard-content", Components.DatabasesController);
+    this.setComponent("#footer", Components.DatabasePagination);
+  },
+
+  apiUrl: function () {
+    return [this.databases.url("apiurl"), this.databases.documentation()];
+  }
 });
+Databases.RouteObjects = [AllDbsRouteObject];
+
+export default Databases;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/0ca35da7/app/addons/databases/stores.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/stores.js b/app/addons/databases/stores.js
index 9331baf..9f5540b 100644
--- a/app/addons/databases/stores.js
+++ b/app/addons/databases/stores.js
@@ -10,119 +10,116 @@
 // License for the specific language governing permissions and limitations under
 // the License.
 
-define([
-  '../../app',
-  '../../core/api',
-  './actiontypes',
-  './resources'
-], function (app, FauxtonAPI, ActionTypes, Resources) {
-
-  var DatabasesStore = FauxtonAPI.Store.extend({
-
-    initialize: function () {
-      this.reset();
-    },
-
-    reset: function () {
-      this._collection = new Backbone.Collection();
-      this._loading = false;
-      this._promptVisible = false;
-    },
-
-    init: function (collection, backboneCollection) {
-      this._collection = collection;
-      this._backboneCollection = backboneCollection;
-    },
-
-    setPage: function (page) {
-      this._page = page;
-    },
-
-    getPage: function () {
-      if (this._page) {
-        return this._page;
-      } else {
-        return 1;
-      }
-    },
-
-    isLoading: function () {
-      return this._loading;
-    },
-
-    setLoading: function (loading) {
-      this._loading = loading;
-    },
-
-    isPromptVisible: function () {
-      return this._promptVisible;
-    },
-
-    setPromptVisible: function (promptVisible) {
-      this._promptVisible = promptVisible;
-    },
-
-    obtainNewDatabaseModel: function (databaseName, nameAccCallback) {
-      return new this._backboneCollection.model({
-        id: databaseName,
-        name: databaseName
+import app from "../../app";
+import FauxtonAPI from "../../core/api";
+import ActionTypes from "./actiontypes";
+import Resources from "./resources";
+
+var DatabasesStore = FauxtonAPI.Store.extend({
+
+  initialize: function () {
+    this.reset();
+  },
+
+  reset: function () {
+    this._collection = new Backbone.Collection();
+    this._loading = false;
+    this._promptVisible = false;
+  },
+
+  init: function (collection, backboneCollection) {
+    this._collection = collection;
+    this._backboneCollection = backboneCollection;
+  },
+
+  setPage: function (page) {
+    this._page = page;
+  },
+
+  getPage: function () {
+    if (this._page) {
+      return this._page;
+    } else {
+      return 1;
+    }
+  },
+
+  isLoading: function () {
+    return this._loading;
+  },
+
+  setLoading: function (loading) {
+    this._loading = loading;
+  },
+
+  isPromptVisible: function () {
+    return this._promptVisible;
+  },
+
+  setPromptVisible: function (promptVisible) {
+    this._promptVisible = promptVisible;
+  },
+
+  obtainNewDatabaseModel: function (databaseName, nameAccCallback) {
+    return new this._backboneCollection.model({
+      id: databaseName,
+      name: databaseName
+    });
+  },
+
+  getCollection: function () {
+    return this._collection;
+  },
+
+  getDatabaseNames: function () {
+    if (this._backboneCollection) {
+      return _.map(this._backboneCollection.toJSON(), function (item, key) {
+        return item.name;
       });
-    },
-
-    getCollection: function () {
-      return this._collection;
-    },
-
-    getDatabaseNames: function () {
-      if (this._backboneCollection) {
-        return _.map(this._backboneCollection.toJSON(), function (item, key) {
-          return item.name;
-        });
-      } else {
-        return [];
-      }
-    },
-
-    doesDatabaseExist: function (databaseName) {
-      return this.getDatabaseNames().indexOf(databaseName) >= 0;
-    },
-
-    dispatch: function (action) {
-      switch (action.type) {
-        case ActionTypes.DATABASES_INIT:
-          this.init(action.options.collection, action.options.backboneCollection);
-          this.setPage(action.options.page);
-          this.setLoading(false);
-        break;
-
-        case ActionTypes.DATABASES_SETPAGE:
-          this.setPage(action.options.page);
-        break;
-
-        case ActionTypes.DATABASES_SET_PROMPT_VISIBLE:
-          this.setPromptVisible(action.options.visible);
-        break;
-
-        case ActionTypes.DATABASES_STARTLOADING:
-          this.setLoading(true);
-        break;
-
-        case ActionTypes.DATABASES_LOADCOMPLETE:
-          this.setLoading(false);
-        break;
-
-        default:
-        return;
-      }
-
-      this.triggerChange();
+    } else {
+      return [];
+    }
+  },
+
+  doesDatabaseExist: function (databaseName) {
+    return this.getDatabaseNames().indexOf(databaseName) >= 0;
+  },
+
+  dispatch: function (action) {
+    switch (action.type) {
+      case ActionTypes.DATABASES_INIT:
+        this.init(action.options.collection, action.options.backboneCollection);
+        this.setPage(action.options.page);
+        this.setLoading(false);
+      break;
+
+      case ActionTypes.DATABASES_SETPAGE:
+        this.setPage(action.options.page);
+      break;
+
+      case ActionTypes.DATABASES_SET_PROMPT_VISIBLE:
+        this.setPromptVisible(action.options.visible);
+      break;
+
+      case ActionTypes.DATABASES_STARTLOADING:
+        this.setLoading(true);
+      break;
+
+      case ActionTypes.DATABASES_LOADCOMPLETE:
+        this.setLoading(false);
+      break;
+
+      default:
+      return;
     }
-  });
-
-  var databasesStore = new DatabasesStore();
-  databasesStore.dispatchToken = FauxtonAPI.dispatcher.register(databasesStore.dispatch.bind(databasesStore));
-  return {
-    databasesStore: databasesStore
-  };
 
+    this.triggerChange();
+  }
 });
+
+var databasesStore = new DatabasesStore();
+databasesStore.dispatchToken = FauxtonAPI.dispatcher.register(databasesStore.dispatch.bind(databasesStore));
+
+export default {
+  databasesStore: databasesStore
+};