-
Notifications
You must be signed in to change notification settings - Fork 61
/
ckeditor.rb
96 lines (73 loc) · 2.85 KB
/
ckeditor.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
module Ckeditor
autoload :ViewHelper, 'ckeditor/view_helper'
autoload :FormBuilder, 'ckeditor/form_builder'
autoload :Middleware, 'ckeditor/middleware'
autoload :Utils, 'ckeditor/utils'
module Hooks
autoload :FormtasticBuilder, 'ckeditor/hooks/formtastic'
autoload :SimpleFormBuilder, 'ckeditor/hooks/simple_form'
end
mattr_accessor :swf_file_post_name
@@swf_file_post_name = "data"
mattr_accessor :swf_image_file_types_description
@@swf_image_file_types_description = "Images"
mattr_accessor :swf_image_file_types
@@swf_image_file_types = "*.jpg;*.jpeg;*.png;*.gif"
mattr_accessor :swf_image_file_size_limit
@@swf_image_file_size_limit = "5 MB"
mattr_accessor :swf_image_file_upload_limit
@@swf_image_file_upload_limit = 10
mattr_accessor :swf_file_types_description
@@swf_file_types_description = "Files"
mattr_accessor :swf_file_types
@@swf_file_types = "*.doc;*.wpd;*.pdf;*.swf;*.xls"
mattr_accessor :swf_file_size_limit
@@swf_file_size_limit = "10 MB"
mattr_accessor :swf_file_upload_limit
@@swf_file_file_upload_limit = 5
mattr_accessor :public_uri
@@public_uri = "/uploads"
mattr_accessor :public_path
@@public_path = "public/uploads"
mattr_accessor :file_manager_uri
@@file_manager_uri = "/ckeditor/attachment_files"
mattr_accessor :file_manager_upload_uri
@@file_manager_upload_uri = "/ckeditor/attachment_files"
mattr_accessor :file_manager_image_upload_uri
@@file_manager_image_upload_uri = "/ckeditor/pictures"
mattr_accessor :file_manager_image_uri
@@file_manager_image_uri = "/ckeditor/pictures"
IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/jpg', 'image/pjpeg', 'image/tiff', 'image/x-png']
# Get the image class from the image reference object.
def self.image_model
if self.class_variables.include?('@@image_model_ref')
@@image_model_ref.get
else
self.file_manager_image_model = "Ckeditor::Picture"
@@image_model_ref.get
end
end
# Set the image model reference object to access the images.
def self.file_manager_image_model=(class_name)
@@image_model_ref = ActiveSupport::Dependencies.ref(class_name)
end
# Get the file class from the file reference object.
def self.file_model
if self.class_variable_defined?('@@file_model_ref')
@@file_model_ref.get
else
self.file_manager_file_model = "Ckeditor::AttachmentFile"
@@file_model_ref.get
end
end
# Set the file model reference object to access the files.
def self.file_manager_file_model=(class_name)
@@file_model_ref = ActiveSupport::Dependencies.ref(class_name)
end
# Default way to setup Ckeditor. Run rails generate ckeditor to create
# a fresh initializer with all configuration values.
def self.setup
yield self
end
end
require 'ckeditor/engine'