Skip to content
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

mix ash_phoenix.gen.live doesn't add fields to show.ex #117

Closed
jarlah opened this issue Nov 17, 2023 · 3 comments
Closed

mix ash_phoenix.gen.live doesn't add fields to show.ex #117

jarlah opened this issue Nov 17, 2023 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jarlah
Copy link
Contributor

jarlah commented Nov 17, 2023

Describe the bug
mix ash_phoenix.gen.live doesn't add fields to show.ex, but they are added to form_component.ex and index.ex

To Reproduce
mix ash_phoenix.gen.live AshActivityPlanner.Planner AshActivityPlanner.Planner.Participant

in

https://github.com/jarlah/ash-activity-planner

(which will ofc now overwrite the existing live view

Expected behavior
Fields should also be added to show.ex, as I have modified it after running the generator in https://github.com/jarlah/ash-activity-planner/blob/main/lib/ash_activity_planner_web/live/participant_live/show.ex#L18

Additional context

Forum discussion:

https://elixirforum.com/t/how-to-convert-mix-gen-live-to-ash-compatible-live-view/59785

@jarlah jarlah added the bug Something isn't working label Nov 17, 2023
@zachdaniel zachdaniel added the good first issue Good for newcomers label Nov 17, 2023
@zachdaniel
Copy link
Contributor

Thanks for the report! I won't have time to get to this soon likely, but it should be a pretty straight-forward thing to add. Marked as good first issue.

@jarlah
Copy link
Contributor Author

jarlah commented Nov 25, 2023

@zachdaniel I see for gen.html it has this block of code in priv/templates/ash_phoenix.gen.html/show.html.heex:

<.list>
<%= for attribute <- @attributes do %>
  <:item title="<%= Phoenix.Naming.humanize(attribute.name) %>"><%%= @<%= @singular %>.<%= attribute.name %> %></:item>
<% end %>
</.list>

however in priv/templates/ash_phoenix.gen.live/show.ex.eex it doesn't

Also it's a bit unknown to me why the file extensions is so different. But I guess that's not important.

The important bit is if I can just add some similar block in code for listing the items? in the template for live?

@zachdaniel
Copy link
Contributor

I think that file extension is wrong, but it's not really that important. We should fix it at some point though. Thanks for the issue and the fix!

@jarlah jarlah closed this as completed Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants