team-formalist / formalist-rb

Flexible form builder
MIT License
22 stars 4 forks source link

Add namespace and paths options to embedded form renderer #91

Closed narinda closed 2 years ago

narinda commented 3 years ago

The PR adds to options to the constructor of the EmbeddedFormRenderer, namespace and paths.

The namespace option simplifies setup by giving the option to let the renderer do the namespace filtering of the container, so you don't having to setup a new container class to do this.

The paths option lets you setup form views in folders and traverse each when looking for a key. This gives us the ability to organise the views into folders, as well as setup views for different contexts. So if, for example, there is an article template in a newsletter folder and a general folder, setting up the newsletter renderer with paths: ["newsletter", "general"] would resolve the template in the newsletter folder. But the newsletter renderer could also use the views in the general folder.

Note: I have also included a commit for the updated dry-validation support that was in another branch, as this was need to get the specs passing with dry-validation ~> 1.0