From 1663bfad247732aa928e60489d4d394e338d1c49 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 2 Oct 2018 17:30:22 -0700 Subject: Add a bit more documentation --- app/helpers/action_text/tag_helper.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'app/helpers/action_text') diff --git a/app/helpers/action_text/tag_helper.rb b/app/helpers/action_text/tag_helper.rb index 28c62166dd..8d1ff0aaad 100644 --- a/app/helpers/action_text/tag_helper.rb +++ b/app/helpers/action_text/tag_helper.rb @@ -2,6 +2,17 @@ module ActionText module TagHelper cattr_accessor(:id, instance_accessor: false) { 0 } + # Returns a `trix-editor` tag that instantiates the Trix JavaScript editor as well as a hidden field + # that Trix will write to on changes, so the content will be sent on form submissions. + # + # ==== Options + # * :class - Defaults to "trix-content" which ensures default styling is applied. + # + # ==== Example + # + # rich_text_area_tag "content", message.content + # # + # # def rich_text_area_tag(name, value = nil, options = {}) options = options.symbolize_keys @@ -37,6 +48,18 @@ module ActionView::Helpers end module FormHelper + # Returns a `trix-editor` tag that instantiates the Trix JavaScript editor as well as a hidden field + # that Trix will write to on changes, so the content will be sent on form submissions. + # + # ==== Options + # * :class - Defaults to "trix-content" which ensures default styling is applied. + # + # ==== Example + # form_with(model: @message) do |form| + # form.rich_text_area :content + # end + # # + # # def rich_text_area(object_name, method, options = {}) Tags::ActionText.new(object_name, method, self, options).render end -- cgit v1.2.3