elderwand 0.1.41 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -151,12 +151,11 @@ module.exports.inherit = function (child) {
151
151
  pluralName: child.pluralName,
152
152
  //menu: utils.getUserMenu(req.user),
153
153
  };
154
- data[child.singularName] = new child.model({});
155
- if (data[child.singularName]){// && data[child.singularName].canEditByUser(req.user)) {
154
+ var virtual = new child.model({});
155
+ if (virtual){// && virtual.canEditByUser(req.user)) {
156
156
  child.loadRelatedData(data, req, res, function (relatedData) {
157
157
  data.inject(relatedData);
158
158
  res.statusData = "Success"
159
- data.item = data[child.singularName]
160
159
 
161
160
 
162
161
  if(fs.existsSync(viewsDir + child.pluralName)){
@@ -311,7 +310,7 @@ module.exports.inherit = function (child) {
311
310
  if (model && model.canEditByUser(req.user)) {
312
311
  child.handleFiles(req, res, function(err){
313
312
  model.save(function (error, model) {
314
- EWLog(error, err)
313
+ //EWLog(error, err)
315
314
  if (!err && !error) {
316
315
  req.flash('success', child.title + ' Başarıyla Güncellendi');
317
316
  res.model = model
@@ -384,7 +383,7 @@ module.exports.inherit = function (child) {
384
383
  //menu: utils.getUserMenu(req.user),
385
384
  };
386
385
  data[child.singularName] = req[child.singularName];
387
- if (data[child.singularName]){// && data[child.singularName].canSeeByUser(req.user)) {
386
+ if (data[child.singularName] && data[child.singularName].canSeeByUser(req.user)) {
388
387
  child.loadRelatedData(data, req, res, function (relatedData) {
389
388
  data.inject(relatedData)
390
389
  res.statusData = "Success"
@@ -419,8 +418,8 @@ module.exports.inherit = function (child) {
419
418
  // return;
420
419
  //};
421
420
  var model = req[child.singularName];
422
- if (model){// && model.canEditByUser(req.user)) {
423
- model.remove(function (err) {
421
+ if (model && model.canEditByUser(req.user)) {
422
+ model.removeOne(function (err) {
424
423
  req.flash('info', 'Başarıyla Silindi');
425
424
  res.statusData = "Success"
426
425
  res.redirect('/' + child.pluralName);
@@ -465,7 +464,7 @@ module.exports.inherit = function (child) {
465
464
  }else{
466
465
  criteria = child.model.list(options, callback);
467
466
  }
468
- child.model.remove(criteria, function(err){
467
+ child.model.deleteMany(criteria, function(err){
469
468
  req.flash('info', 'Başarıyla Silindi');
470
469
  res.statusData = "Success"
471
470
  res.redirect('/' + child.pluralName);
@@ -569,7 +568,7 @@ module.exports.inherit = function (child) {
569
568
  mv(req.files[key].newPath, req.files[key].dataPath, next)
570
569
  }
571
570
  }, function(err){
572
- EWLog(needToSave)
571
+ //EWLog(needToSave)
573
572
  if(needToSave){
574
573
  req[child.singularName].save(next)
575
574
  }else{
@@ -377,7 +377,8 @@ module.exports = function(){
377
377
 
378
378
  addPropertyToClass(Object.prototype,"inject", function(relatedData, keys){
379
379
  if(relatedData && keys){
380
- for (var key in keys) {
380
+ for (var i in keys) {
381
+ var key = keys[i]
381
382
  this[key] = relatedData[key];
382
383
  }
383
384
  }else if (relatedData) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elderwand",
3
- "version": "0.1.41",
3
+ "version": "0.1.46",
4
4
  "description": "KLE Technologies Internal Framework",
5
5
  "main": "./node_modules/.bin/nodemon index.js",
6
6
  "scripts": {