2012-10-25 31 views
3

我跟隨鏈接GitHub gem rich安裝CKEDITOR到rails_admin ,但我得到的錯誤:Unsupported field datatype: rich_editor無法CKEDITOR整合rails_admin寶石(使用寶石豐富)

我的模型

edit do 
     field :title 
     field :description, :rich_editor do 
      config({ 
      :insert_many => true 
      }) 
     end 
     field :autho 
     field :book_type 
     end 

如何解決這個錯誤?或者這是一個問題?


編輯: 我試了一下,它的工作

field :content, :text do 
     ckeditor do true end 
end 

回答

0

我有同樣的問題。我認爲這是一個問題在rails_admin或富有。我已經成功地將這兩者結合在一起(但是與兩者的舊版本)。

我已經在rich(https://github.com/bastiaanterhorst/rich/issues/80)和rails_admin(https://github.com/sferik/rails_admin/issues/1585)回購庫中爲此創建了github問題。

+2

嘿,我編輯了我的問題,它包含解決方案,希望它能幫助你! – duykhoa

+0

謝謝!但是這隻會增加對ckeditor的支持,但不會爲富人提供支持? – Inza

+0

我不知道如何在rails_admin中使用rick_editor,但實際上,rich_editor基於ckeditor基礎。所以請隨時使用它!https://github.com/bastiaanterhorst/rich – duykhoa

1

我無法讓Rich gem與使用Rails管理的Rails 4項目一起工作,所以我決定使用標準的CK Editor Gem,這是作者推薦的行動方案。它把所有的5分鐘,得到它的工作如下這樣:

https://github.com/sferik/rails_admin/wiki/CKEditor

然後我配置我CK_Editor使用的可用功能的一小部分。

加入CK_Editor寶石和配置我的軌管理初始化後,我在我的項目中創建一個新的JavaScript文件:

/app/assets/javascripts/ckeditor/config.js

具有以下內容:

CKEDITOR.config.toolbar = [ 
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], 
    items: [ 'Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat' ] }, 
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], 
    items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 
     'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] }, 
{ name: 'links', items: [ 'Link', 'Unlink' ] }, 

];

記得重新啓動你的Rails服務器!