summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Kowalski <rok@kowalski.gd>2014-04-20 15:36:47 +0200
committerRobert Kowalski <rok@kowalski.gd>2014-04-24 20:32:08 +0200
commit5858a35567c984d30e10304eb6264ef2c0a32b80 (patch)
treed5de6d463673f65ba7ff34b4a922da842cf8990e
parent9e7a8415660075bf17c74ef166e5bbe8cabe0aa9 (diff)
downloadcouchdb-5858a35567c984d30e10304eb6264ef2c0a32b80.tar.gz
Fauxton: remove accidental globals
-rw-r--r--src/fauxton/app/addons/activetasks/tests/viewsSpec.js8
-rw-r--r--src/fauxton/app/addons/activetasks/views.js4
-rw-r--r--src/fauxton/app/addons/auth/resources.js2
-rw-r--r--src/fauxton/app/addons/documents/resources.js2
-rw-r--r--src/fauxton/app/addons/documents/routes.js2
-rw-r--r--src/fauxton/app/addons/documents/views.js2
-rw-r--r--src/fauxton/app/addons/permissions/tests/viewsSpec.js10
-rw-r--r--src/fauxton/app/addons/pouchdb/pouchdb.mapreduce.js10
-rw-r--r--src/fauxton/app/addons/stats/routes.js11
-rw-r--r--src/fauxton/app/addons/stats/views.js6
10 files changed, 31 insertions, 26 deletions
diff --git a/src/fauxton/app/addons/activetasks/tests/viewsSpec.js b/src/fauxton/app/addons/activetasks/tests/viewsSpec.js
index 13c904974..c1be25b5e 100644
--- a/src/fauxton/app/addons/activetasks/tests/viewsSpec.js
+++ b/src/fauxton/app/addons/activetasks/tests/viewsSpec.js
@@ -45,7 +45,7 @@ define([
});
it("Should set polling rate", function () {
- $range = tabMenu.$('#pollingRange');
+ var $range = tabMenu.$('#pollingRange');
$range.val(15);
$range.trigger('change');
@@ -53,8 +53,8 @@ define([
});
it("Should clearInterval", function () {
- $range = tabMenu.$('#pollingRange');
- clearIntervalMock = sinon.spy(window,'clearInterval');
+ var $range = tabMenu.$('#pollingRange');
+ var clearIntervalMock = sinon.spy(window,'clearInterval');
$range.trigger('change');
assert.ok(clearIntervalMock.calledOnce);
@@ -64,7 +64,7 @@ define([
it("Should trigger update:poll event", function () {
var spy = sinon.spy();
Views.Events.on('update:poll', spy);
- $range = tabMenu.$('#pollingRange');
+ var $range = tabMenu.$('#pollingRange');
$range.trigger('change');
assert.ok(spy.calledOnce);
diff --git a/src/fauxton/app/addons/activetasks/views.js b/src/fauxton/app/addons/activetasks/views.js
index b0940bfdf..c7e904a05 100644
--- a/src/fauxton/app/addons/activetasks/views.js
+++ b/src/fauxton/app/addons/activetasks/views.js
@@ -116,7 +116,7 @@ function (app, FauxtonAPI, activetasks) {
"click th": "sortByType"
},
initialize: function(){
- currentView = this.options.currentView;
+ this.currentView = this.options.currentView;
},
sortByType: function(e){
var currentTarget = e.currentTarget,
@@ -127,7 +127,7 @@ function (app, FauxtonAPI, activetasks) {
},
serialize: function(){
return {
- currentView: currentView,
+ currentView: this.currentView,
collection: this.collection
};
},
diff --git a/src/fauxton/app/addons/auth/resources.js b/src/fauxton/app/addons/auth/resources.js
index ba3a438d9..6e191b11d 100644
--- a/src/fauxton/app/addons/auth/resources.js
+++ b/src/fauxton/app/addons/auth/resources.js
@@ -299,7 +299,7 @@ function (app, FauxtonAPI, CouchdbSession) {
"submit #change-password": "changePassword"
},
- changePassword: function () {
+ changePassword: function (event) {
event.preventDefault();
var that = this,
diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js
index a787f0d78..eb6615afd 100644
--- a/src/fauxton/app/addons/documents/resources.js
+++ b/src/fauxton/app/addons/documents/resources.js
@@ -119,7 +119,7 @@ function(app, FauxtonAPI, PagingCollection) {
setDdocView: function (view, map, reduce) {
if (!this.isDdoc()) return false;
- var views = this.get('views');
+ var views = this.get('views'),
tempView = views[view] || {};
if (reduce) {
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js
index d57458802..5a2a04f13 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -256,7 +256,7 @@ function(app, FauxtonAPI, Documents, Databases) {
viewFn: function (databaseName, ddoc, view) {
var params = this.createParams(),
urlParams = params.urlParams,
- docParams = params.docParams;
+ docParams = params.docParams,
decodeDdoc = decodeURIComponent(ddoc);
view = view.replace(/\?.*$/,'');
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index 5b096bbcb..77f3bde5e 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -883,6 +883,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb,
},
getDocFromEditor: function () {
+ var json;
+
if (!this.hasValidCode()) {
return false;
}
diff --git a/src/fauxton/app/addons/permissions/tests/viewsSpec.js b/src/fauxton/app/addons/permissions/tests/viewsSpec.js
index 27abca461..c22d4055f 100644
--- a/src/fauxton/app/addons/permissions/tests/viewsSpec.js
+++ b/src/fauxton/app/addons/permissions/tests/viewsSpec.js
@@ -16,9 +16,10 @@ define([
'testUtils'
], function (FauxtonAPI, Views, Models, testUtils) {
var assert = testUtils.assert,
- ViewSandbox = testUtils.ViewSandbox;
+ ViewSandbox = testUtils.ViewSandbox;
describe('Permission View', function () {
+ var security, section, viewSandbox;
beforeEach(function () {
security = new Models.Security({'admins': {
@@ -62,7 +63,9 @@ define([
});
describe('PermissionsSection', function () {
- var section, security;
+ var section,
+ security,
+ viewSandbox;
beforeEach(function () {
security = new Models.Security({'admins': {
@@ -124,7 +127,8 @@ define([
});
describe('PermissionItem', function () {
- var item;
+ var item,
+ viewSandbox;
beforeEach(function () {
item = new Views.PermissionItem({
diff --git a/src/fauxton/app/addons/pouchdb/pouchdb.mapreduce.js b/src/fauxton/app/addons/pouchdb/pouchdb.mapreduce.js
index 224a6f66f..502e0eb01 100644
--- a/src/fauxton/app/addons/pouchdb/pouchdb.mapreduce.js
+++ b/src/fauxton/app/addons/pouchdb/pouchdb.mapreduce.js
@@ -36,6 +36,10 @@ function(app, FauxtonAPI, Collate) {
var Pouch = {};
Pouch.collate = Collate.collate;
+ function sum(values) {
+ return values.reduce(function(a, b) { return a + b; }, 0);
+ }
+
//var MapReduce = function(db) {
var MapReduce = function() {
@@ -59,7 +63,7 @@ function(app, FauxtonAPI, Collate) {
'max': Math.max.apply(null, values),
'count': values.length,
'sumsqr': (function(){
- _sumsqr = 0;
+ var _sumsqr = 0;
for(var idx in values){
_sumsqr += values[idx] * values[idx];
}
@@ -75,10 +79,6 @@ function(app, FauxtonAPI, Collate) {
return;
}
- function sum(values) {
- return values.reduce(function(a, b) { return a + b; }, 0);
- }
-
var results = [];
var current = null;
var num_started= 0;
diff --git a/src/fauxton/app/addons/stats/routes.js b/src/fauxton/app/addons/stats/routes.js
index 971c11174..9939d43ee 100644
--- a/src/fauxton/app/addons/stats/routes.js
+++ b/src/fauxton/app/addons/stats/routes.js
@@ -25,8 +25,8 @@ function(app, FauxtonAPI, Stats) {
"stats":"showStats",
"_stats": "showStats"
},
-
-
+
+
crumbs: [
{"name": "Statistics", "link": "_stats"}
],
@@ -35,15 +35,14 @@ function(app, FauxtonAPI, Stats) {
initialize: function () {
this.stats = new Stats.Collection();
-
- this.setView("#sidebar-content", new Views.StatSelect({
+ this.setView("#sidebar-content", new Stats.Views.StatSelect({
collection: this.stats
}));
},
showStats: function () {
- this.setView("#dashboard-content", new Views.Statistics({
+ this.setView("#dashboard-content", new Stats.Views.Statistics({
collection: this.stats
}));
},
@@ -53,7 +52,7 @@ function(app, FauxtonAPI, Stats) {
},
apiUrl: function(){
- return [ this.stats.url, this.stats.documentation];
+ return [ this.stats.url, this.stats.documentation];
}
});
diff --git a/src/fauxton/app/addons/stats/views.js b/src/fauxton/app/addons/stats/views.js
index f75ee642f..275c30b63 100644
--- a/src/fauxton/app/addons/stats/views.js
+++ b/src/fauxton/app/addons/stats/views.js
@@ -20,10 +20,10 @@ define([
],
-function(app, FauxtonAPI,Stats, d3, nv) {
- Views = {};
+function(app, FauxtonAPI, Stats, d3, nv) {
+ var Views = {},
+ datatypeEventer = {};
- datatypeEventer = {};
_.extend(datatypeEventer, Backbone.Events);
Views.Legend = FauxtonAPI.View.extend({