elderwand 0.1.38 → 0.1.43
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
|
-
|
|
155
|
-
if (
|
|
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]
|
|
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,7 +418,7 @@ module.exports.inherit = function (child) {
|
|
|
419
418
|
// return;
|
|
420
419
|
//};
|
|
421
420
|
var model = req[child.singularName];
|
|
422
|
-
if (model
|
|
421
|
+
if (model && model.canEditByUser(req.user)) {
|
|
423
422
|
model.remove(function (err) {
|
|
424
423
|
req.flash('info', 'Başarıyla Silindi');
|
|
425
424
|
res.statusData = "Success"
|
|
@@ -549,6 +548,7 @@ module.exports.inherit = function (child) {
|
|
|
549
548
|
if(req[child.singularName].walk(key) == undefined || req[child.singularName].walk(key) == null){
|
|
550
549
|
req[child.singularName].walk(key, [])
|
|
551
550
|
}
|
|
551
|
+
needToSave = true
|
|
552
552
|
if(req.files[key].isArray() ){
|
|
553
553
|
if(req[child.singularName].walk(key) == undefined || req[child.singularName].walk(key) == null){
|
|
554
554
|
req[child.singularName].walk(key, [])
|
|
@@ -568,6 +568,7 @@ module.exports.inherit = function (child) {
|
|
|
568
568
|
mv(req.files[key].newPath, req.files[key].dataPath, next)
|
|
569
569
|
}
|
|
570
570
|
}, function(err){
|
|
571
|
+
//EWLog(needToSave)
|
|
571
572
|
if(needToSave){
|
|
572
573
|
req[child.singularName].save(next)
|
|
573
574
|
}else{
|
|
@@ -76,7 +76,7 @@ exports.createEventData = function(request,response, functionType, classType){
|
|
|
76
76
|
if(!response.errors){
|
|
77
77
|
response.errors = []
|
|
78
78
|
}
|
|
79
|
-
response.on('
|
|
79
|
+
response.on('finish', function(){
|
|
80
80
|
//EWLog("close")
|
|
81
81
|
data.endTime = new Date().getTime();
|
|
82
82
|
|