-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d918215
commit bb09637
Showing
128 changed files
with
42,033 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = true | ||
indent_style = tab | ||
|
||
[{*.yml,*.json}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
public/js/bootstrap | ||
public/js/jquery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "keystone" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,31 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
# Dependency directory | ||
# Deployed apps should consider commenting this line out: | ||
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git | ||
node_modules | ||
|
||
# dotenv environment variables file | ||
# Ignore .env configuration files | ||
.env | ||
|
||
# Ignore .DS_Store files on OS X | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node keystone.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Simulate config options from your production environment by | ||
// customising the .env file in your project's root folder. | ||
require('dotenv').config(); | ||
|
||
// Require keystone | ||
var keystone = require('keystone'); | ||
var cons = require('consolidate'); | ||
var nunjucks = require('nunjucks'); | ||
|
||
// Initialise Keystone with your project's configuration. | ||
// See http://keystonejs.com/guide/config for available options | ||
// and documentation. | ||
|
||
keystone.init({ | ||
'name': 'david.to', | ||
'brand': 'david.to', | ||
|
||
'sass': 'public', | ||
'static': 'public', | ||
'favicon': 'public/favicon.ico', | ||
'views': 'templates/views', | ||
'view engine': '.html', | ||
'custom engine': cons.nunjucks, | ||
|
||
'auto update': true, | ||
'session': true, | ||
'auth': true, | ||
'user model': 'User', | ||
}); | ||
|
||
// Load your project's Models | ||
keystone.import('models'); | ||
|
||
// Setup common locals for your templates. The following are required for the | ||
// bundled templates and layouts. Any runtime locals (that should be set uniquely | ||
// for each request) should be added to ./routes/middleware.js | ||
keystone.set('locals', { | ||
_: require('lodash'), | ||
env: keystone.get('env'), | ||
utils: keystone.utils, | ||
editable: keystone.content.editable, | ||
}); | ||
|
||
// Load your project's Routes | ||
keystone.set('routes', require('./routes')); | ||
|
||
|
||
// Configure the navigation bar in Keystone's Admin UI | ||
keystone.set('nav', { | ||
posts: ['posts', 'post-categories'], | ||
users: 'users', | ||
}); | ||
|
||
// Start Keystone to connect to your database and initialise the web server | ||
|
||
|
||
|
||
keystone.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var keystone = require('keystone'); | ||
var Types = keystone.Field.Types; | ||
|
||
/** | ||
* Post Model | ||
* ========== | ||
*/ | ||
|
||
var Post = new keystone.List('Post', { | ||
map: { name: 'title' }, | ||
autokey: { path: 'slug', from: 'title', unique: true }, | ||
}); | ||
|
||
Post.add({ | ||
title: { type: String, required: true }, | ||
state: { type: Types.Select, options: 'draft, published, archived', default: 'draft', index: true }, | ||
author: { type: Types.Relationship, ref: 'User', index: true }, | ||
publishedDate: { type: Types.Date, index: true, dependsOn: { state: 'published' } }, | ||
image: { type: Types.CloudinaryImage }, | ||
content: { | ||
brief: { type: Types.Html, wysiwyg: true, height: 150 }, | ||
extended: { type: Types.Html, wysiwyg: true, height: 400 }, | ||
}, | ||
categories: { type: Types.Relationship, ref: 'PostCategory', many: true }, | ||
}); | ||
|
||
Post.schema.virtual('content.full').get(function () { | ||
return this.content.extended || this.content.brief; | ||
}); | ||
|
||
Post.defaultColumns = 'title, state|20%, author|20%, publishedDate|20%'; | ||
Post.register(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var keystone = require('keystone'); | ||
|
||
/** | ||
* PostCategory Model | ||
* ================== | ||
*/ | ||
|
||
var PostCategory = new keystone.List('PostCategory', { | ||
autokey: { from: 'name', path: 'key', unique: true }, | ||
}); | ||
|
||
PostCategory.add({ | ||
name: { type: String, required: true }, | ||
}); | ||
|
||
PostCategory.relationship({ ref: 'Post', path: 'posts', refPath: 'categories' }); | ||
|
||
PostCategory.register(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var keystone = require('keystone'); | ||
var Types = keystone.Field.Types; | ||
|
||
/** | ||
* User Model | ||
* ========== | ||
*/ | ||
var User = new keystone.List('User'); | ||
|
||
User.add({ | ||
name: { type: Types.Name, required: true, index: true }, | ||
email: { type: Types.Email, initial: true, required: true, unique: true, index: true }, | ||
password: { type: Types.Password, initial: true, required: true }, | ||
}, 'Permissions', { | ||
isAdmin: { type: Boolean, label: 'Can access Keystone', index: true }, | ||
}); | ||
|
||
// Provide access to Keystone | ||
User.schema.virtual('canAccessKeystone').get(function () { | ||
return this.isAdmin; | ||
}); | ||
|
||
|
||
/** | ||
* Relationships | ||
*/ | ||
User.relationship({ ref: 'Post', path: 'posts', refPath: 'author' }); | ||
|
||
|
||
/** | ||
* Registration | ||
*/ | ||
User.defaultColumns = 'name, email, isAdmin'; | ||
User.register(); |
Oops, something went wrong.