couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [06/50] [abbrv] git commit: updated refs/heads/1867-feature-plugins to 8aad450
Date Mon, 09 Sep 2013 09:53:26 GMT
Update the addon's hello world tutorial to have routeObjects


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

Branch: refs/heads/1867-feature-plugins
Commit: ae74a332f629b8921124454a9528979ed1ae0fbe
Parents: 613c965
Author: suelockwood <deathbearbrown@gmail.com>
Authored: Tue Aug 13 11:07:57 2013 -0400
Committer: Jan Lehnardt <jan@apache.org>
Committed: Mon Sep 9 11:16:42 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/templates/fauxton/nav_bar.html |  2 +-
 src/fauxton/writing_addons.md                  | 55 ++++++++++++---------
 2 files changed, 33 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ae74a332/src/fauxton/app/templates/fauxton/nav_bar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/fauxton/nav_bar.html b/src/fauxton/app/templates/fauxton/nav_bar.html
index f851975..64a0336 100644
--- a/src/fauxton/app/templates/fauxton/nav_bar.html
+++ b/src/fauxton/app/templates/fauxton/nav_bar.html
@@ -33,7 +33,7 @@ the License.
 
     <ul id="bottom-nav-links" class="nav">
         <li data-nav-name= "Documentation">
-            <a class="fonticon-bookmark fonticon" href="http://wiki.apache.org/couchdb/">
+            <a class="fonticon-bookmark fonticon" target="_blank" href="http://docs.couchdb.org/en/latest/">
                 Documentation
             </a>
         </li>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ae74a332/src/fauxton/writing_addons.md
----------------------------------------------------------------------
diff --git a/src/fauxton/writing_addons.md b/src/fauxton/writing_addons.md
index e0a85fa..85d1e7a 100644
--- a/src/fauxton/writing_addons.md
+++ b/src/fauxton/writing_addons.md
@@ -110,28 +110,41 @@ Then define a route in `routes.js` that the addon is accessible at:
     ],
 
     function(app, FauxtonAPI, Resources) {
-      var helloRoute = function () {
-        console.log('helloRoute callback yo');
-        return {
-          layout: "one_pane",
-          crumbs: [
-            {"name": "Hello","link": "_hello"}
-          ],
-          views: {
-            "#dashboard-content": new Resources.Hello({})
-          },
-          apiUrl: 'hello'
-        };
-      };
+      var  HelloRouteObject = FauxtonAPI.RouteObject.extend({
+        layout: "one_pane",
 
-      Routes = {
-        "_hello": helloRoute
-      };
+        crumbs: [
+          {"name": "Hello","link": "_hello"}
+        ],
+
+        routes: {
+           "_hello": "helloRoute"
+        },
+
+        selectedHeader: "Hello",
+
+        roles: ["_admin"],
+
+        apiUrl:'hello',
+
+        initialize: function () {
+            //put common views used on all your routes here (eg:  sidebars )
+        },
+
+        helloRoute: function () {
+          this.setView("#dashboard-content", new Resources.Hello({}));
+        }
+      });
+
+      Resources.RouteObjects = [HelloRouteObject];
+
+      return Resources;
 
-      return Routes;
     });
 
 
+
+
 Then wire it all together in base.js:
 
     define([
@@ -141,16 +154,12 @@ Then wire it all together in base.js:
     ],
 
     function(app, FauxtonAPI, HelloRoutes) {
-      var Hello = new FauxtonAPI.addon();
-      console.log('hello from hello');
 
-      Hello.initialize = function() {
+      HelloRoutes.initialize = function() {
         FauxtonAPI.addHeaderLink({title: "Hello", href: "#_hello"});
       };
 
-      Hello.Routes = HelloRoutes;
-      console.log(Hello);
-      return Hello;
+      return HelloRoutes;
     });
 
 Once the code is in place include the add on in your `settings.json` so that it


Mime
View raw message