You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/08/13 17:44:58 UTC

[3/3] git commit: updated refs/heads/master to 34f53f6

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/34f53f66
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/34f53f66
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/34f53f66

Branch: refs/heads/master
Commit: 34f53f66fccb2abac63272637d3c2dd5e34314a3
Parents: 2008c99
Author: suelockwood <de...@gmail.com>
Authored: Tue Aug 13 11:07:57 2013 -0400
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Aug 13 17:44:37 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/34f53f66/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/34f53f66/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