devel #36

Merged
inhji merged 7 commits from devel into main 2023-03-31 17:35:02 +02:00
4 changed files with 51 additions and 4 deletions
Showing only changes of commit d1f4b70fe8 - Show all commits

View file

@ -57,6 +57,9 @@ defmodule ChiyaWeb do
use Phoenix.LiveView,
layout: {ChiyaWeb.Layouts, :app}
# Import admin components
import ChiyaWeb.AdminComponents
unquote(html_helpers())
end
end
@ -79,6 +82,25 @@ defmodule ChiyaWeb do
# Include general helpers for rendering HTML
unquote(html_helpers())
# Import admin components
import ChiyaWeb.AdminComponents
end
end
def html_public do
quote do
use Phoenix.Component
# Import convenience functions from controllers
import Phoenix.Controller,
only: [get_csrf_token: 0, view_module: 1, view_template: 1]
# Include general helpers for rendering HTML
unquote(html_helpers())
# Import public components
import ChiyaWeb.PublicComponents
end
end
@ -94,10 +116,9 @@ defmodule ChiyaWeb do
alias Phoenix.LiveView.JS
# Custom functions
import ChiyaWeb.AdminComponents
import ChiyaWeb.Format, only: [from_now: 1, pretty_date: 1]
alias ChiyaWeb.Markdown
# Routes generation with the ~p sigil
unquote(verified_routes())
end

View file

@ -1,6 +1,6 @@
defmodule ChiyaWeb.AdminComponents do
use Phoenix.Component
use Phoenix.Component
use Phoenix.VerifiedRoutes,
endpoint: ChiyaWeb.Endpoint,
router: ChiyaWeb.Router,
@ -8,6 +8,15 @@ defmodule ChiyaWeb.AdminComponents do
import ChiyaWeb.CoreComponents
@doc """
Renders a horizontal line
"""
def line(assigns) do
~H"""
<hr class="my-6 dark:border-gray-700" />
"""
end
@doc """
Renders a UI for uploading files
"""

View file

@ -0,0 +1,17 @@
defmodule ChiyaWeb.PublicComponents do
use Phoenix.Component
use Phoenix.VerifiedRoutes,
endpoint: ChiyaWeb.Endpoint,
router: ChiyaWeb.Router,
statics: ChiyaWeb.static_paths()
@doc """
Renders a horizontal line
"""
def line(assigns) do
~H"""
<hr class="my-6 border-theme-dim" />
"""
end
end

View file

@ -1,5 +1,5 @@
defmodule ChiyaWeb.PageHTML do
use ChiyaWeb, :html
use ChiyaWeb, :html_public
embed_templates "page_html/*"
end