简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM