Unsafe Actions: Replace link_to calls with button_to#2516
Merged
Conversation
8e8899a to
6c6c04b
Compare
6c6c04b to
71311da
Compare
71311da to
d705c9f
Compare
d705c9f to
4edb7e6
Compare
4edb7e6 to
c0742f0
Compare
665b11f to
df4c1df
Compare
df4c1df to
da2ed35
Compare
da2ed35 to
09a9d37
Compare
e926279 to
1d7af14
Compare
The `<a>` element is suitable for [Safe HTTP Methods][] (like `GET`) to drive page navigations. Unsafe HTTP Methods (like `POST`, `PUT`, and `DELETE`) are better initiated by `<form>` submissions. This commit replaces generated calls to `link_to` with calls to `button_to`. The rest of the styling changes aim to preserve design decisions made about preserving the appearance of elements that were once presented as `<a>` elements that are now presented as `<input type="submit">` elements nested within `<form>` elements. While the design changes preserved backwards compatibility, it's worth re-considering the choice to present them as "navigation" links instead of "action" buttons. [Safe HTTP Methods]: https://developer.mozilla.org/en-US/docs/Glossary/Safe/HTTP
1d7af14 to
f700c43
Compare
Member
|
Ah, excellent, thanks! |
f-moya
added a commit
to ApprenticeshipStandardsDotOrg/ApprenticeshipStandardsDotOrg
that referenced
this pull request
Nov 15, 2024
- Updated the administrate gem from version 1.0.0beta1 to 1.0.0beta2 in both Gemfile and Gemfile.lock. - Refactored the synonym show page test to check for a "Destroy" button instead of a link, in line with changes noted in the changelog https://github.com/thoughtbot/administrate/blob/main/CHANGELOG.md#100beta2-october-25-2024, specifically the update found in thoughtbot/administrate#2516.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
<a>element is suitable for Safe HTTP Methods (likeGET) to drive page navigations. Unsafe HTTP Methods (likePOST,PUT, andDELETE) are better initiated by<form>submissions.This commit replaces generated calls to
link_towith calls tobutton_to.The rest of the styling changes aim to preserve design decisions made about preserving the appearance of elements that were once presented as
<a>elements that are now presented as<input type="submit">elements nested within<form>elements.While the design changes preserved backwards compatibility, it's worth re-considering the choice to present them as "navigation" links instead of "action" buttons.