2012-08-31 66 views
4

我在使用ck編輯器的軌道上有數據庫mongo db。我跟着鏈接https://github.com/galetahub/ckeditor。我在ckeditor的幫助下成功地工作。 因爲我view.html.erb代碼是這樣的ckeditor在mongodb軌道上

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

和我的節目頁面

<%= [email protected] %> 

它沒有文件的情況下工作。 我有我的模型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文件或任何attachement。當涉及到文件的情況下,它可以成功上傳文件的路徑。但要用戶下載該文件,它不工作。我的意思是後端適用於所有功能。但缺乏下載上傳文件停止通過

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

回答

3

我已經找到了答案這個問題。首先在終端上運行。

$ 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 

並打開attachchement.js文件,並用你從上面的鏈接找到的代碼進行編輯。 click

現在ck編輯器也可以用於文件附件。

+1

正確的做法正在改變: 'gem'ckeditor'' 到 'gem'ckeditor',::git =>'git:// github.com/netoneko/ckeditor.git'' in your Gemfile –

2

看起來像您遇到CKEDITOR this錯誤:

它sugests過濾器修復如之前添加:

# app/model/department.rb 

    before_save :fix_ckeditor_attachment_paths 

    def fix_ckeditor_attachment_paths 
    if self.description.index(/_cke_saved_href/) 
     self.description = self.body.gsub(/_cke_saved_href/, 'href') 
    end 
    end 
+0

你用mongodb數據庫在軌道中使用ck編輯器,它工作正常嗎? – regmiprem

+0

我剛剛設置了示例應用程序,它的工作原理。這是一個github [回購](https://github.com/dmitriybudnik/Rails-CKeditor-Mongoid-and-Paperclip)供您參考。有一些小故障將它記錄下來,但我認爲你不會遇到同樣的問題。 –

+0

感謝您的回購。我嘗試過這個 。在你的ck編輯器中我找不到附加zip文件的選項。對於我已經做過的圖片。我想從背面上傳zip文件並從frot端下載....嘗試編輯<%= f.cktext_area:notes,:toolbar =>'Easy',:width => 800,:height => 400 %>然後點擊圖片上傳和Flash之間的圖標。那是(插入附件)我想在ck編輯器中使用這個函數。 – regmiprem