diff --git a/.gitignore b/.gitignore index f45f04e..2d07c48 100644 --- a/.gitignore +++ b/.gitignore @@ -25,8 +25,9 @@ erl_crash.dump # Ignore package tarball (built via "mix hex.build"). katana-*.tar -# Ignore assets that are produced by build tools. +# Ignore assets that are produced by build tools, taking into consideration our images. /priv/static/* +!/priv/static/images/ # Ignore digested assets cache. /priv/static/cache_manifest.json diff --git a/config/dev.exs b/config/dev.exs index d8137a2..0b3f453 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -23,7 +23,7 @@ config :katana, KatanaWeb.Endpoint, http: [ip: {127, 0, 0, 1}, port: 4000], check_origin: false, code_reloader: true, - debug_errors: true, + debug_errors: false, secret_key_base: "Yz7S7zILG5VpjihK8U0LZIcD0wqwDApDxbVm2/rRIevSMEnF/1HLOjeon/WjGMMh", watchers: [vite: {PhoenixVite.Npm, :run, [:vite, ~w(dev)]}], static_url: [host: "localhost", port: 5173] diff --git a/lib/katana_web.ex b/lib/katana_web.ex index 9f2052f..7df6a95 100644 --- a/lib/katana_web.ex +++ b/lib/katana_web.ex @@ -135,6 +135,8 @@ defmodule KatanaWeb do Icon } + import KatanaWeb.Helpers.UrlHelpers + alias Phoenix.LiveView.JS # Routes generation with the ~p sigil diff --git a/lib/katana_web/controllers/error_html.ex b/lib/katana_web/controllers/error_html.ex index f47b7ea..3b07dce 100644 --- a/lib/katana_web/controllers/error_html.ex +++ b/lib/katana_web/controllers/error_html.ex @@ -13,7 +13,7 @@ defmodule KatanaWeb.ErrorHTML do # * lib/katana_web/controllers/error_html/404.html.heex # * lib/katana_web/controllers/error_html/500.html.heex # - # embed_templates "error_html/*" + embed_templates "error_html/*" # The default is to render a plain text page based on # the template name. For example, "404.html" becomes diff --git a/lib/katana_web/controllers/error_html/404.html.heex b/lib/katana_web/controllers/error_html/404.html.heex new file mode 100644 index 0000000..f59dbac --- /dev/null +++ b/lib/katana_web/controllers/error_html/404.html.heex @@ -0,0 +1,54 @@ + + + + + + + <.live_title default="Page Not Found" prefix="Katana · "> + {assigns[:page_title]} + + + + + + + +
+
+ CoderDojo Braga's Logo +
+ +

404

+

+ Oops! A página que procuras não existe. +

+

+ O link pode estar desatualizado ou a página foi movida. +

+ +
+ + <.vue v-component="Button"> + Voltar à página anterior + + +
+ +
+ URL: + + {full_url(@conn)} + +
+ + +
+ + diff --git a/lib/katana_web/helpers/url_helpers.ex b/lib/katana_web/helpers/url_helpers.ex new file mode 100644 index 0000000..6feefe3 --- /dev/null +++ b/lib/katana_web/helpers/url_helpers.ex @@ -0,0 +1,30 @@ +defmodule KatanaWeb.Helpers.UrlHelpers do + @doc """ + Rebuilds the full URL string based in the information provided by the Plug.conn + """ + + def full_url(conn) do + scheme = Atom.to_string(conn.scheme) + host = conn.host + + port = + case {conn.scheme, conn.port} do + {:http, 80} -> "" + {:https, 443} -> "" + _ -> ":#{conn.port}" + end + + path = + (conn.script_name ++ conn.path_info) + |> Enum.join("/") + |> String.replace(~r{/+}, "/") + + query = + case conn.query_string do + "" -> "" + qs -> "?" <> qs + end + + "#{scheme}://#{host}#{port}/#{path}#{query}" + end +end diff --git a/priv/static/images/logo.svg b/priv/static/images/logo.svg new file mode 100644 index 0000000..35d8ed7 --- /dev/null +++ b/priv/static/images/logo.svg @@ -0,0 +1 @@ +DojoLogo \ No newline at end of file