Created
October 18, 2017 17:19
-
-
Save vmcilwain/5fd92ba0095685be42efa9911220b6d8 to your computer and use it in GitHub Desktop.
Adding trix editor to a rails form_tag (using haml)
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
# Given there is a section object and I would like to use trix editor for adding text to the content attribute | |
# id: is required to tie trix-editor(below to to the hidden input | |
# name: is required so that you can find it via params in the controller in this case params["trix-editor_section_#{section.id}"] | |
# content: is for inserting any content that already existed in the content attribute | |
%input{id: "#{dom_id(section, 'trix-editor')}", name: "#{dom_id(section, 'trix-editor')}", content: "#{section.content}", type: :hidden} | |
%trix-editor{input: "#{dom_id(section, 'trix-editor')}"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment