2024-09-04 10:12:36 +02:00
|
|
|
defmodule Mse25Web do
|
|
|
|
|
@moduledoc """
|
|
|
|
|
The entrypoint for defining your web interface, such
|
|
|
|
|
as controllers, components, channels, and so on.
|
|
|
|
|
|
|
|
|
|
This can be used in your application as:
|
|
|
|
|
|
|
|
|
|
use Mse25Web, :controller
|
|
|
|
|
use Mse25Web, :html
|
|
|
|
|
|
|
|
|
|
The definitions below will be executed for every controller,
|
|
|
|
|
component, etc, so keep them short and clean, focused
|
|
|
|
|
on imports, uses and aliases.
|
|
|
|
|
|
|
|
|
|
Do NOT define functions inside the quoted expressions
|
|
|
|
|
below. Instead, define additional modules and import
|
|
|
|
|
those modules here.
|
|
|
|
|
"""
|
|
|
|
|
|
2024-10-18 12:46:58 +02:00
|
|
|
def static_paths,
|
|
|
|
|
do: ~w(assets fonts images bl favicon.ico robots.txt aey.vcf app.css cv)
|
2024-09-04 10:12:36 +02:00
|
|
|
|
|
|
|
|
def router do
|
|
|
|
|
quote do
|
|
|
|
|
use Phoenix.Router, helpers: false
|
|
|
|
|
|
|
|
|
|
# Import common connection and controller functions to use in pipelines
|
|
|
|
|
import Plug.Conn
|
|
|
|
|
import Phoenix.Controller
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def controller do
|
|
|
|
|
quote do
|
|
|
|
|
use Phoenix.Controller,
|
|
|
|
|
formats: [:html, :json],
|
|
|
|
|
layouts: [html: Mse25Web.Layouts]
|
|
|
|
|
|
|
|
|
|
import Plug.Conn
|
|
|
|
|
import Mse25Web.Gettext
|
|
|
|
|
|
|
|
|
|
unquote(verified_routes())
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def html do
|
|
|
|
|
quote do
|
|
|
|
|
use Phoenix.Component
|
|
|
|
|
|
|
|
|
|
# Import convenience functions from controllers
|
|
|
|
|
import Phoenix.Controller,
|
|
|
|
|
only: [get_csrf_token: 0, view_module: 1, view_template: 1]
|
|
|
|
|
|
|
|
|
|
# Include general helpers for rendering HTML
|
|
|
|
|
unquote(html_helpers())
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
defp html_helpers do
|
|
|
|
|
quote do
|
|
|
|
|
import Phoenix.HTML
|
|
|
|
|
import Mse25Web.CoreComponents
|
|
|
|
|
import Mse25Web.Gettext
|
|
|
|
|
|
|
|
|
|
unquote(verified_routes())
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def verified_routes do
|
|
|
|
|
quote do
|
|
|
|
|
use Phoenix.VerifiedRoutes,
|
|
|
|
|
endpoint: Mse25Web.Endpoint,
|
|
|
|
|
router: Mse25Web.Router,
|
|
|
|
|
statics: Mse25Web.static_paths()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
|
When used, dispatch to the appropriate controller/live_view/etc.
|
|
|
|
|
"""
|
|
|
|
|
defmacro __using__(which) when is_atom(which) do
|
|
|
|
|
apply(__MODULE__, which, [])
|
|
|
|
|
end
|
|
|
|
|
end
|