Skip to content

Commit

Permalink
Add html and core_components
Browse files Browse the repository at this point in the history
  • Loading branch information
axelclark committed Feb 19, 2024
1 parent 2fe3020 commit f4aaf98
Show file tree
Hide file tree
Showing 2 changed files with 708 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/ex338_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,38 @@ defmodule Ex338Web do
end
end

def html 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 while migrating to Phoenix.Component
import Phoenix.View

# Include general helpers for rendering HTML
unquote(html_helpers())
end
end

defp html_helpers do
quote do
# HTML escaping functionality
# Core UI components and translation
import Ex338Web.CoreComponents
import Ex338Web.Gettext
import Phoenix.HTML

# Shortcut for generating JS commands
alias Phoenix.LiveView.JS

# Routes generation with the ~p sigil
unquote(verified_routes())
end
end

def verified_routes do
quote do
use Phoenix.VerifiedRoutes,
Expand Down
Loading

0 comments on commit f4aaf98

Please sign in to comment.