質問編集履歴
1
ckeditor設定情報追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,4 +9,48 @@
|
|
9
9
|
|
10
10
|

|
11
11
|
|
12
|
-
何がいけないのでしょうか。
|
12
|
+
何がいけないのでしょうか。
|
13
|
+
|
14
|
+
###設定情報
|
15
|
+
app/models/ckeditor/asset.rb
|
16
|
+
```ruby
|
17
|
+
class Ckeditor::Asset < ActiveRecord::Base
|
18
|
+
include Ckeditor::Backend::Refile
|
19
|
+
include Ckeditor::Orm::ActiveRecord::AssetBase
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
app/models/ckeditor/attachment_file.rb
|
24
|
+
```ruby
|
25
|
+
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
26
|
+
attachment :data, extension: attachment_file_types
|
27
|
+
|
28
|
+
def url_thumb
|
29
|
+
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
app/models/ckeditor/picture.rb
|
35
|
+
```ruby
|
36
|
+
class Ckeditor::Picture < Ckeditor::Asset
|
37
|
+
attachment :data, extension: image_file_types
|
38
|
+
|
39
|
+
def url_content
|
40
|
+
url
|
41
|
+
end
|
42
|
+
|
43
|
+
def url_thumb
|
44
|
+
url(:fill, 118, 100)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
config/initializers/ckeditor.rb
|
50
|
+
```ruby
|
51
|
+
Ckeditor.setup do |config|
|
52
|
+
require 'ckeditor/orm/active_record'
|
53
|
+
config.assets_languages = ['ja']
|
54
|
+
config.assets_plugins = ['image', 'smiley']
|
55
|
+
end
|
56
|
+
```
|