Changeset View
Changeset View
Standalone View
Standalone View
web/web.ex
Show All 10 Lines | defmodule KolabChat.Web do | ||||
The definitions below will be executed for every view, | The definitions below will be executed for every view, | ||||
controller, etc, so keep them short and clean, focused | controller, etc, so keep them short and clean, focused | ||||
on imports, uses and aliases. | on imports, uses and aliases. | ||||
Do NOT define functions inside the quoted expressions | Do NOT define functions inside the quoted expressions | ||||
below. | below. | ||||
""" | """ | ||||
def model do | |||||
quote do | |||||
use Ecto.Schema | |||||
import Ecto | |||||
import Ecto.Changeset | |||||
import Ecto.Query | |||||
end | |||||
end | |||||
def controller do | def controller do | ||||
quote do | quote do | ||||
use Phoenix.Controller | use Phoenix.Controller | ||||
alias KolabChat.Repo | alias KolabChat.Database | ||||
alias KolabChat.User | |||||
import Ecto | |||||
import Ecto.Query | |||||
import KolabChat.Router.Helpers | import KolabChat.Router.Helpers | ||||
import KolabChat.Gettext | import KolabChat.Gettext | ||||
end | end | ||||
end | end | ||||
def view do | def view do | ||||
quote do | quote do | ||||
Show All 16 Lines | quote do | ||||
use Phoenix.Router | use Phoenix.Router | ||||
end | end | ||||
end | end | ||||
def channel do | def channel do | ||||
quote do | quote do | ||||
use Phoenix.Channel | use Phoenix.Channel | ||||
alias KolabChat.Repo | |||||
import Ecto | |||||
import Ecto.Query | |||||
import KolabChat.Gettext | import KolabChat.Gettext | ||||
end | end | ||||
end | end | ||||
@doc """ | @doc """ | ||||
When used, dispatch to the appropriate controller/view/etc. | When used, dispatch to the appropriate controller/view/etc. | ||||
""" | """ | ||||
defmacro __using__(which) when is_atom(which) do | defmacro __using__(which) when is_atom(which) do | ||||
apply(__MODULE__, which, []) | apply(__MODULE__, which, []) | ||||
end | end | ||||
end | end |