Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3C9DA17A51 for ; Fri, 20 Feb 2015 00:26:35 +0000 (UTC) Received: (qmail 52284 invoked by uid 500); 20 Feb 2015 00:26:34 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 52126 invoked by uid 500); 20 Feb 2015 00:26:34 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 51644 invoked by uid 99); 20 Feb 2015 00:26:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Feb 2015 00:26:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 550B5E0AC5; Fri, 20 Feb 2015 00:26:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kxepal@apache.org To: commits@couchdb.apache.org Date: Fri, 20 Feb 2015 00:26:43 -0000 Message-Id: In-Reply-To: <941ff08aa66a461baf5fc03ec33ebb8a@git.apache.org> References: <941ff08aa66a461baf5fc03ec33ebb8a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/26] documentation commit: updated refs/heads/master to 5a81ace src/fauxton now follows the style Project: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/commit/317a7c85 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/tree/317a7c85 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/diff/317a7c85 Branch: refs/heads/master Commit: 317a7c854e1f29859d8644f86debbce3a205f433 Parents: 805c32e Author: Maria Andersson Authored: Fri Feb 6 22:21:17 2015 +0100 Committer: Maria Andersson Committed: Fri Feb 6 22:21:17 2015 +0100 ---------------------------------------------------------------------- src/fauxton/addons.rst | 112 +++++++++++++++++++++---------------------- src/fauxton/index.rst | 5 +- src/fauxton/install.rst | 32 +++++-------- 3 files changed, 69 insertions(+), 80 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-documentation/blob/317a7c85/src/fauxton/addons.rst ---------------------------------------------------------------------- diff --git a/src/fauxton/addons.rst b/src/fauxton/addons.rst index 0ca8254..edd4a65 100644 --- a/src/fauxton/addons.rst +++ b/src/fauxton/addons.rst @@ -10,7 +10,6 @@ .. License for the specific language governing permissions and limitations under .. the License. - .. _fauxton/addons: =============== @@ -20,16 +19,15 @@ Writting Addons Addons allow you to extend Fauxton for a specific use case. Usually, they have the following structure:: - + my_addon/ - | ---+ assets [optional] - | \ ---+ less - | \ ---- my_addon.less - | ---+ templates/ - | \ ---- my_addon.html - underscore template fragments - | ---- resources.js - models and collections of the addon - | ---- routes.js - URL routing for the addon - | ---- views.js - views that the model provides - + + my_addon/ + | ---+ assets [optional] + | \ ---+ less + | \ ---- my_addon.less + | ---+ templates/ + | \ ---- my_addon.html - underscore template fragments + | ---- resources.js - models and collections of the addon + | ---- routes.js - URL routing for the addon + | ---- views.js - views that the model provides Generating an Addon =================== @@ -77,14 +75,14 @@ selector for a named set of routes, for example: var Search = new FauxtonAPI.addon(); Search.hooks = { - // Render additional content into the sidebar - "#sidebar-content": { - routes:[ - "database/:database/_design/:ddoc/_search/:search", - "database/:database/_design/:ddoc/_view/:view", - "database/:database/_:handler"], - callback: searchSidebar - } + // Render additional content into the sidebar + "#sidebar-content": { + routes:[ + "database/:database/_design/:ddoc/_search/:search", + "database/:database/_design/:ddoc/_view/:view", + "database/:database/_:handler"], + callback: searchSidebar + } }; return Search; @@ -120,75 +118,73 @@ you may want to have a views.js) that renders that template: .. code-block:: javascript define([ - "app", - "api" + "app", + "api" ], function (app, FauxtonAPI) { - var Resources = {}; + var Resources = {}; - Resources.Hello = FauxtonAPI.View.extend({ - template: "addons/hello/templates/hello" - }); + Resources.Hello = FauxtonAPI.View.extend({ + template: "addons/hello/templates/hello" + }); - return Resources; + return Resources; }); - Then define a route in `routes.js` that the addon is accessible at: .. code-block:: javascript define([ - "app", - "api", - "addons/hello/resources" + "app", + "api", + "addons/hello/resources" ], 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 helloRoute = function () { + console.log('helloRoute callback yo'); + return { + layout: "one_pane", + crumbs: [ + {"name": "Hello","link": "_hello"} + ], + views: { + "#dashboard-content": new Resources.Hello({}) + }, + apiUrl: 'hello' + }; }; - }; - Routes = { - "_hello": helloRoute - }; + Routes = { + "_hello": helloRoute + }; - return Routes; + return Routes; }); - Then wire it all together in base.js: .. code-block:: javascript define([ - "app", - "api", - "addons/hello/routes" + "app", + "api", + "addons/hello/routes" ], function(app, FauxtonAPI, HelloRoutes) { - var Hello = new FauxtonAPI.addon(); - console.log('hello from hello'); + var Hello = new FauxtonAPI.addon(); + console.log('hello from hello'); - Hello.initialize = function() { - FauxtonAPI.addHeaderLink({title: "Hello", href: "#_hello"}); - }; + Hello.initialize = function() { + FauxtonAPI.addHeaderLink({title: "Hello", href: "#_hello"}); + }; - Hello.Routes = HelloRoutes; - console.log(Hello); - return Hello; + Hello.Routes = HelloRoutes; + console.log(Hello); + return Hello; }); Once the code is in place include the add on in your `settings.json` so that it http://git-wip-us.apache.org/repos/asf/couchdb-documentation/blob/317a7c85/src/fauxton/index.rst ---------------------------------------------------------------------- diff --git a/src/fauxton/index.rst b/src/fauxton/index.rst index 850ab0a..7429a86 100644 --- a/src/fauxton/index.rst +++ b/src/fauxton/index.rst @@ -10,7 +10,6 @@ .. License for the specific language governing permissions and limitations under .. the License. - .. _fauxton: ======= @@ -19,5 +18,5 @@ Fauxton .. toctree:: - install - addons + install + addons http://git-wip-us.apache.org/repos/asf/couchdb-documentation/blob/317a7c85/src/fauxton/install.rst ---------------------------------------------------------------------- diff --git a/src/fauxton/install.rst b/src/fauxton/install.rst index 6805260..0f6b06b 100644 --- a/src/fauxton/install.rst +++ b/src/fauxton/install.rst @@ -10,7 +10,6 @@ .. License for the specific language governing permissions and limitations under .. the License. - .. _fauxton/install: ============ @@ -23,41 +22,38 @@ A recent of `node.js`_ and `npm`_ is required. .. _npm: https://npmjs.org/doc/README.html Get the source --------------- +============== Clone the CouchDB repo:: - $ git clone http://git-wip-us.apache.org/repos/asf/couchdb.git - $ cd couchdb - + $ git clone http://git-wip-us.apache.org/repos/asf/couchdb.git + $ cd couchdb Fauxton Setup -------------- +============= Install all dependencies:: - couchdb/ $ cd src/fauxton - couchdb/src/fauxton/ $ npm install - + couchdb/ $ cd src/fauxton + couchdb/src/fauxton/ $ npm install .. note:: - To avoid a npm global install add ``node_modules/.bin`` to your path:: - export PATH=./node_modules/.bin:$PATH + export PATH=./node_modules/.bin:$PATH Or just use the wrappers in ``./bin/``. Development mode, non minified files:: - ./bin/grunt couchdebug + ./bin/grunt couchdebug Or fully compiled install:: - ./bin/grunt couchdb + ./bin/grunt couchdb Dev Server ----------- +========== Using the dev server is the easiest way to use Fauxton, specially when developing for it:: @@ -65,7 +61,7 @@ developing for it:: grunt dev Deploy Fauxton --------------- +============== Deploy Fauxton to your local CouchDB instance: @@ -73,9 +69,8 @@ Deploy Fauxton to your local CouchDB instance: The Fauxton be available by http://localhost:5984/fauxton/_design/fauxton/index.html - Understang Fauxton Code layout -============================== +------------------------------ Each bit of functionality is its own separate module or addon. @@ -100,9 +95,8 @@ layout, data, breadcrumbs and api point is required for the view. .. _backbone.js: http://backbonejs.org/ .. _Backbone.layoutmanager: https://github.com/tbranyen/backbone.layoutmanager - ToDo items -========== +---------- Checkout `JIRA`_ for a list of items to do.