keystonejs

Image gallery with caption using CloudinaryImage on keystonejs

末鹿安然 提交于 2019-12-11 01:36:41
问题 I'm using keystonejs and CloudinaryImages to create an Image Gallery. { type: Types.CloudinaryImages } I need the ability to add a caption to the images. I was also reading this: https://github.com/keystonejs/keystone/pull/604 but I could not figure out if this option is already in place or not. Any idea? Thanks. 回答1: I had a similar problem, I wanted to be able to give Images there own descriptions and other attributes, while also being included in a Gallery with a Gallery description. This

How to specify multiple fields in Keystone.js List Map?

喜夏-厌秋 提交于 2019-12-10 21:51:00
问题 Want to know how to specify multiple fields in Keystone.js List Map. For example, based on the Keystone Data Model documentation: http://keystonejs.com/docs/database/ var keystone = require('keystone'), Types = keystone.Field.Types; var Post = new keystone.List('Post', { autokey: { path: 'slug', from: 'title', unique: true }, map: { name: 'title' }, defaultSort: '-createdAt' }); Post.add({ title: { type: String, required: true }, state: { type: Types.Select, options: 'draft, published,

Mongoose schema types in KeystoneJS models

人盡茶涼 提交于 2019-12-10 17:19:13
问题 var keystone = require('keystone'), Types = keystone.Field.Types; var LeaderboardEntry = new keystone.List('leaderboardEntry', { autokey: { path: 'slug', from: 'publicKey playername', unique: false } }); LeaderboardEntry.add({ publicKey: { type: String, required: true, noedit: true }, playername: { type: String, required: true }, playerid: { type: String }, points: { type: Number, required: true }, /*data: { type: Mixed, required: false, unique: false },*/ publishedDate: { type: Types.Date }

How to serve a static site within keystone?

ⅰ亾dé卋堺 提交于 2019-12-10 15:38:45
问题 I have one keystone based site and a completely static one. I would like to integrate the static one into the first one. All the requests to "/" will serve the static one but requests under "/resources" would serve the keystone site. basically: "/" would serve the static folder 'site' "/resources" would serve the keystone app At the moment my structure is: public | - keystone | - site And my keystone static option is set on 'public' 'static': 'public' How would I go to set up these routes? I

How do you update a document in KeystoneJS on save click?

末鹿安然 提交于 2019-12-10 11:58:09
问题 I want to update specific fields in a document after changing another field. I've got a product code and a few fields like price and title which I get from an external api. I want to update the price and title in the document whenever someone changes the product code in the backend. First I tried using a mongoose post save hook on the schema. This resulted in an endless loop, since it kept updating and thus saving the document, after saving the document. Then I implemented a boolean to make

Add custom fieldtype in keystone.js

↘锁芯ラ 提交于 2019-12-08 01:39:04
问题 I am trying to add a hidden fieldtype called 'admin' which just has the user id of the person creating the model item. This works fine locally but for some reason doesn't work on a server. Here is what I did, maybe it is because I modified a file inside keystone/lib? /Models/Group.js var keystone = require('keystone'), Types = keystone.Field.Types; /** * Group Collection Model * ============= */ var Group = new keystone.List('Group'); Group.add({ name: { type: String, required: true, initial:

KeystoneJS之云中漫步

强颜欢笑 提交于 2019-12-06 20:45:51
Keystone是以Express和MongoDB为基础搭建的Node.js CMS和Web应用程序平台。 自从三年前接触到Node.js,我就开始定期在GitHub上搜一下跟Node.js相关的项目。搜索结果列表变得越来越长,这个开发体系也在不断的发展和完善。我眼看着其编程理念、最佳实践、开发工具、库、框架从异彩纷呈到趋于稳定,构建在Node.js平台上的应用程序也越来越多。 Keystone就是我在浏览GitHub上的搜索结果时看到的,它给我的感觉就像是几年前Java圈里的AppFuse。遵循一套开发惯例把一些精选的框架、库和工具集成到一起,可以作为项目的初始模板。但Keystone又不光是项目模板,它还可以当作一个CMS来用。Keystone就像在它的网站上所宣称的那样,“在你需要的功能上领先一步!在Node.js中,用Keystone搭建数据驱动的网站、应用程序和API是最容易的。” 你可以先去看看 用Keystone搭建的网站 。然后回来跟我们一起看看用Keystone搭建一个网站有多容易!不过我们首先还需要搭一个运行环境。 #阿里云上的Node.js ##配置云服务器ECS实例 阿里云的服务器配置很简单,分为基本配置、网络、镜像、存储、密码及购买量五大项。对于部署Node.js而言,其中唯一需要注意的就是CPU的内核数量,因为Node.js是单线程应用

Using S3File for images in KeystoneJS

老子叫甜甜 提交于 2019-12-06 13:43:35
I'd like to know if it's possible, and how much of an effort it would be to use S3File as an image field in KeystoneJS. My testing indicates that while you can indeed upload an image to an S3File, the admin interface treats it as an arbitrary file. The thing I'm missing the most is a preview function like Types.CloudinaryImage provides. Is the autogenerated admin interface easily extensible without it being ugly hacks? Or is it meant to be left untouched because of the simple fact that it already does so much for you? Looks like they intend to improve this. https://gist.github.com/JedWatson

KeystoneJS signin

只谈情不闲聊 提交于 2019-12-06 06:51:21
I am creating a keystone project and I need to provide allow or not allow users to access using the keystone signin. However, I found that keystoneJS sends a form data with email, password and csrf. This csrf is given to the user when he access to the login page. Nevertheless, what I need to do is to comunicate externally to login the user, by using an API. How can I generate the _csrf? Is there another way then generate two requests? Thanks @Sericaia, you didn't include any code or specifics on how you intend to implement your login page, so my answer will be a little vague. Keystone has an

Mongoose two level population using KeystoneJs [duplicate]

旧街凉风 提交于 2019-12-06 06:01:05
This question already has answers here : Populate nested array in mongoose (11 answers) Closed 4 years ago . I need to populate two levels down with Mongoose / Keystone, but have hit a road block. I have 3 models: Region, Country and City. Regions contains countries and countries contain cities. My models: Model Region: var Region = new keystone.List('Region'); Region.add({ name: {type: Types.Text} , countries: {type: Types.Relationship, ref: 'Country', many: true} }); Model Country var Country = new keystone.List('Country'); Country.add({ name: {type: Types.Text} , cities: {type: Types