Add data-params handling to handleMethod#395
Conversation
|
👍 good feature! |
|
👍 would love to see this merged soon ;-) |
|
It seems like this is re-building the functionality of a If it needs to look like a link, that can be achieved through CSS (see bootstrap's |
|
Yes. This is doing the same as |
|
@ecbypi, functionality of a <a href="/admin/parsings" data-method="post" data-params='{"kind_id": "1"}'>Start some kind parsing</a>" |
|
I don't think we should promote JSON usage on data tags. If you need to pass params in a link use the |
|
@rafaelfranca and how to use |
|
It created hidden inputs inside the form tag. |
|
@rafaelfranca, do you think reasonable that parameters are passed in this case: <a href="/admin/parsings" data-remote="true" data-method="post" data-params='{"kind_id": "1"}'>Start some kind parsing</a>"but there is no way? <a href="/admin/parsings" data-method="post" data-params='{"kind_id": "1"}'>Start some kind parsing</a>"Both constructions are handled by jquery-ujs, but in the second case surprisingly no parameters are passed. |
|
O_O. If first is working, there is no reason for the second to not work. |
|
I add test for first case, demonstrate coorrect work of JSON params. |
|
@rafaelfranca what do you think about this PR? |
|
I prefer to defer this decision to @JangoSteve or @lucasmazza? |
|
Sorry, I had to go back and read through the conversation from #307 to remind myself of the initial intent and discussion. There are a few issues with this PR as it stands, that lead me to believe that #307 might be closer to the desired implementation:
|
|
@JangoSteve, I see. I agree with your arguments. Work on this at the end of the week. |
|
@KODerFunk Awesome, sounds good! Thanks! |
|
👍 For this PR |
|
👍 |
|
Is there no progress on this? We (especially me) need this feature. |
|
I was rather surprised to find that this doesn't work. 😞 |
This commit adds the functionality to fetch the data-params attribute from the link and add fields to the form that express the values from the data-param attributes.
This is useful for POST-requests via links that should post parameters instead of sending them in the URL.
My version of forgotten #307 from @phillipp, with escaping and composing hidden inputs from complex objects by @bcm's request.