datocms / product-roadmap

This project is now discontinued. For feature requests, please use our community forum.
https://community.datocms.com/
19 stars 1 forks source link

Add 'is multiple of' validation on modular content type #150

Closed d-cs closed 5 years ago

d-cs commented 5 years ago

Is your feature request related to a problem? Please describe. I am currently developing a site for a photographer where there is an image grid. It would be nice to ensure that the number of images uploaded is always divisible by a set of given numbers. For instance: knowing a collection of images is always divisible by 3 and 5 means I can create grid views for mobile (single column), tablet (three columns) and desktop (five columns) - enforcing that the client puts the correct number of images in the CMS. I can add the instructions in the help text, but it would be nice to enforce the constraint in the model.

Describe the solution you'd like When creating modular content, under validations with the 'Accept only a specified number of records' option selected, an additional option is added that says 'is a multiple of'. In the input, I can enter a comma-separated list of factors I would like the total collection to be divisible by.

Describe alternatives you've considered I have considered adding it to the help text and educating the client. I have also considered truncating the number of images in the front end (not ideal as no warning to the client).

matjack1 commented 5 years ago

This is now live!