redmine1.2.0集成ckeditor

本文详细介绍了在Redmine中集成CKEditor时遇到的错误'undefinedmethod'reply'for class 'IssuesController'的解决方法。通过下载并安装redmine_ckeditor插件,修改相关控制器文件和配置,成功解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

gem list可以查看redmine安装版本信息(本机安装环境rails 2.3.11,redmine-1.2.0)


redmine集成ckeditor
redmine安装CKEDITOR出错(undefined method 'reply' for class 'IssuesController')
解决办法:

下载redmine_ckeditor(https://github.com/a-ono/redmine_ckeditor)
解压文件,修改文件夹名称为redmine_ckeditor

进入redmine_ckeditor/lib,将issues_controller_patch.rb文件重名为journals_controller_patch.rb
采用文本编辑器打开journals_controller_patch.rb,修改文件内容为:

require_dependency 'journals_controller'

module RedmineCkeditor
module JournalsControllerPatch
def self.included(base)
base.send(:include, InstanceMethods)

base.class_eval do
unloadable
alias_method_chain :new, :ckeditor
end
end

module InstanceMethods
def new_with_ckeditor
unless Setting.text_formatting == "CKEditor"
reply_without_ckeditor
return
end

journal = Journal.find(params[:journal_id]) if params[:journal_id]
if journal
user = journal.user
text = journal.notes
else
user = @issue.author
text = @issue.description
end
content = "<p>#{ll(Setting.default_language, :text_user_wrote, user)}</p>"
content << "<blockquote>#{ActionView::Base.full_sanitizer.sanitize(text)}</blockquote><p/>"

render(:update) {|page|
page.<< "CKEDITOR.instances['notes'].setData(#{content.inspect});"
page << "showAndScrollTo('update', 'notes');"
}
end
end
end
end

修改redmine_ckeditor/lib/redmine_ckeditor.rb,文件内容为

require 'redmine_ckeditor/journals_controller_patch'
require 'redmine_ckeditor/toolbar_helper'

module RedmineCkeditor
include ToolbarHelper
PLUGIN_DIR = File.expand_path(File.dirname(File.dirname(__FILE__)))

ALLOWED_TAGS = %w[
a abbr acronym address blockquote b big br caption cite code dd del dfn
div dt em h1 h2 h3 h4 h5 h6 hr i img ins kbd li ol p pre samp small span
strike strong sub sup table tbody td tfoot th thead tr tt u ul var
]

ALLOWED_ATTRIBUTES = %w[
href src width height alt cite datetime title class name xml:lang abbr
style align valign border cellpadding cellspacing colspan rowspan nowrap
]

DEFAULT_TOOLBAR = [
%w[Source - Preview - Maximize ShowBlocks - Template - PasteFromWord -
Undo Redo - Find Replace
], '/',
%w[Bold Italic Underline Strike - Subscript Superscript -
NumberedList BulletedList - Outdent Indent Blockquote -
JustifyLeft JustifyCenter JustifyRight JustifyBlock -
Link Unlink Anchor - Image Table HorizontalRule SpecialChar
], '/',
%w[Styles Format Font FontSize - TextColor BGColor]
]

def self.apply_patch
JournalsController.send(:include, JournalsControllerPatch)
end
end

安装
拷贝redmine_ckeditor到vendor/plugins目录下
启动Redmine
管理员登陆redmine,进入管理-->配置-->文本格式,选择CKEDITOR
修改CKEDITOR配置可以进入 管理-->插件--配置

https://github.com/a-ono/redmine_ckeditor/issues/2#issuecomment-384929

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值