Update guides to explain more about views and controllers #170
Labels
documentation
Improvements or additions to documentation
good first issue
Good for newcomers
help wanted
Extra attention is needed
Yes. So it comes from endpoint in the routing file that points to a controller. If the function in that controller returns {ok, Variables} Nova will render the view with same name like you mentioned. If you want to create a new controller you can do that with a new view with same name combination. And you will have more views.
If you want to have say one view to list users and one view to list one user profile you can do it in same controller but point to the function in the routing file. Then use tuple with three elements.
user_list.dtl user_profile.dtl
list_users(_) ->
{ok, Variables, #{view => user_list}}
user_profile(_) ->
{ok, Variables, #{view => user_profile}}
Routing could be like:
{"/user", {my_user_controller, list_users}, #{methods => [get]}}
{"/user/:userid", {my_user_controller, user_profile}, #{methods => [get]}}
The text was updated successfully, but these errors were encountered: