Merge pull request #442 from miguelcoba/issue-441

Remove unnecessary whitespace, format code, and add comments
This commit is contained in:
Ilan Biala
2015-03-01 21:20:01 -05:00
8 changed files with 22 additions and 10 deletions

View File

@@ -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();

View File

@@ -12,7 +12,7 @@ var _ = require('lodash'),
nodemailer = require('nodemailer'),
async = require('async'),
crypto = require('crypto');
var smtpTransport = nodemailer.createTransport(config.mailer.options);
/**

View File

@@ -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);
});
});
});

View File

@@ -274,7 +274,7 @@ describe('Article CRUD tests', function() {
afterEach(function(done) {
User.remove().exec(function() {
Article.remove().exec(done);
Article.remove().exec(done);
});
});
});

View File

@@ -36,7 +36,8 @@
<!--Application CSS Files-->
{% for cssFile in cssFiles %}
<link rel="stylesheet" href="{{cssFile}}">{% endfor %}
<link rel="stylesheet" href="{{cssFile}}">
{% endfor %}
<!-- HTML5 Shim -->
<!--[if lt IE 9]>
@@ -59,7 +60,8 @@
<!--Application JavaScript Files-->
{% for jsFile in jsFiles %}
<script type="text/javascript" src="{{jsFile}}"></script>{% endfor %}
<script type="text/javascript" src="{{jsFile}}"></script>
{% endfor %}
{% if process.env.NODE_ENV === 'development' %}
<!--Livereload script rendered -->

4
config/env/all.js vendored
View File

@@ -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'
},

View File

@@ -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

View File

@@ -2,7 +2,7 @@
(function() {
// Articles Controller Spec
describe('ArticlesController', function() {
describe('Articles Controller Tests', function() {
// Initialize global variables
var ArticlesController,
scope,