-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Enable button_to to use button without block #35143
Conversation
It seems a bit weird to repeat 'button' twice (i.e. button_to and :button) maybe it's better to make a semantic_button_to helper method instead? That way there's opportunity to create more semantic url helpers down the road. |
I think we used input mostly because of IE6. I'd just change the default behavior to always generate a button, with an application wide configuration to generate inputs. Can you work on that? |
@rafaelfranca yea, button as default element is expected, I'm working on it and will report all implications. |
Yes |
d7c4706
to
f0fe303
Compare
@rafaelfranca I added I think that this change is safe and will not have big impact since |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@rafaelfranca do you know how should I "unstale" this pull requests or how to make it more popular? |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay reviewing this. Code looks good with one exception that I just commented. Can you also add a CHANGELOG entry?
@@ -119,6 +119,7 @@ def load_defaults(target_version) | |||
|
|||
if respond_to?(:action_view) | |||
action_view.default_enforce_utf8 = false | |||
action_view.button_to_generates_input = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move to the 6.1 defaults instead of 6.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved and rebased to the latest master commit.
`<button>` element is more powerful than `<input>` element since it can contain other markup (value of `<input>` can only be a text). To keep generating `<input>` when `button_to` is used without block, there is a configuration: Rails.configuration.action_view.button_to_generates_input = true
Thank you for reviewing, I added to CHANGELOG and moved configuration to 6.1 |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I do not understand why this is not merged yet... |
This has been merged as part of #40747. |
Summary
button_to 'Label', url
generates<input value='Label'>
but if wewant to generate
<button>Label</button>
than we can pass the argumentThis way we can generate
<button>
for block and non block version ofbutton_to
.<button>
element is more powerful than<input>
element since it can containother markup (value of
<input>
can be only a text).I found useful while testing since we can use
assert_select 'button', 'Label'
(instead ofassert_select 'input[value=?]', 'Label')
.Do you think it is useful ? If so, I can update docs...
Or maybe we can replace
<input>
with<button>
completely (Does anyone know of the advantage of<input>
over a<button>
) ?