couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [12/13] git commit: updated refs/heads/master to a9c390e
Date Thu, 08 Aug 2013 13:26:20 GMT
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 <garren.smith@gmail.com>
Authored: Tue Aug 6 11:31:38 2013 +0200
Committer: Garren Smith <garren.smith@gmail.com>
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) {
+          $('<div class="spinner"></div>').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
-            };
-            $('<div class="spinner"></div>').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: "<strong>Warning!</strong> 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.
 -->
 
 <ul class="nav nav-tabs">
-  <li id="field_editor" class="<%= isSelectedClass('field_editor') %>"><a
href="#<%= doc.url('app') %>/field_editor">Doc fields</a></li>
+  <!--<li id="field_editor" class="<%= isSelectedClass('field_editor') %>"><a
href="#<%= doc.url('app') %>/field_editor">Doc fields</a></li>-->
   <li id="code_editor" class="<%= isSelectedClass('code_editor') %>"><a href="#<%=
doc.url('app') %>/code_editor"><i class="icon-pencil"></i> Code editor</a></li>
   <ul class="nav pull-right" style="margin:5px 10px 0px 10px;">
     <li>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/app/templates/documents/jumpdoc.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/jumpdoc.html b/src/fauxton/app/templates/documents/jumpdoc.html
index d95e6aa..546134b 100644
--- a/src/fauxton/app/templates/documents/jumpdoc.html
+++ b/src/fauxton/app/templates/documents/jumpdoc.html
@@ -14,7 +14,7 @@ the License.
 
 
 <form id="jump-to-doc" class="form-inline">
-	<label class="fonticon-search">
+	<label id="jump-to-doc-label" class="fonticon-search">
     <input type="text" id="jump-to-doc-id" class="input-large" placeholder="Document ID"></input>
   </label>
 </form>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/fauxton.less b/src/fauxton/assets/less/fauxton.less
index 7600543..f15ec75 100644
--- a/src/fauxton/assets/less/fauxton.less
+++ b/src/fauxton/assets/less/fauxton.less
@@ -22,6 +22,7 @@
 @import "prettyprint.less";
 @import "database.less";
 @import "icons.less";
+@import "mixins.less";
 
 /*define variable for color here, remove to seperate file later*/
 
@@ -671,9 +672,19 @@ tr.all-docs-item{
   color: @fontGrey;
 }
 
-
 div.spinner {
   position: absolute;
   left: 50%;
   top: 50%;
 }
+
+/* Code mirror overrides */
+.CodeMirror-scroll {
+  .border-radius(2px);
+  border: solid 1px #ddd;
+}
+
+.btn-primary a:visited {
+  color: #fff;
+
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/acecae56/src/fauxton/assets/less/mixins.less
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/less/mixins.less b/src/fauxton/assets/less/mixins.less
new file mode 100644
index 0000000..d1b08ef
--- /dev/null
+++ b/src/fauxton/assets/less/mixins.less
@@ -0,0 +1,20 @@
+/*  Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ *  use this file except in compliance with the License. You may obtain a copy of
+ *  the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *  License for the specific language governing permissions and limitations under
+ *  the License.
+ */
+
+// Border Radius
+.border-radius(@radius) {
+  -webkit-border-radius: @radius;
+     -moz-border-radius: @radius;
+          border-radius: @radius;
+}
+


Mime
View raw message