properly generate link
This commit is contained in:
@@ -7,10 +7,10 @@ defmodule LabelmakerWeb.Home do
|
||||
def mount(_params, _session, socket) do
|
||||
assigns =
|
||||
Constants.defaults()
|
||||
|> Map.merge(Constants.preview())
|
||||
|> Map.merge(Constants.form_defaults())
|
||||
|> Map.put(
|
||||
:preview_background,
|
||||
Tools.process_preview_background(Constants.preview().preview_background)
|
||||
Tools.process_preview_background(Constants.form_defaults().preview_background)
|
||||
)
|
||||
|> Enum.to_list()
|
||||
|
||||
@@ -39,6 +39,15 @@ defmodule LabelmakerWeb.Home do
|
||||
{:noreply, assign(socket, :preview_background, Tools.process_preview_background(bg))}
|
||||
end
|
||||
|
||||
def handle_event("update_sizing", %{"sizing" => sizing}, socket) do
|
||||
sizing =
|
||||
if sizing in Constants.sizing_values(), do: sizing, else: Constants.form_defaults().sizing
|
||||
|
||||
assigns = Map.put(socket.assigns, :sizing, sizing)
|
||||
|
||||
{:noreply, assign(socket, sizing: sizing, link: Tools.generate_link(assigns))}
|
||||
end
|
||||
|
||||
def handle_event("update_alignment", %{"option" => option}, socket) do
|
||||
{:noreply, assign(socket, :align, option)}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user