couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject git commit: updated refs/heads/API-url-docs to 78e7a68
Date Mon, 07 Oct 2013 17:40:22 GMT
Updated Branches:
  refs/heads/API-url-docs ccaa657a9 -> 78e7a680f


Adding documentation to the models/collections


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

Branch: refs/heads/API-url-docs
Commit: 78e7a680f40d0d67892ff7eddba19e2980682c2e
Parents: ccaa657
Author: suelockwood <deathbearbrown@gmail.com>
Authored: Mon Oct 7 13:39:55 2013 -0400
Committer: suelockwood <deathbearbrown@gmail.com>
Committed: Mon Oct 7 13:39:55 2013 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/activetasks/resources.js |  1 +
 src/fauxton/app/addons/activetasks/routes.js    |  8 +++---
 src/fauxton/app/addons/config/resources.js      |  3 ++-
 src/fauxton/app/addons/config/routes.js         |  2 +-
 src/fauxton/app/addons/logs/resources.js        |  2 ++
 src/fauxton/app/addons/logs/routes.js           |  2 +-
 src/fauxton/app/addons/replication/resources.js |  1 +
 src/fauxton/app/addons/replication/route.js     |  3 ++-
 src/fauxton/app/addons/stats/resources.js       |  1 +
 src/fauxton/app/addons/stats/routes.js          |  4 ++-
 src/fauxton/app/helpers.js                      |  7 +++---
 src/fauxton/app/modules/databases/resources.js  |  8 +++++-
 src/fauxton/app/modules/databases/routes.js     |  2 +-
 src/fauxton/app/modules/documents/resources.js  | 26 ++++++++++++++------
 src/fauxton/app/modules/documents/routes.js     |  6 ++---
 src/fauxton/app/modules/fauxton/base.js         | 10 +++-----
 src/fauxton/app/templates/fauxton/api_bar.html  |  4 +--
 17 files changed, 57 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/activetasks/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/activetasks/resources.js b/src/fauxton/app/addons/activetasks/resources.js
index 6d892dd..5646eec 100644
--- a/src/fauxton/app/addons/activetasks/resources.js
+++ b/src/fauxton/app/addons/activetasks/resources.js
@@ -37,6 +37,7 @@ function (app, backbone, Fauxton) {
       "indexer": "Indexer",
       "view_compaction": "View Compaction"
     },
+    documentation: "_active_tasks",
     url: function () {
       return app.host + '/_active_tasks';
     },

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/activetasks/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/activetasks/routes.js b/src/fauxton/app/addons/activetasks/routes.js
index 068fa3a..e0454b7 100644
--- a/src/fauxton/app/addons/activetasks/routes.js
+++ b/src/fauxton/app/addons/activetasks/routes.js
@@ -30,23 +30,23 @@ function (app, FauxtonAPI, Activetasks, Views) {
     {"name": "Active tasks", "link": "activetasks"}
     ],
     apiUrl: function(){
-      return [app.host+"/_active_tasks", "docs"];
+      return [this.newtasks.url(), this.newtasks.documentation];
     }, 
 
     roles: ["_admin"],
 
     defaultView: function(id){
-      var newtasks = new Activetasks.Tasks({
+     this.newtasks = new Activetasks.Tasks({
         currentView: "all", 
         id:'activeTasks'
       });
       this.setView("#sidebar-content", new Views.TabMenu({
         currentView: "all",
-        model: newtasks
+        model: this.newtasks
       })); 
 
       this.setView("#dashboard-content", new Views.DataSection({
-        model: newtasks,
+        model: this.newtasks,
         currentView: "all"
       })); 
     }

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/config/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/resources.js b/src/fauxton/app/addons/config/resources.js
index db26bb7..89d2b91 100644
--- a/src/fauxton/app/addons/config/resources.js
+++ b/src/fauxton/app/addons/config/resources.js
@@ -21,7 +21,8 @@ function (app, FauxtonAPI) {
 
   Config.Model = Backbone.Model.extend({});
   Config.OptionModel = Backbone.Model.extend({
-
+    documentation: "config",
+    
     url: function () {
       return app.host + '/_config/' + this.get("section") + '/' + this.get("name");
     },

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/config/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/config/routes.js b/src/fauxton/app/addons/config/routes.js
index f521c53..6af8157 100644
--- a/src/fauxton/app/addons/config/routes.js
+++ b/src/fauxton/app/addons/config/routes.js
@@ -37,7 +37,7 @@ function(app, FauxtonAPI, Config) {
     ],
 
     apiUrl: function () {
-      this.configs.url();
+      return [this.configs.url(), this.configs.documentation];
     },
 
     routes: {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/logs/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/logs/resources.js b/src/fauxton/app/addons/logs/resources.js
index 072290b..3a47b92 100644
--- a/src/fauxton/app/addons/logs/resources.js
+++ b/src/fauxton/app/addons/logs/resources.js
@@ -51,6 +51,8 @@ function (app, FauxtonAPI, Backbone) {
     initialize: function (options) {
       this.params = {bytes: 5000};
     },
+    
+    documentation: "log",
 
     url: function () {
       query = "?" + $.param(this.params);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/logs/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/logs/routes.js b/src/fauxton/app/addons/logs/routes.js
index bc4de9a..5c937af 100644
--- a/src/fauxton/app/addons/logs/routes.js
+++ b/src/fauxton/app/addons/logs/routes.js
@@ -37,7 +37,7 @@ function(app, FauxtonAPI, Log) {
     roles: ["_admin"],
 
     apiUrl: function() {
-      return [this.logs.url(), "logs"];
+      return [this.logs.url(), this.logs.documentation];
     },
 
     initialize: function () {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/replication/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/resources.js b/src/fauxton/app/addons/replication/resources.js
index 38ae139..14f255a 100644
--- a/src/fauxton/app/addons/replication/resources.js
+++ b/src/fauxton/app/addons/replication/resources.js
@@ -59,6 +59,7 @@ function (app, FauxtonAPI, ActiveTasks) {
   });
 
   Replication.Replicate = Backbone.Model.extend({
+    documentation: "replication_doc",
     url: function(){
       return app.host + "/_replicate";
     }

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/replication/route.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/replication/route.js b/src/fauxton/app/addons/replication/route.js
index be850e9..17368f8 100644
--- a/src/fauxton/app/addons/replication/route.js
+++ b/src/fauxton/app/addons/replication/route.js
@@ -26,7 +26,7 @@ function(app, FauxtonAPI, Replication, Views) {
     },
     selectedHeader: "Replication",
     apiUrl: function() {
-      return [app.host+"/_replicate", "replication_doc"];
+      return [this.replication.url(), this.replication.documentation];
     },
     crumbs: [
       {"name": "Replicate changes from: ", "link": "replication"}
@@ -34,6 +34,7 @@ function(app, FauxtonAPI, Replication, Views) {
     defaultView: function(dbname){
 			this.databases = new Replication.DBList({});
       this.tasks = new Replication.Tasks({id: "ReplicationTasks"});
+      this.replication = new Replication.Replicate({});
 			this.setView("#dashboard-content", new Views.ReplicationForm({
         selectedDB: dbname ||"",
 				collection: this.databases,

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/stats/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/stats/resources.js b/src/fauxton/app/addons/stats/resources.js
index 94be6bb..f8f8aa6 100644
--- a/src/fauxton/app/addons/stats/resources.js
+++ b/src/fauxton/app/addons/stats/resources.js
@@ -23,6 +23,7 @@ function (app, FauxtonAPI, backbone, _, Fauxton) {
 
   Stats.Collection = Backbone.Collection.extend({
     model: Backbone.Model,
+    documentation: "stats",
     url: "/_stats",
     parse: function(resp) {
       return _.flatten(_.map(resp, function(doc, key) {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/addons/stats/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/stats/routes.js b/src/fauxton/app/addons/stats/routes.js
index 2eeced4..971c111 100644
--- a/src/fauxton/app/addons/stats/routes.js
+++ b/src/fauxton/app/addons/stats/routes.js
@@ -52,7 +52,9 @@ function(app, FauxtonAPI, Stats) {
       return [this.stats.fetch()];
     },
 
-    apiUrl: "_stats"
+    apiUrl: function(){
+      return [ this.stats.url, this.stats.documentation]; 
+    }
   });
 
   Stats.RouteObjects = [StatsRouteObject];

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/helpers.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/helpers.js b/src/fauxton/app/helpers.js
index e72422d..c1cc4fa 100644
--- a/src/fauxton/app/helpers.js
+++ b/src/fauxton/app/helpers.js
@@ -42,12 +42,13 @@ function() {
     "map_functions": "http://docs.couchdb.org/en/latest/couchapp/ddocs.html#map-functions",
     "reduce_functions": "http://docs.couchdb.org/en/latest/couchapp/ddocs.html#reduce-and-rereduce-functions",
     "api_reference": "http://docs.couchdb.org/en/latest/http-api.html",
-    "database_permission": "http://docs.couchdb.org/en/latest/api/database/security.html#db-security"
+    "database_permission": "http://docs.couchdb.org/en/latest/api/database/security.html#db-security",
+    "stats": "http://docs.couchdb.org/en/latest/api/server/common.html?highlight=stats#get--_stats",
+    "_active_tasks": "http://docs.couchdb.org/en/latest/api/server/common.html?highlight=stats#active-tasks",
+    "log": "http://docs.couchdb.org/en/latest/api/server/common.html?highlight=stats#log"
   }; 
   
   Helpers.getDocUrl = function(getthis){
-    console.log(getthis, "oh hai", Helpers.docs, "docs");
-    console.log(Helpers.docs[getthis], "inside helpers");
     return Helpers.docs[getthis] || '#';
   };
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/modules/databases/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/resources.js b/src/fauxton/app/modules/databases/resources.js
index f613cdf..9e93edf 100644
--- a/src/fauxton/app/modules/databases/resources.js
+++ b/src/fauxton/app/modules/databases/resources.js
@@ -29,6 +29,10 @@ function(app, FauxtonAPI, Documents) {
       });
     },
 
+    documentation: function(){
+      return "docs";
+    },
+    
     buildAllDocs: function(params) {
       this.allDocs = new Documents.AllDocs(null, {
         database: this,
@@ -137,7 +141,9 @@ function(app, FauxtonAPI, Documents) {
   // TODO: shared databases - read from the user doc
   Databases.List = Backbone.Collection.extend({
     model: Databases.Model,
-
+    documentation: function(){
+      return "docs";
+    },
     url: function() {
       return app.host + "/_all_dbs";
     },

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/modules/databases/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/routes.js b/src/fauxton/app/modules/databases/routes.js
index 88c52c8..ac50b4b 100644
--- a/src/fauxton/app/modules/databases/routes.js
+++ b/src/fauxton/app/modules/databases/routes.js
@@ -37,7 +37,7 @@ function(app, FauxtonAPI, Databases, Views) {
     },
 
     apiUrl: function() {
-      return [this.databases.url(), "docs"];
+      return [this.databases.url(), this.databases.documentation()];
     },
 
     selectedHeader: "Databases",

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/modules/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/resources.js b/src/fauxton/app/modules/documents/resources.js
index bbacb0f..cb9a01e 100644
--- a/src/fauxton/app/modules/documents/resources.js
+++ b/src/fauxton/app/modules/documents/resources.js
@@ -21,7 +21,9 @@ function(app, FauxtonAPI) {
 
   Documents.Doc = Backbone.Model.extend({
     idAttribute: "_id",
-
+    documentation: function(){
+      return "docs";
+    },
     url: function(context) {
       if (context === "app") {
         return this.getDatabase().url("app") + "/" + this.safeID();
@@ -191,7 +193,9 @@ function(app, FauxtonAPI) {
 
   Documents.DdocInfo = Backbone.Model.extend({
     idAttribute: "_id",
-
+    documentation: function(){
+      return "docs";
+    },
     initialize: function (_attrs, options) {
       this.database = options.database;
     },
@@ -220,7 +224,9 @@ function(app, FauxtonAPI) {
 
       return this.id.match(/^_design/) ? "design doc" : "doc";
     },
-
+    documentation: function(){
+      return "docs";
+    },
     url: function(context) {
       if (!this.isEditable()) return false;
 
@@ -249,13 +255,15 @@ function(app, FauxtonAPI) {
       });
 
       return deferred.promise();
-    },
+    }
 
   });
 
   Documents.AllDocs = Backbone.Collection.extend({
     model: Documents.Doc,
-
+    documentation: function(){
+      return "docs";
+    },
     initialize: function(_models, options) {
       this.database = options.database;
       this.params = options.params;
@@ -348,7 +356,9 @@ function(app, FauxtonAPI) {
 
   Documents.IndexCollection = Backbone.Collection.extend({
     model: Documents.ViewRow,
-
+    documentation: function(){
+      return "docs";
+    },
     initialize: function(_models, options) {
       this.database = options.database;
       this.params = _.extend({limit: 20, reduce: false}, options.params);
@@ -491,7 +501,9 @@ function(app, FauxtonAPI) {
   
   Documents.PouchIndexCollection = Backbone.Collection.extend({
     model: Documents.ViewRow,
-
+    documentation: function(){
+      return "docs";
+    },
     initialize: function(_models, options) {
       this.database = options.database;
       this.rows = options.rows;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/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 4eb5bcf..572bf1f 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -111,7 +111,7 @@ function(app, FauxtonAPI, Documents, Databases) {
     },
 
     apiUrl: function() {
-      return [this.doc.url(), "docs"];
+      return [this.doc.url(), this.doc.documentation()];
     }
   });
 
@@ -219,7 +219,7 @@ function(app, FauxtonAPI, Documents, Databases) {
         {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}
       ];
 
-      this.apiUrl = [this.data.database.allDocs.url(), "docs"];
+      this.apiUrl = [this.data.database.allDocs.url(), this.data.database.allDocs.documentation()
];
     },
 
     viewFn: function (databaseName, ddoc, view) {
@@ -388,7 +388,7 @@ function(app, FauxtonAPI, Documents, Databases) {
     },
 
     apiUrl: function() {
-      return [this.database.changes.url(), "docs"];
+      return [this.database.changes.url(), this.database.changes.documentation()];
     }
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/modules/fauxton/base.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/modules/fauxton/base.js
index f76a7f6..da70b7b 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -190,7 +190,7 @@ function(app, Backbone, resizeColumns) {
     template: "templates/fauxton/api_bar",
     endpoint: '_all_docs',
 
-    docs: 'docs',
+    documentation: 'docs',
 
     events:  {
       "click .api-url-btn" : "toggleAPIbar"
@@ -211,18 +211,14 @@ function(app, Backbone, resizeColumns) {
     serialize: function() {
       return {
         endpoint: this.endpoint,
-        docname: this.docs
+        documentation: this.documentation
       };
     },
 
     update: function(endpoint) {
-      console.log(endpoint);
-      // Take endpoint and write it into the api bar.
-      console.log('ApiBar endpoint: ' + endpoint);
       this.endpoint = endpoint[0];
-      this.docs = endpoint[1];
+      this.documentation = endpoint[1];
       this.render();
-      console.log(this.docs, "docs");
     }
 
   });

http://git-wip-us.apache.org/repos/asf/couchdb/blob/78e7a680/src/fauxton/app/templates/fauxton/api_bar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/api_bar.html b/src/fauxton/app/templates/fauxton/api_bar.html
index bc6dee1..1f03a2c 100644
--- a/src/fauxton/app/templates/fauxton/api_bar.html
+++ b/src/fauxton/app/templates/fauxton/api_bar.html
@@ -19,8 +19,8 @@ the License.
 <div class="api-navbar" style="display: none">
     <div class="input-prepend input-append">
       <span class="add-on">
-        API reference  sjlhjlhdsfhjksdfhjkdshjkfdshkfsdkhjdjskh <%=docs%>
-        <a href="<%=getDocUrl('replication_doc')%>" target="_blank">
+        API reference
+        <a href="<%=getDocUrl(documentation)%>" target="_blank">
           <i class="icon-question-sign"></i>
         </a>
       </span>


Mime
View raw message