Macrow / rails_kindeditor

Kindeditor for Ruby on Rails
260 stars 108 forks source link

where is view helper? #16

Closed zlx closed 11 years ago

zlx commented 11 years ago

The README say, I can use form.input 'content', :as => :kindeditor but it donot work..

env

ruby 1.9.3p125
rails 3.2.2
rails_kindedtor 0.3.9
zlx commented 11 years ago

views

<%= text_area_tag "page[content]", page.content(params[:locale]), :style=> "width: 1050px; height: 600px;", :id => 'page_content' %>

script

<script type="text/javascript">
    $(function() { KindEditor.create('#page_content', {
      uploadJson: '/kindeditor/upload',
      allowFileManager: true,
      fileManagerJson: '/kindeditor/filemanager',
      langType : "<%= params[:locale] == 'cn' ? 'zh_CN' : 'en' %>"
      }); });
</script>

It works!

Macrow commented 11 years ago

You used the simple_form ?

I think you could need 'kindeditor_tag' helper:

<%= kindeditor_tag "page[content]", page.content(params[:locale]), :allowFileManager => true, :langType => (params[:locale] == 'cn' ? 'zh_CN' : 'en')%>

no need for extra javascript.