Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E4ECD10263 for ; Thu, 8 Aug 2013 13:26:17 +0000 (UTC) Received: (qmail 18744 invoked by uid 500); 8 Aug 2013 13:26:16 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 18471 invoked by uid 500); 8 Aug 2013 13:26:13 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 18131 invoked by uid 99); 8 Aug 2013 13:26:10 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Aug 2013 13:26:10 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 79B7C835D2E; Thu, 8 Aug 2013 13:26:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: garren@apache.org To: commits@couchdb.apache.org Date: Thu, 08 Aug 2013 13:26:20 -0000 Message-Id: In-Reply-To: <1f3e86d429744be691997e7cb0332063@git.apache.org> References: <1f3e86d429744be691997e7cb0332063@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/13] git commit: updated refs/heads/master to a9c390e Fauxton: Spinner shows before routeObject establish Hide field editor for now Documents view trash cash enabled on item selected Jump to doc working Fauxton fix views page Fixes for docs Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/acecae56 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/acecae56 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/acecae56 Branch: refs/heads/master Commit: acecae56f3e8442e067a3f0c1847d95ecd92e876 Parents: eed363c Author: Garren Smith Authored: Tue Aug 6 11:31:38 2013 +0200 Committer: Garren Smith Committed: Thu Aug 8 15:21:27 2013 +0200 ---------------------------------------------------------------------- src/fauxton/app/addons/activetasks/views.js | 1 - src/fauxton/app/api.js | 59 ++++++++++---------- src/fauxton/app/initialize.js | 2 +- src/fauxton/app/modules/documents/routes.js | 10 +--- src/fauxton/app/modules/documents/views.js | 51 +++++++++++++---- .../documents/doc_field_editor_tabs.html | 2 +- .../app/templates/documents/jumpdoc.html | 2 +- src/fauxton/assets/less/fauxton.less | 13 ++++- src/fauxton/assets/less/mixins.less | 20 +++++++ 9 files changed, 108 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/app/addons/activetasks/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/activetasks/views.js b/src/fauxton/app/addons/activetasks/views.js index 7305367..348fb2a 100644 --- a/src/fauxton/app/addons/activetasks/views.js +++ b/src/fauxton/app/addons/activetasks/views.js @@ -89,7 +89,6 @@ function (app, FauxtonAPI, activetasks) { var that = this; clearInterval(pollingInfo.intervalId); pollingInfo.intervalId = setInterval(function() { - console.log('hit me once'); that.establish(); }, pollingInfo.rate*1000); }, http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/app/api.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/api.js b/src/fauxton/app/api.js index f441bbf..da74d6a 100644 --- a/src/fauxton/app/api.js +++ b/src/fauxton/app/api.js @@ -265,11 +265,6 @@ function(app, Fauxton) { } } - //add page loader. "app-container" shouldn't be overwritten. Even if a new index.underscore is provided in settings.json - // if (!this.disableLoader) { - // $('#app-container').addClass(this.loaderClassname); - // } - masterLayout.clearBreadcrumbs(); var crumbs = this.get('crumbs'); @@ -279,43 +274,47 @@ function(app, Fauxton) { })); } + if (!this.disableLoader){ + var opts = { + lines: 16, // The number of lines to draw + length: 8, // The length of each line + width: 4, // The line thickness + radius: 12, // The radius of the inner circle + color: '#aaa', // #rbg or #rrggbb + speed: 1, // Rounds per second + trail: 10, // Afterglow percentage + shadow: false // Whether to render a shadow + }; + + if (!$('.spinner').length) { + $('
').appendTo('#app-container'); + } + + var spinner = new Spinner(opts).spin(); + $('.spinner').append(spinner.el); + } + FauxtonAPI.when(this.establish()).done(function(resp) { - // if (!this.disableLoader) { - // $('#app-container').removeClass(this.loaderClassname); - // } _.each(routeObject.getViews(), function(view, selector) { if(view.hasRendered()) { return; } - if (!view.disableLoader){ - var opts = { - lines: 16, // The number of lines to draw - length: 8, // The length of each line - width: 4, // The line thickness - radius: 12, // The radius of the inner circle - color: '#ccc', // #rbg or #rrggbb - speed: 1, // Rounds per second - trail: 10, // Afterglow percentage - shadow: false // Whether to render a shadow - }; - $('
').appendTo(selector); - var spinner = new Spinner(opts).spin(); - $('.spinner').append(spinner.el); - } FauxtonAPI.when(view.establish()).then(function(resp) { masterLayout.setView(selector, view); + if (!view.disableLoader){ spinner.stop(); - } - // } $(selector).removeClass(view.loaderClassname); + } + masterLayout.renderView(selector); }, function(resp) { - view.establishError = { - error: true, - reason: resp - }; + view.establishError = { + error: true, + reason: resp + }; + masterLayout.renderView(selector); }); - + var hooks = masterLayout.hooks[selector]; var boundRoute = route; http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/app/initialize.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/initialize.js b/src/fauxton/app/initialize.js index 6fed729..4826c5e 100644 --- a/src/fauxton/app/initialize.js +++ b/src/fauxton/app/initialize.js @@ -36,7 +36,7 @@ function(app, _, Bootstrap) { // Thanks to: http://stackoverflow.com/a/2880929 getParams: function(queryString) { - if (typeof queryString !== "undefined") { + if (queryString) { // I think this could be combined into one if if (queryString.substring(0,1) === "?") { queryString = queryString.substring(1); http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/app/modules/documents/routes.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/modules/documents/routes.js b/src/fauxton/app/modules/documents/routes.js index f712ec3..6a7d4b4 100644 --- a/src/fauxton/app/modules/documents/routes.js +++ b/src/fauxton/app/modules/documents/routes.js @@ -47,7 +47,8 @@ function(app, FauxtonAPI, Documents, Databases) { }, routes: { - "database/:database/:doc/field_editor": "field_editor", + // We are hiding the field_editor for this first release + //"database/:database/:doc/field_editor": "field_editor", "database/:database/:doc/code_editor": "code_editor", "database/:database/:doc": "code_editor" }, @@ -173,11 +174,6 @@ function(app, FauxtonAPI, Documents, Databases) { collection: this.data.designDocs, database: this.data.database })); - - // this.setView("#tabs", new Documents.Views.Tabs({ - // collection: this.data.designDocs, - // database: this.data.database - // })); }, establish: function () { @@ -199,7 +195,7 @@ function(app, FauxtonAPI, Documents, Databases) { if (this.viewEditor) { this.viewEditor.remove(); } - this.toolsView = this.setView("#dashboard-upper-menu", new Documents.Views.JumpToDoc()); + this.toolsView = this.setView("#dashboard-upper-menu", new Documents.Views.JumpToDoc({database: this.data.database})); this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({ collection: this.data.database.allDocs http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/app/modules/documents/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js index 881f3d1..6aa4e11 100644 --- a/src/fauxton/app/modules/documents/views.js +++ b/src/fauxton/app/modules/documents/views.js @@ -303,6 +303,14 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { }, destroy: function(event) { + if (this.model.isNewDoc()) { + FauxtonAPI.addNotification({ + msg: 'This document has not been saved yet.', + type: 'warning' + }); + return; + } + if (!window.confirm("Are you sure you want to delete this doc?")) { return false; } @@ -343,6 +351,13 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { }, duplicate: function(event) { + if (this.model.isNewDoc()) { + FauxtonAPI.addNotification({ + msg: 'Please save the document before duplicating it.', + type: 'warning' + }); + return; + } event.preventDefault(); this.duplicateModal.showModal(); }, @@ -461,7 +476,16 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { template: "templates/documents/all_docs_list", events: { "click button.all": "selectAll", - "click button.bulk-delete": "bulkDelete" + "click button.bulk-delete": "bulkDelete", + "change .row-select":"toggleTrash" + }, + + toggleTrash: function () { + if (this.$('.row-select:checked').length > 0) { + this.$('.bulk-delete').removeClass('disabled'); + } else { + this.$('.bulk-delete').addClass('disabled'); + } }, initialize: function(options){ @@ -487,7 +511,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { }, selectAll: function(evt){ - $("input:checkbox").attr('checked', !$(evt.target).hasClass('active')); + $("input:checkbox").prop('checked', !$(evt.target).hasClass('active')); }, serialize: function() { @@ -539,6 +563,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { that.rows[ele].$el.fadeOut(); model.collection.remove(model.id); + that.$('.bulk-delete').addClass('disabled'); }, function(resp) { FauxtonAPI.addNotification({ msg: "Failed to destroy your doc!", @@ -767,7 +792,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { langTemplates: { "javascript": { - map: "function(doc) {\n emit(doc.id, 1);\n}", + map: "function(doc) {\n emit(doc._id, 1);\n}", reduce: "function(keys, values, rereduce){\n if (rereduce){\n return sum(values);\n } else {\n return values.length;\n }\n}" } }, @@ -968,7 +993,7 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { FauxtonAPI.addNotification({ msg: "Warning! Preview executes the Map/Reduce functions in your browser, and may behave differently from CouchDB.", type: "warning", - selector: "#define-view .errors-container", + selector: ".advanced-options", fade: true }); @@ -1166,9 +1191,10 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { }, afterRender: function() { - var that = this; - var mapFun = $("#map-function"); - var reduceFun = $("#reduce-function"); + var that = this, + mapFun = this.$("#map-function"), + reduceFun = this.$("#reduce-function"); + if (this.newView) { mapFun.val(this.langTemplates[this.defaultLang].map); reduceFun.val(this.langTemplates[this.defaultLang].reduce); @@ -1249,13 +1275,18 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) { } }); - - //moved out of sidebar into it's own view Views.JumpToDoc = FauxtonAPI.View.extend({ template: "templates/documents/jumpdoc", + + initialize: function (options) { + this.database = options.database; + }, + events: { - "submit #jump-to-doc": "jumpToDoc" + "submit #jump-to-doc": "jumpToDoc", + "click #jump-to-doc-label": "jumpToDoc" }, + jumpToDoc: function (event) { event.preventDefault(); var docId = this.$('#jump-to-doc-id').val(); http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/app/templates/documents/doc_field_editor_tabs.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html index fcc2b53..29c6d8b 100644 --- a/src/fauxton/app/templates/documents/doc_field_editor_tabs.html +++ b/src/fauxton/app/templates/documents/doc_field_editor_tabs.html @@ -13,7 +13,7 @@ the License. -->