ruby-on-railstrumbowyg

How to implement Trumbowyg in Rails


I want to know how properly implement this gem: Trumbowyg_rails

I add all required files. (//= require trumbowyg/trumbowyg,

//= require trumbowyg/langs/pl

*= require trumbowyg/trumbowyg)

Part of view form.html.haml

  .form-group
    = f.text_area :meaning, class: 'form-control', id: 'trumbowyg', rows: 10, placeholder: "Wpisz treść..."
  .form-group.text-right
    = link_to :back, class: "btn btn-primary" do
      %i.glyphicon.glyphicon-chevron-left

    = f.button :submit, class: "btn btn-success"

:javascript
  $(document).ready(function(){
      $('#trumbowyg').trumbowyg({
          lang: 'pl'
      });

  });

Unfortunately above code displays plain textarea.


Solution

  • Maybe you forget the icons, try to put the file icons.svg under assets/images/`, then

     $('#trumbowyg').trumbowyg({
         svgPath: '<%= image_path("icons.svg")%>'
     });
    

    Hope can help you