Fixes
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/014b8c11 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/014b8c11 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/014b8c11 Branch: refs/heads/fauxton-file-reorder Commit: 014b8c111157e251a88a016643c53ae692eaf85d Parents: 4c7c1ef Author: Garren Smith <garren.sm...@gmail.com> Authored: Tue Jan 21 14:10:30 2014 +0200 Committer: Garren Smith <garren.sm...@gmail.com> Committed: Wed Jan 29 15:48:54 2014 +0200 ---------------------------------------------------------------------- src/Makefile.am | 22 ++++++++++++++-------- src/fauxton/app/addons/auth/base.js | 1 + src/fauxton/app/addons/documents/resources.js | 17 ++++++++++++++++- src/fauxton/app/addons/documents/views.js | 8 ++++---- src/fauxton/app/addons/fauxton/components.js | 11 +++++++---- src/fauxton/app/core/couchdbSession.js | 19 ------------------- 6 files changed, 42 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/014b8c11/src/Makefile.am ---------------------------------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index ba160b9..0f5c491 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -111,14 +111,22 @@ FAUXTON_FILES = \ fauxton/app/addons/verifyinstall/routes.js \ fauxton/app/addons/verifyinstall/templates/main.html \ fauxton/app/addons/verifyinstall/assets/less/verifyinstall.less \ - fauxton/app/api.js \ + fauxton/app/core/api.js \ + fauxton/app/core/auth.js \ + fauxton/app/core/base.js \ + fauxton/app/core/couchdbSession.js \ + fauxton/app/core/layout.js \ + fauxton/app/core/routeObject.js \ + fauxton/app/core/router.js \ + fauxton/app/core/utils.js \ + fauxton/app/core/tests/layoutSpec.js \ + fauxton/app/core/tests/routeObjectSpec.js \ fauxton/app/app.js \ fauxton/app/config.js \ fauxton/app/helpers.js \ fauxton/app/initialize.js.underscore \ fauxton/app/load_addons.js.underscore \ fauxton/app/main.js \ - fauxton/app/utils.js \ fauxton/app/addons/databases/base.js \ fauxton/app/addons/databases/resources.js \ fauxton/app/addons/databases/routes.js \ @@ -131,11 +139,13 @@ FAUXTON_FILES = \ fauxton/app/addons/fauxton/base.js \ fauxton/app/addons/fauxton/components.js \ fauxton/app/addons/fauxton/layout.js \ + fauxton/app/addons/fauxton/resizeColumns.js \ + fauxton/app/addons/fauxton/tests/baseSpec.js \ + fauxton/app/addons/fauxton/tests/navbarSpec.js \ + fauxton/app/addons/fauxton/tests/paginateSpec.js \ fauxton/app/addons/pouchdb/base.js \ fauxton/app/addons/pouchdb/pouch.collate.js \ fauxton/app/addons/pouchdb/pouchdb.mapreduce.js \ - fauxton/app/resizeColumns.js \ - fauxton/app/router.js \ fauxton/app/addons/databases/templates/item.html \ fauxton/app/addons/databases/templates/list.html \ fauxton/app/addons/databases/templates/newdatabase.html \ @@ -309,10 +319,6 @@ FAUXTON_FILES = \ fauxton/tasks/couchserver.js \ fauxton/tasks/fauxton.js \ fauxton/tasks/helper.js \ - fauxton/test/core/layoutSpec.js \ - fauxton/test/core/navbarSpec.js \ - fauxton/test/core/paginateSpec.js \ - fauxton/test/core/routeObjectSpec.js \ fauxton/test/mocha/chai.js \ fauxton/test/mocha/mocha.css \ fauxton/test/mocha/mocha.js \ http://git-wip-us.apache.org/repos/asf/couchdb/blob/014b8c11/src/fauxton/app/addons/auth/base.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/auth/base.js b/src/fauxton/app/addons/auth/base.js index 9f9a332..7f69a7f 100644 --- a/src/fauxton/app/addons/auth/base.js +++ b/src/fauxton/app/addons/auth/base.js @@ -20,6 +20,7 @@ function(app, FauxtonAPI, Auth) { Auth.session = new Auth.Session(); FauxtonAPI.setSession(Auth.session); + app.session = Auth.session; Auth.initialize = function() { Auth.navLink = new Auth.NavLink({model: Auth.session}); http://git-wip-us.apache.org/repos/asf/couchdb/blob/014b8c11/src/fauxton/app/addons/documents/resources.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js index 831d5e3..75cd541 100644 --- a/src/fauxton/app/addons/documents/resources.js +++ b/src/fauxton/app/addons/documents/resources.js @@ -18,6 +18,21 @@ define([ function(app, FauxtonAPI) { var Documents = FauxtonAPI.addon(); + Documents.UUID = FauxtonAPI.Model.extend({ + initialize: function(options) { + options = _.extend({count: 1}, options); + this.count = options.count; + }, + + url: function() { + return "/_uuids?count=" + this.count; + }, + + next: function() { + return this.get("uuids").pop(); + } + }); + Documents.Doc = Backbone.Model.extend({ idAttribute: "_id", documentation: function(){ @@ -258,7 +273,7 @@ function(app, FauxtonAPI) { Documents.NewDoc = Documents.Doc.extend({ fetch: function() { - var uuid = new FauxtonAPI.UUID(); + var uuid = new Documents.UUID(); var deferred = this.deferred = $.Deferred(); var that = this; http://git-wip-us.apache.org/repos/asf/couchdb/blob/014b8c11/src/fauxton/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index bd4307b..6cdd1db 100644 --- a/src/fauxton/app/addons/documents/views.js +++ b/src/fauxton/app/addons/documents/views.js @@ -264,7 +264,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum showModal: function () { var showModal = this._showModal, setDefaultIdValue = this.setDefaultIdValue, - uuid = new FauxtonAPI.UUID(); + uuid = new Documents.UUID(); uuid.fetch().then(function () { setDefaultIdValue(uuid.next()); @@ -720,11 +720,11 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum }, cleanup: function () { - //if (!this.pagination) { return; } - this.pagination.remove(); - //this.pagination = null; this.allDocsNumber.remove(); _.each(this.rows, function (row) {row.remove();}); + + if (!this.pagination) { return; } + this.pagination.remove(); }, beforeRender: function() { http://git-wip-us.apache.org/repos/asf/couchdb/blob/014b8c11/src/fauxton/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js index ca1d3c5..c26fc96 100644 --- a/src/fauxton/app/addons/fauxton/components.js +++ b/src/fauxton/app/addons/fauxton/components.js @@ -125,7 +125,7 @@ function(app, FauxtonAPI, ace, spin) { pageEnd: function () { if (this.collection.length < this.pageLimit()) { - return this.collection.length; + return (this.previousParams.length * this.pageLimit()) + this.collection.length; } return (this.previousParams.length * this.pageLimit()) + this.pageLimit(); @@ -236,6 +236,8 @@ function(app, FauxtonAPI, ace, spin) { this.theme = options.theme || 'crimson_editor'; this.couchJSHINT = options.couchJSHINT; this.edited = false; + + _.bindAll(this); }, afterRender: function () { @@ -296,13 +298,14 @@ function(app, FauxtonAPI, ace, spin) { }, removeIncorrectAnnotations: function () { - var editor = this.editor; + var editor = this.editor, + isIgnorableError = this.isIgnorableError; - this.editor.getSession().on("changeAnnotation", function(){ + this.editor.getSession().on("changeAnnotation", function () { var annotations = editor.getSession().getAnnotations(); var newAnnotations = _.reduce(annotations, function (annotations, error) { - if (!this.isIgnorableError(error.raw)) { + if (!isIgnorableError(error.raw)) { annotations.push(error); } return annotations; http://git-wip-us.apache.org/repos/asf/couchdb/blob/014b8c11/src/fauxton/app/core/couchdbSession.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/core/couchdbSession.js b/src/fauxton/app/core/couchdbSession.js index 6f13677..93bfd8a 100644 --- a/src/fauxton/app/core/couchdbSession.js +++ b/src/fauxton/app/core/couchdbSession.js @@ -13,21 +13,6 @@ define([ ], function (FauxtonAPI) { var CouchdbSession = { - UUID: FauxtonAPI.Model.extend({ - initialize: function(options) { - options = _.extend({count: 1}, options); - this.count = options.count; - }, - - url: function() { - return "/_uuids?count=" + this.count; - }, - - next: function() { - return this.get("uuids").pop(); - } - }), - Session: FauxtonAPI.Model.extend({ url: '/_session', @@ -65,9 +50,5 @@ function (FauxtonAPI) { }) }; - - //set default session - //FauxtonAPI.setSession(new FauxtonAPI.Session()); - return CouchdbSession; });