在 Rails 3.1 的活动管理界面上看不到 CKEditor 面板
有人尝试过将 Rails 3.1 应用程序上的 CKEditor 与 active_admin 集成吗?我在正常表单方面取得了成功...但在 active_admin 界面上的表单方面却没有成功。假设我有一个产品输入表单,只有管理员用户可以更新或插入...现在,由于我需要更多自定义的外观,我制作了产品表单的一部分,并在其上使用了格式化代码,因为 active_admin 依赖于它。 CKEditor 应该也可以处理格式字段...但我只能看到一个普通的文本区域字段...任何人都可以帮助我解决我错过的问题吗?
我为此使用 ckeditor gem。 在formastic表单上,我有一个名为description的字段,并在active_admin产品输入表单上为ckeditor添加了这一行:
<%= semantic_form_for [:admin, @product] do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :price %>
<%= f.input :description, :as => :ckeditor, :input_html => { :height => 400 } %>
<%= f.input :image, :as => :file %>
<% end %>
<%= f.buttons :commit %>
<% end %>
Anyone tried integrating CKEditor on a Rails 3.1 application with active_admin?? I am successful on the part of normal forms... but not with the forms on active_admin interfaces. Say I have a product entry form which only admin users can update or insert... Now as I needed more customized look I made a partial of product form and used formastic code on that as active_admin relies upon that. CKEditor is supposed to work with formastic fields as well... but I can only see a normal textarea field... can anyone help me out here what I am missing out??
I am using ckeditor gem for this.
On the formastic form I have a field named description and I added this line for the ckeditor on active_admin product entry form:
<%= semantic_form_for [:admin, @product] do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :price %>
<%= f.input :description, :as => :ckeditor, :input_html => { :height => 400 } %>
<%= f.input :image, :as => :file %>
<% end %>
<%= f.buttons :commit %>
<% end %>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,ckeditor 在类“ckeditor”的输入上激活。所以你可以写:
f.input :description, :input_html => {:类=> "ckeditor" }
这对我有用
ckeditor activates on inputs with class 'ckeditor' by default. So you can write:
f.input :description, :input_html => { :class => "ckeditor" }
It's works for me
由于一些奇怪的原因,对我来说,它可以添加
到 active_admin.js.coffee 中
,最初我将它添加到 application.js 中,如下所示,
但奇怪的是,这还不够
for some strange reason for me it worked to add
in active_admin.js.coffee
initially I added it to application.js like this
but strangely it wasn't enough