欢迎来到天天文库
浏览记录
ID:34085810
大小:137.82 KB
页数:6页
时间:2019-03-03
《rubyonrails学习笔记》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、fckeditor插件使用和rails2.3不兼容的解决办法:fckeditor插件使用和rails2.3不兼容的解决办法下载包解压放到当前项目主目录下vendorpluginsfckeditor目录中rakefckeditor:intall在项目目录中出现publicjavascriptsfckeditor里面是产生的JS文件。在更新了Rails2.3后发现和fckeditor出现了兼容性问题。undefinedmethod`relative_url_root'for#搜了一下找到解决办法如下。主要是路径PATH问题先到目录
2、vendorpluginsfckeditor找到文件app/controllers/fckeditor_controller.rblookforuploaded=request.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"replaceitwiththisuploaded= ActionController::Base.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}"同样在文件lib/fckeditor.rbre
3、placejs_path="#{request.relative_url_root}/javascripts"withjs_path="#{ActionController::Base.relative_url_root}/javascripts"ror(rails)中使用tinymce过程详解及问题解答关键字:tinymcerorrails前几天在ror中学习使用tinymce,从安装到使用,过程中还有一些问题,查了网上的一些资料,自己也琢磨了一些,现在整理一下,做个总结。 1、下载plugin。http://github.com/
4、kete/tiny_mce/tree/master 2、安装1.将下载的东东解压后,拷贝到rails工程的vendor/plugins文件夹下,注意,tinymce插件的文件夹名应起为:tiny_mce2.执行raketiny_mce:install? 安装tinymce的静态文件到相应的文件夹下。如果使用的netbeans,可以右键点击工程名,找到Run/DebugRakeTask菜单,其中会找到doc:plugins:tiny_mce的任务项,选中执行就可以了。经过以上两步,tiny_mce就安装完毕了。 3、使用1.在布局模板的
5、头部增加<%#=include_tiny_mce_if_needed%>,这样,可以使tiny_mce插件自己决定是否引入相应的js脚本。2.在视图模板的表单中,直接在textarea标签中加上class为mceEditor,即可实现html编辑器效果。如:<%=f.text_area:body,:class=>"mceEditor"%> 4、配置tinymce是一个强大的html编辑器,提供了非常丰富的选项配置参数。当使用tinymce的ror插件时,可以通过在controller中设置这些参数。如:Ruby代码1.uses_tin
6、y_mce( :options => { 2. :theme => 'advanced', # 皮肤 3. :language => 'zh', # 中文界面 4. :convert_urls => false, # 不转换路径,否则在插入图片或头像时,会转成相对路径,容易导致路径错乱。 5. :theme_advanced_toolbar_location => "top", # 工具条在上面 6. :theme_advanced_toolbar_align => "left", 7.
7、 :theme_advanced_resizing => true, # 似乎不好使 8. :theme_advanced_resize_horizontal => false, 9. :paste_auto_cleanup_on_paste => true, 10. # 工具条上的按钮布局 11. :theme_advanced_buttons1 => %w{formatselect fontselect fontsizeselect forecolor backcolor bold ital
8、ic underline strikethrough sub sup removeformat}, 12. :theme_advanced_buttons2 => %w{undo redo cut copy pa
此文档下载收益归作者所有