Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/mix/tasks/oidcc_plug.gen.controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ case Code.ensure_loaded(Igniter.Mix.Task) do
|> inspect()
|> String.trim_trailing("Controller")
|> Kernel.<>("HTML")
|> then(&Module.module_name(igniter, &1))
|> Module.parse()

html_path =
html_module_name |> inspect() |> String.split(".") |> List.last() |> Macro.underscore()
Expand Down Expand Up @@ -270,11 +270,9 @@ case Code.ensure_loaded(Igniter.Mix.Task) do
html_module_name,
Sourceror.to_string(
quote do
defmodule unquote(html_module_name) do
use unquote(web_module), :html
use unquote(web_module), :html

embed_templates(unquote("#{html_path}/*"))
end
embed_templates(unquote("#{html_path}/*"))
end
)
)
Expand Down
10 changes: 4 additions & 6 deletions test/mix/tasks/oidcc_plug.gen.controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ defmodule OidccPlug.Gen.ControllerTest do
| Test.Repo,
...|
""")
|> assert_has_patch("lib/test/test_web/auth_html.ex", """
|defmodule Test.TestWeb.AuthHTML do
| defmodule Test.TestWeb.AuthHTML do
| use TestWeb, :html
| embed_templates("auth_html/*")
| end
|> assert_has_patch("lib/test_web/controllers/auth_html.ex", """
|defmodule TestWeb.AuthHTML do
| use TestWeb, :html
| embed_templates("auth_html/*")
|end
|
""")
Expand Down