-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
100 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule Beacon.Plug do | ||
@moduledoc """ | ||
Used to ensure consistency for Beacon Page rendering. | ||
This is especially important when using Page Variants. | ||
## Usage | ||
Add the plug to your Router's `:browser` pipeline: | ||
``` | ||
pipeline :browser do | ||
... | ||
plug Beacon.Plug | ||
end | ||
``` | ||
""" | ||
@behaviour Plug | ||
|
||
@impl Plug | ||
def init(_opts), do: [] | ||
|
||
@impl Plug | ||
def call(conn, _opts), do: Plug.Conn.put_session(conn, :beacon_variant_roll, Enum.random(1..100)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule Beacon.Template.LoadMetadata do | ||
@moduledoc """ | ||
Metadata passed to page loading lifecycle. | ||
""" | ||
|
||
defstruct [:site, :path] | ||
|
||
@type t :: %__MODULE__{ | ||
site: Beacon.Types.Site.t(), | ||
path: String.t() | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Beacon.Template.RenderMetadata do | ||
@moduledoc """ | ||
Metadata passed to page rendering lifecycle. | ||
""" | ||
|
||
defstruct [:site, :path, :page_module, :assigns, :env] | ||
|
||
@type t :: %__MODULE__{ | ||
site: Beacon.Types.Site.t(), | ||
path: String.t(), | ||
page_module: module(), | ||
assigns: Phoenix.LiveView.Socket.assigns(), | ||
env: Macro.Env.t() | ||
} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters