I have a blog built in Phoenix using ex_admin on the back-end and I'd like to override some of the default inputs for my blog post template.
My post has the following properties:
schema "posts" do
field :title, :string
field :image, :string # will store as URL, will reference external host like S3
field :created_on, :datetime
field :content, :text
timestamps()
end
I would like to do the following:
- Keep the
:title
field a text input - Create an uploader input for
:image
- Keep the multiple drop-down selection scheme that is default with Phoenix for
created_on
- Create a Quill wysiwyg for my
:content
(Basically put in a script that targets the:content
text field)
Ideally, I would like to do something like this:
defmodule MyBlog.ExAdmin.Post do
use ExAdmin.Register
register_resource MyBlog.Post do
end
form post do
inputs do
input post, :title, type: :string
input post, :image, type: :file
input post, :created_on, type: :datetime
input post, :content, type: :text
end
end
# Add a javascript hook that fires here to target the :content input
end
:title
, :image
and :created_on
fields all show text inputs...the only type that I have noticed that alters the text field is type: :password
. Is there a way to drop in these types dynamically from the inputs do
list, or would I have to create a custom template and reference it?