ruby-on-railsstimulusjstrix

Syntax for form data elements using stimulus-library


Reference document stimulus-library and its relevant example

Attempting to get the rich text area - also using mobility - wher the goal is to alter the trix-editor tag as follows:

<trix-editor
  data-controller="trix-modifier"
  data-no-file-uploads
></trix-editor>

the following fail

<%= form.rich_text_area "translatable_content_#{Mobility.normalize_locale(user_idioma.idioma.code.to_s)}", rows: 20,  
data: { controller: 'trix-modifier'}, data: { 'no-file-uploads' } %>

<%= form.rich_text_area "translatable_content_#{Mobility.normalize_locale(user_idioma.idioma.code.to_s)}", rows: 20,  
data: { controller: 'trix-modifier', 'no-file-uploads' } %>

while a simple controller element definition renders correctly:

<%= form.rich_text_area "translatable_content_#{Mobility.normalize_locale(user_idioma.idioma.code.to_s)}", rows: 20,  
data: { controller: 'trix-modifier'} %>

how should the syntax be set to generate the proper tag impeding file uploads?


Solution

  • Posting this as a simple reference, figured out by poking around:

    <%= form.rich_text_area "translatable_content_#{Mobility.normalize_locale(user_idioma.idioma.code.to_s)}", rows: 20,  
    data: { controller: 'trix-modifier', 'no-file-uploads' => true } %>