diff --git a/app/controllers/articles.server.controller.js b/app/controllers/articles.server.controller.js index 8eb757b..f23f2ab 100644 --- a/app/controllers/articles.server.controller.js +++ b/app/controllers/articles.server.controller.js @@ -99,8 +99,8 @@ exports.articleByID = function(req, res, next, id) { if (err) return next(err); if (!article) { return res.status(404).send({ - message: 'Article not found' - }); + message: 'Article not found' + }); } req.article = article; next(); diff --git a/app/controllers/users/users.password.server.controller.js b/app/controllers/users/users.password.server.controller.js index 63c20b5..765aad0 100644 --- a/app/controllers/users/users.password.server.controller.js +++ b/app/controllers/users/users.password.server.controller.js @@ -12,7 +12,7 @@ var _ = require('lodash'), nodemailer = require('nodemailer'), async = require('async'), crypto = require('crypto'); - + var smtpTransport = nodemailer.createTransport(config.mailer.options); /** diff --git a/app/tests/article.server.model.test.js b/app/tests/article.server.model.test.js index 9ced1d4..b4b76b8 100644 --- a/app/tests/article.server.model.test.js +++ b/app/tests/article.server.model.test.js @@ -58,7 +58,7 @@ describe('Article Model Unit Tests:', function() { afterEach(function(done) { Article.remove().exec(function() { - User.remove().exec(done); + User.remove().exec(done); }); }); }); diff --git a/app/tests/article.server.routes.test.js b/app/tests/article.server.routes.test.js index 55716a1..7eb5f77 100644 --- a/app/tests/article.server.routes.test.js +++ b/app/tests/article.server.routes.test.js @@ -274,7 +274,7 @@ describe('Article CRUD tests', function() { afterEach(function(done) { User.remove().exec(function() { - Article.remove().exec(done); + Article.remove().exec(done); }); }); }); diff --git a/app/views/layout.server.view.html b/app/views/layout.server.view.html index 220a200..6c03814 100644 --- a/app/views/layout.server.view.html +++ b/app/views/layout.server.view.html @@ -36,7 +36,8 @@ {% for cssFile in cssFiles %} - {% endfor %} + + {% endfor %} {% for jsFile in jsFiles %} - {% endfor %} + + {% endfor %} {% if process.env.NODE_ENV === 'development' %} diff --git a/config/env/all.js b/config/env/all.js index 66fc208..2c302c8 100644 --- a/config/env/all.js +++ b/config/env/all.js @@ -14,7 +14,7 @@ module.exports = { // The name of the MongoDB collection to store sessions in sessionCollection: 'sessions', // The session cookie settings - sessionCookie: { + sessionCookie: { path: '/', httpOnly: true, // If secure is set to true then it will cause the cookie to be set @@ -25,7 +25,7 @@ module.exports = { // Only set the maxAge to null if the cookie shouldn't be expired // at all. The cookie will expunge when the browser is closed. maxAge: null, - // To set the cookie in a specific domain uncomment the following + // To set the cookie in a specific domain uncomment the following // setting: // domain: 'yourdomain.com' }, diff --git a/public/modules/articles/controllers/articles.client.controller.js b/public/modules/articles/controllers/articles.client.controller.js index 364987e..d90ec3d 100644 --- a/public/modules/articles/controllers/articles.client.controller.js +++ b/public/modules/articles/controllers/articles.client.controller.js @@ -1,17 +1,23 @@ 'use strict'; +// Articles controller angular.module('articles').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Authentication', 'Articles', function($scope, $stateParams, $location, Authentication, Articles) { $scope.authentication = Authentication; + // Create new Article $scope.create = function() { + // Create new Article object var article = new Articles({ title: this.title, content: this.content }); + + // Redirect after save article.$save(function(response) { $location.path('articles/' + response._id); + // Clear form fields $scope.title = ''; $scope.content = ''; }, function(errorResponse) { @@ -19,6 +25,7 @@ angular.module('articles').controller('ArticlesController', ['$scope', '$statePa }); }; + // Remove existing Article $scope.remove = function(article) { if (article) { article.$remove(); @@ -35,6 +42,7 @@ angular.module('articles').controller('ArticlesController', ['$scope', '$statePa } }; + // Update existing Article $scope.update = function() { var article = $scope.article; @@ -45,10 +53,12 @@ angular.module('articles').controller('ArticlesController', ['$scope', '$statePa }); }; + // Find a list of Articles $scope.find = function() { $scope.articles = Articles.query(); }; + // Find existing Article $scope.findOne = function() { $scope.article = Articles.get({ articleId: $stateParams.articleId diff --git a/public/modules/articles/tests/articles.client.controller.test.js b/public/modules/articles/tests/articles.client.controller.test.js index 7e25c69..677cb99 100644 --- a/public/modules/articles/tests/articles.client.controller.test.js +++ b/public/modules/articles/tests/articles.client.controller.test.js @@ -2,7 +2,7 @@ (function() { // Articles Controller Spec - describe('ArticlesController', function() { + describe('Articles Controller Tests', function() { // Initialize global variables var ArticlesController, scope,