var keystone = require('keystone'), Types = keystone.Field.Types; var Project = new keystone.List('Project'); Project.add({ title: { type: String, initial: true, required: true, index: true }, year: { type: Number, required: true, initial: true }, cover: { type: Types.Relationship, ref: 'Photo', required: true, initial: true }, description: { type: Types.Html, wysiwyg: true, height: 400, initial: true }, photoCount: { type: Number, required: true, initial: true }, student1: { type: Types.Relationship, ref: 'Student', initial: true }, student2: { type: Types.Relationship, ref: 'Student', initial: true }, student3: { type: Types.Relationship, ref: 'Student', initial: true }, student4: { type: Types.Relationship, ref: 'Student', initial: true }, student5: { type: Types.Relationship, ref: 'Student', initial: true }, student6: { type: Types.Relationship, ref: 'Student', initial: true }, student7: { type: Types.Relationship, ref: 'Student', initial: true }, student8: { type: Types.Relationship, ref: 'Student', initial: true }, student9: { type: Types.Relationship, ref: 'Student', initial: true }, student10: { type: Types.Relationship, ref: 'Student', initial: true }, student11: { type: Types.Relationship, ref: 'Student', initial: true }, student12: { type: Types.Relationship, ref: 'Student', initial: true }, student13: { type: Types.Relationship, ref: 'Student', initial: true }, student14: { type: Types.Relationship, ref: 'Student', initial: true }, student15: { type: Types.Relationship, ref: 'Student', initial: true }, student16: { type: Types.Relationship, ref: 'Student', initial: true }, student17: { type: Types.Relationship, ref: 'Student', initial: true }, student18: { type: Types.Relationship, ref: 'Student', initial: true }, student19: { type: Types.Relationship, ref: 'Student', initial: true }, student20: { type: Types.Relationship, ref: 'Student', initial: true },
var keystone = require('keystone'), Types = keystone.Field.Types; var Predictivemodeling = new keystone.List('Predictivemodeling', { autokey: { from: 'name', path: 'key' } }); Predictivemodeling.add({ image:{type:Types.CloudinaryImage}, text:{type:String}, subText1:{ type: String }, subText2:{ type: String }, subText3:{ type: String }, subText4:{ type: String }, subText5:{ type: String }, subText6:{ type: String }, subText7:{ type: String }, subText8:{ type: String }, subText9:{ type: String }, subText10:{ type: String }, shortString:{ type: Types.Textarea, initial: true }, heading:{type:String}, }); /** Registration ============ */ //Predictivemodeling.addPattern('standard meta'); Predictivemodeling.register();
var keystone = require('keystone'), Types = keystone.Field.Types; /** * Enquiry Model * ============= */ var Enquiry = new keystone.List('Enquiry', { nocreate: true, noedit: true }); Enquiry.add({ name: { type: Types.Name, required: true }, email: { type: Types.Email, required: true }, phone: { type: String }, enquiryType: { type: Types.Select, options: [ { value: 'message', label: 'Just leaving a message' }, { value: 'question', label: 'I\'ve got a question' }, { value: 'other', label: 'Something else...' } ] }, message: { type: Types.Markdown, required: true }, createdAt: { type: Date, default: Date.now } }); Enquiry.schema.pre('save', function(next) { this.wasNew = this.isNew; next(); });
var keystone = require('keystone'); var transform = require('model-transform'); var Types = keystone.Field.Types; var User = new keystone.List('User'); User.add({ name: { type: Types.Name, required: true, index: true }, email: { type: Types.Email, initial: true, required: 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; }); transform.toJSON(User); User.defaultColumns = 'name, email, isAdmin'; User.register();
/** * DFP Form - Tactic Model * =========== * This model mimics the TACTICS. */ var keystone = require('keystone'); var Types = keystone.Field.Types; var DFPTactic = new keystone.List('DFPTactic', { map: { name: 'advertiserName' }, defaultSort: '-advertiserName' }); DFPTactic.add({ advertiserName: { type: String }, startDate: { type: String }, endDate: { type: String }, destinationURL: { type: String }, imageSize: { type: String }, imageSize_index: { type: Number }, utmID: { type: String }, adTag: { type: String }, notes: { type: String }, order: { type: String }, //Parent Order GUID campaign: { type: String }, //Parent Campaign GUID imgGUID: { type: String }, //GUIDs to the images uploaded with the tactic. imgURL: { type: String } //URLs to the images themselves });
var _ = require('underscore'), keystone = require('keystone'), Types = keystone.Field.Types; /** * Users * ===== */ var User = new keystone.List('User'); User.add({ name: { type: Types.Name, required: true, index: true, label: 'Имя Фамилия' }, email: { type: Types.Email, initial: true, required: true, index: true }, password: { type: Types.Password, initial: true, required: false, label: 'Пароль' } }, 'Permissions', {
var path = require('path') var _ = require('underscore') var mkdirp = require('mkdirp') var keystone = require('keystone') var Types = keystone.Field.Types //autoIncrement.initialize(keystone.mongoose.connection) var Sculpture = new keystone.List('Sculpture', { defaultSort: '+createdAt' }) var imagePath = path.resolve(path.join(__dirname, '..', 'public', 'images', 'sculptures')) mkdirp(imagePath, function (er) { if (er) console.error("Failed to create image dir", imagePath) }) var audioPath = path.resolve(path.join(__dirname, '..', 'public', 'audio', 'sculptures')) mkdirp(audioPath, function (er) { if (er) console.error("Failed to create audio dir", audioPath) }) var humanId = 0 function nextHumanId () { return humanId } Sculpture.add({
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * Competition Model * ========== */ var Result = new keystone.List('Result'); Result.add({ competition: { type: Types.Relationship, initial: true, ref: 'Event', required: true }, wod: { type: Types.Relationship, filters: { competition: ':competition' }, ref: 'Wod' }, team: { type: Types.Relationship, filters: { competition: ':competition' }, ref: 'Team' }, }, 'AMRAP', { rounds: { type: Types.Number }, reps: { type: Types.Number } }, 'forTime (mm:ss)', { time: { type: Types.Text }, hasCap: { type: Types.Boolean, default: false}, capReps: { type: Types.Number } }, 'forReps', { aloneReps: { type: Types.Number } }, 'forLoad (kg)', { load: { type: Types.Text } }, 'triplet (A + B + C)', {
var keystone = require('keystone'), Types = keystone.Field.Types; /** * Gallery Model * ============= */ var Gallery = new keystone.List('Gallery', { autokey: { from: 'name', path: 'key', unique: true } }); Gallery.add({ name: { type: String, required: true }, publishedDate: { type: Date, default: Date.now }, heroImage: { type: Types.CloudinaryImage }, images: { type: Types.CloudinaryImages } }); Gallery.register();
var keystone = require('keystone'); var Types = keystone.Field.Types; var Movie = new keystone.List('Movie', { autokey: { from: 'name', path: 'key', unique: true }, label: '單一影音', }); Movie.add({ name : { type: String, required: true }, english_name : { type: String }, 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 }, image : { type: Types.CloudinaryImage }, director : { type: String }, actor : { type: Types.Html, wysiwyg: true, height: 150 }, link : { type: String }, videoTime : { type: String }, inDate : { type: Types.Date }, content : { brief : { type: Types.Html, wysiwyg: true, height: 150 }, extended: { type: Types.Html, wysiwyg: true, height: 500 }, }, // 地區 region_categories : { type: Types.Relationship, ref : 'MovieRegionCategory' }, // 主題分類 theme_categories : {
var keystone = require('keystone'), Types = keystone.Field.Types; /** * User Model * ========== */ var deps = { facebook: { 'services.facebook.isConfigured': true } } var User = new keystone.List('User'); User.add({ name: { type: Types.Name, required: true}, email: { type: Types.Email, initial: true, required: true, index: true }, password: { type: Types.Password, initial: true, required: true }, resetPasswordKey: { type: String, hidden: true }, // TODO: update with googlemaps api adress: { type: Types.Text, initial: true }, adress2: { type: Types.Text, initial: true }, city: { type: Types.Text, initial: true }, country: { type: Types.Text, initial: true, default: 'Norge' }, postCode : { type: Types.Text, initial: true }, mobile : { type: Types.Text, initial: true }, mobile2 : { type: Types.Text, initial: true }, mobile3 : { type: Types.Text, initial: true }, photo: { type: Types.CloudinaryImage }, mobileLand : {type: Types.Text, default: '47'},
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * Frontend Widget Model * =========== * Frontend Widgets are simply links to image URLs that will be posted to the front-end. * This model intended can be updated with a custom UI or the KeystoneJS backend. */ var FrontendWidget = new keystone.List('FrontendWidget', { map: { name: 'title' } }); FrontendWidget.add({ title: { type: String, required: true }, url1: { type: String }, alt1: { type: String }, attributes1: { type: String }, category: { type: String }, //Used to categorize widgets. priorityId: { type: String }, //Used to prioritize display order. url2: { type: String }, alt2: { type: String }, attributes2: { type: String }, content1: { type: String }, content2: { type: String }, content3: { type: String }, content4: { type: String }, trans1: { type: String }, //default transformaiton trans2: { type: String }
var keystone = require('keystone'), 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 } } }); 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();
const keystone = require('keystone'); const Types = keystone.Field.Types; const { definedIfOtherField, SuperPromise } = require('../utils/tools'); const Guide = new keystone.List('Guide', { autokey: { from: 'view', path: 'key', unique: true }, map: { name: 'view' }, sortable: true, }); Guide.add({ view: { type: Types.Select, initial: true, required: true, label: 'View type', options: 'main, origin, egg, interview', }, originId: { type: Types.Relationship, ref: 'Origin', label: 'Origin', dependsOn: { view: 'origin' }, watch: true, value: definedIfOtherField('originId', 'view', 'origin'), }, eggId: { type: Types.Relationship, ref: 'Egg', label: 'Egg', dependsOn: { view: 'egg' }, watch: true, value: definedIfOtherField('eggId', 'view', 'egg'), }, interviewId: { type: Types.Relationship, ref: 'Interview', label: 'Interview', dependsOn: { view: 'interview' }, watch: true, value: definedIfOtherField('interviewId', 'view', 'interview'), }, }); Guide.schema.statics.getAll = () => {
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * Channels Model * ========== */ var Channel = new keystone.List('Channel', { map: { name: 'name'}, autokey: { path: 'slug', from: 'name', unique: true }, track: { createdBy: true, createdAt: true, updatedBy: true, updatedAt: true } }); Channel.add({ name: { type: String, required: true }, }); Channel.relationship({ ref: 'Sponsor', refPath: 'channels', path: 'sponsors' }); Channel.relationship({ ref: 'Speaker', refPath: 'channels', path: 'speakers' }); Channel.relationship({ ref: 'Proposal', refPath: 'channels', path: 'proposals' }); Channel.relationship({ ref: 'Talk', refPath: 'channels', path: 'talks' }); Channel.relationship({ ref: 'Workshop', refPath: 'channels', path: 'workshops' }); Channel.defaultColumns = 'name, slug'; Channel.register();
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * Post Model * ========== */ var Post = new keystone.List('Post', { // name is displayed in admin UI map: {name: 'title'}, autokey: {path: 'slug', from: 'title', unique: true}, defaultSort: '-publishedDate' }); Post.add({ title: {label:'标题',type: String, required: true}, author: {label: '作者', type: String, default: '新闻学院'}, category: { label: '分类', type: Types.Select, options: [ {label: '公告', value: 0}, {label: '团委新闻', value: 1}, {label: '学生会新闻', value: 2}, {label: '研究生会新闻', value: 3} ], index:true, default:0, required:true }, publishedDate: {label: '发布日期', type: Types.Date, index: true,default:Date.now,format:"YYYY-MM-DD"},
var keystone = require('keystone'); var Types = keystone.Field.Types; var TypesUtils = require('../commons/types-utils.js'); /** * Post Model * ========== */ var Post = new keystone.List('Post', { map: { name: 'title' }, autokey: { path: 'slug', from: 'title', unique: true } }); // Use extra functions in commons/types-utils.js var titleImageObj = TypesUtils.createFileTypeObj('post/images/'); var postImageObj = TypesUtils.createFileTypeObj('post/images/'); Post.add({ title: { type: String, required: true }, state: { type: Types.Select, options: 'draft, published, archived', default: 'draft', index: true }, uploader: { type: Types.Relationship, ref: 'User', index: true }, publishedDate: { type: Types.Date, index: true, dependsOn: { state: 'published' } }, titleImage: titleImageObj, postImage: postImageObj, contentImage: { type: Types.LocalFiles, dest: process.cwd() + '/files/post/images/'}, content: { brief: { type: Types.Html, wysiwyg: true, height: 150 }, extended: { type: Types.Html, wysiwyg: true, height: 400 } },
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 }, priority: { type: Number } }); PostCategory.relationship({ ref: 'Post', path: 'categories' }); PostCategory.register();
/** * DFP Form - Order Model * =========== * This model covers the ORDERS */ var keystone = require('keystone'); var Types = keystone.Field.Types; var DFPOrder = new keystone.List('DFPOrder', { map: { name: 'timeStamp' }, defaultSort: '-timeStamp' }); DFPOrder.add({ formUser: { type: String }, //name phoneNumber: { type: String }, emailAddress: { type: String }, campaigns: { type: String }, //CSV of campaign GUIDs submissionStatus: { type: String }, timeStamp: {type: String }, orderNumberVD: {type: String} }); DFPOrder.defaultColumns = 'timeStamp'; DFPOrder.register();
var keystone = require('keystone'), Types = keystone.Field.Types; /** * Yanng Post Model * ========== */ var YanngPost = new keystone.List('Yanng Post', { map: { name: 'title' }, autokey: { path: 'slug', from: 'title', unique: true } }); YanngPost.add({ title: { type: String, required: true }, key: Types.Key, content: { brief: { type: Types.Html, wysiwyg: true, height: 150 }, }, }); YanngPost.schema.virtual('content.full').get(function() { return this.content.brief; }); YanngPost.defaultColumns = 'title'; YanngPost.register();
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, index: true }, password: { type: Types.Password, initial: true, required: true }, description: { type: Types.Html, wysiwyg: true, height: 150 }, avatar: { type: Types.CloudinaryImage } }, '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' });
var keystone = require('keystone'); var Types = keystone.Field.Types; var Servicedirectory = new keystone.List('Servicedirectory', { label: 'Service Direcotries', autokey: { from: 'name', path: 'key', unique: true }, map: {name:'pathway'} }); Servicedirectory.add({ pathway: { type: String, required: true, initial: true }, project: { type: Types.Select, options: 'Mentoring, EducationFund, India, Cambodia', initial: true}, nameOfProvision: { type: String, initial: true }, address: { type: String, initial: true }, contactInfo: { type: String, initial: true }, criteriaAndDescription: { type: Types.Textarea, initial: true }, notes: { type: Types.Textarea, initial: true } }); Servicedirectory.track = true; Servicedirectory.defaultColumns = 'pathway|25%, nameOfProvision|25%, address|25%, contactInfo|25%'; Servicedirectory.register();
var keystone = require('keystone'); var Types = keystone.Field.Types; var ResourcesPost = new keystone.List('ResourcesPost', { autokey: { from: 'name', path: 'key', unique: true }, label: '文章' }); ResourcesPost.add({ name: { 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 }, 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: 'ResourcesPostCategory', many: true }, }); ResourcesPost.schema.virtual('content.full').get(function () { return this.content.extended || this.content.brief; }); ResourcesPost.track = true; ResourcesPost.defaultColumns = 'name, state|20%, author|20%, publishedDate|20%'; ResourcesPost.register();
var keystone = require('keystone'); var Types = keystone.Field.Types; var Review = new keystone.List('Review', { autokey: { from: 'name', path: 'key', unique: true } }); Review.add({ user: { type: Types.Name, required: true, initial: true, index: true }, comments: { type: Types.Html, wysiwyg: true, height: 400 }, hits: { type: Number, required: false } }); Review.relationship({ ref: 'Provider',
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * Link Comments Model * =================== */ var LinkComment = new keystone.List('LinkComment', { nocreate: true }); LinkComment.add({ link: { type: Types.Relationship, ref: 'Link', index: true }, author: { type: Types.Relationship, ref: 'User', index: true }, date: { type: Types.Date, default: Date.now, index: true }, content: { type: Types.Markdown } }); /** * Registration * ============ */ LinkComment.defaultColumns = 'author, date|20%'; LinkComment.register();
var keystone = require('keystone'), Types = keystone.Field.Types; var Offering = new keystone.List('Offering', { autokey: { from: 'name', path: 'key' } }); Offering.add({ offeringImage:{type: Types.CloudinaryImage}, heading:{type:String}, }); /** Registration ============ */ Offering.addPattern('standard meta'); Offering.register();
var keystone = require('keystone'); var Types = keystone.Field.Types; /** * ListItem Model */ var ListItem = new keystone.List('ListItem', { autokey: { path: 'slug', from: 'title', unique: true } }); ListItem.add({ title: { type: String, initial: true, // Causes the field to be displayed in the Create form required: true }, state: { type: Types.Select, options: 'draft, published, expired', default: 'draft', index: true }, author: { type: Types.Relationship, ref: 'User', index: true },
/** * Created by hesk on 12/21/2014. */ var keystone = require('keystone'), Types = keystone.Field.Types; var Tokenized = new keystone.List('Tokenized', { nocreate: true, noedit: true }); Tokenized.add({ user: {type: Types.Relationship, ref: 'User'}, expire: {type: Types.Datetime}, token: {type: Types.Text}, object: { type: Types.Select, options: [ {value: 'registration', label: 'registration'}, {value: 'login', label: 'login'}, {value: 'verification-1', label: 'verification-1'}, {value: 'verification-2', label: 'verification-2'} ], default: 'registration' } }); Tokenized.defaultColumns = 'object, token, expire, user'; Tokenized.register();
var keystone = require('keystone'); var Types = keystone.Field.Types; var ShopList = new keystone.List('ShopList', { label: 'ShopList', autokey: { from: 'shopName', path: 'slug', unique: true }, map: { name: 'shopName' }, searchFields: 'shopName', defaultSort: '-createDate', sortable: true, // drilldown: 'author', track: true, defaultColumns : 'shopName, state|20%, publishedDate|20%' }); ShopList.add( { shopName:{default:null,label:'Shop List Name',required:true,type:Types.Text,note:''}, shopShortDescription:{default:null,label:'Short Description',required:false,type:Types.Text,note:''}, shopId:{ref:'Shop',default:null, initial:true,label:'Shop',required:false,type:Types.Relationship,note:''}, shopCategories:{many:true,ref:'ShopCategory',default:null,label:'Shop Categories',required:false,type:Types.Relationship,note:''}, shopListImage:{ref:'Assets',default:null,label:'Image ',required:false,type:Types.Relationship,note:''}, ribbonText:{default:null,label:'Ribbon Text',required:false,type:Types.Text,note:''}, isEndingSoon:{default:null,label:'Is Ending Soon?',required:false,type:Types.Boolean,note:''}, isFoodCourt:{default:null,label:'Is Food Court?',required:false,type:Types.Boolean,note:''}, isMostPopular:{default:null,label:'Is Most Popular?',required:false,type:Types.Boolean,note:''}, isNewDeals:{default:null,label:'Is New Deals?',required:false,type:Types.Boolean,note:''}, floorPlanIDs:{ref:'FloorPlan',default:null,label:'Floor Plan',required:false,type:Types.Relationship,note:''}, isActive:{default:null,label:'Is Active?',required:true,type:Types.Boolean,note:''}, isNeverExpired:{default:null,label:'Is Never Expired?',required:false,type:Types.Boolean,note:'', dependsOn: { isActive: true }}, expireAfter:{default:Date.now,label:'Expire After',required:false,type:Types.Date,note:'', dependsOn: { isNeverExpired: false }},
var keystone = require('keystone'), Types = keystone.Field.Types; var store = new keystone.List('Store', { map: { name: 'title' }, autokey: { path: 'slug', from: 'title', unique: true }, singular: '商家', plural: '商家' }); store.add({ title: { type: String, required: true, default: '商家名称', label: '商家名称' }, property: { type: Types.Relationship, ref: 'User', index: true, label: '物业' }, type: { type: Types.Relationship, ref: 'StoreType',