summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuelockwood <deathbearbrown@gmail.com>2013-08-13 11:07:57 -0400
committerGarren Smith <garren.smith@gmail.com>2013-08-13 17:44:37 +0200
commit34f53f66fccb2abac63272637d3c2dd5e34314a3 (patch)
treed00cd5a5ab6f475a7a8b0129801f145a5ed497dc
parent2008c99b3031d980d77cc39c7c8ac928f7121102 (diff)
downloadcouchdb-34f53f66fccb2abac63272637d3c2dd5e34314a3.tar.gz
Update the addon's hello world tutorial to have routeObjects
-rw-r--r--src/fauxton/app/templates/fauxton/nav_bar.html2
-rw-r--r--src/fauxton/writing_addons.md55
2 files changed, 33 insertions, 24 deletions
diff --git a/src/fauxton/app/templates/fauxton/nav_bar.html b/src/fauxton/app/templates/fauxton/nav_bar.html
index f85197539..64a033646 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>
diff --git a/src/fauxton/writing_addons.md b/src/fauxton/writing_addons.md
index e0a85fae0..85d1e7a02 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