From a5476f90edcf5da689fb41b39b8281a98f277669 Mon Sep 17 00:00:00 2001 From: Tery Lim Date: Sat, 5 Jul 2014 14:18:21 +0800 Subject: [PATCH 1/2] Minor cleanup for convention and readability --- app/schemas/models/user.coffee | 10 +++------- server/plugins/achievements.coffee | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/schemas/models/user.coffee b/app/schemas/models/user.coffee index 08401b03b..a144494e1 100644 --- a/app/schemas/models/user.coffee +++ b/app/schemas/models/user.coffee @@ -107,7 +107,7 @@ UserSchema = c.object {}, name: {type: 'string', maxLength: 30, title: 'Link Name', description: 'What are you linking to? Ex: "Personal Website", "GitHub"', format: 'link-name'} link: c.url {title: 'Link', description: 'The URL.', default: 'http://example.com'} photoURL: {type: 'string', format: 'image-file', title: 'Profile Picture', description: 'Upload a 256x256px or larger image if you want to show a different profile picture to employers than your normal avatar.'} - curated: c.object {title: 'Curated', required: ['shortDescription','mainTag','location','education','workHistory','phoneScreenFilter','schoolFilter','locationFilter','roleFilter','seniorityFilter']}, + curated: c.object {title: 'Curated', required: ['shortDescription', 'mainTag', 'location', 'education', 'workHistory', 'phoneScreenFilter', 'schoolFilter', 'locationFilter', 'roleFilter', 'seniorityFilter']}, shortDescription: title: 'Short description' description: 'A sentence or two describing the candidate' @@ -118,17 +118,13 @@ UserSchema = c.object {}, type: 'string' location: title: 'Location' - description: "The CURRENT location of the candidate" + description: 'The CURRENT location of the candidate' type: 'string' education: title: 'Education' description: 'The main educational institution of the candidate' type: 'string' - workHistory: c.array - title: 'Work history' - description: 'One or two places the candidate has worked' - type: 'array' - , + workHistory: c.array {title: 'Work history', description: 'One or two places the candidate has worked', type: 'array'}, title: 'Workplace' type: 'string' phoneScreenFilter: diff --git a/server/plugins/achievements.coffee b/server/plugins/achievements.coffee index 0e4d448c0..431775268 100644 --- a/server/plugins/achievements.coffee +++ b/server/plugins/achievements.coffee @@ -8,7 +8,7 @@ achievements = {} module.exports = AchievablePlugin = (schema, options) -> User = require '../users/User' # Avoid mutual inclusion cycles - Achievement = require('../achievements/Achievement') + Achievement = require '../achievements/Achievement' checkForAchievement = (doc) -> collectionName = doc.constructor.modelName @@ -85,7 +85,7 @@ module.exports = AchievablePlugin = (schema, options) -> module.exports.loadAchievements = -> achievements = {} - Achievement = require('../achievements/Achievement') + Achievement = require '../achievements/Achievement' query = Achievement.find({}) query.exec (err, docs) -> _.each docs, (achievement) -> From 1f02b999426c1f732f0981cf4840baaf90daee49 Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Sun, 6 Jul 2014 20:01:47 +0200 Subject: [PATCH 2/2] Refactored showNotFound into notFoundView --- app/lib/Router.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/Router.coffee b/app/lib/Router.coffee index 357c56ddc..02d7432b9 100644 --- a/app/lib/Router.coffee +++ b/app/lib/Router.coffee @@ -44,7 +44,7 @@ module.exports = class CocoRouter extends Backbone.Router return @openRoute(args.join('/')) view = new ViewClass({}, slugOrId) view.render() - if view then @openView(view) else @showNotFound() + @openView if view then view else @notFoundView() cache: {} openRoute: (route) -> @@ -99,7 +99,7 @@ module.exports = class CocoRouter extends Backbone.Router return document.location.reload() path = "views/#{path}" ViewClass = @tryToLoadModule path - return @showNotFound() if not ViewClass + return @openView @notFoundView() if not ViewClass view = new ViewClass({}, args...) # options, then any path fragment args view.render() @openView(view) @@ -117,7 +117,7 @@ module.exports = class CocoRouter extends Backbone.Router break if ViewClass split -= 1 - return @showNotFound() if not ViewClass + return @notFoundView() if not ViewClass args = pieces[split+1..] view = new ViewClass({}, args...) # options, then any path fragment args view.render() @@ -129,7 +129,7 @@ module.exports = class CocoRouter extends Backbone.Router if error.toString().search('Cannot find module "' + path + '" from') is -1 throw error - showNotFound: -> + notFoundView: -> NotFoundView = require('views/not_found') view = new NotFoundView() view.render()