Changeset View
Changeset View
Standalone View
Standalone View
lib/kolab_chat/web/web.ex
- This file was moved from web/web.ex.
Show All 12 Lines | defmodule KolabChat.Web do | ||||
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 controller do | def controller do | ||||
quote do | quote do | ||||
use Phoenix.Controller | use Phoenix.Controller, namespace: KolabChat.Web | ||||
alias KolabChat.Database | alias KolabChat.Database | ||||
import KolabChat.Router.Helpers | import KolabChat.Web.Router.Helpers | ||||
import KolabChat.Gettext | import KolabChat.Web.Gettext | ||||
end | end | ||||
end | end | ||||
def view do | def view do | ||||
quote do | quote do | ||||
use Phoenix.View, root: "web/templates" | use Phoenix.View, root: "lib/kolab_chat/web/templates", | ||||
namespace: KolabChat.Web | |||||
# Import convenience functions from controllers | # Import convenience functions from controllers | ||||
import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1] | import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1] | ||||
# Use all HTML functionality (forms, tags, etc) | # Use all HTML functionality (forms, tags, etc) | ||||
use Phoenix.HTML | use Phoenix.HTML | ||||
import KolabChat.Router.Helpers | import KolabChat.Web.Router.Helpers | ||||
import KolabChat.ErrorHelpers | import KolabChat.Web.ErrorHelpers | ||||
import KolabChat.Gettext | import KolabChat.Web.Gettext | ||||
end | end | ||||
end | end | ||||
def router do | def router do | ||||
quote do | 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.Database | alias KolabChat.Database | ||||
alias KolabChat.Presence | alias KolabChat.Web.Presence | ||||
import KolabChat.Gettext | import KolabChat.Web.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 |