加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 带有mongodb的轨道中的ckeditor

发布时间:2020-12-17 02:36:54 所属栏目:百科 来源:网络整理
导读:我在使用数据库mongo db的rails中使用ck编辑器.我按照链接 https://github.com/galetahub/ckeditor.我在ckeditor的帮助下成功完成了工作. 因为我的view.html.erb代码是这样的 %= f.cktext_area :description,:toolbar = 'Easy',:width = 800,:height = 200 %
我在使用数据库mongo db的rails中使用ck编辑器.我按照链接 https://github.com/galetahub/ckeditor.我在ckeditor的帮助下成功完成了工作.
因为我的view.html.erb代码是这样的

<%= f.cktext_area :description,:toolbar => 'Easy',:width => 800,:height => 200 %><br>

我的节目页面是

<%= raw@department.description %>

它不适用于文件案例.
我的模型attachment_file.rb是

class Ckeditor::AttachmentFile < Ckeditor::Asset
  has_mongoid_attached_file :data,:url => "/ckeditor_assets/attachments/:id/:filename",:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"

  validates_attachment_size :data,:less_than => 100.megabytes
  validates_attachment_presence :data

  def url_thumb
    @url_thumb ||= Ckeditor::Utils.filethumb(filename)
  end
end

它适用于图像案例,但不适用于zip文件或任何附件.当涉及到文件情况时,它可以通过其路径成功上传文件.但是要按用户下载该文件它不起作用.我的意思是后端适用于所有功能.但缺乏下载上传的文件停止

`javascript:void(0)/*130*/

解决方法

我找到了这个问题的答案.首先在终端运行它.

$sudo chmod -R 777 /usr/share/ruby-rvm/gems/ruby-1.9.3-p194/gems/ckeditor-3.7.1

在您的计算机中按照此路径,因为我使用的是Linux,我的gem文件位于此处.

/usr/share/ruby-rvm/gems/ruby-1.9.3-p194/gems/ckeditor-3.7.1/vendor/assets/javascripts/ckeditor/plugins/attachment/dialogs

并打开attachement.js文件并使用您从上面的链接找到的代码进行编辑.
click

现在ck编辑器也适用于文件附件.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读