mirror of
https://github.com/ClaperCo/Claper.git
synced 2026-02-24 20:19:48 +01:00
## ⚠️ Breaking changes - S3 variables are now named: S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_REGION and S3_BUCKET - Users now have roles. Refer to the `roles` table and assign a role to a user with the `role_id` column in the `users` table. ## Features - Add Admin Panel to manage users and presentations - Add user roles: user, admin - Add `LANGUAGES` setting to configure available languages in the app - Add hideable presenter attendee count (#183 #155) - Add Hungarian translation (#161) - Add Latvian translation (#163) - Add custom S3 endpoint with `S3_SCHEME`, `S3_HOST`, `S3_PORT` and `S3_PUBLIC_URL` ## Fixes and improvements - Upgrade JS dependencies - Upgrade Elixir dependencies, including Phoenix Live View to 1.0.17 - Upgrade to Tailwind 4+ - Refactor view templates to use {} instead of <%= %> - Fix event name validation to be required - Docker image is now using Ubuntu instead of Alpine for better dependencies support - Fix scrollbar not showing in event manager when no presentation file (#164) (@aryel780) - Fix settings scroll for small screen (#168) - Fix duplicate key quiz when duplicate (#182) - Fix email change confirmation (#172) - Fix italian translation (#179) - Fix random poll choices (#184)
64 lines
1.4 KiB
Elixir
64 lines
1.4 KiB
Elixir
defmodule ClaperWeb.LayoutView do
|
|
import Phoenix.Component
|
|
use ClaperWeb, :view
|
|
|
|
# Phoenix LiveDashboard is available only in development by default,
|
|
# so we instruct Elixir to not warn if the dashboard route is missing.
|
|
@compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}}
|
|
|
|
def active_class(conn, path) do
|
|
current_path = Path.join(["/" | conn.path_info])
|
|
|
|
if path == current_path do
|
|
"bg-gray-900 text-white"
|
|
else
|
|
""
|
|
end
|
|
end
|
|
|
|
def active_live_class(conn, path) do
|
|
if path == conn.host_uri do
|
|
"bg-gray-900 text-white"
|
|
else
|
|
""
|
|
end
|
|
end
|
|
|
|
def get_section_path(conn) do
|
|
section = Enum.at(conn.path_info, 1)
|
|
|
|
case section do
|
|
"users" -> ~p"/admin/users"
|
|
"events" -> ~p"/admin/events"
|
|
"oidc_providers" -> ~p"/admin/oidc_providers"
|
|
_ -> ~p"/admin"
|
|
end
|
|
end
|
|
|
|
def active_link(%Plug.Conn{} = conn, text, opts) do
|
|
class =
|
|
[opts[:class], active_class(conn, opts[:to])]
|
|
|> Enum.filter(& &1)
|
|
|> Enum.join(" ")
|
|
|
|
opts =
|
|
opts
|
|
|> Keyword.put(:class, class)
|
|
|
|
link(text, opts)
|
|
end
|
|
|
|
def active_link(%Phoenix.LiveView.Socket{} = conn, text, opts) do
|
|
class =
|
|
[opts[:class], active_live_class(conn, opts[:to])]
|
|
|> Enum.filter(& &1)
|
|
|> Enum.join(" ")
|
|
|
|
opts =
|
|
opts
|
|
|> Keyword.put(:class, class)
|
|
|
|
link(text, opts)
|
|
end
|
|
end
|