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

Update :text column to textarea to match intent for html generator #5963

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

lifeiscontent
Copy link
Contributor

@lifeiscontent lifeiscontent commented Nov 2, 2024

No description provided.

@lifeiscontent lifeiscontent changed the title Update phx.gen.html.ex Update :text column to textarea to match intent for html generator Nov 2, 2024
@ShPakvel
Copy link
Contributor

ShPakvel commented Nov 5, 2024

Thank you for catch. 🙇🏼

@SteffenDE
Copy link
Contributor

Hi @lifeiscontent,

I'm not sure if we can really assume that users that specify text as column type also want a textarea necessarily? In any case we'd need to have the same behavior in the phx.gen.live generator as well.

It is also really not a big change to do yourself after running the generator. Let's see what others think :)

@ShPakvel
Copy link
Contributor

ShPakvel commented Nov 6, 2024

@lifeiscontent +1 from my side on similar update for live form. And also I suggest to update this test with additional text field, to check textarea input in this form assertion.

@SteffenDE, regarding choice between input and textarea. Usually type string associated with input in html, and type text associated with textarea in html, as text type chosen for databases usually means "we expect lot more words to store here". I believe it is general practical approach to map html-to-db this way.

@lifeiscontent
Copy link
Contributor Author

@ShPakvel yep, my thoughts exactly. I'll try to follow up on this PR over the weekend. :)

@josevalim
Copy link
Member

Yes, text is meant to be translated to textarea, otherwise use string. 👍

@lifeiscontent
Copy link
Contributor Author

alright, all updated, including tests! Thanks for the support guys :)

@SteffenDE
Copy link
Contributor

@lifeiscontent I don't see phx.gen.live being updated?

see

{key, :text} ->
~s(<.input field={@form[#{inspect(key)}]} type="text" label="#{label(key)}" />)

Update :text column to textarea to match intent for html generator
@lifeiscontent
Copy link
Contributor Author

@SteffenDE I'm not sure what happened, but it appears my work went missing during tranmission, all fixed now 😅

@lifeiscontent
Copy link
Contributor Author

@SteffenDE bump

@SteffenDE SteffenDE merged commit 222d9ab into phoenixframework:main Nov 17, 2024
4 of 7 checks passed
@SteffenDE
Copy link
Contributor

Thanks for bumping! 🙌🏻

@lifeiscontent lifeiscontent deleted the patch-1 branch November 18, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants