findAll: function (store, type) {
var data, designDoc, normalizeResponse, typeString, typeViewName;
typeString = Ember.String.singularize(type.modelName);
designDoc = this.get("designDoc") || typeString;
typeViewName = this.get("typeViewName");
normalizeResponse = function (data) {
var json,
self = this;
json = {};
json[[Ember.String.pluralize(type.modelName)]] = data.rows.getEach("doc").map(function (doc) {
return self._normalizeRevision(doc);
});
return json;
};
data = {
include_docs: true,
key: "\"" + typeString + "\""
};
return this.ajax("_design/" + designDoc + "/_view/" + typeViewName, "GET", normalizeResponse, {
data: data
});
},
this.store.query('task', {state: 'active'})
query: function (store, type, query) {
var designDoc, normalizeResponse;
designDoc = query.designDoc || this.get("designDoc");
if (!query.options) {
query.options = {};
}
if (query.ids) {
return this.findMany(store, type, query.ids, query.options);
}
query.options.include_docs = true;
normalizeResponse = function (data) {
var json,
self = this;
json = {};
json[designDoc] = data.rows.getEach("doc").map(function (doc) {
return self._normalizeRevision(doc);
});
json.total_rows = data.total_rows;
if (query.options.limit) {
json.total_pages = Math.ceil(data.total_rows / query.options.limit);
}
return json;
};
return this.ajax("_design/" + designDoc + "/_view/" + query.viewName, "GET", normalizeResponse, {
context: this,
data: query.options
});
},
model: function() {
this.store.filter('task', {state: 'active'}, function(task){
return task.get('state') === 'active';
});
}
ENV['simple-auth'] = {
authorizer: 'authorizer:couchdb'
}
export function initialize(/* container, application */) {
// application.inject('route', 'foo', 'service:foo');
}
export default {
name: 'authentication',
initialize: initialize
};
import Authenticator from 'authenticators/couchdb';
import Authorizer from 'authorizers/couchdb';
export function initialize(container, application) {
application.register('authenticator:couchdb', Authenticator);
application.register('authorizer:couchdb', Authorizer);
}
export default {
name: 'authentication',
initialize: initialize
};