-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Custom tags don't support Hash #1418
Comments
Does it work if you do this? tag "turbo-frame", options: params do
text "test"
end |
@jwoertink yea, that worked. ^^ - Is that supposed to work like that? Would nice that they work the same as the others or is it something that makes it harder? |
It works because the second argument is for the valueless args like if you were writing some Vuejs tag "turbo-frame", [] of Symbol, params do
text "test"
end Maybe we can use an outer variable for that? Or possible swap those, but not sure how much damage that might cause 🤔 |
@jwoertink does it make sense to provide an overload of the tag method which takes the params hash as the second parameter? Going too far down that road might make things confusing but maybe this isn't a step too far? |
Yeah. It looks like this current overload is to match the base ones https://github.com/luckyframework/lucky/blob/master/src/lucky/tags/base_tags.cr#L54 but we seem to be missing this variant https://github.com/luckyframework/lucky/blob/master/src/lucky/tags/base_tags.cr#L46 (without the attrs). I think if we add that in, then it should work. |
Describe the bug
custom tags don't support Hash as params, but divs and others do. This makes it hard to make custom tags work with flexible data.
To Reproduce
make a normal
Hash(String, String)
calledparams
with variables.make a code like:
If you make it with div like:
It will work.
Expected behavior
Have the same consistent behavior everywhere. Make custom tags work as standard tags.
Versions (please complete the following information):
crystal --version
): 0.36.1The text was updated successfully, but these errors were encountered: