Created
August 10, 2009 22:51
-
-
Save henrypoydar/165477 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PROBLEM: | |
// A Sammy app | |
// Current code with nested view queries: | |
get('#/renderings', function() { | |
var ctx = this; | |
couchapp.design.view("renderings", { | |
include_docs: true, | |
success: function(jsona) { | |
//console.log(jsona); | |
couchapp.design.view("sketches", { | |
include_docs: true, | |
success: function(jsonb) { | |
//console.log(jsonb); | |
ctx.partial('views/renderings/index.html', {sketches: jsonb.rows.reverse(), renderings: jsona.rows.reverse()}); | |
} | |
}); | |
} | |
}); | |
}); | |
// Psuedo code I'd like to find syntax for: | |
get('#/renderings', function() { | |
var ctx = this; | |
var renderings = couchapp.design.view("renderings", {...}); | |
var sketches = couchapp.design.view("sketches", {...}); | |
ctx.partial('views/renderings/index.html', {sketches: sketches, renderings: renderings}); | |
}); | |
// SOLUTION | |
// Patched jquery.couchapp.js and jquery.couch.js to accept ajaxOptions that are passed to the db.view function, which are then merged into the $.ajax call | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment