Closed jaysylvester closed 6 months ago
After looking into it, rendering a view without a controller is a terrible idea. Even if a view isn't intended to be publicly accessible, it could be rendered directly if it doesn't have a controller sitting in front of it to receive the request. It also makes routing more confusing. A controller will remain a requirement to intercept a request.
For now at least, I think removing the requirement of putting a lone view within a folder is enough of an improvement. The other ideas have complications and don't feel entirely intuitive.
A controller with a single view can have that view placed directly within /app/patterns/views
and default to the controller's name, with alternate views specified using the controller's view directive.
Controllers with multiple views can either have all views directly within /app/patterns/views
or make use of the older directory structure (a dedicated folder matching the controller name, the default view also matching the controller name, and alternate views alongside the default view).
Remove requirement of separate folders for view templates and default to
/app/patterns/views/[controller].html
If there is a view folder for a given controller, set the default template to/app/patterns/views/[controller]/index.html
Allow the view directive to accept a file name or path:Allow rendering a view without calling a controller (look for controller, if not found, look for matching view, throw 404 otherwise).