I have one controller, for example: LessonController.
Few Views: StudentView, TeacherView, ModeratorView.
And of course, I have different folders for templates for every view. These folders contain templates with equal names but different content.
I want to keep this structure and use Drab with some of the templates.
As I can have only one Commander per Controller I faced a problem:
handlers which are not from current template throw a generic error: “An error occurred. Please contact the System Administrator.”
I know that Drab usage means that I can fully generate everything. But I want to keep this structure.
How can I maybe clarify that I want to use this particular handler only in some particular template?
Sharing with public [:handler_name] will make handlers accessible from everywhere.
But I want to use some handlers only on specific templates.
For example some handler has this: peek(socket, "show.html", :lesson)
It’s a show.html template and I want to make this handler work only on this template.
I am not sure if I understood the issue.
Handlers and commanders are the entities similar to actions and controllers in the plain Phoenix. The “normal” (not shared, public) commander is bound to the controller, so they are not bound to views or templates.
Could you please share the code and the full error from iex/log?
But in this case it would work only if the template and partials are generated with Drab.Live.EExEngine (has .drab extension). I don’t know if it would not be confusing, but by the other hand, good error message with explanation (can’t find the partial “users.html”. Try to add .drab extension instead of .eex) would do the trick.
By the other hand it would add the unnecessary complication to Drab.Element (which is supposed to be the simplest Drab’s module) and make it dependent on Drab.Live.