couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject [41/48] fauxton commit: updated refs/heads/secondary-indexes to 8688d16
Date Mon, 25 Aug 2014 13:40:21 GMT
Header stuff for all docs


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/6daad5d1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/6daad5d1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/6daad5d1

Branch: refs/heads/secondary-indexes
Commit: 6daad5d118ed122c636572ad5429d6f1b7e52af5
Parents: f5fd76d
Author: deathbearbrown <deathbearbrown@gmail.com>
Authored: Sun Aug 24 16:33:43 2014 +0200
Committer: deathbearbrown <deathbearbrown@gmail.com>
Committed: Mon Aug 25 09:37:36 2014 -0400

----------------------------------------------------------------------
 app/addons/databases/routes.js                  |  3 +
 .../databases/templates/header_alldbs.html      | 26 ++++++
 app/addons/databases/templates/jump_to_db.html  | 19 ++++
 app/addons/databases/templates/list.html        | 38 +++-----
 app/addons/databases/views.js                   | 97 ++++++++++++++++----
 app/addons/documents/templates/view_editor.html |  0
 app/addons/documents/tests/viewsSpec.js         | 57 ------------
 app/addons/fauxton/resizeColumns.js             | 23 +++++
 app/addons/fauxton/tests/baseSpec.js            |  6 --
 app/templates/layouts/one_pane.html             |  4 +-
 assets/less/headers.less                        |  7 +-
 assets/less/templates.less                      | 16 +---
 12 files changed, 172 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/databases/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/routes.js b/app/addons/databases/routes.js
index 131abf9..1e4396c 100644
--- a/app/addons/databases/routes.js
+++ b/app/addons/databases/routes.js
@@ -45,6 +45,9 @@ function(app, FauxtonAPI, Databases, Views) {
     initialize: function() {
       this.databases = new Databases.List();
       this.deferred = FauxtonAPI.Deferred();
+      this.rightHeader = this.setView("#api-navbar", new Views.RightAllDBsHeader({
+        collection: this.databases
+      }));
     },
 
     allDatabases: function() {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/databases/templates/header_alldbs.html
----------------------------------------------------------------------
diff --git a/app/addons/databases/templates/header_alldbs.html b/app/addons/databases/templates/header_alldbs.html
new file mode 100644
index 0000000..a993225
--- /dev/null
+++ b/app/addons/databases/templates/header_alldbs.html
@@ -0,0 +1,26 @@
+<!--
+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.
+-->
+
+  <!-- floats right -->
+
+  <div id="header-api-bar" class="button"></div>
+
+  <!-- add database-->
+  <div class="button add-db">
+  </div>
+
+  <!-- search (jump to doc)-->
+  <div id="header-search" class="js-search searchbox-container"></div>
+
+

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/databases/templates/jump_to_db.html
----------------------------------------------------------------------
diff --git a/app/addons/databases/templates/jump_to_db.html b/app/addons/databases/templates/jump_to_db.html
new file mode 100644
index 0000000..6c0f03a
--- /dev/null
+++ b/app/addons/databases/templates/jump_to_db.html
@@ -0,0 +1,19 @@
+<!--
+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.
+-->
+<form id="jump-to-db" class="navbar-form pull-right database-search">
+  <div class="input-append">
+    <input type="text" class="search-autocomplete" name="search-query" placeholder="Database
name" />
+    <button class="btn btn-primary" type="submit"><i class="icon icon-search"></i></button>
+  </div>
+</form>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/databases/templates/list.html
----------------------------------------------------------------------
diff --git a/app/addons/databases/templates/list.html b/app/addons/databases/templates/list.html
index 1503c32..b0569e7 100644
--- a/app/addons/databases/templates/list.html
+++ b/app/addons/databases/templates/list.html
@@ -11,27 +11,19 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 License for the specific language governing permissions and limitations under
 the License.
 -->
-
-<div class="result-tools" style="">
-  <div id="newButton" class="pull-left"></div>
-  <form id="jump-to-db" class="navbar-form pull-right database-search">
-    <div class="input-append">
-      <input type="text" class="search-autocomplete" name="search-query" placeholder="Database
name" />
-      <button class="btn btn-primary" type="submit"><i class="icon icon-search"></i></button>
-    </div>
-  </form>
-
-
+<div class="view">
+  <table class="databases table table-striped">
+    <thead>
+      <th>Name</th>
+      <th>Size</th>
+      <th># of Docs</th>
+      <th>Update Seq</th>
+      <th>Actions</th>
+    </thead>
+    <tbody>
+    </tbody>
+  </table>
 </div>
-<table class="databases table table-striped">
-  <thead>
-    <th>Name</th>
-    <th>Size</th>
-    <th># of Docs</th>
-    <th>Update Seq</th>
-    <th>Actions</th>
-  </thead>
-  <tbody>
-  </tbody>
-</table>
-<div id="database-pagination"></div>
+<footer class="pagination-footer window-resizeable">
+  <div id="database-pagination"></div>
+</footer>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/databases/views.js
----------------------------------------------------------------------
diff --git a/app/addons/databases/views.js b/app/addons/databases/views.js
index 5629cb1..29158c8 100644
--- a/app/addons/databases/views.js
+++ b/app/addons/databases/views.js
@@ -21,6 +21,36 @@ define([
 function(app, Components, FauxtonAPI, Databases) {
   var Views = {};
 
+  //Header for alldocs with search, Query options,& api bar
+  Views.RightAllDBsHeader = FauxtonAPI.View.extend({
+    className: "header-right",
+    template: "addons/databases/templates/header_alldbs",
+    initialize: function(options){
+      //adding the database to the object
+      _.bindAll(this);
+    },
+
+    updateApiUrl: function(api){
+      //this will update the api bar when the route changes
+      //you can find the method that updates it in components.js Components.ApiBar()
+      this.apiBar && this.apiBar.update(api);
+    },
+
+    beforeRender:function(){
+      this.headerSearch = this.insertView("#header-search", new Views.JumpToDB({
+        collection: this.collection
+      }));
+
+      this.newbutton = this.insertView("#add-db-button", new Views.NewDatabaseButton({
+        collection: this.collection
+      }));
+
+
+      //Moved the apibar view into the components file so you can include it in your views
+      this.apiBar = this.insertView("#header-api-bar", new Components.ApiBar({}));
+    }
+  });
+
   Views.Item = FauxtonAPI.View.extend({
     template: "addons/databases/templates/item",
     tagName: "tr",
@@ -36,25 +66,16 @@ function(app, Components, FauxtonAPI, Databases) {
     }
   });
 
-  Views.List = FauxtonAPI.View.extend({
-    dbLimit: 20,
-    perPage: 20,
-    template: "addons/databases/templates/list",
+
+  Views.JumpToDB = FauxtonAPI.View.extend({
+    template: "addons/databases/templates/jump_to_db",
     events: {
-      "click button.all": "selectAll",
       "submit form#jump-to-db": "switchDatabase"
     },
-
     initialize: function(options) {
       var params = app.getParams();
       this.page = params.page ? parseInt(params.page, 10) : 1;
     },
-
-    serialize: function() {
-      return {
-        databases: this.collection
-      };
-    },
     establish: function(){
       var currentDBs = this.paginated();
       var deferred = FauxtonAPI.Deferred();
@@ -90,6 +111,54 @@ function(app, Components, FauxtonAPI, Databases) {
         });
       }
     },
+    afterRender: function() {
+      var that = this,
+          AllDBsArray = _.map(this.collection.toJSON(), function(item, key){
+            return item.name;
+          });
+
+      this.dbSearchTypeahead = new Components.Typeahead({
+        el: "input.search-autocomplete",
+        source: AllDBsArray,
+        onUpdate: function (item) {
+          that.switchDatabase(null, item);
+        }
+      });
+      this.dbSearchTypeahead.render();
+      this.$el.find(".js-db-graveyard").tooltip();
+    }
+  });
+  Views.List = FauxtonAPI.View.extend({
+    dbLimit: 20,
+    perPage: 20,
+    template: "addons/databases/templates/list",
+    events: {
+      "click button.all": "selectAll"
+    },
+
+    initialize: function(options) {
+      var params = app.getParams();
+      this.page = params.page ? parseInt(params.page, 10) : 1;
+    },
+
+    serialize: function() {
+      return {
+        databases: this.collection
+      };
+    },
+    establish: function(){
+      var currentDBs = this.paginated();
+      var deferred = FauxtonAPI.Deferred();
+
+      FauxtonAPI.when(currentDBs.map(function(database) {
+        return database.status.fetchOnce();
+      })).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();
+      });
+      return [deferred];
+    },
 
     paginated: function() {
       var start = (this.page - 1) * this.perPage;
@@ -99,10 +168,6 @@ function(app, Components, FauxtonAPI, Databases) {
 
     beforeRender: function() {
 
-      this.insertView("#newButton", new Views.NewDatabaseButton({
-        collection: this.collection
-      }));
-
       _.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/6daad5d1/app/addons/documents/templates/view_editor.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/view_editor.html b/app/addons/documents/templates/view_editor.html
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/documents/tests/viewsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/viewsSpec.js b/app/addons/documents/tests/viewsSpec.js
index df3abf7..e69de29 100644
--- a/app/addons/documents/tests/viewsSpec.js
+++ b/app/addons/documents/tests/viewsSpec.js
@@ -1,57 +0,0 @@
-// 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.
-define([
-        'addons/documents/views',
-        'addons/documents/resources',
-        'addons/databases/base',
-        'testUtils'
-], function (Views, Resources, Databases, testUtils) {
-  var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox,
-      viewSandbox;
-
-  describe('AllDocsList', function () {
-    var database = new Databases.Model({id: 'registry'}),
-        bulkDeleteDocCollection = new Resources.BulkDeleteDocCollection([], {databaseId:
'registry'});
-
-    database.allDocs = new Resources.AllDocs({_id: "ente"}, {
-      database: database,
-      viewMeta: {update_seq: 1},
-      params: {}
-    });
-
-    var view = new Views.Views.AllDocsList({
-      viewList: false,
-      bulkDeleteDocsCollection: bulkDeleteDocCollection,
-      collection: database.allDocs
-    });
-
-    beforeEach(function (done) {
-      viewSandbox = new ViewSandbox();
-      viewSandbox.renderView(view, done);
-    });
-
-    afterEach(function () {
-      viewSandbox.remove();
-    });
-
-    it('should load', function () {
-      assert.equal(typeof Views.Views.AllDocsList, 'function');
-    });
-
-    it('pressing SelectAll should fill the delete-bulk-docs-collection', function () {
-      assert.equal(bulkDeleteDocCollection.length, 0);
-      view.$('button.all').trigger('click');
-      assert.equal(bulkDeleteDocCollection.length, 1);
-    });
-  });
-});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/fauxton/resizeColumns.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/resizeColumns.js b/app/addons/fauxton/resizeColumns.js
index 3fd1883..210ae4b 100644
--- a/app/addons/fauxton/resizeColumns.js
+++ b/app/addons/fauxton/resizeColumns.js
@@ -23,6 +23,25 @@ define([
 
 function(FauxtonAPI) {
 
+
+// Lets think about what this needs to do, so it can be rewritten.
+/*
+  I have 3 types of resizable layouts:
+    - full size which will span across the content area that is
+     window.innerWidth - primaryNavWidth
+    - 2 panel which is the above divided by 2 with the left set on the second div
+    - "sidebar" which is window.innerWidth - primaryNavWidth - sidebarwidth
+    Also everything needs to account for border width
+
+    Step 1:
+    - getPrimaryNavWidth
+    - get window.innerWidth
+    - get appContainerWidth AKA full width
+    - getPanelWidth (app container / 2)
+    - sidebarwidth (app container - sidebar)
+*/
+
+
   var Resize = function(options){
     this.options = options;
   };
@@ -33,6 +52,8 @@ function(FauxtonAPI) {
       return primaryNavWidth;
     },
 
+    getSidebarWidth: function(){},
+
     getSinglePanelWidth: function(){
       var sidebarWidth = $('#sidebar-content').length > 0 ? $('#sidebar-content').outerWidth()
: 0,
           borders = parseInt($('#dashboard').css('border-left-width'), 10) +
@@ -115,8 +136,10 @@ function(FauxtonAPI) {
         */
 
         var panelWidth = this.getPanelWidth();
+        var fullWidth = this.getPanelWidth();
         this.setPosition(panelWidth);
         $('.window-resizeable').innerWidth(panelWidth);
+        $('.window-resizeable-full').innerWidth(fullWidth);
       }
       //if there is a callback, run that
       if(this.options.callback) {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/addons/fauxton/tests/baseSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/baseSpec.js b/app/addons/fauxton/tests/baseSpec.js
index b9814bc..8a41cff 100644
--- a/app/addons/fauxton/tests/baseSpec.js
+++ b/app/addons/fauxton/tests/baseSpec.js
@@ -61,12 +61,6 @@ define([
       FauxtonAPI.masterLayout = _layout;
     });
 
-    it('Should clear breadcrumbs', function () {
-      FauxtonAPI.masterLayout = mockLayout;
-      testRouteObject.renderWith('the-route', mockLayout, 'args');
-      assert.ok(mockLayout.removeView.calledWith('#breadcrumbs'), 'Clear Breadcrumbs called');
-    });
-
     it('Should set breadcrumbs when breadcrumbs exist', function () {
       FauxtonAPI.masterLayout = mockLayout;
       testRouteObject.renderWith('the-route', mockLayout, 'args');

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/app/templates/layouts/one_pane.html
----------------------------------------------------------------------
diff --git a/app/templates/layouts/one_pane.html b/app/templates/layouts/one_pane.html
index 0bbc989..a3c770b 100644
--- a/app/templates/layouts/one_pane.html
+++ b/app/templates/layouts/one_pane.html
@@ -17,13 +17,13 @@ the License.
   <div id="global-notifications" class="container errors-container window-resizeable"></div>
   <div class="fixed-header">
     <div id="breadcrumbs"></div>
-    <div id="api-navbar"></div>
+    <div id="api-navbar" class="window-resizeable"></div>
   </div>
 
 
   <div class="row-fluid content-area">
   	<div id="tabs" class="row"></div>
-    <div id="dashboard-content" class="window-resizeable"></div>
+    <div id="dashboard-content" class="window-resizeable-full"></div>
   </div>
 </div>
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/assets/less/headers.less
----------------------------------------------------------------------
diff --git a/assets/less/headers.less b/assets/less/headers.less
index a110714..9ce3243 100644
--- a/assets/less/headers.less
+++ b/assets/less/headers.less
@@ -49,9 +49,6 @@
     }
   }
   .one-pane & {
-    #breadcrumbs{
-      width: 90%;
-    }
     position: relative;
     border: none;
     .box-shadow(none);
@@ -74,9 +71,7 @@
 
 #breadcrumbs {
   height: 60px;
-  &.sidebar{
-    width: @sidebarWidth - 4;
-  }
+  width: @sidebarWidth - 4;
   /* these styles are for the new header*/
   .header-left{
     > div{

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/6daad5d1/assets/less/templates.less
----------------------------------------------------------------------
diff --git a/assets/less/templates.less b/assets/less/templates.less
index abf1c4b..b2dc28b 100644
--- a/assets/less/templates.less
+++ b/assets/less/templates.less
@@ -342,28 +342,16 @@
   }
 }
 
-#dashboard-lower-content .view{
-  padding: 20px;
-}
 
-#dashboard-upper-content{
-  .tab-content {
-    padding-top: 70px;
-  }
-  .well{
+#dashboard-content{
+  .view {
     padding: 20px;
-    .border-radius(0);
-    .box-shadow(none);
   }
-}
-
-#dashboard-content{
   &.row-fluid,
   &.window-resizeable{
     /*remove gutter without rewriting variable*/
     margin-left: 0px;
   }
-  padding: 20px;
   .with-sidebar &{
     .left-shadow-border;
     border-right: 1px solid #999;


Mime
View raw message