-
-
Save roehst/81496b27283183bb61940e1487100638 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule HelloWeb do | |
def controller do | |
quote do | |
use Phoenix.Controller, namespace: HelloWeb | |
import Plug.Conn | |
import HelloWeb.Router.Helpers | |
import HelloWeb.Gettext | |
end | |
end | |
def view do | |
quote do | |
use Phoenix.View, root: "lib/hello_web/templates", | |
namespace: HelloWeb | |
# Import convenience functions from controllers | |
import Phoenix.Controller, only: [get_flash: 2, view_module: 1] | |
# Use all HTML functionality (forms, tags, etc) | |
use Phoenix.HTML | |
import HelloWeb.Router.Helpers | |
import HelloWeb.ErrorHelpers | |
import HelloWeb.Gettext | |
end | |
end | |
def router do | |
quote do | |
use Phoenix.Router | |
import Plug.Conn | |
import Phoenix.Controller | |
end | |
end | |
def channel do | |
quote do | |
use Phoenix.Channel | |
import HelloWeb.Gettext | |
end | |
end | |
defmacro __using__(which) when is_atom(which) do | |
apply(__MODULE__, which, []) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment