diff --git a/demos/couchdb_multiview/app.js b/demos/couchdb_multiview/app.js index 4929ff64..c02fe9e7 100755 --- a/demos/couchdb_multiview/app.js +++ b/demos/couchdb_multiview/app.js @@ -2,39 +2,22 @@ jQuery(function($) { window.dataExplorer = null; window.explorerDiv = $('.data-explorer-here'); - // This is some fancy stuff to allow configuring the multiview from - // parameters in the query string - // - // For more on state see the view documentation. - var state = recline.View.parseQueryString(decodeURIComponent(window.location.search)); - if (state) { - _.each(state, function(value, key) { - try { - value = JSON.parse(value); - } catch(e) {} - state[key] = value; - }); - } else { - state.url = 'demo'; - } + var queryParameters = recline.View.parseQueryString(decodeURIComponent(window.location.search)); -//Add your couchdb here!!! -//"couchdb" is what a choose for my reverse proxy. look up apache reverse or nginx reverse proxy. you need to set this up before you can connect your db -var dataset = new recline.Model.Dataset({ - db_url: '/couchdb/yourcouchdb', - view_url: '/couchdb/yourcouchdb/_design/yourdesigndoc/_view/yourview', - backend: 'couchdb', - query_options: { - 'key': '_id' - } -}); + var dataset = new recline.Model.Dataset({ + db_url: queryParameters['url'] || '/couchdb/yourcouchdb', + view_url: queryParameters['view_url'] || '/couchdb/yourcouchdb/_design/yourdesigndoc/_view/yourview', + backend: 'couchdb', + query_options: { + 'key': '_id' + } + }); - -dataset.fetch().done(function(dataset) { + dataset.fetch().done(function(dataset) { console.log('records: ' + dataset.records); -}); + }); - createExplorer(dataset, state); + createExplorer(dataset); }); // make Explorer creation / initialization in a function so we can call it diff --git a/demos/couchdb_multiview/index.html b/demos/couchdb_multiview/index.html index 18055faf..953ef283 100755 --- a/demos/couchdb_multiview/index.html +++ b/demos/couchdb_multiview/index.html @@ -1,62 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- +--- +layout: container +title: CouchDB Multiview - Demos +recline-deps: true +root: ../../ +--- +
+

Instructions

+

To use this demo you will need a CouchDB instance running and accessible over HTTP. You should then pass the following 2 query parameters to this page:

+ +
url: url-to-your-couchdb-instance
+view_url: url-to-your-couchdb-view
+
+Example:
+http://path-to-this-page/?url=/mycouchdb/&view_url=/mycouchdb/_design/yourdesigndoc/_view/yourview
+
+ +

Note that if the CouchDB database is not running on the same domain as this page then the host it is on must support CORS – the simplest approach here is probably to set up a reverse proxy or proxy so your CouchDB database appears on the local domain at e.g. /mycouchdb/.

+
+ +

Demo

+
+ - - diff --git a/demos/index.html b/demos/index.html index 9b49e6b8..31b3bd3e 100644 --- a/demos/index.html +++ b/demos/index.html @@ -10,27 +10,6 @@ root: ../ -
-
-
-

CouchDB Multiview Demo

-

You will need to modify the "app.js" file in "demos/couchdb_multiview" - to connect to your couch database. Also, don't forget to configure your - reverse proxy or proxy so you can connect to your database.

-

Multiview Demo

-

See the integrated multiview in action on a - sample dataset - the multiview incorporates most the main views - (grid, graph, map etc) into one integrated view with search, filtering - and field summaries.

-
-
-
- -
-
- -
-
@@ -77,3 +56,18 @@ root: ../
+ +
+
+
+

CouchDB Demo

+

Using CouchDB with Recline Multiview to provide an elegant powerful browser for a CouchDB database and view.

+
+
+
+ +
+
+ +
+