<%= if @error !== nil do %>
<p>
<%= @error %>
</p>
<% end %>
<button drab-click="login" type="button">Login</button>
defhandler login(socket, _sender) do
poke socket, error: "Test error!"
end
[error] Drab Handler failed with the following exception:
** (Phoenix.Template.UndefinedError) Could not render "lib/tgshop_web/templates/layout/app.html" for TgshopWeb.LoginView, please define a matching clause for render/2 or define a template at "lib/tgshop_web/templates/login/*". The following templates were compiled:
* index.html
Assigns:
%{conn: %Plug.Conn{adapter: {Plug.MissingAdapter, :...}, assigns: %{}, before_send: [], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "www.example.com", method: "GET", owner: nil, params: %Plug.Conn.Unfetched{aspect: :params}, path_info: [], path_params: %{}, port: 0, private: %{phoenix_action: :index, phoenix_controller: TgshopWeb.LoginController, phoenix_endpoint: TgshopWeb.Endpoint}, query_params: %Plug.Conn.Unfetched{aspect: :query_params}, query_string: "", remote_ip: nil, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [], request_path: "", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, error: "Test error!", view_module: TgshopWeb.LoginView, view_template: "lib/tgshop_web/templates/layout/app.html"}
Assigned keys: [:conn, :error, :view_module, :view_template]
(phoenix 1.4.13) lib/phoenix/template.ex:341: Phoenix.Template.raise_template_not_found/3
(phoenix 1.4.13) lib/phoenix/view.ex:410: Phoenix.View.render_to_iodata/3
(phoenix 1.4.13) lib/phoenix/view.ex:417: Phoenix.View.render_to_string/3
(drab 0.10.3) lib/drab/live.ex:692: Drab.Live.rerender_template/4
(drab 0.10.3) lib/drab/live.ex:647: Drab.Live.process_poke/9
(drab 0.10.3) lib/drab.ex:360: anonymous fn/7 in Drab.handle_event/6
I have a
login_controllerthat rendersindex.html.drabintemplates/login/with this content:I also defined the corresponding
login_commanderwith simply:When clicking the button, i got this error
What did I do wrong? Do I have to use
mix drab.gen.commander Logininstead of creating the files by hand?