-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE-REQUEST] custom html tag for show/edit page #159
Comments
I've been playing around and basically, something like that would do the trick : |
Hey @sulphur Currently, we have the "custom types" solution which does work for your case (as can be seen here and here). Admittedly, it's more involved by design and your solution is much simpler for simpler cases. Your changes seem good and working, but it needs to be a bit more "integrated" and polished. def build_text_field(), do: something() |> build_safe_html()
def build_image_field(), do: logic() |> build_safe_html()
def build_safe_html(), do: {:safe, some_html} This way, in the future, if we want to add more fields, it would have a standard way of doing it. |
Yeah, I totally agree my "example" was just to illustrate the need ;) the real solution should be something more elaborate ;) like the one you suggest. I had the same idea about having a generic function that is used by specific functions that facilitate the display. |
I have a very similar need... I'd like to customize a form field with a custom input, but I'm also already using a custom type and don't like to mix application code with web (admin). So maybe the def form_fields(_) do
[
id_card_front: %{name: "ID Front", type: CustomType }
]
end and this custom type must have the function By the way, love this library and think it's very promising :) |
Hi,
or
we can also pass url directly and some style :
|
I've created a PR here : #161 |
@jotaviobiondo I agree. It does make sense to provide |
Describe the problem you're proposing to solve
Since the show and edit are on the same page it would be good to be able to put custom HTML tags that aren't submitted as well. For example, there is no easy way to display a big image on the show/edit page. I know that this can be done via custom Ecto type but in my case, I already have a custom Ecto type from my upload lib (Arc/Waffle). Also, I'm not a fan of adding an admin logic code to the application code.
Describe the solution you'd like
be able to add custom html tags to show/edit form so something like:
Describe alternatives you've considered
I was considering going with a custom page for the moment.
Additional context
Add any other context or screenshots about the feature request here.
I can try to implement it but first, I need to know whether this kind of approach is ok with you guys. Or maybe you know some other alternatives that don't require a custom Ecto type since.
Cheers
Piotr
The text was updated successfully, but these errors were encountered: