http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/replication/base.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/base.js b/app/addons/replication/base.js index 08a5088..e0ae776 100644 --- a/app/addons/replication/base.js +++ b/app/addons/replication/base.js @@ -16,8 +16,8 @@ define([ 'addons/replication/route' ], -function(app, FauxtonAPI, replication) { - replication.initialize = function() { +function (app, FauxtonAPI, replication) { + replication.initialize = function () { FauxtonAPI.addHeaderLink({ title: 'Replication', href: '#/replication', icon: 'fonticon-replicate' }); };
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/replication/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/resources.js b/app/addons/replication/resources.js index 69fe1c1..8c5c584 100644 --- a/app/addons/replication/resources.js +++ b/app/addons/replication/resources.js @@ -28,12 +28,12 @@ function (app, FauxtonAPI) { Replication.DBList = Backbone.Collection.extend({ model: Replication.DBModel, - url: function() { + url: function () { return app.host + '/_all_dbs'; }, - parse: function(resp) { + parse: function (resp) { // TODO: pagination! - return _.map(resp, function(database) { + return _.map(resp, function (database) { return { id: database, name: database @@ -49,9 +49,9 @@ function (app, FauxtonAPI) { url: function () { return app.host + '/_active_tasks'; }, - parse: function(resp) { + parse: function (resp) { //only want replication tasks to return - return _.filter(resp, function(task) { + return _.filter(resp, function (task) { return task.type === 'replication'; }); } @@ -59,7 +59,7 @@ function (app, FauxtonAPI) { Replication.Replicate = Backbone.Model.extend({ documentation: FauxtonAPI.constants.DOC_URLS.REPLICATION, - url: function() { + url: function () { return window.location.origin + '/_replicate'; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/replication/route.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/route.js b/app/addons/replication/route.js index 8ec0c73..adfc2d5 100644 --- a/app/addons/replication/route.js +++ b/app/addons/replication/route.js @@ -16,7 +16,7 @@ define([ 'addons/replication/resources', 'addons/replication/views' ], -function(app, FauxtonAPI, Replication, Views) { +function (app, FauxtonAPI, Replication, Views) { var RepRouteObject = FauxtonAPI.RouteObject.extend({ layout: 'one_pane', routes: { @@ -30,7 +30,7 @@ function(app, FauxtonAPI, Replication, Views) { crumbs: [ { "name": 'Replicate changes from: ', 'link': 'replication' } ], - defaultView: function(dbname) { + defaultView: function (dbname) { var isAdmin = FauxtonAPI.session.isAdmin(); this.tasks = []; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/replication/templates/form.html ---------------------------------------------------------------------- diff --git a/app/addons/replication/templates/form.html b/app/addons/replication/templates/form.html index 4dc12f4..3ad2ec4 100644 --- a/app/addons/replication/templates/form.html +++ b/app/addons/replication/templates/form.html @@ -21,8 +21,8 @@ the License. <div class="from_local local_option"> <select id="from_name" name="source"> - <% _.each( databases, function( db, i ) { %> - <option value="<%- db.name %>" <% if(selectedDB == db.name) {%>selected<%}%> ><%- db.name %></option> + <% _.each( databases, function ( db, i ) { %> + <option value="<%- db.name %>" <% if (selectedDB == db.name) {%>selected<%}%> ><%- db.name %></option> <% }); %> </select> </div> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/replication/views.js ---------------------------------------------------------------------- diff --git a/app/addons/replication/views.js b/app/addons/replication/views.js index c072e11..bcc6b69 100644 --- a/app/addons/replication/views.js +++ b/app/addons/replication/views.js @@ -16,7 +16,7 @@ define([ 'addons/fauxton/components', 'addons/replication/resources' ], -function(app, FauxtonAPI, Components, Replication) { +function (app, FauxtonAPI, Components, Replication) { var View = {}, Events = {}, pollingInfo = { @@ -90,7 +90,7 @@ function(app, FauxtonAPI, Components, Replication) { if (targetVal === 'local') { $currentTarget.parents('.form_set').addClass('local'); - }else{ + }else { $currentTarget.parents('.form_set').removeClass('local'); } }, @@ -129,7 +129,7 @@ function(app, FauxtonAPI, Components, Replication) { formValidation: function () { var $remote = this.$el.find('input:visible'), error = false; - _.each($remote, function(item) { + _.each($remote, function (item) { if (item.value === 'http://' || item.value === '') { error = true; } @@ -137,7 +137,7 @@ function(app, FauxtonAPI, Components, Replication) { return error; }, - serialize: function() { + serialize: function () { return { databases: this.collection.toJSON(), selectedDB: this.selectedDB @@ -169,7 +169,7 @@ function(app, FauxtonAPI, Components, Replication) { this.enableFields(); }, - updateButtonText: function(wait) { + updateButtonText: function (wait) { var $button = this.$('#replication button[type=submit]'); if (wait) { $button.text('Starting replication...').attr('disabled', true); @@ -262,7 +262,7 @@ function(app, FauxtonAPI, Components, Replication) { }, beforeRender: function () { - this.collection.forEach(function(item) { + this.collection.forEach(function (item) { this.insertView(new View.replicationItem({ model: item })); @@ -307,14 +307,14 @@ function(app, FauxtonAPI, Components, Replication) { "cancel": true }, { - success: function(model, xhr, options) { + success: function (model, xhr, options) { FauxtonAPI.addNotification({ msg: 'Replication stopped.', type: 'success', clear: true }); }, - error: function(model, xhr, options) { + error: function (model, xhr, options) { var errorMessage = JSON.parse(xhr.responseText); FauxtonAPI.addNotification({ msg: errorMessage.reason, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/styletests/base.js ---------------------------------------------------------------------- diff --git a/app/addons/styletests/base.js b/app/addons/styletests/base.js index 51a095b..4d77257 100644 --- a/app/addons/styletests/base.js +++ b/app/addons/styletests/base.js @@ -16,9 +16,9 @@ define([ "addons/styletests/routes" ], -function(app, FauxtonAPI, tests) { +function (app, FauxtonAPI, tests) { - tests.initialize = function() { + tests.initialize = function () { FauxtonAPI.addHeaderLink({ title: "Tests", http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/styletests/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/styletests/routes.js b/app/addons/styletests/routes.js index 1595874..8cc6287 100644 --- a/app/addons/styletests/routes.js +++ b/app/addons/styletests/routes.js @@ -16,7 +16,7 @@ define([ "addons/styletests/views" ], -function(app, FauxtonAPI, Views) { +function (app, FauxtonAPI, Views) { var TestRouteObject = FauxtonAPI.RouteObject.extend({ layout: "one_pane", @@ -25,10 +25,10 @@ function(app, FauxtonAPI, Views) { }, selectedHeader: 'theme tests', crumbs:[], - apiUrl: function() { + apiUrl: function () { return false; }, - initialize: function() { + initialize: function () { this.setView("#dashboard-content", new Views.tests({})); } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/verifyinstall/base.js ---------------------------------------------------------------------- diff --git a/app/addons/verifyinstall/base.js b/app/addons/verifyinstall/base.js index bfdb321..68e2bf9 100644 --- a/app/addons/verifyinstall/base.js +++ b/app/addons/verifyinstall/base.js @@ -16,7 +16,7 @@ define([ 'addons/verifyinstall/routes' ], -function(app, FauxtonAPI, VerifyInstall) { +function (app, FauxtonAPI, VerifyInstall) { VerifyInstall.initialize = function () { FauxtonAPI.addHeaderLink({ title: 'Verify', http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/verifyinstall/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/verifyinstall/routes.js b/app/addons/verifyinstall/routes.js index 14dff0b..bc7b8a1 100644 --- a/app/addons/verifyinstall/routes.js +++ b/app/addons/verifyinstall/routes.js @@ -15,7 +15,7 @@ define([ 'api', 'addons/verifyinstall/views' ], -function(app, FauxtonAPI, VerifyInstall) { +function (app, FauxtonAPI, VerifyInstall) { var VerifyRouteObject = FauxtonAPI.RouteObject.extend({ layout: 'one_pane', http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/verifyinstall/views.js ---------------------------------------------------------------------- diff --git a/app/addons/verifyinstall/views.js b/app/addons/verifyinstall/views.js index bc48542..1c3f9cd 100644 --- a/app/addons/verifyinstall/views.js +++ b/app/addons/verifyinstall/views.js @@ -15,7 +15,7 @@ define([ 'api', 'addons/verifyinstall/resources' ], -function(app, FauxtonAPI, VerifyInstall) { +function (app, FauxtonAPI, VerifyInstall) { VerifyInstall.Main = FauxtonAPI.View.extend({ template: 'addons/verifyinstall/templates/main', http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/app.js ---------------------------------------------------------------------- diff --git a/app/app.js b/app/app.js index cfa81e1..6483e5a 100644 --- a/app/app.js +++ b/app/app.js @@ -31,7 +31,7 @@ define([ 'plugins/jquery.form' ], -function(app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI, Couchdb) { +function (app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI, Couchdb) { // Make sure we have a console.log if (_.isUndefined(console)) { @@ -70,11 +70,11 @@ function(app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI, Couchdb) { prefix: 'app/', // Inject app/helper.js for shared functionality across all html templates - renderTemplate: function(template, context) { + renderTemplate: function (template, context) { return template(_.extend(Helpers, context)); }, - fetchTemplate: function(path) { + fetchTemplate: function (path) { // Initialize done for use in async-mode var done; @@ -88,7 +88,7 @@ function(app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI, Couchdb) { // Put fetch into `async-mode`. done = this.async(); // Seek out the template asynchronously. - return $.ajax({ url: app.root + path }).then(function(contents) { + return $.ajax({ url: app.root + path }).then(function (contents) { done(JST[path] = _.template(contents)); }); } @@ -106,7 +106,7 @@ function(app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI, Couchdb) { // I haven't wrapped these dispatch methods in a action // because I don't want to require fauxton/actions in this method. - addHeaderLink: function(link) { + addHeaderLink: function (link) { FauxtonAPI.dispatch({ type: 'ADD_NAVBAR_LINK', link: link @@ -121,7 +121,7 @@ function(app, $, _, Backbone, Bootstrap, Helpers, Utils, FauxtonAPI, Couchdb) { }, - removeHeaderLink: function(link) { + removeHeaderLink: function (link) { FauxtonAPI.dispatch({ type: 'REMOVE_NAVBAR_LINK', link: link http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/api.js ---------------------------------------------------------------------- diff --git a/app/core/api.js b/app/core/api.js index f1ca478..d925aa0 100644 --- a/app/core/api.js +++ b/app/core/api.js @@ -22,7 +22,7 @@ define([ 'flux' ], -function(FauxtonAPI, Layout, Router, RouteObject, utils, Store, constants, Flux) { +function (FauxtonAPI, Layout, Router, RouteObject, utils, Store, constants, Flux) { FauxtonAPI = _.extend(FauxtonAPI, { Layout: Layout, Router: Router, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/auth.js ---------------------------------------------------------------------- diff --git a/app/core/auth.js b/app/core/auth.js index 19e4a8c..af2e377 100644 --- a/app/core/auth.js +++ b/app/core/auth.js @@ -14,7 +14,7 @@ define([ "core/base", "backbone" ], -function(FauxtonAPI, Backbone) { +function (FauxtonAPI, Backbone) { // This is not exposed externally as it should not need to be accessed or overridden var Auth = function (options) { @@ -26,9 +26,9 @@ function(FauxtonAPI, Backbone) { Auth.extend = Backbone.Model.extend; _.extend(Auth.prototype, Backbone.Events, { - authDeniedCb: function() {}, + authDeniedCb: function () {}, - initialize: function() { + initialize: function () { var that = this; }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/base.js ---------------------------------------------------------------------- diff --git a/app/core/base.js b/app/core/base.js index 12bc342..e121847 100644 --- a/app/core/base.js +++ b/app/core/base.js @@ -15,7 +15,7 @@ define([ "plugins/backbone.layoutmanager" ], -function(Backbone, LayoutManager) { +function (Backbone, LayoutManager) { var FauxtonAPI = { //add default objects router: { @@ -31,7 +31,7 @@ function(Backbone, LayoutManager) { } }; - FauxtonAPI.Deferred = function() { + FauxtonAPI.Deferred = function () { return $.Deferred(); }; @@ -44,18 +44,18 @@ function(Backbone, LayoutManager) { }; FauxtonAPI.addonExtensions = { - initialize: function() {}, + initialize: function () {}, RouteObjects: {}, Views: {} }; - FauxtonAPI.addon = function(extra) { + FauxtonAPI.addon = function (extra) { return _.extend(_.clone(FauxtonAPI.addonExtensions), extra); }; FauxtonAPI.View = Backbone.View.extend({ // This should return an array of promises, an empty array, or null - establish: function() { + establish: function () { return null; }, loaderClassname: 'loader', http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/layout.js ---------------------------------------------------------------------- diff --git a/app/core/layout.js b/app/core/layout.js index fe6e53b..14d1518 100644 --- a/app/core/layout.js +++ b/app/core/layout.js @@ -13,7 +13,7 @@ define([ "backbone", "plugins/backbone.layoutmanager" -], function(Backbone) { +], function (Backbone) { // A wrapper of the main Backbone.layoutmanager // Allows the main layout of the page to be changed by any plugin. @@ -39,20 +39,20 @@ define([ return this.layout.render(); }, - setTemplate: function(template) { + setTemplate: function (template) { if (template.prefix) { this.layout.template = template.prefix + template.name; - } else{ + } else { this.layout.template = "templates/layouts/" + template; } // If we're changing layouts all bets are off, so kill off all the // existing views in the layout. - _.each(this.layoutViews, function(view) {view.removeView();}); + _.each(this.layoutViews, function (view) {view.removeView();}); this.layoutViews = {}; return this.render().promise(); }, - setView: function(selector, view, keep) { + setView: function (selector, view, keep) { this.layout.setView(selector, view, false); if (!keep) { @@ -64,7 +64,7 @@ define([ return view; }, - renderView: function(selector) { + renderView: function (selector) { var view = this.layoutViews[selector]; if (!view) { return false; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/routeObject.js ---------------------------------------------------------------------- diff --git a/app/core/routeObject.js b/app/core/routeObject.js index 03a9a0b..6dae4a4 100644 --- a/app/core/routeObject.js +++ b/app/core/routeObject.js @@ -14,9 +14,9 @@ define([ "core/base", "backbone" ], -function(FauxtonAPI, Backbone) { +function (FauxtonAPI, Backbone) { - var RouteObject = function(options) { + var RouteObject = function (options) { this._options = options; this._configure(options || {}); @@ -77,14 +77,14 @@ function(FauxtonAPI, Backbone) { disableLoader: false, loaderClassname: 'loader', renderedState: false, - establish: function() {}, - route: function() {}, + establish: function () {}, + route: function () {}, roles: [], _promises: [], - initialize: function() {} + initialize: function () {} }, { - renderWith: function(route, masterLayout, args) { + renderWith: function (route, masterLayout, args) { // set the options for this render var options = { @@ -112,7 +112,7 @@ function(FauxtonAPI, Backbone) { }); }, - setTemplateOnFullRender: function(masterLayout) { + setTemplateOnFullRender: function (masterLayout) { var promise = $.Deferred(); @@ -127,12 +127,12 @@ function(FauxtonAPI, Backbone) { return promise; }, - callEstablish: function(establishPromise) { + callEstablish: function (establishPromise) { this.addPromise(establishPromise); return FauxtonAPI.when(establishPromise); }, - renderAllViews: function(options, resp) { + renderAllViews: function (options, resp) { var routeObject = this, renderView = _.bind(this.renderView, this, routeObject, options); @@ -142,7 +142,7 @@ function(FauxtonAPI, Backbone) { return FauxtonAPI.when(promises); }, - renderView: function(routeObject, options, view, selector) { + renderView: function (routeObject, options, view, selector) { var viewInfo = { view: view, selector: selector, @@ -161,7 +161,7 @@ function(FauxtonAPI, Backbone) { return this.callEstablish(view.establish()).then(renderViewOnLayout, this.establishError); }, - renderViewOnLayout: function(viewInfo, resp, xhr) { + renderViewOnLayout: function (viewInfo, resp, xhr) { var masterLayout = viewInfo.masterLayout, triggerBroadcast = _.bind(this.triggerBroadcast, this); @@ -175,7 +175,7 @@ function(FauxtonAPI, Backbone) { return promise; }, - establishError: function(resp) { + establishError: function (resp) { if (!resp || !resp.responseText) { return; } FauxtonAPI.addNotification({ msg: 'An Error occurred: ' + JSON.parse(resp.responseText).reason, @@ -190,7 +190,7 @@ function(FauxtonAPI, Backbone) { this.triggerBroadcast('renderComplete'); }, - setRenderedState: function(bool) { + setRenderedState: function (bool) { this.renderedState = bool; }, @@ -202,14 +202,14 @@ function(FauxtonAPI, Backbone) { broadcaster.trigger.apply(broadcaster, args); }, - get: function(key) { + get: function (key) { return _.isFunction(this[key]) ? this[key]() : this[key]; }, - addEvents: function(events) { + addEvents: function (events) { events = events || this.get('events'); - _.each(events, function(method, event) { - if (!_.isFunction(method) && !_.isFunction(this[method])) { + _.each(events, function (method, event) { + if (!_.isFunction(method) && !_.isFunction (this[method])) { throw new Error("Invalid method: " + method); } method = _.isFunction(method) ? method : this[method]; @@ -218,22 +218,22 @@ function(FauxtonAPI, Backbone) { }, this); }, - _configure: function(options) { - _.each(_.intersection(_.keys(options), routeObjectOptions), function(key) { + _configure: function (options) { + _.each(_.intersection(_.keys(options), routeObjectOptions), function (key) { this[key] = options[key]; }, this); }, - getView: function(selector) { + getView: function (selector) { return this.views[selector]; }, - setView: function(selector, view) { + setView: function (selector, view) { this.views[selector] = view; return view; }, - getViews: function() { + getViews: function () { return this.views; }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/router.js ---------------------------------------------------------------------- diff --git a/app/core/router.js b/app/core/router.js index 08a78a6..f6143b2 100644 --- a/app/core/router.js +++ b/app/core/router.js @@ -16,7 +16,7 @@ define([ "backbone" ], -function(FauxtonAPI, Auth, Backbone) { +function (FauxtonAPI, Auth, Backbone) { var beforeUnloads = {}; @@ -46,13 +46,13 @@ function(FauxtonAPI, Auth, Backbone) { } }, - addModuleRouteObject: function(RouteObject) { + addModuleRouteObject: function (RouteObject) { var that = this; var masterLayout = FauxtonAPI.masterLayout, routeUrls = RouteObject.prototype.getRouteUrls(); - _.each(routeUrls, function(route) { - this.route(route, route.toString(), function() { + _.each(routeUrls, function (route) { + this.route(route, route.toString(), function () { var args = Array.prototype.slice.call(arguments), roles = RouteObject.prototype.getRouteRoles(route), authPromise = FauxtonAPI.auth.checkAccess(roles); @@ -75,8 +75,8 @@ function(FauxtonAPI, Auth, Backbone) { }, this); }, - setModuleRoutes: function(addons) { - _.each(addons, function(module) { + setModuleRoutes: function (addons) { + _.each(addons, function (module) { if (module) { module.initialize(); // This is pure routes the addon provides @@ -87,7 +87,7 @@ function(FauxtonAPI, Auth, Backbone) { }, this); }, - initialize: function(addons) { + initialize: function (addons) { this.addons = addons; this.auth = FauxtonAPI.auth = new Auth(); // NOTE: This must be below creation of the layout @@ -107,7 +107,7 @@ function(FauxtonAPI, Auth, Backbone) { }, this); }, - triggerRouteEvent: function(event, args) { + triggerRouteEvent: function (event, args) { if (this.activeRouteObject) { var eventArgs = [event].concat(args); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/store.js ---------------------------------------------------------------------- diff --git a/app/core/store.js b/app/core/store.js index 90d5851..6614372 100644 --- a/app/core/store.js +++ b/app/core/store.js @@ -13,7 +13,7 @@ define([ "backbone" ], -function(Backbone) { +function (Backbone) { var Store = function () { this.initialize.apply(this, arguments); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/core/utils.js ---------------------------------------------------------------------- diff --git a/app/core/utils.js b/app/core/utils.js index 7029c45..dbc1155 100644 --- a/app/core/utils.js +++ b/app/core/utils.js @@ -30,7 +30,7 @@ function ($, _) { var utils = { // Thanks to: http://stackoverflow.com/a/2880929 - getParams: function(queryString) { + getParams: function (queryString) { if (queryString) { // I think this could be combined into one if if (queryString.substring(0, 1) === "?") { @@ -58,7 +58,7 @@ function ($, _) { }, // this takes the current URL and replaces all ?x=x with whatever new params are passed - replaceQueryParams: function(params) { + replaceQueryParams: function (params) { var fragment = window.location.hash.replace(/\?.*$/, ""); if (!_.isEmpty(params)) { fragment = fragment + "?" + $.param(params); @@ -66,21 +66,21 @@ function ($, _) { return fragment; }, - addWindowResize: function(fun, key) { + addWindowResize: function (fun, key) { onWindowResize[key] = fun; // You shouldn't need to call it here. Just define it at startup and each time it will loop // through all the functions in the hash. //app.initWindowResize(); }, - removeWindowResize: function(key) { + removeWindowResize: function (key) { delete onWindowResize[key]; utils.initWindowResize(); }, - initWindowResize: function() { + initWindowResize: function () { //when calling this it should be overriding what was called previously - window.onresize = function(e) { + window.onresize = function (e) { // could do this instead of the above for loop _.each(onWindowResize, function (fn) { fn(); @@ -88,11 +88,11 @@ function ($, _) { }; }, - removeSpecialCharacters: function(name) { + removeSpecialCharacters: function (name) { return name.replace(/[^\w\s]/gi, ""); }, - safeURLName: function(name) { + safeURLName: function (name) { var testName = name || ""; var checkforBad = testName.match(/[\$\-/,+-]/g); return (checkforBad !== null) ? encodeURIComponent(name) : name; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/helpers.js ---------------------------------------------------------------------- diff --git a/app/helpers.js b/app/helpers.js index a400786..478ca89 100644 --- a/app/helpers.js +++ b/app/helpers.js @@ -24,7 +24,7 @@ define([ 'moment' ], -function(constants, utils, d3, moment) { +function (constants, utils, d3, moment) { var Helpers = {}; @@ -32,7 +32,7 @@ function(constants, utils, d3, moment) { Helpers.safeURL = utils.safeURLName; - Helpers.imageUrl = function(path) { + Helpers.imageUrl = function (path) { // TODO: add dynamic path for different deploy targets return path; }; @@ -42,7 +42,7 @@ function(constants, utils, d3, moment) { }; // File size pretty printing, taken from futon.format.js - Helpers.formatSize = function(size) { + Helpers.formatSize = function (size) { var jump = 512; if (size < jump) return size + " bytes"; var units = ["KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/initialize.js.underscore ---------------------------------------------------------------------- diff --git a/app/initialize.js.underscore b/app/initialize.js.underscore index 245bf55..c0af5fb 100644 --- a/app/initialize.js.underscore +++ b/app/initialize.js.underscore @@ -17,7 +17,7 @@ define([], -function() { +function () { // Provide a global location to place configuration settings and module // creation. var app = { @@ -29,6 +29,6 @@ function() { zeroClipboardPath: "<%= zeroClipboardPath %>" }; - return app; + return app; }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/load_addons.js.underscore ---------------------------------------------------------------------- diff --git a/app/load_addons.js.underscore b/app/load_addons.js.underscore index 9686ad7..e6a49f7 100644 --- a/app/load_addons.js.underscore +++ b/app/load_addons.js.underscore @@ -18,7 +18,7 @@ define([ <%= '"' + deps.join('","') + '"' %> ], -function() { +function () { var LoadAddons = { addons: arguments }; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/main.js ---------------------------------------------------------------------- diff --git a/app/main.js b/app/main.js index 7799a13..d5d903c 100644 --- a/app/main.js +++ b/app/main.js @@ -17,7 +17,7 @@ require([ "load_addons" ], -function(app, FauxtonAPI, LoadAddons) { +function (app, FauxtonAPI, LoadAddons) { app.addons = LoadAddons.addons; FauxtonAPI.router = app.router = new FauxtonAPI.Router(app.addons); @@ -29,7 +29,7 @@ function(app, FauxtonAPI, LoadAddons) { // All navigation that is relative should be passed through the navigate // method, to be processed by the router. If the link has a `data-bypass` // attribute, bypass the delegation completely. - $(document).on("click", "a:not([data-bypass])", function(evt) { + $(document).on("click", "a:not([data-bypass])", function (evt) { // Get the absolute anchor href. var href = { prop: $(this).prop("href"), attr: $(this).attr("href") }; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/tasks/addon/root/base.js.underscore ---------------------------------------------------------------------- diff --git a/tasks/addon/root/base.js.underscore b/tasks/addon/root/base.js.underscore index d002cd5..7ec70a4 100644 --- a/tasks/addon/root/base.js.underscore +++ b/tasks/addon/root/base.js.underscore @@ -16,6 +16,6 @@ define([ "addons/{%= name.toLowerCase() %}/routes" ], -function(app, FauxtonAPI, {%= name %}) { +function (app, FauxtonAPI, {%= name %}) { return {%= name %}; }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/tasks/addon/root/routes.js.underscore ---------------------------------------------------------------------- diff --git a/tasks/addon/root/routes.js.underscore b/tasks/addon/root/routes.js.underscore index cd9394d..0fa3c6f 100644 --- a/tasks/addon/root/routes.js.underscore +++ b/tasks/addon/root/routes.js.underscore @@ -15,7 +15,7 @@ define([ "api", "addons/{%= name.toLowerCase() %}/resources" ], -function(app, FauxtonAPI, {%= name %}) { +function (app, FauxtonAPI, {%= name %}) { var {%= name.substr(0, 1).toUpperCase() + name.substr(1)%}RouteObject = FauxtonAPI.RouteObject.extend({ layout: "with_sidebar", @@ -27,7 +27,7 @@ function(app, FauxtonAPI, {%= name %}) { roles: [], - apiUrl: function() { + apiUrl: function () { return ["insert url here..."]; }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/tasks/addon/template.js ---------------------------------------------------------------------- diff --git a/tasks/addon/template.js b/tasks/addon/template.js index 89354e6..fd296ed 100644 --- a/tasks/addon/template.js +++ b/tasks/addon/template.js @@ -23,7 +23,7 @@ exports.after = "Created your addon! Don't forget to update your" + // exports.warnOn = '*'; // The actual init template. -exports.template = function(grunt, init, done) { +exports.template = function (grunt, init, done) { // destpath init.process( http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/tasks/fauxton.js ---------------------------------------------------------------------- diff --git a/tasks/fauxton.js b/tasks/fauxton.js index a61ccf4..743c8ef 100644 --- a/tasks/fauxton.js +++ b/tasks/fauxton.js @@ -10,11 +10,11 @@ // License for the specific language governing permissions and limitations under // the License. -module.exports = function(grunt) { +module.exports = function (grunt) { var _ = grunt.util._, fs = require('fs'); - grunt.registerMultiTask('template', 'generates an html file from a specified template', function() { + grunt.registerMultiTask('template', 'generates an html file from a specified template', function () { var data = this.data, _ = grunt.util._, tmpl = _.template(grunt.file.read(data.src), null, data.variables); @@ -22,7 +22,7 @@ module.exports = function(grunt) { grunt.file.write(data.dest, tmpl(data.variables)); }); - grunt.registerMultiTask('get_deps', 'Fetch external dependencies', function(version) { + grunt.registerMultiTask('get_deps', 'Fetch external dependencies', function (version) { grunt.log.writeln("Fetching external dependencies"); var done = this.async(), @@ -33,20 +33,20 @@ module.exports = function(grunt) { _ = grunt.util._; // This should probably be a helper, though they seem to have been removed - var fetch = function(deps, command) { + var fetch = function (deps, command) { var child_process = require('child_process'); var async = require('async'); - async.forEach(deps, function(dep, cb) { + async.forEach(deps, function (dep, cb) { var path = target + dep.name; var location = dep.url || dep.path; grunt.log.writeln("Fetching: " + dep.name + " (" + location + ")"); - child_process.exec(command(dep, path), function(error, stdout, stderr) { + child_process.exec(command(dep, path), function (error, stdout, stderr) { grunt.log.writeln(stderr); grunt.log.writeln(stdout); cb(error); }); - }, function(error) { + }, function (error) { if (error) { grunt.log.writeln("ERROR: " + error.message); return false; @@ -56,15 +56,15 @@ module.exports = function(grunt) { }); }; - var remoteDeps = _.filter(settings.deps, function(dep) { return !! dep.url; }); + var remoteDeps = _.filter(settings.deps, function (dep) { return !! dep.url; }); grunt.log.writeln(remoteDeps.length + " remote dependencies"); - var remote = fetch(remoteDeps, function(dep, destination) { + var remote = fetch(remoteDeps, function (dep, destination) { return "git clone " + dep.url + " " + destination; }); - var localDeps = _.filter(settings.deps, function(dep) { return !! dep.path; }); + var localDeps = _.filter(settings.deps, function (dep) { return !! dep.path; }); grunt.log.writeln(localDeps.length + " local dependencies"); - var local = fetch(localDeps, function(dep, destination) { + var local = fetch(localDeps, function (dep, destination) { // TODO: Windows var command = "cp -r " + dep.path + " " + destination; grunt.log.writeln(command); @@ -75,14 +75,14 @@ module.exports = function(grunt) { }); - grunt.registerMultiTask('gen_load_addons', 'Generate the load_addons.js file', function() { + grunt.registerMultiTask('gen_load_addons', 'Generate the load_addons.js file', function () { var data = this.data, _ = grunt.util._, settingsFile = fs.existsSync(data.src) ? data.src : "settings.json.default", settings = grunt.file.readJSON(settingsFile), template = "app/load_addons.js.underscore", dest = "app/load_addons.js", - deps = _.map(settings.deps, function(dep) { + deps = _.map(settings.deps, function (dep) { return "addons/" + dep.name + "/base"; }); @@ -90,7 +90,7 @@ module.exports = function(grunt) { grunt.file.write(dest, tmpl({deps: deps})); }); - grunt.registerMultiTask('gen_initialize', 'Generate the app.js file', function() { + grunt.registerMultiTask('gen_initialize', 'Generate the app.js file', function () { var _ = grunt.util._, settings = this.data, template = "app/initialize.js.underscore", @@ -108,7 +108,7 @@ module.exports = function(grunt) { grunt.file.write(dest, tmpl(app)); }); - grunt.registerMultiTask('mochaSetup', 'Generate a config.js and runner.html for tests', function() { + grunt.registerMultiTask('mochaSetup', 'Generate a config.js and runner.html for tests', function () { var data = this.data, configInfo, _ = grunt.util._, @@ -213,7 +213,7 @@ module.exports = function(grunt) { function _getNightwatchTests (settings) { var addonBlacklist = (_.has(settings.nightwatch, 'addonBlacklist')) ? settings.nightwatch.addonBlacklist : []; - return _.filter(settings.deps, function(addon) { + return _.filter(settings.deps, function (addon) { // if we've explicitly been told to ignore this addon's test, ignore 'em! if (_.contains(addonBlacklist, addon.name)) { @@ -228,7 +228,7 @@ module.exports = function(grunt) { // see if the addon has any tests return fs.existsSync(fileLocation); - }).map(function(addon) { + }).map(function (addon) { return 'app/addons/' + addon.name + '/tests/nightwatch'; }); } http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/tasks/helper.js ---------------------------------------------------------------------- diff --git a/tasks/helper.js b/tasks/helper.js index b3a0007..e0b82bb 100644 --- a/tasks/helper.js +++ b/tasks/helper.js @@ -13,7 +13,7 @@ var fs = require('fs'), path = require('path'); -exports.init = function(grunt) { +exports.init = function (grunt) { var _ = grunt.util._, platform = process.platform; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/test/nightwatch_tests/custom-commands/clickWhenVisible.js ---------------------------------------------------------------------- diff --git a/test/nightwatch_tests/custom-commands/clickWhenVisible.js b/test/nightwatch_tests/custom-commands/clickWhenVisible.js index 9f7c3a7..ee96eca 100644 --- a/test/nightwatch_tests/custom-commands/clickWhenVisible.js +++ b/test/nightwatch_tests/custom-commands/clickWhenVisible.js @@ -12,7 +12,7 @@ exports.command = function (element, waitTime) { - if(waitTime === undefined){ + if (waitTime === undefined) { waitTime = 10000; } http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/test/nightwatch_tests/custom-commands/deleteDocument.js ---------------------------------------------------------------------- diff --git a/test/nightwatch_tests/custom-commands/deleteDocument.js b/test/nightwatch_tests/custom-commands/deleteDocument.js index c398e9b..29ecac4 100644 --- a/test/nightwatch_tests/custom-commands/deleteDocument.js +++ b/test/nightwatch_tests/custom-commands/deleteDocument.js @@ -16,8 +16,8 @@ DeleteDocument.prototype.command = function (databaseName, documentName) { database = nano.use(databaseName), documentRev; - database.get(documentName, function(err, body) { - if (!err){ + database.get(documentName, function (err, body) { + if (!err) { documentRev = body._rev; database.destroy(documentName, documentRev, function (err, body, header) {