rails/guides
bhumi1102 f0f624bde4
[RF-DOCS] Action View Form Helpers Guide [ci-skip] (#51936)
In addition to updating the code examples and editing text for clarity and flow, here some more details on some of the changes:

- [X] Do we still need an HTML5 warning at the end of the 1st section? It's pretty standard these days.
--> agree, removed.
- [X] Not sure the output of `_form_with model: @article`_ is 100% correct, might need to double check that.
--> yes. updated this example and got the HTML output from my "guides playground" rails app.
- [X] When we mention `record.persisted?` in record identification, could be a good plug to link to the Active Model guide on that.
--> Hm...there is no direction mention, other than this https://guides.rubyonrails.org/active_model_basics.html#conversion
- [X] Similar to STI, link to the guide / reference on it.
- [X] Time Zone and Country Select should likely be broken into separate sub-sections (I don't mind still mentioning country select)
- [X]  Would the file upload example would be better with a CSV for local processing, rather than showing saving to local disk? (which is probably a very uncommon usage?)
- [X] The _labeled_form_with_ example could likely be simplified with `_**options_` being all that it takes, instead of explicitly showing all possible kwargs.
- [X]  It may be better to show "complex forms" (section 10) right after the parameters (section 8), moving "forms to external resources" down... just because complex forms require exactly the fields_for incantation that was detailed further under the parameters section, so it seems a better continuation. (or potentially even reversed? complex forms then params? not sure)
- [X] Under "complex forms", adding fields on the flow could be slightly expanded, it feels very "go figure". 
--> Yeah, not sure what to do about this one. Was thinking about removing it as there is not built-in support to showcase.

---------

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Petrik de Heus <petrik@deheus.net>
Co-authored-by: Amanda Perino <58528404+AmandaPerino@users.noreply.github.com>
Co-authored-by: Karl Lingiah <karl@superchilled.co.uk>
2024-06-28 17:49:36 +02:00
..
assets Fix guide menu overflow [ci skip] 2024-06-25 09:47:26 -04:00
bug_report_templates Pin sqlite3 version in bug_report_templates 2024-04-18 09:48:41 +09:00
rails_guides Remove debug require from guides generator 2024-05-10 18:42:55 +00:00
source [RF-DOCS] Action View Form Helpers Guide [ci-skip] (#51936) 2024-06-28 17:49:36 +02:00
.document
.rubocop.yml Document response.parsed_body in 7.1 release notes 2023-08-23 15:33:52 -04:00
CHANGELOG.md Register 8b173d9 in the guides CHANGELOG 2024-06-20 09:45:25 +02:00
rails_guides.rb Add rake guides:lint task to raise error on broken anchor links 2024-05-01 17:29:35 +05:30
Rakefile Add rake guides:lint task to raise error on broken anchor links 2024-05-01 17:29:35 +05:30
README.md Fixed typo in guides/README.md 2024-03-28 21:51:23 +09:00
w3c_validator.rb Use frozen string literal in guides/ 2017-08-13 22:04:09 +09:00

Rails Guides Redesign 2024

About the Project

The Rails Guides Visual Refresh occurred in Q1 2024, and was intended to bring the visual style of the guides inline with the rubyonrails.org site.

Editing Dependencies

The editing files for the Guides rebuild reside in stylesrc and use SCSS to improve developer experience. The code base relies on include_media (https://eduardoboucas.github.io/include-media/) to enable inline media-queries adjustments. We've also relied on the standard normalize.css (https://necolas.github.io/normalize.css/) to help bring all browsers together.

Building the Guides in Development

To generate new guides into static files, type rake guides:generate from inside the guides folder. If you make changes to the HTML or ERB, you'll need to remove the "output" directory before running this command. The master SCSS files (style.scss, highlight.scss) will compile as part of this process.

FAQ

Why are you not using CSS variables?

Per the MDN documentation on CSS custom properties (https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), they are not supported in media or container queries at this point (Feb 2024). They may in future releases, and we should pivot to that when they are more wholistically supported. SCSS variables, because they are interpolated at build, serve a similar purpose and allow us the flexibility to support much older browsers.

Why do we include LTR and RTL?

LTR/RTL (Left to right/right to left) is a layout change based on the nature of the language the site is being displayed in. Arabic and Farsi are two well known "RTL" languages. If the site is automatically translated, then the layout will adjust (mirror horizontally) to be more in line with the text.

Why is Dark Mode in a separate file

IncludeMedia does not handle prefers-color-scheme at this time, so it was extracted.