0

How would I go about generating a keystone list name programmatically?

I'm looking for something like this...

var Font = new keystone.List('Font', {
    // ↓↓↓ LOOK ↓↓↓ HERE ↓↓↓
    map: { name: 'typefaceName + weightName' },
    track: true,
    schema: { collection: 'Font' }
});

Font.add({
    typefaceName: { type: String, initial: true, required: true},
    weightName: { type: String , initial: true, required: true}
});

Which would generate the name, like so. enter image description here

Quinn Keaveney
  • 1,248
  • 1
  • 17
  • 39
  • haha good to see someone stuck in keystone too :D – Syed Faizan Dec 16 '15 at 07:35
  • What's the syntax for the list if you cannot do it programmatically? – Bergi Dec 16 '15 at 07:41
  • Can you expand @Bergi? I am talking about the keystone model (called lists) not a javascript list. – Quinn Keaveney Dec 17 '15 at 07:33
  • @QuinnKeaveney: What do you want to generate programmatically from what? I have no idea of keystone, but if you show us the lengthy code that works, and the code that you would like to abbreviate it to, we can help. – Bergi Dec 17 '15 at 12:41
  • @Bergi There isn't any lengthy code that works. What I am trying to do is update the value of the title field depending on the value entered in two other fields for this Keystone Model (called a list) I think you have to understand keystone to help with this.. but maybe a mongoose pro can help me do it.. – Quinn Keaveney Dec 18 '15 at 01:25
  • Ah, I thought you were asking to do something programmatically that you already know how to do manually. Then sorry :-/ – Bergi Dec 18 '15 at 01:27

0 Answers0