Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listFor: function(opts) {
- var recordType = opts.recordType ;
- var resource = recordType.resourceURL() ; if (!resource) return false ;
- // TODO: check if the user has given a path to a view.
- // if so, call that view (with Method: GET)
- var url = resource + "/_temp_view"
- var content = {}
- var context = {
- recordType: recordType
- }
- //CHANGED
- params = {} ;
- var temp = '(doc)';
- if (opts.conditions) {
- var conditions = this._decamelizeData(opts.conditions) ;
- for(var key in conditions) {
- temp = '' + temp + ' && (doc.' + key + '==\'' + conditions[key] + '\')';
- }
- }
- //CHANGED
- content.map = "function(doc) { " +
- "if ("+temp+"){ "+
- "emit(doc._id, doc)"+
- "}}" ;
- params.requestContext = context ;
- params.url = url ;
- params.body = content ;
- params.onSuccess = this._listSuccess.bind(this) ;
- params.onNotModified = this._listNotModified.bind(this) ;
- params.onFailure = this._listFailure.bind(this) ;
- this.request(resource, this._listForAction, null, params, this._listForMethod) ;
- }
Add Comment
Please, Sign In to add comment