couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [05/27] fauxton commit: updated refs/heads/master to 0ca35da
Date Tue, 31 May 2016 07:58:33 GMT
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);
     });
   });
 });


Mime
View raw message