diff --git a/Jakefile.js b/Jakefile.js index d607012..cdb440f 100755 --- a/Jakefile.js +++ b/Jakefile.js @@ -102,7 +102,12 @@ namespace('db', function() { var Client; log('- db:populate'.yellow); - + if (!JK.models) { + JK.models = {}; + ['client'].forEach(function (elem, index) { + JK.models[elem] = require('./app/models/' + elem)(JK.mongoose); + }); + } Client = JK.models.client; howMany = howMany || 50; diff --git a/app/models/client.js b/app/models/client.js index 4b90a36..e2b3885 100755 --- a/app/models/client.js +++ b/app/models/client.js @@ -1,5 +1,6 @@ module.exports = function(mongoose) { var validator = require('../../lib/validator'), + mongoose = require('mongoose'), Schema = mongoose.Schema, Client; diff --git a/public/js/views/clients/edit.js b/public/js/views/clients/edit.js index ddb39cd..4a3ea95 100755 --- a/public/js/views/clients/edit.js +++ b/public/js/views/clients/edit.js @@ -70,6 +70,7 @@ define('ClientEditView', [ that.renderErrMsg(res.errors); } else { model.trigger('save-success', model.get('_id')); + window.alert("Client informations updated "); } }, error: function(model, res) { diff --git a/public/js/views/clients/show.js b/public/js/views/clients/show.js index 02e9d92..e273924 100755 --- a/public/js/views/clients/show.js +++ b/public/js/views/clients/show.js @@ -30,6 +30,7 @@ define('ClientView', [ sync: true, success: function(model) { model.trigger('delete-success'); + window.alert("Client deleted "); }, error: function(model, res) { if (res.status === 404) {