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

[RF-DOCS] Action View Helpers Documentation [ci-skip] #51432

Conversation

Ridhwana
Copy link
Contributor

@Ridhwana Ridhwana commented Mar 27, 2024

Motivation / Background

This Pull Request has been created to provide clarity to the Action View Helpers guide.

Detail

Here are some notes on what has changed:

Some notes:

  • AssetTagHelper talks about a bunch of *_tag helpers, but also some of them mention *_url and *_path helpers. (which live in AssetUrlHelper). Those are helpful to know, but less frequently used I think. It's also incomplete (some mention it, others don't, *_tag helpers have their _url/_path counterparts, or use the basic asset_path/url.) I don't think it's worth expanding with all these variants, I'd rather remove the individual ones, and if we want to mention, we can maybe bundle them together within the same subsection instead, or just as examples of the related *_tag sections.

  • The cache helper could use some more info. I don't think it's worth linking to the Fragments API, but rather to the fragments caching piece of the caching guide, where it goes into more details. The example could also be expanded to show something that at least gets a record as an example too.

  • content_for could perhaps benefit from showing content_for? in the example, somehow.

  • We do not want to show any form helpers here, just link to the specific guide, but we can maybe make that paragraph clearer.

  • escape_javascript could use an example (not the one that's on the API as it seems very jquery-related... maybe some other example of embedding some Ruby in JS or something)

  • mention of rails-html-sanitizer could be linked.

  • "NB: The output may still contain unescaped '<', '>', '&' characters and confuse browsers." should be a note?

  • UrlHelper could have a few extra items like current_page? and mail_to, which can be commonly used. (no need to show each and every method, just the most common ones)

  • CsrfHelper seems unnecessary to explain here. (we don't add CspHelper for instance... not sure we need to get into those, can probably skip them.)

  • We could have a section on TextHelper mentioning things like simple_format, truncate, excerpt, maybe some other(s). (again, not everything, just the most commonly used ones)

  • We could have a section on TagHelper mentioning content_tag and tag.

  • Updated the 'what you will know section'

  • Formatted all sections to be similar where there is some description under the helper and then we get into the methods

  • Column count adherence.

  • Removed Benchmark that was deprecated

  • Made tweaks to language and clarity.

  • Added more clarity to capture and content_for

  • Added more examples where necessary.

  • Remove WIP from index page

  • Rearranged the sections

Additional information

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

@rails-bot rails-bot bot added the docs label Mar 27, 2024
Ridhwana and others added 29 commits March 27, 2024 10:39
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Ridhwana and others added 18 commits April 8, 2024 22:31
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Ridhwana and others added 5 commits April 8, 2024 22:57
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
@Ridhwana
Copy link
Contributor Author

Ridhwana commented Apr 8, 2024

@carlosantoniodasilva, @brunoprietog and @p8 thank you for the feedback 🎉 I've accepted the suggestions, and made some additional changes that were discussed in the thread that can be found here and here.

@carlosantoniodasilva carlosantoniodasilva force-pushed the Ridhwana/action-view-helpers-documentation branch from 481f589 to 945306a Compare April 9, 2024 13:17
@carlosantoniodasilva carlosantoniodasilva merged commit a7e3798 into rails:main Apr 9, 2024
3 checks passed
fractaledmind pushed a commit to fractaledmind/rails that referenced this pull request May 13, 2024
Review and improve the Action View Helpers guide.

- Reorganize sections, in most cases moving most commonly used helpers up, grouping some of the formatting ones together
- Expand with more examples and a few new methods
- Link back to the API of each helper whenever possible
- Remove WIP

Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs rails foundation Rails Foundation PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants