Skip to content
Permalink
Browse files

add phoenix liveview

  • Loading branch information...
dnsbty committed Aug 18, 2019
1 parent 13242c3 commit 89be4e2439a6b048d354d0ee7bd62732c94f6484
@@ -1,3 +1,4 @@
/* This file is for your main application css. */

@import "./phoenix.css";
@import "../../deps/phoenix_live_view/assets/css/live_view.css";
@@ -11,6 +11,11 @@ import css from "../css/app.css"
//
import "phoenix_html"

import LiveSocket from "phoenix_live_view"

let liveSocket = new LiveSocket("/live")
liveSocket.connect()

// Import local files
//
// Local files can be imported directly using relative paths, for example:

Some generated files are not rendered by default. Learn more.

@@ -7,7 +7,8 @@
},
"dependencies": {
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html"
"phoenix_html": "file:../deps/phoenix_html",
"phoenix_live_view": "file:../deps/phoenix_live_view"
},
"devDependencies": {
"@babel/core": "^7.0.0",
@@ -12,6 +12,9 @@ config :user_admin,

# Configures the endpoint
config :user_admin, UserAdminWeb.Endpoint,
live_view: [
signing_salt: "IwFcfUnVjSG7O9hTsiJ8TgkxN3EfxGk7"
],
url: [host: "localhost"],
secret_key_base: "PfiXnmVDb7TVU67+5YysxMvkY8dBR5FOzCYMugNTfTg3o5jTNViLeR7/1ASJ7HUL",
render_errors: [view: UserAdminWeb.ErrorView, accepts: ~w(html json)],
@@ -61,7 +61,8 @@ config :user_admin, UserAdminWeb.Endpoint,
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/user_admin_web/{live,views}/.*(ex)$",
~r"lib/user_admin_web/templates/.*(eex)$"
~r"lib/user_admin_web/templates/.*(eex)$",
~r{lib/my_app_web/live/.*(ex)$}
]
]

@@ -24,6 +24,7 @@ defmodule UserAdminWeb do
import Plug.Conn
import UserAdminWeb.Gettext
alias UserAdminWeb.Router.Helpers, as: Routes
import Phoenix.LiveView.Controller, only: [live_render: 3]
end
end

@@ -42,6 +43,7 @@ defmodule UserAdminWeb do
import UserAdminWeb.ErrorHelpers
import UserAdminWeb.Gettext
alias UserAdminWeb.Router.Helpers, as: Routes
import Phoenix.LiveView, only: [live_render: 2, live_render: 3, live_link: 1, live_link: 2]
end
end

@@ -50,6 +52,7 @@ defmodule UserAdminWeb do
use Phoenix.Router
import Plug.Conn
import Phoenix.Controller
import Phoenix.LiveView.Router
end
end

@@ -1,6 +1,8 @@
defmodule UserAdminWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :user_admin

socket "/live", Phoenix.LiveView.Socket

socket "/socket", UserAdminWeb.UserSocket,
websocket: true,
longpoll: false
@@ -5,6 +5,7 @@ defmodule UserAdminWeb.Router do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug Phoenix.LiveView.Flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
@@ -36,6 +36,7 @@ defmodule UserAdmin.MixProject do
{:phoenix, "~> 1.4.9"},
{:phoenix_pubsub, "~> 1.1"},
{:phoenix_ecto, "~> 4.0"},
{:phoenix_live_view, github: "phoenixframework/phoenix_live_view"},
{:ecto_sql, "~> 3.1"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.11"},
@@ -14,6 +14,7 @@
"phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_html": {:hex, :phoenix_html, "2.13.3", "850e292ff6e204257f5f9c4c54a8cb1f6fbc16ed53d360c2b780a3d0ba333867", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.2.1", "274a4b07c4adbdd7785d45a8b0bb57634d0b4f45b18d2c508b26c0344bd59b8f", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_live_view": {:git, "https://github.com/phoenixframework/phoenix_live_view.git", "c73010597ee12c463e44d190714778a16607a9b5", []},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.2", "496c303bdf1b2e98a9d26e89af5bba3ab487ba3a3735f74bf1f4064d2a845a3e", [:mix], [], "hexpm"},
"plug": {:hex, :plug, "1.8.3", "12d5f9796dc72e8ac9614e94bda5e51c4c028d0d428e9297650d09e15a684478", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm"},
"plug_cowboy": {:hex, :plug_cowboy, "2.1.0", "b75768153c3a8a9e8039d4b25bb9b14efbc58e9c4a6e6a270abff1cd30cbe320", [:mix], [{:cowboy, "~> 2.5", [hex: :cowboy, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},

0 comments on commit 89be4e2

Please sign in to comment.
You can’t perform that action at this time.