Ensure optional Phoenix is optional (#39)
This commit is contained in:
parent
9aea707fcc
commit
3e3f4480fa
2 changed files with 221 additions and 211 deletions
|
@ -1,4 +1,5 @@
|
||||||
defmodule Mix.Tasks.Temple.Gen.Html do
|
if Code.ensure_loaded?(Mix.Phoenix) do
|
||||||
|
defmodule Mix.Tasks.Temple.Gen.Html do
|
||||||
@shortdoc "Generates controller, views, and context for an HTML resource in Temple"
|
@shortdoc "Generates controller, views, and context for an HTML resource in Temple"
|
||||||
|
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
|
@ -153,9 +154,15 @@ defmodule Mix.Tasks.Temple.Gen.Html do
|
||||||
Path.join([web_prefix, "templates", web_path, schema.singular, "new.html.exs"])},
|
Path.join([web_prefix, "templates", web_path, schema.singular, "new.html.exs"])},
|
||||||
{:eex, "show.html.exs",
|
{:eex, "show.html.exs",
|
||||||
Path.join([web_prefix, "templates", web_path, schema.singular, "show.html.exs"])},
|
Path.join([web_prefix, "templates", web_path, schema.singular, "show.html.exs"])},
|
||||||
{:eex, "view.ex", Path.join([web_prefix, "views", web_path, "#{schema.singular}_view.ex"])},
|
{:eex, "view.ex",
|
||||||
|
Path.join([web_prefix, "views", web_path, "#{schema.singular}_view.ex"])},
|
||||||
{:eex, "controller_test.exs",
|
{:eex, "controller_test.exs",
|
||||||
Path.join([test_prefix, "controllers", web_path, "#{schema.singular}_controller_test.exs"])}
|
Path.join([
|
||||||
|
test_prefix,
|
||||||
|
"controllers",
|
||||||
|
web_path,
|
||||||
|
"#{schema.singular}_controller_test.exs"
|
||||||
|
])}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -252,4 +259,5 @@ defmodule Mix.Tasks.Temple.Gen.Html do
|
||||||
defp error(field) do
|
defp error(field) do
|
||||||
~s{partial error_tag(form, #{inspect(field)})}
|
~s{partial error_tag(form, #{inspect(field)})}
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
defmodule Mix.Tasks.Temple.Gen.Layout do
|
if Code.ensure_loaded?(Mix.Phoenix) do
|
||||||
|
defmodule Mix.Tasks.Temple.Gen.Layout do
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
|
||||||
@shortdoc "Generates a default Phoenix layout file in Temple"
|
@shortdoc "Generates a default Phoenix layout file in Temple"
|
||||||
|
@ -26,4 +27,5 @@ defmodule Mix.Tasks.Temple.Gen.Layout do
|
||||||
defp temple_paths do
|
defp temple_paths do
|
||||||
[".", :temple]
|
[".", :temple]
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue