couchdb-commits mailing list archives

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


Mime
View raw message