styleguide: requireSpaceAfterKeywords PR: #326 PR-URL: https://github.com/apache/couchdb-fauxton/pull/326 Reviewed-By: garren smith <garren.sm...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/c54822ab Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/c54822ab Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/c54822ab Branch: refs/heads/master Commit: c54822ab81b34dca7b1a49ca7bc314c8d5a86ce2 Parents: e3425b0 Author: Robert Kowalski <r...@kowalski.gd> Authored: Sun Mar 22 22:09:32 2015 +0100 Committer: Robert Kowalski <robertkowal...@apache.org> Committed: Wed Mar 25 11:11:58 2015 +0100 ---------------------------------------------------------------------- Gruntfile.js | 24 +++---- app/addons/activetasks/views.js | 4 +- app/addons/auth/base.js | 6 +- app/addons/auth/resources.js | 10 +-- app/addons/auth/routes.js | 2 +- app/addons/compaction/base.js | 4 +- app/addons/compaction/routes.js | 2 +- .../components/tests/beautifySpec.react.jsx | 2 +- app/addons/config/base.js | 4 +- app/addons/config/routes.js | 4 +- app/addons/config/views.js | 12 ++-- app/addons/cors/actions.js | 4 +- app/addons/cors/base.js | 2 +- app/addons/cors/components.react.jsx | 2 +- app/addons/cors/resources.js | 4 +- app/addons/databases/base.js | 8 +-- app/addons/databases/resources.js | 36 +++++------ app/addons/databases/routes.js | 6 +- app/addons/databases/views.js | 8 +-- app/addons/documents/base.js | 2 +- app/addons/documents/header/header.react.jsx | 4 +- app/addons/documents/helpers.js | 2 +- .../documents/index-editor/components.react.jsx | 14 ++--- app/addons/documents/index-editor/stores.js | 8 +-- .../documents/pagination/pagination.react.jsx | 8 +-- app/addons/documents/resources.js | 38 +++++------ app/addons/documents/routes-doc-editor.js | 6 +- app/addons/documents/routes-documents.js | 4 +- app/addons/documents/routes.js | 2 +- app/addons/documents/shared-resources.js | 48 +++++++------- app/addons/documents/shared-views.js | 26 ++++---- .../documents/tests/changes.storesSpec.js | 4 +- app/addons/documents/tests/resourcesSpec.js | 24 +++---- app/addons/documents/tests/storesSpec.js | 4 +- app/addons/documents/views-changes.js | 4 +- app/addons/documents/views-doceditor.js | 6 +- app/addons/documents/views-queryoptions.js | 2 +- app/addons/documents/views.js | 44 ++++++------- app/addons/fauxton/actions.js | 2 +- app/addons/fauxton/actiontypes.js | 2 +- app/addons/fauxton/base.js | 12 ++-- app/addons/fauxton/components.js | 66 ++++++++++---------- app/addons/fauxton/components.react.jsx | 4 +- app/addons/fauxton/stores.js | 6 +- app/addons/fauxton/templates/breadcrumbs.html | 2 +- app/addons/fauxton/templates/pagination.html | 2 +- app/addons/permissions/base.js | 4 +- app/addons/permissions/views.js | 2 +- app/addons/plugins/base.js | 4 +- app/addons/plugins/routes.js | 2 +- app/addons/plugins/templates/plugins.html | 16 ++--- app/addons/pouchdb/base.js | 8 +-- app/addons/replication/base.js | 4 +- app/addons/replication/resources.js | 12 ++-- app/addons/replication/route.js | 4 +- app/addons/replication/templates/form.html | 4 +- app/addons/replication/views.js | 16 ++--- app/addons/styletests/base.js | 4 +- app/addons/styletests/routes.js | 6 +- app/addons/verifyinstall/base.js | 2 +- app/addons/verifyinstall/routes.js | 2 +- app/addons/verifyinstall/views.js | 2 +- app/app.js | 12 ++-- app/core/api.js | 2 +- app/core/auth.js | 6 +- app/core/base.js | 10 +-- app/core/layout.js | 12 ++-- app/core/routeObject.js | 44 ++++++------- app/core/router.js | 16 ++--- app/core/store.js | 2 +- app/core/utils.js | 16 ++--- app/helpers.js | 6 +- app/initialize.js.underscore | 4 +- app/load_addons.js.underscore | 2 +- app/main.js | 4 +- tasks/addon/root/base.js.underscore | 2 +- tasks/addon/root/routes.js.underscore | 4 +- tasks/addon/template.js | 2 +- tasks/fauxton.js | 34 +++++----- tasks/helper.js | 2 +- .../custom-commands/clickWhenVisible.js | 2 +- .../custom-commands/deleteDocument.js | 4 +- 82 files changed, 384 insertions(+), 384 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/Gruntfile.js ---------------------------------------------------------------------- diff --git a/Gruntfile.js b/Gruntfile.js index 22997d1..1bbcd94 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -18,7 +18,7 @@ /*jslint node: true */ "use strict"; -module.exports = function(grunt) { +module.exports = function (grunt) { var helper = require('./tasks/helper').init(grunt), _ = grunt.util._, fs = require('fs'); @@ -41,7 +41,7 @@ module.exports = function(grunt) { var cleanableAddons = function () { var theListToClean = []; - helper.processAddons(function(addon) { + helper.processAddons(function (addon) { // Only clean addons that are included from a local dir if (addon.path) { theListToClean.push("app/addons/" + addon.name); @@ -51,14 +51,14 @@ module.exports = function(grunt) { return theListToClean; }(); - var cleanable = function() { + var cleanable = function () { // Whitelist files and directories to be cleaned // You'll always want to clean these two directories // Now find the external addons you have and add them for cleaning up return _.union(["dist/", "app/load_addons.js"], cleanableAddons); }(); - var assets = function() { + var assets = function () { // Base assets var theAssets = { less:{ @@ -73,11 +73,11 @@ module.exports = function(grunt) { // fauxton.css should load first css: ["assets/css/*.css", "dist/debug/css/fauxton.css"] }; - helper.processAddons(function(addon) { + helper.processAddons(function (addon) { // Less files from addons var root = addon.path || "app/addons/" + addon.name; var lessPath = root + "/assets/less"; - if(fs.existsSync(lessPath)) { + if (fs.existsSync(lessPath)) { // .less files exist for this addon theAssets.less.paths.push(lessPath); theAssets.less.files["dist/debug/css/" + addon.name + ".css"] = @@ -87,18 +87,18 @@ module.exports = function(grunt) { // Images root = addon.path || "app/addons/" + addon.name; var imgPath = root + "/assets/img"; - if(fs.existsSync(imgPath)) { + if (fs.existsSync(imgPath)) { theAssets.img.push(imgPath + "/**"); } var fontsPath = root + "/assets/fonts"; - if(fs.existsSync(fontsPath)) { + if (fs.existsSync(fontsPath)) { theAssets.fonts.push(fontsPath + "/**"); } }); return theAssets; }(); - var templateSettings = function() { + var templateSettings = function () { var defaultSettings = { "development": { "src": "assets/index.underscore", @@ -159,7 +159,7 @@ module.exports = function(grunt) { // The jshint option for scripturl is set to lax, because the anchor // override inside main.js needs to test for them so as to not accidentally - // route. Settings expr true so we can do `mightBeNullObject && mightBeNullObject.coolFunction()` + // route. Settings expr true so we can do `mightBeNullObject && mightBeNullObject.coolfunction()` jshint: { all: ['app/**/*.js', 'Gruntfile.js', "!app/**/assets/js/*.js", "!app/**/*.jsx"], options: { @@ -211,7 +211,7 @@ module.exports = function(grunt) { jst: { compile: { options: { - processContent: function(src) { + processContent: function (src) { return src.replace(/<!--[\s\S]*?-->/gm, ''); } }, @@ -464,7 +464,7 @@ module.exports = function(grunt) { grunt.initConfig(config); // on watch events configure jshint:all to only run on changed file - grunt.event.on('watch', function(action, filepath) { + grunt.event.on('watch', function (action, filepath) { if (!!filepath.match(/.js$/) && filepath.indexOf('test.config.js') === -1) { grunt.config(['jshint', 'all'], filepath); } http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/activetasks/views.js ---------------------------------------------------------------------- diff --git a/app/addons/activetasks/views.js b/app/addons/activetasks/views.js index 053e252..dadb9e0 100644 --- a/app/addons/activetasks/views.js +++ b/app/addons/activetasks/views.js @@ -137,7 +137,7 @@ function (app, FauxtonAPI, ActiveTasks) { this.$('.task-tabs').find('li').eq(0).addClass('active'); }, - changePollInterval: function(e) { + changePollInterval: function (e) { var range = this.$(e.currentTarget).val(); this.$('label[for="pollingRange"] span').text(range); pollingInfo.rate = range; @@ -149,7 +149,7 @@ function (app, FauxtonAPI, ActiveTasks) { clearInterval(pollingInfo.intervalId); }, - requestByType: function(e) { + requestByType: function (e) { var currentTarget = e.currentTarget, filter = this.$(currentTarget).attr('data-type'); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/auth/base.js ---------------------------------------------------------------------- diff --git a/app/addons/auth/base.js b/app/addons/auth/base.js index d1f6d65..8f4b1b3 100644 --- a/app/addons/auth/base.js +++ b/app/addons/auth/base.js @@ -16,13 +16,13 @@ define([ "addons/auth/routes" ], -function(app, FauxtonAPI, Auth) { +function (app, FauxtonAPI, Auth) { Auth.session = new Auth.Session(); FauxtonAPI.setSession(Auth.session); app.session = Auth.session; - Auth.initialize = function() { + Auth.initialize = function () { FauxtonAPI.addHeaderLink({ id: "auth", @@ -85,7 +85,7 @@ function(app, FauxtonAPI, Auth) { if (session.isAdminParty()) { session.trigger("authenticated"); deferred.resolve(); - } else if(session.matchesRoles(roles)) { + } else if (session.matchesRoles(roles)) { session.trigger("authenticated"); deferred.resolve(); } else { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/auth/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/auth/resources.js b/app/addons/auth/resources.js index b8fc9b0..3b6d295 100644 --- a/app/addons/auth/resources.js +++ b/app/addons/auth/resources.js @@ -33,10 +33,10 @@ function (app, FauxtonAPI, CouchdbSession) { }; var Admin = Backbone.Model.extend({ - url: function() { + url: function () { return app.host + '/_config/admins/' + this.get("name"); }, - isNew: function() { return false; }, + isNew: function () { return false; }, sync: function (method, model, options) { var params = { @@ -259,7 +259,7 @@ function (app, FauxtonAPI, CouchdbSession) { }); }, - afterRender: function() { + afterRender: function () { $("#username").focus(); } }); @@ -283,7 +283,7 @@ function (app, FauxtonAPI, CouchdbSession) { urlBack = this.urlBack, promise = this.model.login(username, password); - promise.then(function() { + promise.then(function () { FauxtonAPI.addNotification({msg: FauxtonAPI.session.messages.loggedIn }); if (urlBack) { @@ -296,7 +296,7 @@ function (app, FauxtonAPI, CouchdbSession) { promise.fail(errorHandler); }, - afterRender: function() { + afterRender: function () { $("#username").focus(); } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/auth/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/auth/routes.js b/app/addons/auth/routes.js index 785a492..b6ea57d 100644 --- a/app/addons/auth/routes.js +++ b/app/addons/auth/routes.js @@ -16,7 +16,7 @@ define([ "addons/auth/resources" ], -function(app, FauxtonAPI, Auth) { +function (app, FauxtonAPI, Auth) { var authRouteObject = FauxtonAPI.RouteObject.extend({ layout: 'one_pane', http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/compaction/base.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/base.js b/app/addons/compaction/base.js index d320cd2..b82852a 100644 --- a/app/addons/compaction/base.js +++ b/app/addons/compaction/base.js @@ -16,9 +16,9 @@ define([ "addons/compaction/routes" ], -function(app, FauxtonAPI, Compaction) { +function (app, FauxtonAPI, Compaction) { - Compaction.initialize = function() { + Compaction.initialize = function () { FauxtonAPI.registerExtension('docLinks', { title: "Compact & Clean", url: "compact", http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/compaction/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/compaction/routes.js b/app/addons/compaction/routes.js index 6d39524..295765e 100644 --- a/app/addons/compaction/routes.js +++ b/app/addons/compaction/routes.js @@ -20,7 +20,7 @@ define([ 'addons/documents/shared-routes' ], -function(app, FauxtonAPI, Compaction, Databases, BaseRoute) { +function (app, FauxtonAPI, Compaction, Databases, BaseRoute) { var CompactionRouteObject = BaseRoute.extend({ routes: { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/components/tests/beautifySpec.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/components/tests/beautifySpec.react.jsx b/app/addons/components/tests/beautifySpec.react.jsx index 7315986..c7eefdf 100644 --- a/app/addons/components/tests/beautifySpec.react.jsx +++ b/app/addons/components/tests/beautifySpec.react.jsx @@ -57,7 +57,7 @@ define([ beautifyEl = TestUtils.renderIntoDocument( <ReactComponents.Beautify beautifiedCode={beautifiedCode} - code={'function () { console.log("hello"); }'} + code={'function() { console.log("hello"); }'} noOfLines={1}/>, container ); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/config/base.js ---------------------------------------------------------------------- diff --git a/app/addons/config/base.js b/app/addons/config/base.js index 8362cb5..6c59e43 100644 --- a/app/addons/config/base.js +++ b/app/addons/config/base.js @@ -19,8 +19,8 @@ define([ "addons/config/routes" ], -function(app, FauxtonAPI, Config) { - Config.initialize = function() { +function (app, FauxtonAPI, Config) { + Config.initialize = function () { FauxtonAPI.addHeaderLink({title: "Config", href: "#_config", icon:"fonticon-cog", className: 'config'}); }; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/config/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/config/routes.js b/app/addons/config/routes.js index 85b8ff6..f2cf2d0 100644 --- a/app/addons/config/routes.js +++ b/app/addons/config/routes.js @@ -18,7 +18,7 @@ define([ 'addons/cors/views' ], -function(app, FauxtonAPI, Config, Views, CORS) { +function (app, FauxtonAPI, Config, Views, CORS) { var ConfigRouteObject = FauxtonAPI.RouteObject.extend({ layout: 'with_tabs_sidebar', @@ -66,7 +66,7 @@ function(app, FauxtonAPI, Config, Views, CORS) { this.sidebar.setSelectedTab("main"); }, - configCORS: function() { + configCORS: function () { this.removeView('#right-header'); this.newSection = this.setView('#dashboard-content', new CORS.Views.CORSWrapper({ cors: this.cors, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/config/views.js ---------------------------------------------------------------------- diff --git a/app/addons/config/views.js b/app/addons/config/views.js index f04aec8..35318e3 100644 --- a/app/addons/config/views.js +++ b/app/addons/config/views.js @@ -16,7 +16,7 @@ define([ "addons/config/resources", "addons/fauxton/components" ], -function(app, FauxtonAPI, Config, Components) { +function (app, FauxtonAPI, Config, Components) { var Views = {}; Views.TableRow = FauxtonAPI.View.extend({ @@ -111,15 +111,15 @@ function(app, FauxtonAPI, Config, Components) { Views.Table = FauxtonAPI.View.extend({ template: "addons/config/templates/dashboard", - initialize: function() { + initialize: function () { this.listenTo(FauxtonAPI.Events, "config:newSection", this.render); this.listenTo(FauxtonAPI.Events, "config:rerender", this.render); }, - beforeRender: function() { + beforeRender: function () { var collection = this.collection; - this.collection.each(function(config) { + this.collection.each(function (config) { _.each(config.get("options"), function (option, index) { this.insertView("table.config tbody", new Views.TableRow({ collection: collection, @@ -134,7 +134,7 @@ function(app, FauxtonAPI, Config, Components) { }, this); }, - establish: function() { + establish: function () { return [this.collection.fetch()]; } }); @@ -257,7 +257,7 @@ function(app, FauxtonAPI, Config, Components) { this.$('li').removeClass('active'); this.$('a[data-type-select="' + this.selectedTab + '"]').parent("li").addClass('active'); }, - afterRender: function() { + afterRender: function () { this.setSelectedTab(this.selectedTab); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/cors/actions.js ---------------------------------------------------------------------- diff --git a/app/addons/cors/actions.js b/app/addons/cors/actions.js index bb9e25b..071f2ed 100644 --- a/app/addons/cors/actions.js +++ b/app/addons/cors/actions.js @@ -114,7 +114,7 @@ define([ }, sanitizeOrigins: function (origins) { - if(_.isEmpty(origins)) { + if (_.isEmpty(origins)) { return ''; } @@ -125,7 +125,7 @@ define([ var promises = []; promises.push(this.saveEnableCorsToHttpd(options.enableCors)); - if(options.enableCors) { + if (options.enableCors) { promises.push(this.saveCorsOrigins(this.sanitizeOrigins(options.origins))); promises.push(this.saveCorsCredentials()); promises.push(this.saveCorsHeaders()); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/cors/base.js ---------------------------------------------------------------------- diff --git a/app/addons/cors/base.js b/app/addons/cors/base.js index 300b5b7..f4b9fac 100644 --- a/app/addons/cors/base.js +++ b/app/addons/cors/base.js @@ -18,7 +18,7 @@ define([ function (app, FauxtonAPI, CORS) { - CORS.initialize = function() {}; + CORS.initialize = function () {}; return CORS; }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/cors/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/cors/components.react.jsx b/app/addons/cors/components.react.jsx index 357810c..9ea15d9 100644 --- a/app/addons/cors/components.react.jsx +++ b/app/addons/cors/components.react.jsx @@ -237,7 +237,7 @@ define([ corsStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { corsStore.off('change', this.onChange); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/cors/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/cors/resources.js b/app/addons/cors/resources.js index 867c356..640db24 100644 --- a/app/addons/cors/resources.js +++ b/app/addons/cors/resources.js @@ -20,7 +20,7 @@ function (app, FauxtonAPI) { CORS.Config = FauxtonAPI.Model.extend({ - url: function() { + url: function () { return app.host + '/_config/cors'; }, @@ -37,7 +37,7 @@ function (app, FauxtonAPI) { }); CORS.Httpd = FauxtonAPI.Model.extend({ - url: function() { + url: function () { return app.host + '/_config/httpd'; }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/databases/base.js ---------------------------------------------------------------------- diff --git a/app/addons/databases/base.js b/app/addons/databases/base.js index e5aafd6..ad07c42 100644 --- a/app/addons/databases/base.js +++ b/app/addons/databases/base.js @@ -22,7 +22,7 @@ define([ ], -function(app, FauxtonAPI, Databases, Views) { +function (app, FauxtonAPI, Databases, Views) { Databases.Views = Views; Databases.initialize = function () { @@ -35,7 +35,7 @@ function(app, FauxtonAPI, Databases, Views) { }; // Utility functions - Databases.databaseUrl = function(database) { + Databases.databaseUrl = function (database) { var name = _.isObject(database) ? database.id : database, dbname = app.utils.safeURLName(name); @@ -57,7 +57,7 @@ function(app, FauxtonAPI, Databases, Views) { }); FauxtonAPI.registerUrls('allDBs', { - app: function() { + app: function () { return '_all_dbs' ; } }); @@ -67,7 +67,7 @@ function(app, FauxtonAPI, Databases, Views) { return window.location.origin + '/' + database; }, app: function (database) { - return '/database/' + database; + return '/database/' + database; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/databases/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/databases/resources.js b/app/addons/databases/resources.js index 39e05a3..58b265f 100644 --- a/app/addons/databases/resources.js +++ b/app/addons/databases/resources.js @@ -19,13 +19,13 @@ define([ "addons/documents/resources" ], -function(app, FauxtonAPI, Documents) { +function (app, FauxtonAPI, Documents) { var Databases = FauxtonAPI.addon(); Databases.DocLimit = 100; Databases.Model = FauxtonAPI.Model.extend({ - initialize: function(options) { + initialize: function (options) { this.status = new Databases.Status({ database: this }); @@ -35,7 +35,7 @@ function(app, FauxtonAPI, Documents) { return FauxtonAPI.constants.DOC_URLS.ALL_DBS; }, - buildAllDocs: function(params) { + buildAllDocs: function (params) { this.allDocs = new Documents.AllDocs(null, { database: this, params: params @@ -44,7 +44,7 @@ function(app, FauxtonAPI, Documents) { return this.allDocs; }, - isNew: function() { + isNew: function () { // Databases are never new, to make Backbone do a PUT return false; }, @@ -53,7 +53,7 @@ function(app, FauxtonAPI, Documents) { return (/^_/).test(this.id); }, - url: function(context) { + url: function (context) { if (context === "index") { return "/database/" + this.safeID() + "/_all_docs"; } else if (context === "web-index") { @@ -70,10 +70,10 @@ function(app, FauxtonAPI, Documents) { return app.host + "/" + this.safeID(); } }, - safeName: function() { + safeName: function () { return app.utils.safeURLName(this.get("name")); }, - safeID: function() { + safeID: function () { return app.utils.safeURLName(this.id); }, buildChanges: function (params) { @@ -92,11 +92,11 @@ function(app, FauxtonAPI, Documents) { Databases.Changes = FauxtonAPI.Collection.extend({ - initialize: function(options) { + initialize: function (options) { this.database = options.database; this.params = options.params; }, - documentation: function() { + documentation: function () { return FauxtonAPI.constants.DOC_URLS.CHANGES; }, url: function (context) { @@ -117,27 +117,27 @@ function(app, FauxtonAPI, Documents) { }); Databases.Status = FauxtonAPI.Model.extend({ - url: function() { + url: function () { return app.host + "/" + this.database.safeID(); }, - initialize: function(options) { + initialize: function (options) { this.database = options.database; }, - numDocs: function() { + numDocs: function () { return this.get("doc_count"); }, - numDeletedDocs: function() { + numDeletedDocs: function () { return this.get("doc_del_count"); }, - isGraveYard: function() { + isGraveYard: function () { return this.numDeletedDocs() > this.numDocs(); }, - updateSeq: function(full) { + updateSeq: function (full) { var updateSeq = this.get("update_seq"); if (full || (typeof(updateSeq) === 'number')) { return updateSeq; @@ -178,7 +178,7 @@ function(app, FauxtonAPI, Documents) { expires: 60 }, - url: function(context) { + url: function (context) { if (context === "apiurl") { return window.location.origin + "/_all_dbs"; } else { @@ -186,9 +186,9 @@ function(app, FauxtonAPI, Documents) { } }, - parse: function(resp) { + parse: function (resp) { // TODO: pagination! - return _.map(resp, function(database) { + return _.map(resp, function (database) { return { id: app.utils.safeURLName(database), name: database http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/databases/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/databases/routes.js b/app/addons/databases/routes.js index 143b89c..53cf52b 100644 --- a/app/addons/databases/routes.js +++ b/app/addons/databases/routes.js @@ -42,11 +42,11 @@ function (app, FauxtonAPI, Databases, Views, Components) { selectedHeader: "Databases", - initialize: function() { + initialize: function () { this.databases = new Databases.List(); }, - allDatabases: function() { + allDatabases: function () { var params = app.getParams(), dbPage = params.page ? parseInt(params.page, 10) : 1, perPage = FauxtonAPI.constants.MISC.DEFAULT_PAGE_SIZE, @@ -81,7 +81,7 @@ function (app, FauxtonAPI, Databases, Views, Components) { return [this.databases.url("apiurl"), this.databases.documentation()]; }, - establish: function() { + establish: function () { return [this.databases.fetch({ cache: false })]; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/databases/views.js ---------------------------------------------------------------------- diff --git a/app/addons/databases/views.js b/app/addons/databases/views.js index 591e9a8..eedf358 100644 --- a/app/addons/databases/views.js +++ b/app/addons/databases/views.js @@ -17,7 +17,7 @@ define([ 'addons/databases/resources' ], -function(app, Components, FauxtonAPI, Databases) { +function (app, Components, FauxtonAPI, Databases) { var Views = {}; @@ -79,9 +79,9 @@ function(app, Components, FauxtonAPI, Databases) { var currentDBs = this.paginated(); var deferred = FauxtonAPI.Deferred(); - FauxtonAPI.when(currentDBs.map(function(database) { + FauxtonAPI.when(currentDBs.map(function (database) { return database.status.fetchOnce(); - })).always(function(resp) { + })).always(function (resp) { //make this always so that even if a user is not allowed access to a database //they will still see a list of all databases deferred.resolve(); @@ -96,7 +96,7 @@ function(app, Components, FauxtonAPI, Databases) { }, beforeRender: function () { - _.each(this.paginated(), function(database) { + _.each(this.paginated(), function (database) { this.insertView('table.databases tbody', new Views.Item({ model: database })); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/base.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/base.js b/app/addons/documents/base.js index bbdd90f..776f514 100644 --- a/app/addons/documents/base.js +++ b/app/addons/documents/base.js @@ -19,7 +19,7 @@ define([ "addons/documents/routes" ], -function(app, FauxtonAPI, Documents) { +function (app, FauxtonAPI, Documents) { FauxtonAPI.registerUrls( 'allDocs', { server: function (id, query) { http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/header/header.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/header/header.react.jsx b/app/addons/documents/header/header.react.jsx index efdf75f..5906974 100644 --- a/app/addons/documents/header/header.react.jsx +++ b/app/addons/documents/header/header.react.jsx @@ -42,7 +42,7 @@ function (app, FauxtonAPI, React, Stores, Actions, ReactComponents) { bulkDocumentHeaderStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { bulkDocumentHeaderStore.off('change', this.onChange); }, @@ -158,7 +158,7 @@ function (app, FauxtonAPI, React, Stores, Actions, ReactComponents) { headerBarStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { headerBarStore.off('change', this.onChange); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/helpers.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/helpers.js b/app/addons/documents/helpers.js index ad1acef..9197bf8 100644 --- a/app/addons/documents/helpers.js +++ b/app/addons/documents/helpers.js @@ -12,7 +12,7 @@ define([ 'api' -], function(FauxtonAPI) { +], function (FauxtonAPI) { var Helpers = {}; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/index-editor/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/index-editor/components.react.jsx b/app/addons/documents/index-editor/components.react.jsx index a7c1fcb..01e5153 100644 --- a/app/addons/documents/index-editor/components.react.jsx +++ b/app/addons/documents/index-editor/components.react.jsx @@ -127,7 +127,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, ReactComponents, indexEditorStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { indexEditorStore.off('change', this.onChange); }, @@ -218,7 +218,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, ReactComponents, indexEditorStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { indexEditorStore.off('change', this.onChange); }, @@ -294,12 +294,12 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, ReactComponents, indexEditorStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { indexEditorStore.off('change', this.onChange); }, - hasValidCode: function() { - return _.every(['mapEditor', 'reduceEditor'], function(editorName) { + hasValidCode: function () { + return _.every(['mapEditor', 'reduceEditor'], function (editorName) { if (editorName === 'reduceEditor' && !indexEditorStore.hasCustomReduce()) { return true; } @@ -418,11 +418,11 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, ReactComponents, }; }, - componentDidMount: function() { + componentDidMount: function () { indexEditorStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { indexEditorStore.off('change', this.onChange); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/index-editor/stores.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/index-editor/stores.js b/app/addons/documents/index-editor/stores.js index bfcdf29..9ed952d 100644 --- a/app/addons/documents/index-editor/stores.js +++ b/app/addons/documents/index-editor/stores.js @@ -15,13 +15,13 @@ define([ 'addons/documents/index-editor/actiontypes' ], -function(FauxtonAPI, ActionTypes) { +function (FauxtonAPI, ActionTypes) { var Stores = {}; Stores.IndexEditorStore = FauxtonAPI.Store.extend({ - defaultMap: 'function(doc) {\n emit(doc._id, 1);\n}', - defaultReduce: 'function(keys, values, rereduce) {\n if (rereduce) {\n return sum(values);\n } else {\n return values.length;\n }\n}', + defaultMap: 'function (doc) {\n emit(doc._id, 1);\n}', + defaultReduce: 'function (keys, values, rereduce) {\n if (rereduce) {\n return sum(values);\n } else {\n return values.length;\n }\n}', editIndex: function (options) { this._database = options.database; @@ -160,7 +160,7 @@ function(FauxtonAPI, ActionTypes) { }, dispatch: function (action) { - switch(action.type) { + switch (action.type) { case ActionTypes.EDIT_INDEX: this.editIndex(action.options); this.triggerChange(); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/pagination/pagination.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/pagination/pagination.react.jsx b/app/addons/documents/pagination/pagination.react.jsx index 75ea0a3..b5729d5 100644 --- a/app/addons/documents/pagination/pagination.react.jsx +++ b/app/addons/documents/pagination/pagination.react.jsx @@ -31,11 +31,11 @@ define([ return this.getStoreState(); }, - componentDidMount: function() { + componentDidMount: function () { indexPaginationStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { indexPaginationStore.off('change', this.onChange); }, @@ -125,11 +125,11 @@ define([ return this.getStoreState(); }, - componentDidMount: function() { + componentDidMount: function () { indexPaginationStore.on('change', this.onChange, this); }, - componentWillUnmount: function() { + componentWillUnmount: function () { indexPaginationStore.off('change', this.onChange); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/resources.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js index 18bb213..880cce1 100644 --- a/app/addons/documents/resources.js +++ b/app/addons/documents/resources.js @@ -17,7 +17,7 @@ define([ 'cloudant.pagingcollection' ], -function(app, FauxtonAPI, Documents, PagingCollection) { +function (app, FauxtonAPI, Documents, PagingCollection) { Documents.QueryParams = (function () { var _eachParams = function (params, action) { @@ -47,7 +47,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { Documents.DdocInfo = FauxtonAPI.Model.extend({ idAttribute: "_id", - documentation: function() { + documentation: function () { return FauxtonAPI.constants.DOC_URLS.GENERAL; }, initialize: function (_attrs, options) { @@ -66,19 +66,19 @@ function(app, FauxtonAPI, Documents, PagingCollection) { // is a separate route. Alternatively, maybe these should be // treated separately. For instance, we could default into the // json editor for docs, or into a ddoc specific page. - safeID: function() { + safeID: function () { var ddoc = this.id.replace(/^_design\//, ""); return "_design/" + app.utils.safeURLName(ddoc); } }); Documents.NewDoc = Documents.Doc.extend({ - fetch: function() { + fetch: function () { var uuid = new FauxtonAPI.UUID(); var deferred = this.deferred = $.Deferred(); var that = this; - uuid.fetch().done(function() { + uuid.fetch().done(function () { that.set("_id", uuid.next()); deferred.resolve(); }); @@ -177,10 +177,10 @@ function(app, FauxtonAPI, Documents, PagingCollection) { Documents.IndexCollection = PagingCollection.extend({ model: Documents.Doc, - documentation: function() { + documentation: function () { return FauxtonAPI.constants.DOC_URLS.GENERAL; }, - initialize: function(_models, options) { + initialize: function (_models, options) { this.database = options.database; this.params = _.extend({limit: 20, reduce: false}, options.params); @@ -220,13 +220,13 @@ function(app, FauxtonAPI, Documents, PagingCollection) { return this.urlRef.apply(this, arguments); }, - totalRows: function() { + totalRows: function () { if (this.params.reduce) { return "unknown_reduce";} return this.viewMeta.total_rows || "unknown"; }, - updateSeq: function() { + updateSeq: function () { if (!this.viewMeta) { return false; } @@ -251,7 +251,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { }); }, - parse: function(resp) { + parse: function (resp) { var rows = resp.rows; this.endTime = new Date().getTime(); this.requestDuration = (this.endTime - this.startTime); @@ -259,7 +259,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { return PagingCollection.prototype.parse.apply(this, arguments); }, - buildAllDocs: function() { + buildAllDocs: function () { this.fetch(); }, @@ -270,7 +270,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { return PagingCollection.prototype.fetch.call(this); }, - allDocs: function() { + allDocs: function () { return this.models; }, @@ -311,10 +311,10 @@ function(app, FauxtonAPI, Documents, PagingCollection) { Documents.PouchIndexCollection = PagingCollection.extend({ model: Documents.ViewRow, - documentation: function() { + documentation: function () { return FauxtonAPI.constants.DOC_URLS.GENERAL; }, - initialize: function(_models, options) { + initialize: function (_models, options) { this.database = options.database; this.rows = options.rows; this.view = options.view; @@ -352,7 +352,7 @@ function(app, FauxtonAPI, Documents, PagingCollection) { }, - fetch: function() { + fetch: function () { var deferred = FauxtonAPI.Deferred(); this.reset(this.rows, {silent: true}); @@ -360,19 +360,19 @@ function(app, FauxtonAPI, Documents, PagingCollection) { return deferred; }, - totalRows: function() { + totalRows: function () { return this.viewMeta.total_rows || "unknown"; }, - updateSeq: function() { + updateSeq: function () { return this.viewMeta.update_seq || false; }, - buildAllDocs: function() { + buildAllDocs: function () { this.fetch(); }, - allDocs: function() { + allDocs: function () { return this.models; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/routes-doc-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js index 296d665..400de43 100644 --- a/app/addons/documents/routes-doc-editor.js +++ b/app/addons/documents/routes-doc-editor.js @@ -21,7 +21,7 @@ define([ "addons/databases/base" ], -function(app, FauxtonAPI, Helpers, Documents, DocEditor, Databases) { +function (app, FauxtonAPI, Helpers, Documents, DocEditor, Databases) { var DocEditorRouteObject = FauxtonAPI.RouteObject.extend({ @@ -29,7 +29,7 @@ function(app, FauxtonAPI, Helpers, Documents, DocEditor, Databases) { disableLoader: true, selectedHeader: 'Databases', - initialize: function(route, masterLayout, options) { + initialize: function (route, masterLayout, options) { this.databaseName = options[0]; this.docID = options[1] || 'new'; @@ -110,7 +110,7 @@ function(app, FauxtonAPI, Helpers, Documents, DocEditor, Databases) { }); }, - apiUrl: function() { + apiUrl: function () { return [this.doc.url('apiurl'), this.doc.documentation()]; } }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/routes-documents.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js index 9920176..0b607de 100644 --- a/app/addons/documents/routes-documents.js +++ b/app/addons/documents/routes-documents.js @@ -28,7 +28,7 @@ define([ 'addons/documents/pagination/stores' ], -function(app, FauxtonAPI, BaseRoute, Documents, Changes, Index, DocEditor, +function (app, FauxtonAPI, BaseRoute, Documents, Changes, Index, DocEditor, Databases, Resources, Components, PaginationActions, PaginationStores) { @@ -126,7 +126,7 @@ function(app, FauxtonAPI, BaseRoute, Documents, Changes, Index, DocEditor, * urlParams are what are shown in the url and to the user * They are not the same when paginating */ - allDocs: function(databaseName, options) { + allDocs: function (databaseName, options) { var params = this.createParams(options), urlParams = params.urlParams, docParams = params.docParams, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js index 2b9aec6..0f16d4a 100644 --- a/app/addons/documents/routes.js +++ b/app/addons/documents/routes.js @@ -17,7 +17,7 @@ define([ 'addons/documents/routes-index-editor' ], -function(Documents, DocumentsRouteObject, docEditor, IndexEditorRouteObject) { +function (Documents, DocumentsRouteObject, docEditor, IndexEditorRouteObject) { Documents.RouteObjects = [ docEditor.DocEditorRouteObject, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/shared-resources.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/shared-resources.js b/app/addons/documents/shared-resources.js index 930c600..06306cf 100644 --- a/app/addons/documents/shared-resources.js +++ b/app/addons/documents/shared-resources.js @@ -23,17 +23,17 @@ define([ Documents.Doc = FauxtonAPI.Model.extend({ idAttribute: "_id", - documentation: function() { + documentation: function () { return FauxtonAPI.constants.DOC_URLS.GENERAL; }, - url: function(context) { + url: function (context) { if (context === undefined) { context = 'server'; } return FauxtonAPI.urls('document', context, this.getDatabase().safeID(), this.safeID()); }, - initialize: function(_attrs, options) { + initialize: function (_attrs, options) { if (this.collection && this.collection.database) { this.database = this.collection.database; } else if (options.database) { @@ -43,25 +43,25 @@ define([ // HACK: the doc needs to know about the database, but it may be // set directly or indirectly in all docs - getDatabase: function() { + getDatabase: function () { return this.database ? this.database : this.collection.database; }, - validate: function(attrs, options) { + validate: function (attrs, options) { if (this.id && this.id !== attrs._id && this.get('_rev') ) { return "Cannot change a documents id."; } }, - docType: function() { + docType: function () { return this.id && this.id.match(/^_design\//) ? "design doc" : "doc"; }, - isEditable: function() { + isEditable: function () { return this.docType() != "reduction"; }, - isFromView: function() { + isFromView: function () { return !this.id; }, @@ -73,11 +73,11 @@ define([ } }, - isDdoc: function() { + isDdoc: function () { return this.docType() === "design doc"; }, - hasViews: function() { + hasViews: function () { if (!this.isDdoc()) return false; var doc = this.get('doc'); if (doc) { @@ -92,7 +92,7 @@ define([ return !!this.get('_attachments'); }, - getDdocView: function(view) { + getDdocView: function (view) { if (!this.isDdoc() || !this.hasViews()) { return false; } @@ -144,7 +144,7 @@ define([ return this; }, - viewHasReduce: function(viewName) { + viewHasReduce: function (viewName) { var view = this.getDdocView(viewName); return view && view.reduce; @@ -154,16 +154,16 @@ define([ // is a separate route. Alternatively, maybe these should be // treated separately. For instance, we could default into the // json editor for docs, or into a ddoc specific page. - safeID: function() { + safeID: function () { if (this.isDdoc()) { var ddoc = this.id.replace(/^_design\//, ""); return "_design/" + app.utils.safeURLName(ddoc); - }else{ + }else { return app.utils.safeURLName(this.id); } }, - destroy: function() { + destroy: function () { var url = this.url() + "?rev=" + this.get('_rev'); return $.ajax({ url: url, @@ -172,7 +172,7 @@ define([ }); }, - parse: function(resp) { + parse: function (resp) { if (resp.rev) { resp._rev = resp.rev; delete resp.rev; @@ -191,7 +191,7 @@ define([ return resp; }, - prettyJSON: function() { + prettyJSON: function () { var data = this.get("doc") ? this.get("doc") : this.attributes; return JSON.stringify(data, null, " "); @@ -216,7 +216,7 @@ define([ documentation: function () { return FauxtonAPI.constants.DOC_URLS.GENERAL; }, - initialize: function(_models, options) { + initialize: function (_models, options) { this.viewMeta = options.viewMeta; this.database = options.database; this.params = _.clone(options.params); @@ -229,7 +229,7 @@ define([ } }, - urlRef: function(context, params) { + urlRef: function (context, params) { var query = ""; if (params) { @@ -265,7 +265,7 @@ define([ }); }, - totalRows: function() { + totalRows: function () { return this.viewMeta.total_rows || "unknown"; }, @@ -276,23 +276,23 @@ define([ } }, - updateSeq: function() { + updateSeq: function () { if (!this.viewMeta) { return false; } return this.viewMeta.update_seq || false; }, - parse: function(resp) { + parse: function (resp) { var rows = resp.rows; // remove any query errors that may return without doc info // important for when querying keys on all docs - var cleanRows = _.filter(rows, function(row) { + var cleanRows = _.filter(rows, function (row) { return row.value; }); - resp.rows = _.map(cleanRows, function(row) { + resp.rows = _.map(cleanRows, function (row) { return { _id: row.id, _rev: row.value.rev, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/shared-views.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/shared-views.js b/app/addons/documents/shared-views.js index f4595f8..93876a7 100644 --- a/app/addons/documents/shared-views.js +++ b/app/addons/documents/shared-views.js @@ -20,7 +20,7 @@ define([ "addons/databases/resources" ], -function(app, FauxtonAPI, Components, Documents, Databases) { +function (app, FauxtonAPI, Components, Documents, Databases) { var Views = {}; Views.Sidebar = FauxtonAPI.View.extend({ @@ -28,7 +28,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { className: "sidenav", tagName: "nav", - initialize: function(options) { + initialize: function (options) { this.database = options.database; if (options.ddocInfo) { @@ -39,7 +39,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { this.designDocList = []; }, - serialize: function() { + serialize: function () { var docLinks = FauxtonAPI.getExtensions('docLinks'), newLinks = FauxtonAPI.getExtensions('sidebar:newLinks'), addLinks = FauxtonAPI.getExtensions('sidebar:links'), @@ -92,7 +92,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { }]); }, - beforeRender: function(manage) { + beforeRender: function (manage) { this.deleteDBModal = this.setView( '#delete-db-modal', new Views.DeleteDBModal({ @@ -117,7 +117,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { _.each(this.designDocList, function (view) { view.remove(); view = undefined;}); this.designDocList = []; - this.collection.each(function(design) { + this.collection.each(function (design) { if (design.has('doc')) { design.collection = this.collection; var view = this.insertView(new Views.DdocSidenav({ @@ -163,10 +163,10 @@ function(app, FauxtonAPI, Components, Documents, Databases) { "click .js-collapse-toggle": "toggleArrow" }, - toggleArrow: function(e) { + toggleArrow: function (e) { this.$(e.currentTarget).toggleClass("down"); }, - buildIndexList: function(designDocs, info) { + buildIndexList: function (designDocs, info) { var design = this.model.id.replace(/^_design\//, ""); var databaseId = this.model.database.id; @@ -181,12 +181,12 @@ function(app, FauxtonAPI, Components, Documents, Databases) { })); }, - serialize: function() { + serialize: function () { var ddocName = this.model.id.replace(/^_design\//, ""), docSafe = app.utils.safeURLName(ddocName), databaseName = this.collection.database.safeID(); - return{ + return { designDocMetaUrl: FauxtonAPI.urls('designDocs', 'app', databaseName, docSafe), designDoc: ddocName, ddoc_clean: docSafe, @@ -233,7 +233,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { }, - beforeRender: function(manage) { + beforeRender: function (manage) { var sideBarMenuLinks = []; sideBarMenuLinks.push({ @@ -252,7 +252,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { template: "addons/documents/templates/index_menu_item", tagName: 'li', - initialize: function(options) { + initialize: function (options) { this.index = options.index; this.ddoc = options.ddoc; this.database = options.database; @@ -266,7 +266,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { }; }, - serialize: function() { + serialize: function () { return { icon: this.indexTypeMap[this.selector].icon, urlFolder: this.indexTypeMap[this.selector].urlFolder, @@ -281,7 +281,7 @@ function(app, FauxtonAPI, Components, Documents, Databases) { }; }, - afterRender: function() { + afterRender: function () { if (this.selected) { $(".sidenav ul.nav-list li").removeClass("active"); this.$el.addClass("active"); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/tests/changes.storesSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/changes.storesSpec.js b/app/addons/documents/tests/changes.storesSpec.js index 9bcc023..36b313e 100644 --- a/app/addons/documents/tests/changes.storesSpec.js +++ b/app/addons/documents/tests/changes.storesSpec.js @@ -29,13 +29,13 @@ define([ Stores.changesStore.reset(); }); - it('toggleTabVisibility() changes state in store', function() { + it('toggleTabVisibility() changes state in store', function () { assert.ok(Stores.changesStore.isTabVisible() === false); Stores.changesStore.toggleTabVisibility(); assert.ok(Stores.changesStore.isTabVisible() === true); }); - it('reset() changes tab visibility to hidden', function() { + it('reset() changes tab visibility to hidden', function () { Stores.changesStore.toggleTabVisibility(); Stores.changesStore.reset(); assert.ok(Stores.changesStore.isTabVisible() === false); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/tests/resourcesSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/resourcesSpec.js b/app/addons/documents/tests/resourcesSpec.js index 1b467c9..ad480f2 100644 --- a/app/addons/documents/tests/resourcesSpec.js +++ b/app/addons/documents/tests/resourcesSpec.js @@ -88,16 +88,16 @@ define([ }); }); - describe('QueryParams', function() { - describe('parse', function() { - it('should not parse arbitrary parameters', function() { + describe('QueryParams', function () { + describe('parse', function () { + it('should not parse arbitrary parameters', function () { var params = {"foo": "[1]]"}; var result = Models.QueryParams.parse(params); assert.deepEqual(result, params); }); - it('parses startkey, endkey', function() { + it('parses startkey, endkey', function () { var params = { "startkey":"[\"a\",\"b\"]", "endkey":"[\"c\",\"d\"]" @@ -110,7 +110,7 @@ define([ }); }); - it('parses key', function() { + it('parses key', function () { var params = { "key":"[1,2]" }; @@ -119,7 +119,7 @@ define([ assert.deepEqual(result, {"key": [1, 2]}); }); - it('does not modify input', function() { + it('does not modify input', function () { var params = { "key":"[\"a\",\"b\"]" }; @@ -130,15 +130,15 @@ define([ }); }); - describe('stringify', function() { - it('should not stringify arbitrary parameters', function() { + describe('stringify', function () { + it('should not stringify arbitrary parameters', function () { var params = {"foo": [1, 2, 3]}; var result = Models.QueryParams.stringify(params); assert.deepEqual(result, params); }); - it('stringifies startkey, endkey', function() { + it('stringifies startkey, endkey', function () { var params = { "startkey": ["a", "b"], "endkey": ["c", "d"] @@ -152,14 +152,14 @@ define([ }); }); - it('stringifies key', function() { + it('stringifies key', function () { var params = {"key":[ "a", "b"]}; var result = Models.QueryParams.stringify(params); assert.deepEqual(result, { "key": "[\"a\",\"b\"]" }); }); - it('does not modify input', function() { + it('does not modify input', function () { var params = {"key": ["a", "b"]}; var clone = _.clone(params); var result = Models.QueryParams.stringify(params); @@ -167,7 +167,7 @@ define([ assert.deepEqual(params, clone); }); - it('is symmetrical with parse', function() { + it('is symmetrical with parse', function () { var params = { "startkey": ["a", "b"], "endkey": ["c", "d"], http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/tests/storesSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/tests/storesSpec.js b/app/addons/documents/tests/storesSpec.js index 492213c..4a042ed 100644 --- a/app/addons/documents/tests/storesSpec.js +++ b/app/addons/documents/tests/storesSpec.js @@ -48,7 +48,7 @@ define([ }); it('returns default map', function () { - assert.equal(store.getMap(), 'function(doc) {\n emit(doc._id, 1);\n}'); + assert.equal(store.getMap(), 'function (doc) {\n emit(doc._id, 1);\n}'); }); it('Edit Index as title', function () { @@ -207,7 +207,7 @@ define([ type: ActionTypes.SELECT_REDUCE_CHANGE, reduceSelectedOption: 'CUSTOM' }); - assert.equal(store.getReduce(), 'function(keys, values, rereduce) {\n if (rereduce) {\n return sum(values);\n } else {\n return values.length;\n }\n}'); + assert.equal(store.getReduce(), 'function (keys, values, rereduce) {\n if (rereduce) {\n return sum(values);\n } else {\n return values.length;\n }\n}'); }); }); }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/views-changes.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views-changes.js b/app/addons/documents/views-changes.js index fd56412..416270d 100644 --- a/app/addons/documents/views-changes.js +++ b/app/addons/documents/views-changes.js @@ -21,7 +21,7 @@ define([ 'addons/documents/changes/actions' ], -function(app, FauxtonAPI, Components, Changes, ChangesActions) { +function (app, FauxtonAPI, Components, Changes, ChangesActions) { var Views = {}; @@ -52,7 +52,7 @@ function(app, FauxtonAPI, Components, Changes, ChangesActions) { Changes.renderChanges(this.el); }, - establish: function() { + establish: function () { return [this.model.changes.fetchOnce({ prefill: true })]; }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/views-doceditor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js index 9cc767e..3ac3554 100644 --- a/app/addons/documents/views-doceditor.js +++ b/app/addons/documents/views-doceditor.js @@ -304,7 +304,7 @@ function (app, FauxtonAPI, Components, Documents, Databases, prettify) { clear: true }); }); - } else if(this.model.validationError && this.model.validationError === 'Cannot change a documents id.') { + } else if (this.model.validationError && this.model.validationError === 'Cannot change a documents id.') { FauxtonAPI.addNotification({ msg: 'Cannot save. Cannot change a documents _id, try Clone Document instead!', type: 'error', @@ -582,8 +582,8 @@ function (app, FauxtonAPI, Components, Documents, Databases, prettify) { afterRender: function () { var that = this; this.$('.modal').on('hide', function (e) { - if(that.subEditor.edited) { - if(!confirm("Close without saving changes?")) { + if (that.subEditor.edited) { + if (!confirm("Close without saving changes?")) { e.preventDefault(); return; } http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/views-queryoptions.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views-queryoptions.js b/app/addons/documents/views-queryoptions.js index c9d1894..3eb8eef 100644 --- a/app/addons/documents/views-queryoptions.js +++ b/app/addons/documents/views-queryoptions.js @@ -408,7 +408,7 @@ define([ parseJSON: function (value) { try { return JSON.parse(value); - } catch(e) { + } catch (e) { return undefined; } }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js index b7a2257..8685db7 100644 --- a/app/addons/documents/views.js +++ b/app/addons/documents/views.js @@ -76,7 +76,7 @@ function (app, FauxtonAPI, Components, Documents, 'click .toggle-select-menu': 'selectAllMenu' }, - initialize: function(options) { + initialize: function (options) { this.database = options.database; this.params = options.params; @@ -97,53 +97,53 @@ function (app, FauxtonAPI, Components, Documents, })); }, - afterRender: function() { + afterRender: function () { this.toggleQueryOptionsHeader(this.isHidden); }, - cleanup: function() { + cleanup: function () { FauxtonAPI.Events.unbind('success:bulkDelete'); }, - selectAllMenu: function(e) { + selectAllMenu: function (e) { FauxtonAPI.triggerRouteEvent("toggleSelectHeader"); FauxtonAPI.Events.trigger("documents:showSelectAll", this.selectVisible); }, // updates the API bar when the route changes - updateApiUrl: function(api) { + updateApiUrl: function (api) { this.apiBar && this.apiBar.update(api); }, // these are similar, but different! resetQueryOptions() completely resets the settings then overlays the new ones; // updateQueryOptions() just updates the existing settings with whatever is specified. Between them, the - resetQueryOptions: function(options) { + resetQueryOptions: function (options) { this.queryOptions.resetQueryOptions(options); }, - updateQueryOptions: function(options) { + updateQueryOptions: function (options) { this.queryOptions.updateQueryOptions(options); }, - hideQueryOptions: function() { + hideQueryOptions: function () { this.isHidden = true; if (this.hasRendered) { this.toggleQueryOptionsHeader(this.isHidden); } }, - showQueryOptions: function() { + showQueryOptions: function () { this.isHidden = false; if (this.hasRendered) { this.toggleQueryOptionsHeader(this.isHidden); } }, - toggleQueryOptionsHeader: function(hide) { + toggleQueryOptionsHeader: function (hide) { $("#header-query-options").toggleClass("hide", hide); }, - serialize: function() { + serialize: function () { return { database: this.database.get('id') }; @@ -170,7 +170,7 @@ function (app, FauxtonAPI, Components, Documents, this.showModal(); }, - cleanup: function() { + cleanup: function () { FauxtonAPI.Events.off('database:delete', this.showDeleteDatabase); }, @@ -236,13 +236,13 @@ function (app, FauxtonAPI, Components, Documents, "dblclick .doc-item": "edit" }, - attributes: function() { + attributes: function () { return { "data-id": this.model.id }; }, - serialize: function() { + serialize: function () { return { docIdentifier: this.model.isReducedShown() ? this.model.get('key') : this.model.get('_id'), doc: this.model, @@ -257,11 +257,11 @@ function (app, FauxtonAPI, Components, Documents, }, this); }, - establish: function() { + establish: function () { return [this.model.fetch()]; }, - edit: function(event) { + edit: function (event) { event.preventDefault(); if (!this.model.isReducedShown()) { FauxtonAPI.navigate(this.model.url('app')); @@ -361,7 +361,7 @@ function (app, FauxtonAPI, Components, Documents, }); }, - establish: function() { + establish: function () { if (this.newView) { return null; } return this.collection.fetch({reset: true}).then(function () { @@ -421,7 +421,7 @@ function (app, FauxtonAPI, Components, Documents, }); }, - serialize: function() { + serialize: function () { return { endOfResults: !PaginationStores.indexPaginationStore.canShowNext() }; @@ -437,7 +437,7 @@ function (app, FauxtonAPI, Components, Documents, this.render(); }, - bulkDelete: function() { + bulkDelete: function () { var that = this, documentsLength = this.bulkDeleteDocsCollection.length, msg; @@ -466,14 +466,14 @@ function (app, FauxtonAPI, Components, Documents, this.rows = {}; }, - beforeRender: function() { + beforeRender: function () { var docs; this.removeNestedViews(); docs = this.expandDocs ? this.collection : this.collection.simple(); - docs.each(function(doc) { + docs.each(function (doc) { var isChecked; if (this.bulkDeleteDocsCollection) { isChecked = this.bulkDeleteDocsCollection.get(doc.id); @@ -555,7 +555,7 @@ function (app, FauxtonAPI, Components, Documents, return this.model.fetch(); }, - afterRender: function() { + afterRender: function () { this.startRefreshInterval(); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/actions.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/actions.js b/app/addons/fauxton/actions.js index 234f629..9794358 100644 --- a/app/addons/fauxton/actions.js +++ b/app/addons/fauxton/actions.js @@ -34,7 +34,7 @@ function (app, FauxtonAPI, ActionTypes) { }); }, - removeHeaderLink: function(link) { + removeHeaderLink: function (link) { FauxtonAPI.dispatch({ type: ActionTypes.REMOVE_NAVBAR_LINK, link: link http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/actiontypes.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/actiontypes.js b/app/addons/fauxton/actiontypes.js index ca85a21..0c9ccdd 100644 --- a/app/addons/fauxton/actiontypes.js +++ b/app/addons/fauxton/actiontypes.js @@ -10,7 +10,7 @@ // License for the specific language governing permissions and limitations under // the License. -define([], function() { +define([], function () { return { ADD_NAVBAR_LINK: 'ADD_NAVBAR_LINK', TOGGLE_NAVBAR_MENU: 'TOGGLE_NAVBAR_MENU', http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/base.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/base.js b/app/addons/fauxton/base.js index 01cf6f5..2ff9a47 100644 --- a/app/addons/fauxton/base.js +++ b/app/addons/fauxton/base.js @@ -19,7 +19,7 @@ define([ "plugins/zeroclipboard/ZeroClipboard" ], -function(app, FauxtonAPI, Components, ReactComponents, Actions, ZeroClipboard) { +function (app, FauxtonAPI, Components, ReactComponents, Actions, ZeroClipboard) { var Fauxton = FauxtonAPI.addon(); FauxtonAPI.addNotification = function (options) { @@ -35,16 +35,16 @@ function(app, FauxtonAPI, Components, ReactComponents, Actions, ZeroClipboard) { }; FauxtonAPI.UUID = FauxtonAPI.Model.extend({ - initialize: function(options) { + initialize: function (options) { options = _.extend({count: 1}, options); this.count = options.count; }, - url: function() { + url: function () { return app.host + "/_uuids?count=" + this.count; }, - next: function() { + next: function () { return this.get("uuids").pop(); } }); @@ -109,7 +109,7 @@ function(app, FauxtonAPI, Components, ReactComponents, Actions, ZeroClipboard) { 'click .js-dismiss': 'onClickRemoveWithAnimation' }, - initialize: function(options) { + initialize: function (options) { this.htmlToRender = options.msg; // escape always, except the value is false if (options.escape !== false) { @@ -166,7 +166,7 @@ function(app, FauxtonAPI, Components, ReactComponents, Actions, ZeroClipboard) { }.bind(this), this.animationTimer); }, - renderNotification: function(selector) { + renderNotification: function (selector) { selector = selector || this.selector; if (this.clear) { $(selector).html(''); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js index 0348296..7d5d766 100644 --- a/app/addons/fauxton/components.js +++ b/app/addons/fauxton/components.js @@ -33,7 +33,7 @@ define([ "velocity.ui" ], -function(app, FauxtonAPI, ace, spin, ZeroClipboard) { +function (app, FauxtonAPI, ace, spin, ZeroClipboard) { var Components = FauxtonAPI.addon(); // setting up the left header with the backbutton used in Views and All docs @@ -73,7 +73,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { } }, - beforeRender: function() { + beforeRender: function () { this.setUpCrumbs(); this.setUpDropDownMenu(); @@ -82,13 +82,13 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { } }, - setUpCrumbs: function() { + setUpCrumbs: function () { this.breadcrumbs = this.insertView("#header-breadcrumbs", new Components.Breadcrumbs({ crumbs: this.crumbs })); }, - setUpDropDownMenu: function() { + setUpDropDownMenu: function () { if (this.dropdownMenuLinks) { this.dropdown = this.insertView("#header-dropdown-menu", new Components.MenuDropDown({ icon: 'fonticon-cog', @@ -124,11 +124,11 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { "click .js-lastelement": "toggleLastElement" }, - serialize: function() { + serialize: function () { var crumbs = _.clone(this.crumbs); // helper template function to determine when to insert a delimiter char - var nextCrumbHasLabel = function(crumb, index) { + var nextCrumbHasLabel = function (crumb, index) { var nextHasLabel = crumbs[index + 1].name !== ""; return index < crumbs.length && crumb.name && nextHasLabel; }; @@ -155,12 +155,12 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.$('.js-enabled').removeClass('js-enabled'); }, - update: function(crumbs) { + update: function (crumbs) { this.crumbs = crumbs; this.render(); }, - initialize: function(options) { + initialize: function (options) { this.crumbs = options.crumbs; this.toggleDisabled = options.toggleDisabled || false; } @@ -197,7 +197,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.trayId = 'tray-' + this.cid; var that = this; - $('body').on('click.' + this.trayId, function(e) { + $('body').on('click.' + this.trayId, function (e) { var $clickEl = $(e.target); if (!that.trayVisible()) { @@ -214,7 +214,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { FauxtonAPI.Events.on(FauxtonAPI.constants.EVENTS.TRAY_OPENED, this.onTrayOpenEvent, this); }, - cleanup: function() { + cleanup: function () { $('body').off('click.' + this.trayId); }, @@ -283,7 +283,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.initTray({ toggleTrayBtnSelector: '.api-url-btn' }); }, - serialize: function() { + serialize: function () { return { endpoint: this.endpoint, documentation: this.documentation @@ -298,7 +298,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.$el.removeClass('hide'); }, - update: function(endpoint) { + update: function (endpoint) { this.endpoint = endpoint[0]; this.documentation = endpoint[1]; this.render(); @@ -514,7 +514,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { ].join(''); }, - source: function(query, process) { + source: function (query, process) { var url = this.getURL(query, this.dbLimit); var resultFilter = this.resultFilter; @@ -524,7 +524,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { cache: false, url: url, dataType: 'json', - success: function(data) { + success: function (data) { if (resultFilter) { data = resultFilter(data); } @@ -540,7 +540,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { this.database = options.database; _.bindAll(this); }, - source: function(id, process) { + source: function (id, process) { var query = '?' + $.param({ startkey: JSON.stringify(id), endkey: JSON.stringify(id + "\u9999"), @@ -555,7 +555,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { cache: false, url: url, dataType: 'json', - success: function(data) { + success: function (data) { var ids = _.map(data.rows, function (row) { return row.id; }); @@ -674,7 +674,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { return Math.floor(this.availableEditorHeight / singleLine); }, - getLines: function() { + getLines: function () { return this.editor.getSession().getDocument().getLength(); }, @@ -728,7 +728,7 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { hadValidCode: function () { var errors = this.getAnnotations(); // By default CouchDB view functions don't pass lint - return _.every(errors, function(error) { + return _.every(errors, function (error) { return this.isIgnorableError(error.raw); }, this); }, @@ -740,15 +740,15 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { "['{a}'] is better written in dot notation." ], - isIgnorableError: function(msg) { + isIgnorableError: function (msg) { return _.contains(this.excludedViewErrors, msg); }, - configureFixedHeightEditor: function(numLines) { + configureFixedHeightEditor: function (numLines) { this.editor.renderer.setVScrollBarAlwaysVisible(true); this.editor.renderer.setHScrollBarAlwaysVisible(true); /* customize the ace scrolling for static edit height */ - this.editor.renderer.$autosize = function() { + this.editor.renderer.$autosize = function () { this.$size.height = numLines * this.lineHeight; this.desiredHeight = numLines * this.lineHeight; this.container.style.height = this.desiredHeight + "px"; @@ -757,33 +757,33 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { }; }, - replaceCurrentLine: function(replacement) { + replaceCurrentLine: function (replacement) { this.editor.getSelection().selectLine(); this.editor.insert(replacement); this.editor.getSelection().moveCursorUp(); }, - getLine: function(lineNum) { + getLine: function (lineNum) { return this.editor.session.getLine(lineNum); }, - getSelectionStart: function() { + getSelectionStart: function () { return this.editor.getSelectionRange().start; }, - getSelectionEnd: function() { + getSelectionEnd: function () { return this.editor.getSelectionRange().end; }, - getRowHeight: function() { + getRowHeight: function () { return this.editor.renderer.layerConfig.lineHeight; }, - isRowExpanded: function(row) { + isRowExpanded: function (row) { return !this.editor.getSession().isRowFolded(row); }, - documentToScreenRow: function(row) { + documentToScreenRow: function (row) { return this.editor.getSession().documentToScreenRow(row, 0); } @@ -802,12 +802,12 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { Components.MenuDropDown = FauxtonAPI.View.extend({ template: "addons/fauxton/templates/menu_dropdown", className: "dropdown", - initialize: function(options) { + initialize: function (options) { this.links = options.links; this.icon = options.icon || "fonticon-plus-circled"; this.setUpEvents(); }, - setUpEvents: function() { + setUpEvents: function () { this.events = {}; _.each(this.links, function (parentLink) { _.each(parentLink.links, function (link) { @@ -816,16 +816,16 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) { }, this); }, this); }, - triggerEvent: function(e) { + triggerEvent: function (e) { e.preventDefault(); var eventTrigger = $(e.currentTarget).attr('triggerEvent'); FauxtonAPI.Events.trigger(eventTrigger); }, - update: function(links) { + update: function (links) { this.links = links; this.render(); }, - serialize: function() { + serialize: function () { return { links: this.links, icon: this.icon http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/components.react.jsx b/app/addons/fauxton/components.react.jsx index 32a07c7..474289d 100644 --- a/app/addons/fauxton/components.react.jsx +++ b/app/addons/fauxton/components.react.jsx @@ -19,7 +19,7 @@ define([ 'plugins/zeroclipboard/ZeroClipboard' ], -function(app, FauxtonAPI, React, Stores, Actions, ZeroClipboard) { +function (app, FauxtonAPI, React, Stores, Actions, ZeroClipboard) { var navBarStore = Stores.navBarStore; var Footer = React.createClass({ @@ -106,7 +106,7 @@ function(app, FauxtonAPI, React, Stores, Actions, ZeroClipboard) { this.setMenuState(); }, - componentWillUnmount: function() { + componentWillUnmount: function () { navBarStore.off('change', this.onChange); }, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/stores.js ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/stores.js b/app/addons/fauxton/stores.js index 5211d9e..ef1249b 100644 --- a/app/addons/fauxton/stores.js +++ b/app/addons/fauxton/stores.js @@ -16,7 +16,7 @@ define([ 'addons/fauxton/actiontypes' ], -function(app, FauxtonAPI, ActionTypes) { +function (app, FauxtonAPI, ActionTypes) { var Stores = {}; Stores.NavBarStore = FauxtonAPI.Store.extend({ @@ -111,7 +111,7 @@ function(app, FauxtonAPI, ActionTypes) { return oldLink.id === link.id; }); - if(!oldLink) { return; } + if (!oldLink) { return; } oldLink.title = link.title; oldLink.href = link.href; @@ -139,7 +139,7 @@ function(app, FauxtonAPI, ActionTypes) { }, dispatch: function (action) { - switch(action.type) { + switch (action.type) { case ActionTypes.ADD_NAVBAR_LINK: this.addLink(action.link); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/templates/breadcrumbs.html ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/templates/breadcrumbs.html b/app/addons/fauxton/templates/breadcrumbs.html index c795877..1db3971 100644 --- a/app/addons/fauxton/templates/breadcrumbs.html +++ b/app/addons/fauxton/templates/breadcrumbs.html @@ -12,7 +12,7 @@ License for the specific language governing permissions and limitations under the License. */%> -<% _.each(_.initial(crumbs), function(crumb, index) { %> +<% _.each(_.initial(crumbs), function (crumb, index) { %> <% if (crumb.type === 'back') { %> <li class="pull-left breadcrumb-back-link"> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/fauxton/templates/pagination.html ---------------------------------------------------------------------- diff --git a/app/addons/fauxton/templates/pagination.html b/app/addons/fauxton/templates/pagination.html index 7fb5b41..19a4eb5 100644 --- a/app/addons/fauxton/templates/pagination.html +++ b/app/addons/fauxton/templates/pagination.html @@ -16,7 +16,7 @@ the License. <% } else { %> <li class="disabled"> <a href="<%- urlFun(page) %>">«</a></li> <% } %> -<% _.each(_.range(from, to), function(i) { %> +<% _.each(_.range(from, to), function (i) { %> <li <% if (page == i) { %>class="active"<% } %>> <a href="<%- urlFun(i) %>"><%- i %></a></li> <% }) %> <% if (page < totalPages) { %> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/permissions/base.js ---------------------------------------------------------------------- diff --git a/app/addons/permissions/base.js b/app/addons/permissions/base.js index 6c071c6..cc7fb8b 100644 --- a/app/addons/permissions/base.js +++ b/app/addons/permissions/base.js @@ -16,9 +16,9 @@ define([ 'addons/permissions/routes' ], -function(app, FauxtonAPI, Permissions) { +function (app, FauxtonAPI, Permissions) { - Permissions.initialize = function() {}; + Permissions.initialize = function () {}; return Permissions; }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/permissions/views.js ---------------------------------------------------------------------- diff --git a/app/addons/permissions/views.js b/app/addons/permissions/views.js index e410018..7a111ca 100644 --- a/app/addons/permissions/views.js +++ b/app/addons/permissions/views.js @@ -119,7 +119,7 @@ function (app, FauxtonAPI, Permissions) { items: function () { this.discardRemovedViews(); - return { + return { names: this.getItemFromView(this.nameViews), roles: this.getItemFromView(this.roleViews) }; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/plugins/base.js ---------------------------------------------------------------------- diff --git a/app/addons/plugins/base.js b/app/addons/plugins/base.js index 0798fbd..cfdb62d 100644 --- a/app/addons/plugins/base.js +++ b/app/addons/plugins/base.js @@ -16,8 +16,8 @@ define([ "addons/plugins/routes" ], -function(app, FauxtonAPI, plugins) { - plugins.initialize = function() { +function (app, FauxtonAPI, plugins) { + plugins.initialize = function () { //FauxtonAPI.addHeaderLink({title: "Plugins", href: "#_plugins", icon: "fonticon-plugins", className: 'plugins'}); }; return plugins; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/plugins/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/plugins/routes.js b/app/addons/plugins/routes.js index 5077c53..3971d69 100644 --- a/app/addons/plugins/routes.js +++ b/app/addons/plugins/routes.js @@ -15,7 +15,7 @@ define([ "api", "addons/plugins/resources" ], -function(app, FauxtonAPI, plugins) { +function (app, FauxtonAPI, plugins) { var PluginsRouteObject = FauxtonAPI.RouteObject.extend({ layout: "one_pane", http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/plugins/templates/plugins.html ---------------------------------------------------------------------- diff --git a/app/addons/plugins/templates/plugins.html b/app/addons/plugins/templates/plugins.html index 3002247..f1afa98 100644 --- a/app/addons/plugins/templates/plugins.html +++ b/app/addons/plugins/templates/plugins.html @@ -44,13 +44,13 @@ specific language governing permissions and limitations under the License. </div> </div></body> <script> - $('.install-plugin').each(function() { + $('.install-plugin').each(function () { var button = $(this); var name = button.data('name'); var version = button.data('version'); - $.get("/_config/plugins/" + name + "/", function(body, textStatus) { + $.get("/_config/plugins/" + name + "/", function (body, textStatus) { body = JSON.parse(body); - if(body == version) { + if (body == version) { button.html('Already Installed. Click to Uninstall'); button.data('delete', true); } else { @@ -60,7 +60,7 @@ specific language governing permissions and limitations under the License. }); }); - $('.install-plugin').click(function(event) { + $('.install-plugin').click(function (event) { var button = $(this); var delete_plugin = button.data('delete') || false; var plugin_spec = JSON.stringify({ @@ -78,8 +78,8 @@ specific language governing permissions and limitations under the License. contentType: 'application/json', // what we send to the server dataType: 'json', // expected from the server processData: false, // keep our precious JSON - success: function(data, textStatus, jqXhr) { - if(textStatus == "success") { + success: function (data, textStatus, jqXhr) { + if (textStatus == "success") { var action = delete_plugin ? 'Uninstalled' : 'Installed'; button.html('Sucessfully ' + action); button.attr('disabled', true); @@ -87,7 +87,7 @@ specific language governing permissions and limitations under the License. button.html(textStatus); } }, - beforeSend: function(xhr) { + beforeSend: function (xhr) { xhr.setRequestHeader('Accept', 'application/json'); }, }); @@ -99,4 +99,4 @@ specific language governing permissions and limitations under the License. padding:1em; margin-bottom:1em; } - </style> \ No newline at end of file + </style> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c54822ab/app/addons/pouchdb/base.js ---------------------------------------------------------------------- diff --git a/app/addons/pouchdb/base.js b/app/addons/pouchdb/base.js index 3cd2b43..b2ee6da 100644 --- a/app/addons/pouchdb/base.js +++ b/app/addons/pouchdb/base.js @@ -25,11 +25,11 @@ define([ "addons/pouchdb/pouchdb.mapreduce" ], -function(app, FauxtonAPI, MapReduce) { +function (app, FauxtonAPI, MapReduce) { var Pouch = FauxtonAPI.addon(); Pouch.MapReduce = MapReduce; - Pouch.runViewQuery = function(fun, opts) { + Pouch.runViewQuery = function (fun, opts) { /*docs = [ {_id: 'test_doc_1', foo: 'bar-1'}, {_id: 'test_doc_2', foo: 'bar-2'}, @@ -44,7 +44,7 @@ function(app, FauxtonAPI, MapReduce) { ];*/ var deferred = FauxtonAPI.Deferred(); - var complete = function(resp, rows) { + var complete = function (resp, rows) { deferred.resolve(rows); }; @@ -53,6 +53,6 @@ function(app, FauxtonAPI, MapReduce) { Pouch.MapReduce.query(fun, options); return deferred; }; - //pdb.runViewQuery({map:function(doc) { emit(doc._id, doc.foo) }}) + //pdb.runViewQuery({map:function (doc) { emit(doc._id, doc.foo) }}) return Pouch; });