Turning a keystonejs field into a sortable list

46
May 16, 2019, at 00:20 AM

I'm trying to use Keystone.js and i'm trying to make a image list be sortable by dragging and dropping. I'm not sure if this even possible.

Currently I have a artist model called mag

var mag = new keystone.List('mag', {                                                                                                          
    map: { name: 'name' },                                                                                                                        
    autokey: { from: 'name', path: 'key', unique: true }
});     

mag.add({                                                                                                                                         
    name: { type: String, required: true },                                                                                                                                                         
    heroImage: { type: Types.Relationship, ref:'Image' },                                                                                         
    images: {type: Types.Relationship, ref:'Image', many:true, sortable:true}  
});                                                                                                                                                   

Which is linked to the image model

Image.add({
    name: { type: String, required: true },
    image: { type: Types.CloudinaryImage, autoCleanup: true, required: true, initial: false, thumb:true },
    description: { type: Types.Textarea, height: 150 },
    state: { type: Types.Select, options: 'unsold, sold, archived,', default: 'unsold', index: true },
});

Is it possible to turn the images field on mag, into a sortable list? I can use the sortable attribute on a list itself, but when combining it to a field such as images, nothing happens.

READ ALSO
Scheduling a task in BotFramework

Scheduling a task in BotFramework

My scenario is I want to send an adaptive card to the user every one minuteSo, I am using the node-cron module in node to do this

14
How to save an array of objects into a mongoose db

How to save an array of objects into a mongoose db

I am trying to save a leader board made of objects nested in an arrayI want to save it in my database, but I have not been able to create the right schema and I don't think I that is the best way to go

21
How to insert a Distinct and Order in include?

How to insert a Distinct and Order in include?

i'm doing a project in nodejs (express and angular) and im finding difficulties with this sequielizeI cannot add a distinct (at the beginning of the query, i receive too much copies) and i cannot add an order by for a "include field"

19
multiple sockets on one client using angular

multiple sockets on one client using angular

I'm not even sure if this is possibleIf not, please point me in a different direction

26