質問編集履歴

1

ckeditor設定情報追加

2017/08/02 07:52

投稿

o502
o502

スコア10

test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,91 @@
21
21
 
22
22
 
23
23
  何がいけないのでしょうか。
24
+
25
+
26
+
27
+ ###設定情報
28
+
29
+ app/models/ckeditor/asset.rb
30
+
31
+ ```ruby
32
+
33
+ class Ckeditor::Asset < ActiveRecord::Base
34
+
35
+ include Ckeditor::Backend::Refile
36
+
37
+ include Ckeditor::Orm::ActiveRecord::AssetBase
38
+
39
+ end
40
+
41
+ ```
42
+
43
+
44
+
45
+ app/models/ckeditor/attachment_file.rb
46
+
47
+ ```ruby
48
+
49
+ class Ckeditor::AttachmentFile < Ckeditor::Asset
50
+
51
+ attachment :data, extension: attachment_file_types
52
+
53
+
54
+
55
+ def url_thumb
56
+
57
+ @url_thumb ||= Ckeditor::Utils.filethumb(filename)
58
+
59
+ end
60
+
61
+ end
62
+
63
+ ```
64
+
65
+
66
+
67
+ app/models/ckeditor/picture.rb
68
+
69
+ ```ruby
70
+
71
+ class Ckeditor::Picture < Ckeditor::Asset
72
+
73
+ attachment :data, extension: image_file_types
74
+
75
+
76
+
77
+ def url_content
78
+
79
+ url
80
+
81
+ end
82
+
83
+
84
+
85
+ def url_thumb
86
+
87
+ url(:fill, 118, 100)
88
+
89
+ end
90
+
91
+ end
92
+
93
+ ```
94
+
95
+
96
+
97
+ config/initializers/ckeditor.rb
98
+
99
+ ```ruby
100
+
101
+ Ckeditor.setup do |config|
102
+
103
+ require 'ckeditor/orm/active_record'
104
+
105
+ config.assets_languages = ['ja']
106
+
107
+ config.assets_plugins = ['image', 'smiley']
108
+
109
+ end
110
+
111
+ ```