init commit
This commit is contained in:
24
lib/here_i_am_web/controllers/error_html.ex
Normal file
24
lib/here_i_am_web/controllers/error_html.ex
Normal file
@@ -0,0 +1,24 @@
|
||||
defmodule HereIAmWeb.ErrorHTML do
|
||||
@moduledoc """
|
||||
This module is invoked by your endpoint in case of errors on HTML requests.
|
||||
|
||||
See config/config.exs.
|
||||
"""
|
||||
use HereIAmWeb, :html
|
||||
|
||||
# If you want to customize your error pages,
|
||||
# uncomment the embed_templates/1 call below
|
||||
# and add pages to the error directory:
|
||||
#
|
||||
# * lib/here_i_am_web/controllers/error_html/404.html.heex
|
||||
# * lib/here_i_am_web/controllers/error_html/500.html.heex
|
||||
#
|
||||
# embed_templates "error_html/*"
|
||||
|
||||
# The default is to render a plain text page based on
|
||||
# the template name. For example, "404.html" becomes
|
||||
# "Not Found".
|
||||
def render(template, _assigns) do
|
||||
Phoenix.Controller.status_message_from_template(template)
|
||||
end
|
||||
end
|
21
lib/here_i_am_web/controllers/error_json.ex
Normal file
21
lib/here_i_am_web/controllers/error_json.ex
Normal file
@@ -0,0 +1,21 @@
|
||||
defmodule HereIAmWeb.ErrorJSON do
|
||||
@moduledoc """
|
||||
This module is invoked by your endpoint in case of errors on JSON requests.
|
||||
|
||||
See config/config.exs.
|
||||
"""
|
||||
|
||||
# If you want to customize a particular status code,
|
||||
# you may add your own clauses, such as:
|
||||
#
|
||||
# def render("500.json", _assigns) do
|
||||
# %{errors: %{detail: "Internal Server Error"}}
|
||||
# end
|
||||
|
||||
# By default, Phoenix returns the status message from
|
||||
# the template name. For example, "404.json" becomes
|
||||
# "Not Found".
|
||||
def render(template, _assigns) do
|
||||
%{errors: %{detail: Phoenix.Controller.status_message_from_template(template)}}
|
||||
end
|
||||
end
|
9
lib/here_i_am_web/controllers/page_controller.ex
Normal file
9
lib/here_i_am_web/controllers/page_controller.ex
Normal file
@@ -0,0 +1,9 @@
|
||||
defmodule HereIAmWeb.PageController do
|
||||
use HereIAmWeb, :controller
|
||||
|
||||
def home(conn, _params) do
|
||||
# The home page is often custom made,
|
||||
# so skip the default app layout.
|
||||
render(conn, :home)
|
||||
end
|
||||
end
|
10
lib/here_i_am_web/controllers/page_html.ex
Normal file
10
lib/here_i_am_web/controllers/page_html.ex
Normal file
@@ -0,0 +1,10 @@
|
||||
defmodule HereIAmWeb.PageHTML do
|
||||
@moduledoc """
|
||||
This module contains pages rendered by PageController.
|
||||
|
||||
See the `page_html` directory for all templates available.
|
||||
"""
|
||||
use HereIAmWeb, :html
|
||||
|
||||
embed_templates "page_html/*"
|
||||
end
|
12
lib/here_i_am_web/controllers/page_html/home.html.heex
Normal file
12
lib/here_i_am_web/controllers/page_html/home.html.heex
Normal file
@@ -0,0 +1,12 @@
|
||||
<.flash_group flash={@flash} />
|
||||
|
||||
<div class="container mx-auto text-center py-10">
|
||||
<article class="prose mx-auto px-4">
|
||||
<p>
|
||||
This site allows you to set an MP3 to play when your device connects to the network.
|
||||
</p>
|
||||
<a href="/devices">
|
||||
<button class="btn btn-primary mt-5">Manage Devices</button>
|
||||
</a>
|
||||
</article>
|
||||
</div>
|
Reference in New Issue
Block a user