Update add_phx_click_event making :target option optional
This commit is contained in:
@ -26,9 +26,12 @@ defmodule Outlook.InternalTree do
|
|||||||
def add_phx_click_event(tree, opts) do
|
def add_phx_click_event(tree, opts) do
|
||||||
phx_opts = %{
|
phx_opts = %{
|
||||||
"phx-click": Keyword.get(opts, :click),
|
"phx-click": Keyword.get(opts, :click),
|
||||||
"phx-target": Keyword.get(opts, :target) |> to_string,
|
|
||||||
"phx-value-nid": fn n -> n.nid end
|
"phx-value-nid": fn n -> n.nid end
|
||||||
}
|
}
|
||||||
|
phx_opts = case Keyword.has_key?(opts, :target) do
|
||||||
|
true -> Map.put(phx_opts, "phx-target", Keyword.get(opts, :target) |> to_string)
|
||||||
|
false -> phx_opts
|
||||||
|
end
|
||||||
options = Map.put(%{}, Keyword.get(opts, :nodes, :elements), phx_opts)
|
options = Map.put(%{}, Keyword.get(opts, :nodes, :elements), phx_opts)
|
||||||
garnish(tree, options)
|
garnish(tree, options)
|
||||||
end
|
end
|
||||||
@ -74,4 +77,8 @@ defmodule Outlook.InternalTree do
|
|||||||
def modify_tunits(tree, modifier, tu_ids) do
|
def modify_tunits(tree, modifier, tu_ids) do
|
||||||
TunitModifications.apply_modifier(tree, modifier, tu_ids)
|
TunitModifications.apply_modifier(tree, modifier, tu_ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tunit_modifiers() do
|
||||||
|
TunitModifications.modifiers()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user