Commit Graph

30 Commits

Author SHA1 Message Date
Jonathan Hefner
940980d1af Update instructions for rich text custom rendering [ci-skip]
Since #43110, we no longer generate `.scss` files by default.

This commit:

* Changes remaining `.scss` filenames to `.css`.
* Updates the instructions for omitting the default Trix styles.
* Eliminates repetitive use of the word "default".
* Reorders the content slightly for better flow.
2022-02-13 13:12:48 -06:00
Eugene Kenny
1e250e6ee2 Replace "ActionText" with "Action Text" [ci skip]
http://guides.rubyonrails.org/api_documentation_guidelines.html#wording
2021-10-03 21:48:05 +01:00
David Heinemeier Hansson
d5b9618da1
Remove default reliance on Sass and CSS generators (#43110)
* No benefit to having actiontext css as scss

* Update test

* Update docs

* No more css assets to be generated

New world, new CSS frameworks, new needs.

* SCSS is becoming optional

* Remove Sass as a default-on setting

But continue to make it easy to add.

* Update docs

* No longer used

* Update tests

* Update docs

* Update docs

* No longer used

* No longer by default

* Fix tests

* Promote Tailwind CSS as an alternative to Sass

* Fix test and copy task

* Update railties/lib/rails/generators/rails/app/templates/Gemfile.tt

Co-authored-by: Kevin Newton <kddnewton@gmail.com>

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2021-08-26 13:40:25 +02:00
David Heinemeier Hansson
af7428c4ac
Replace webpack with importmapped Hotwire as default js (#42999)
* Turbolinks is being replaced with Hotwire

* Make --webpack opt-in

* Don't use specific webpacker installers any more in preparation for next Webpacker

* Update railties/lib/rails/app_updater.rb

Co-authored-by: Alex Ghiculescu <alex@tanda.co>

* Trailing whitespace

* Convert to Turbo data attribute for tracking

* Default is no webpack, no hotwire

* Swap out turbolinks references for hotwire

* Drop explicit return

* Only generate package.json if using webpack

* Only create package.json in webpack mode

* Only create app/javascript in webpack mode

* Generate correct style/js links based on js mode

* Fix tests from changed output format

Not sure why these are showing up in this PR, though.

* Rubocopping

* Stick with webpack for the test app for now

* Adjust tests

* Replace minitest-reporters with minitest-ci (#43016)

minitest-reporters is used to create junit xml reports on CI.

But when it loads before rails minitest plugin makes
`Rails::TestUnitReporter` not being added as a reporter.

minitest-ci is now only loaded at ci and does not interferes with
rails minitest plugins. And keeps junit reports workings

* Too heavy handed to actually run bundle

Just like we don't auto-migrate

* Pin js frameworks in importmap

Instead of having importmap preconfigure it.

* Match updated app/javascript path

* No need for the explaining comment

* Fixes test cases for replace webpack with importmapped Hotwire as default js (#42999)

* Fix rubocop issues

* Fix more railities test cases

* Fix plugin generator railties shared test cases

* Fix Action Text install generator asset pipeline spec

* They're modules, not files

* Let dev use the latest release as well

So we don't have to replace unexisting dev releases with latest release

* Make Webpack responsible for generating all the JS files it needs

Webpacker 6 has already moved from app/javascript to app/packs.

* Don't add rails/ujs by default any longer

All the ajax/form functionality has been superseded by Turbo. The rest lives in a weird inbetween land we need to address through other means.

* Use new importmap location

* Switch to using turbo-rails and stimulus-rails directly

The hotwire-rails gem does not offer enough value for its indirection

* Use latest Webpacker

* Prevent version resolution requests from getting swallowed

* Use ESM syntax for imports

* Move management of yarn, package.json, etc to Webpacker 6

* Update for Webpacker 6

* Move bin/setup addition to Webpacker as well

* Remove dead tests

* Bump to Webpacker 6.0.0.rc.2

* No longer relevant given the new default is no webpacker

* Rely on Webpacker 6

* No longer relevant

* No longer relevant

* Make cable channel generator work for both webpacker and importmap setups

* Fix tests

* For tests testing importmap way

* Use Webpacker 6 dummy

* RuboCopping

* One more bump to fix webpack-dev-server

* Another bump. Hopefully the last one!

* Also enough to not want turbo tracking on

* Fix tests

* Latest

* Fix tests

* Fix more tests

* Fix tests

Co-authored-by: Alex Ghiculescu <alex@tanda.co>
Co-authored-by: André Luis Leal Cardoso Junior <andrehjr@gmail.com>
Co-authored-by: Abhay Nikam <nikam.abhay1@gmail.com>
Co-authored-by: Guillermo Iguaran <guilleiguaran@gmail.com>
2021-08-26 10:39:36 +02:00
Aditya Bhutani
59b3df719d [ci skip] Corrected Grammatical Error 2021-06-13 02:36:14 +05:30
Abhay Nikam
ae8e593dc7 Document Action Text rich_text field attribute [ci skip]
Similar to: #42391
2021-06-04 22:48:58 +05:30
Steve Polito
e0d57541ab Add note regarding "trix-content" class 2021-05-30 10:37:21 -05:00
Avidor Turkewitz
4c1cf12ab1
Fix HTML tag mismatches in Action Text README [ci skip] 2021-04-12 17:42:13 -04:00
Vipul A M
b1f1879a50
Merge pull request #40995 from garrettdimon/patch-1
Add note for ActionText models that use UUID's [ci skip]
2021-02-08 12:03:28 +05:30
Kevin Dias
3bab126641 Fix typo in Action Text Overview guide
Aciton Text -> Action Text
2021-01-12 04:03:46 +09:00
Garrett Dimon
266f06e7d9
Add note for ActionText models that use UUID's
I ran into an issue where I failed to specify `type: :uuid` for the ActionText migration since the migration was automatically generated.

The result was that even after updating the fixtures, my tests were failing due to `nil`  values for the `body` of any rich text attributes. It took a little time to connect the dots, so hopefully this (or something like it) could help save others some time investigating.

Separately, this also made me realize that the polymorphic nature of the `action_text_rich_texts` table means that all models that need rich text attributes would have to use the same approach, either UUID's or integer ID's. This note may be trying to do too much as a result. Very much open to better approaches on how to clarify this to save anyone else some spelunking.
2021-01-01 16:45:10 -07:00
Sean Doyle
3500571b43 Improve ActionText extensiblibility
Extensible layout
---

Expose how we render the HTML _surrounding_ rich text content as an
extensible `layouts/action_text/contents/_content.html.erb` template to
encourage user-land customizations, while retaining private API control
over how the rich text itself is rendered by moving the
`#render_action_text_content` helper invocation to the
`action_text/contents/_content.html.erb` partial.

Extensible Attachable `#to_attachable_partial_path`
---

When an application declares a canonical partial for a record, there is
no way to override which partial is used when transformed to Rich Text.
For example, a default `Person < ApplicationRecord` instance returns
`"people/person"` from calls to `#to_partial_path`, resulting in the
`app/views/people/_person.html.erb` partial being rendered.

Prior to this change, when encountering an `<action-text-attachment
sgid="...">` element, ActionText retrieved the corresponding
`Attachable` instance (usually an `ActiveRecord::Base` instance) and
transformed it to rich text HTML by rendering the partial that
corresponds to its `#to_partial_path`.

This proposed change instead invokes
`Attachable#to_attachable_partial_path`. By default,
`#to_attachable_partial_path` is an alias for `#to_partial_path`.

Guides
---

Extend the `guides/action_text_overview` document to
describe how to customize these templates, and to better illustrate how
ActionText::Attachable instances are rendered into HTML.
2020-12-29 20:06:45 -05:00
Jonathan Hefner
cb0da4f817 Fix typos, grammar, and formatting [ci-skip]
This is a collection of minor superficial improvements.  It does not
include any significant content changes.
2020-12-28 12:05:53 -06:00
weiserma
2cfdf71872
Update action_text_overview.md
Added additional overview in n+1 queries that the scope is named with the rich text field name.
2020-10-09 11:23:06 -04:00
Chirag
84d6a0e568 Formats code blocks for better syntax highlighting 2020-08-21 15:47:32 +05:30
BK
e87ed40fd7
Update Documentation - add method which eliminates N + 1 queries 2020-02-17 00:42:02 +01:00
Carlos Antonio da Silva
95eb9cfd3c Fix markup and improve Action Text guide a bit [ci skip]
* The last html block wasn't formatting properly, it needed a blank line
  between the paragraph and the text.
* The ordered list wasn't generating the sequence, but always showing 1.,
  the inner content/examples needed to be indented for that to work.
* Mark some pieces as inline code for highlighting.
* Tweak a couple sentences.
2019-12-31 07:42:13 -03:00
Rafael França
4fbb393b25
Merge pull request #35023 from hahmed/deprecate-global-rails-command-docs
Remove reference to global rails command in the docs
2019-12-27 16:39:55 -03:00
Haroon Ahmed
db1ae8cbb4 remove reference to global rails command and replace with bin/rails 2019-12-27 19:32:37 +00:00
Uģis Ozols
e473eb392c Polish the Action Text guide [ci skip] 2019-12-26 20:23:48 -05:00
Petrik
c711edb23f Use the 'What is FRAMEWORK?' title for all framework guides [ci skip]
Action View, Active Record and Active Storage use the 'What is
FRAMEWORK?' title for the framework introduction, the other frameworks
use 'Introduction'. The 'What is' form is more descriptive and better
for SEO.

This change makes the titles more consistent by using the 'What is
FRAMEWORK?' title for the other frameworks.
2019-12-20 13:18:22 +01:00
Jack Kinsella
e1e9373fae
Reword docs on ActionText [ci skip] 2019-12-18 16:31:39 +01:00
Jack Kinsella
695b6e0d86
Update ActionText docs [ci skip]
- Added guidance on issues with webpacker (making actiontext more beginner friendly)
- Clarify confusion about whether `content` attribute in database is needed.
2019-12-18 14:42:21 +01:00
Rafael França
3bcc0ae0f4
Merge pull request #36143 from fedeagripa/guides/action-text_backend
Add backend API doc for action text [ci skip]
2019-12-17 21:19:32 -03:00
Jonathan Hefner
f2cedf9151 Update form examples [ci skip]
Convert examples to use `form_with` instead of `form_for` or `form_tag`,
which have been soft-deprecated.  Also rename form variable in examples
from `f` to `form`, as exemplified by 8ff7ca5d11.
2019-11-01 18:10:36 -05:00
Yuji Yaginuma
3567fa53f7
Merge pull request #36117 from shioimm/fix_action_text_overview
Fix installation on guides/source/action_text_overview.md
2019-06-09 07:10:14 +09:00
Misaki Shioi
86ba1ee824 Fix installation on guides/source/action_text_overview.md
gem 'image_proccessing' is required.
2019-06-08 23:46:43 +09:00
fedeagripa
ed7f409d52 Add backend API doc for action text 2019-05-28 15:33:01 -03:00
Alec Clarke
4c3231ebb6 [ci skip] Correct the stylesheet name used in the guide.
In the Action Text guides, `app/assets/stylesheets/actiontext.css`
is specified as the file used to style the Action Text editor and
content but the actual file generated from `rails action_text:install`
is `app/assets/stylesheets/actiontext.scss`.

This change simply corrects the file extension shown in the guide.
2019-05-02 19:32:52 -04:00
bogdanvlviv
0fb6c9011f
Add Action Text to guides [ci skip]
- Move some actiontext/README.md content to Action Text Overview guide
- I added WIP label to that guide since we definitely want to complement it.
- Add Action Text to Major Features of Rails 6.0

Similar approach was used in #34812
2019-01-05 13:30:37 +02:00