Comparing version 0.2.1 to 0.2.2
@@ -151,3 +151,3 @@ /*jshint camelcase:false */ | ||
*/ | ||
CrudCmd.prototype._readOne = Promise.method(function(req, res){ | ||
CrudCmd.prototype._readOne = Promise.method(function(req, res) { | ||
// attempt to fetch the record... | ||
@@ -173,3 +173,3 @@ var query = new Object(null); | ||
self.addError(res, err); | ||
res.render(this.views.view); | ||
res.render(self.views.view); | ||
throw (err); | ||
@@ -285,3 +285,8 @@ }); | ||
CrudCmd.prototype.handleError = function(req, res, redirectUrl, err) { | ||
switch(mime.extension(req.header('Accept'))) { | ||
var acceptHeader = req.header('Accept'); | ||
var accepts = null; | ||
if (acceptHeader) { | ||
accepts = mime.extension(acceptHeader); | ||
} | ||
switch(accepts) { | ||
case 'json': | ||
@@ -298,3 +303,2 @@ res.statusCode = 400; | ||
} | ||
throw err; | ||
}; |
@@ -87,4 +87,4 @@ /** | ||
this.createView.unshift(middleware); | ||
this.readOne.unshift(middleware); | ||
this.readList.unshift(middleware); | ||
this.readList.unshift(middleware); | ||
this.update.unshift(middleware); | ||
@@ -103,4 +103,4 @@ this.updateView.unshift(middleware); | ||
this.createView.push(middleware); | ||
this.readOne.push(middleware); | ||
this.readList.push(middleware); | ||
this.readList.push(middleware); | ||
this.update.push(middleware); | ||
@@ -126,8 +126,8 @@ this.updateView.push(middleware); | ||
* @param {Object} res The response Object. | ||
* @param {Function} next callback. | ||
* @protected | ||
*/ | ||
CrudCtrl.prototype._prepResponse = function(req, res) { | ||
CrudCtrl.prototype._prepResponse = function(req, res, next) { | ||
res.locals.opts = this.opts; | ||
var entity = new this.Entity(); | ||
res.locals.schema = entity.getSchema(); | ||
res.locals.schema = this.entity.getSchema(); | ||
res.locals.currentUser = req.user; | ||
@@ -137,2 +137,3 @@ // all template functions | ||
__.extend(res.locals.fn, tplHelpers); | ||
next(); | ||
}; | ||
@@ -139,0 +140,0 @@ |
@@ -35,3 +35,2 @@ /** | ||
this.entity = entity; | ||
return this._paginateMiddleware.bind(this, opts); | ||
@@ -52,3 +51,2 @@ }; | ||
res, next) { | ||
var page = sanitize(req.query.page).toInt() || 1; | ||
@@ -55,0 +53,0 @@ var limit = sanitize(req.query.show).toInt() || opts.limit; |
{ | ||
"name": "crude", | ||
"description": "Seamless CRUD control operations for node.", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "https://github.com/talksession/node-crude", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -32,2 +32,4 @@ # node-crude | ||
## Release History | ||
- **v0.2.2**, *18 Feb 2014* | ||
- Bug fixes. | ||
- **v0.2.1**, *17 Feb 2014* | ||
@@ -34,0 +36,0 @@ - Lazy instantiate Entities. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29889
732
62