smpallen99 / ex_admin

ExAdmin is an auto administration package for Elixir and the Phoenix Framework
MIT License
1.2k stars 276 forks source link

Adding Block Javascript to Show Page #432

Open cdesch opened 6 years ago

cdesch commented 6 years ago

Would adding a javascript block to the show view be fairly straightforward as dropping javascript macro onto show.ex. Or is there a reason why it is limited to the forms (form.ex)

  @doc """
  Add javascript to the form
  Adds a block of javascript code to the form. Typically used to add
  change or click handlers to elements on the page
  """
  defmacro javascript(do: block) do
    quote do
      var!(script_block, ExAdmin.Form) = unquote(block)
    end
  end