Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Fixing Indentation Convention to TABS
Browse files Browse the repository at this point in the history
  • Loading branch information
amoshaviv committed Feb 10, 2014
1 parent eae6f2d commit c1213e9
Show file tree
Hide file tree
Showing 18 changed files with 417 additions and 422 deletions.
7 changes: 1 addition & 6 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"directory": "public/lib",
"storage": {
"packages": ".bower-cache",
"registry": ".bower-registry"
},
"tmp": ".bower-tmp"
"directory": "public/lib"
}
78 changes: 39 additions & 39 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"browser": true, // Standard browser globals e.g. `window`, `document`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": false, // Require {} for every new block or scope.
"eqeqeq": true, // Require triple equals i.e. `===`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef": true, // Prohibit variable use before definition.
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"quotmark": "single", // Define quotes to string values.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
"undef": true, // Require all non-global variables be declared before they are used.
"unused": false, // Warn unused variables.
"strict": true, // Require `use strict` pragma in every file.
"trailing": true, // Prohibit trailing whitespaces.
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
"globals": { // Globals variables.
"angular": true,
"ApplicationConfiguration": true
},
"predef": [ // Extra globals.
"define",
"require",
"exports",
"module",
"describe",
"before",
"beforeEach",
"after",
"afterEach",
"it",
"inject",
"expect"
],
"indent": 4, // Specify indentation spacing
"devel": true, // Allow development statements e.g. `console.log();`.
"noempty": true // Prohibit use of empty blocks.
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"browser": true, // Standard browser globals e.g. `window`, `document`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": false, // Require {} for every new block or scope.
"eqeqeq": true, // Require triple equals i.e. `===`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef": true, // Prohibit variable use before definition.
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"quotmark": "single", // Define quotes to string values.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
"undef": true, // Require all non-global variables be declared before they are used.
"unused": false, // Warn unused variables.
"strict": true, // Require `use strict` pragma in every file.
"trailing": true, // Prohibit trailing whitespaces.
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
"globals": { // Globals variables.
"angular": true,
"ApplicationConfiguration": true
},
"predef": [ // Extra globals.
"define",
"require",
"exports",
"module",
"describe",
"before",
"beforeEach",
"after",
"afterEach",
"it",
"inject",
"expect"
],
"indent": 4, // Specify indentation spacing
"devel": true, // Allow development statements e.g. `console.log();`.
"noempty": true // Prohibit use of empty blocks.
}
110 changes: 55 additions & 55 deletions app/controllers/articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,104 +4,104 @@
* Module dependencies.
*/
var mongoose = require('mongoose'),
Article = mongoose.model('Article'),
_ = require('lodash');
Article = mongoose.model('Article'),
_ = require('lodash');

/**
* Create a article
*/
exports.create = function(req, res) {
var article = new Article(req.body);
article.user = req.user;
var article = new Article(req.body);
article.user = req.user;

article.save(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
article: article
});
} else {
res.jsonp(article);
}
});
article.save(function(err) {
if (err) {
return res.send('users/signup', {
errors: err.errors,
article: article
});
} else {
res.jsonp(article);
}
});
};

/**
* Show the current article
*/
exports.read = function(req, res) {
res.jsonp(req.article);
res.jsonp(req.article);
};

/**
* Update a article
*/
exports.update = function(req, res) {
var article = req.article;
var article = req.article;

article = _.extend(article, req.body);
article = _.extend(article, req.body);

article.save(function(err) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(article);
}
});
article.save(function(err) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(article);
}
});
};

/**
* Delete an article
*/
exports.delete = function(req, res) {
var article = req.article;
var article = req.article;

article.remove(function(err) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(article);
}
});
article.remove(function(err) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(article);
}
});
};

/**
* List of Articles
*/
exports.list = function(req, res) {
Article.find().sort('-created').populate('user', 'displayName').exec(function(err, articles) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(articles);
}
});
Article.find().sort('-created').populate('user', 'displayName').exec(function(err, articles) {
if (err) {
res.render('error', {
status: 500
});
} else {
res.jsonp(articles);
}
});
};

/**
* Article middleware
*/
exports.articleByID = function(req, res, next, id) {
Article.load(id, function(err, article) {
if (err) return next(err);
if (!article) return next(new Error('Failed to load article ' + id));
req.article = article;
next();
});
Article.load(id, function(err, article) {
if (err) return next(err);
if (!article) return next(new Error('Failed to load article ' + id));
req.article = article;
next();
});
};

/**
* Article authorization middleware
*/
exports.hasAuthorization = function(req, res, next) {
if (req.article.user.id !== req.user.id) {
return res.send(403, 'User is not authorized');
}
next();
if (req.article.user.id !== req.user.id) {
return res.send(403, 'User is not authorized');
}
next();
};
6 changes: 3 additions & 3 deletions app/controllers/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Module dependencies.
*/
exports.index = function(req, res) {
res.render('index.html', {
res.render('index.html', {
user: req.user || null
});
};
});
};
50 changes: 25 additions & 25 deletions app/models/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,48 @@
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
Schema = mongoose.Schema;

/**
* Article Schema
*/
var ArticleSchema = new Schema({
created: {
type: Date,
default: Date.now
},
title: {
type: String,
default: '',
trim: true
},
content: {
type: String,
default: '',
trim: true
},
user: {
type: Schema.ObjectId,
ref: 'User'
}
created: {
type: Date,
default: Date.now
},
title: {
type: String,
default: '',
trim: true
},
content: {
type: String,
default: '',
trim: true
},
user: {
type: Schema.ObjectId,
ref: 'User'
}
});

/**
* Validations
*/
ArticleSchema.path('title').validate(function(title) {
return title.length;
return title.length;
}, 'Title cannot be blank');

/**
* Statics
*/
ArticleSchema.statics = {
load: function(id, cb) {
this.findOne({
_id: id
}).populate('user', 'displayName').exec(cb);
}
load: function(id, cb) {
this.findOne({
_id: id
}).populate('user', 'displayName').exec(cb);
}
};

mongoose.model('Article', ArticleSchema);
10 changes: 5 additions & 5 deletions app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ var UserSchema = new Schema({
firstName: {
type: String,
default: '',
trim: true
trim: true
},
lastName: {
type: String,
default: '',
trim: true
trim: true
},
displayName: {
type: String,
default: '',
trim: true
trim: true
},
email: {
type: String,
default: '',
trim: true,
trim: true,
unique: true
},
username: {
type: String,
default: '',
trim: true,
trim: true,
unique: true
},
provider: {
Expand Down
Loading

0 comments on commit c1213e9

Please sign in to comment.