Skip to content

Commit

Permalink
Add basic home page for admin endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Feb 6, 2025
1 parent 8c6f51e commit 2c23e78
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/asciinema_web/admin/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ defmodule AsciinemaWeb.Admin.Router do

live_dashboard "/dashboard", metrics: Asciinema.Telemetry
oban_dashboard("/oban")

get "/", HomeController, :show
end
end
9 changes: 9 additions & 0 deletions lib/asciinema_web/controllers/admin/home_controller.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule AsciinemaWeb.Admin.HomeController do
use AsciinemaWeb, :controller

def show(conn, _params) do
conn
|> put_layout(:admin)
|> render(:show)
end
end
5 changes: 5 additions & 0 deletions lib/asciinema_web/controllers/admin/home_html.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule AsciinemaWeb.Admin.HomeHTML do
use AsciinemaWeb, :html

embed_templates "home_html/*"
end
4 changes: 4 additions & 0 deletions lib/asciinema_web/controllers/admin/home_html/show.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<ul>
<li><a href="/dashboard">Live dashboard</a></li>
<li><a href="/oban">Oban dashboard</a></li>
</ul>
15 changes: 15 additions & 0 deletions lib/asciinema_web/templates/layout/admin.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Admin panel - asciinema</title>
</head>

<body>
<div>
{@inner_content}
</div>
</body>
</html>

0 comments on commit 2c23e78

Please sign in to comment.