Add wrapper for garnish/2 for phx event
This commit is contained in:
@ -27,6 +27,16 @@ defmodule Outlook.InternalTree do
|
||||
|> RawInternalBasic.partition_to_tunits()
|
||||
end
|
||||
|
||||
def add_phx_click_event(tree, opts) do
|
||||
phx_opts = %{
|
||||
"phx-click": Keyword.get(opts, :click),
|
||||
"phx-target": Keyword.get(opts, :target) |> to_string,
|
||||
"phx-value-nid": fn n -> n.nid end
|
||||
}
|
||||
options = Map.put(%{}, Keyword.get(opts, :nodes, :elements), phx_opts)
|
||||
garnish(tree, options)
|
||||
end
|
||||
|
||||
def garnish(tree, options) do
|
||||
options = Enum.reduce(
|
||||
~w(el_ids el_names tu_ids)a,
|
||||
|
||||
Reference in New Issue
Block a user