From 66f82d53d3939dcdf4f5d47b931c8b75b3013b71 Mon Sep 17 00:00:00 2001
From: Inhji
Date: Sat, 8 Jul 2023 14:51:56 +0200
Subject: [PATCH 1/2] only show hcard if user exists
---
lib/chiya_web/components/layouts/root_public.html.heex | 2 ++
lib/chiya_web/global_assigns.ex | 7 +------
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex
index f6c56d7..be4172c 100644
--- a/lib/chiya_web/components/layouts/root_public.html.heex
+++ b/lib/chiya_web/components/layouts/root_public.html.heex
@@ -115,12 +115,14 @@
+ <%= if @profile do %>
+ <% end %>
diff --git a/lib/chiya_web/global_assigns.ex b/lib/chiya_web/global_assigns.ex
index a17330d..7068283 100644
--- a/lib/chiya_web/global_assigns.ex
+++ b/lib/chiya_web/global_assigns.ex
@@ -6,12 +6,7 @@ defmodule ChiyaWeb.GlobalAssigns do
def fetch_profile(conn, _opts) do
user = Chiya.Accounts.get_user(1)
-
- if user do
- assign(conn, :profile, user)
- else
- conn
- end
+ assign(conn, :profile, user)
end
def fetch_settings(conn, _opts) do
--
2.39.5
From c1478bbde7c9f789e9cccd7ef1d42dad829148a2 Mon Sep 17 00:00:00 2001
From: Inhji
Date: Sat, 8 Jul 2023 15:05:16 +0200
Subject: [PATCH 2/2] new error messages
---
.../controllers/error_html/404.html.heex | 18 ++++++++++++++----
.../controllers/error_html/500.html.heex | 18 ++++++++++++++----
lib/chiya_web/error.ex | 3 +--
3 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/lib/chiya_web/controllers/error_html/404.html.heex b/lib/chiya_web/controllers/error_html/404.html.heex
index 42ca532..dffc557 100644
--- a/lib/chiya_web/controllers/error_html/404.html.heex
+++ b/lib/chiya_web/controllers/error_html/404.html.heex
@@ -1,4 +1,14 @@
-<.header>
- <:title>four oh four
- <:subtitle>this page went away and never came back.
-
\ No newline at end of file
+
+
+ Not found
+
+
+
+
+
+ <.header>
+ <:title>Not found
+ <:subtitle>This page went away and never came back.
+
+
+
\ No newline at end of file
diff --git a/lib/chiya_web/controllers/error_html/500.html.heex b/lib/chiya_web/controllers/error_html/500.html.heex
index 411448e..9e23369 100644
--- a/lib/chiya_web/controllers/error_html/500.html.heex
+++ b/lib/chiya_web/controllers/error_html/500.html.heex
@@ -1,4 +1,14 @@
-<.header>
- <:title>infernal server error
- <:subtitle>server got hot and went to hell.
-
\ No newline at end of file
+
+
+ Infernal Server Error
+
+
+
+
+
+ <.header>
+ <:title>Infernal Server Error
+ <:subtitle>Server got hot and went to hell.
+
+
+
\ No newline at end of file
diff --git a/lib/chiya_web/error.ex b/lib/chiya_web/error.ex
index 4b8746f..36849a8 100644
--- a/lib/chiya_web/error.ex
+++ b/lib/chiya_web/error.ex
@@ -1,10 +1,9 @@
defmodule ChiyaWeb.Error do
import Plug.Conn, only: [put_status: 2]
- import Phoenix.Controller, only: [put_view: 2, render: 3, put_root_layout: 2]
+ import Phoenix.Controller, only: [put_view: 2, render: 3]
def render_error(conn, :not_found, assigns \\ []) do
conn
- |> put_root_layout(html: {ChiyaWeb.Layouts, :root_error})
|> put_status(:not_found)
|> put_view(ChiyaWeb.ErrorHTML)
|> render("404.html", assigns)
--
2.39.5