Signal drop!
Relay (operand.online) is unreachable.
Usually, a dropped signal means an upgrade is happening. Hold on!
Sorry, no connección.
Hang in there while we get back on track
gram: op
> ./lib/op_web/live/chronicle/show.ex
Lenses
(coming soon!)
defmodule OpWeb.Chronicle.Show do
require Ash.Query
alias Phoenix.LiveView.JS
use OpWeb, :live_view
import Phoenix.HTML
import Phoenix.HTML.Form
use PhoenixHTMLHelpers
@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
@impl true
def handle_params(%{"key" => key } = params, _, socket) do
page = Source.Page.query_by_key!(key)
linebreaks = (page.linebreaks || params["l"] == "b")
body = if linebreaks do
page.body |> String.split("\n") |> Enum.join(" \n")
else
page.body
end
{:noreply,
socket
|> assign(:page_title, key <> " | Operand Chronicle")
|> assign(:page, page)
|> assign(:messages,
Op.Communique.Message
|> Ash.Query.filter([published: [is_nil: false]])
|> Ash.Query.filter(channel == ^("op.page:" <> key))
|> Ash.read!)
|> assign(:body, body)
|> assign(:linebreaks, linebreaks)
}
end
end